mlir.dialects.transform.debug

Classes

Attribute

Operation

Value

Abstract base class for generic types.

StringAttr

EmitParamAsRemarkOp

This operation emits a diagnostic remark containing the string form of the

EmitParamAsRemarkOpAdaptor

EmitRemarkAtOp

This operation emits a diagnostic remark with the given message at the

EmitRemarkAtOpAdaptor

EmitParamAsRemarkOp

This operation emits a diagnostic remark containing the string form of the

EmitRemarkAtOp

This operation emits a diagnostic remark with the given message at the

Functions

debug_emit_param_as_remark(→ EmitParamAsRemarkOp)

debug_emit_remark_at(→ EmitRemarkAtOp)

emit_param_as_remark(param, *[, anchor, message, loc, ip])

emit_remark_at(at[, message, loc, ip])

Module Contents

class mlir.dialects.transform.debug.Attribute(cast_from_type: Attribute)
property _CAPIPtr: object

Gets a capsule wrapping the MlirAttribute.

static _CAPICreate(arg: object, /) Attribute

Creates an Attribute from a capsule wrapping MlirAttribute.

static parse(asm: str, context: Context | None = None) Attribute

Parses an attribute from an assembly form. Raises an MLIRError on failure.

property context: Context

Context that owns the Attribute.

property type: Type

Returns the type of the Attribute.

get_named(arg: str, /) NamedAttribute

Binds a name to the attribute, creating a NamedAttribute.

Parameters:

name – The name to bind to the Attribute.

Returns:

A NamedAttribute with the given name and this attribute.

__eq__(arg: Attribute, /) bool
__eq__(arg: object, /) bool

Compares attribute with non-attribute object (always returns False).

__hash__() int

Returns the hash value of the attribute.

dump() None

Dumps a debug representation of the object to stderr.

__str__() str

Returns the assembly form of the Attribute.

__repr__() str

Returns a string representation of the attribute.

property typeid: TypeID

Returns the TypeID of the attribute.

maybe_downcast() Attribute

Downcasts the attribute to a more specific attribute if possible.

class mlir.dialects.transform.debug.Operation

Bases: _OperationBase

static create(name: str, results: collections.abc.Sequence[Type] | None = None, operands: collections.abc.Sequence[Value] | None = None, attributes: dict[str, Attribute] | None = None, successors: collections.abc.Sequence[Block] | None = None, regions: int = 0, loc: Location | None = None, ip: object | None = None, infer_type: bool = False) Operation

Creates a new operation.

Parameters:
  • name – Operation name (e.g. dialect.operation).

  • results – Optional sequence of Type representing op result types.

  • operands – Optional operands of the operation.

  • attributes – Optional Dict of {str: Attribute}.

  • successors – Optional List of Block for the operation’s successors.

  • regions – Number of regions to create (default = 0).

  • location – Optional Location object (defaults to resolve from context manager).

  • ip – Optional InsertionPoint (defaults to resolve from context manager or set to False to disable insertion, even with an insertion point set in the context manager).

  • infer_type – Whether to infer result types (default = False).

Returns:

A new detached Operation object. Detached operations can be added to blocks, which causes them to become attached.

static parse(source: str, *, source_name: str = '', context: Context | None = None) OpView

Parses an operation. Supports both text assembly format and binary bytecode format.

property _CAPIPtr: object

Gets a capsule wrapping the MlirOperation.

static _CAPICreate(arg: object, /) object

Creates an Operation from a capsule wrapping MlirOperation.

property operation: Operation

Returns self (the operation).

property opview: OpView

Returns an OpView of this operation.

Note: If the operation has a registered and loaded dialect then this OpView will be concrete wrapper class.

property block: Block

Returns the block containing this operation.

property successors: OpSuccessors

Returns the list of Operation successors.

replace_uses_of_with(of: Value, with_: Value) None

Replaces uses of the ‘of’ value with the ‘with’ value inside the operation.

_set_invalid() None

Invalidate the operation.

class mlir.dialects.transform.debug.Value(value: Value)

Bases: Generic[_T]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]): def **getitem**(self, key: KT) -> VT: … # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default

property _CAPIPtr: object

Gets a capsule wrapping the MlirValue.

static _CAPICreate(arg: object, /) Value

Creates a Value from a capsule wrapping MlirValue.

property context: Context

Context in which the value lives.

dump() None

Dumps a debug representation of the object to stderr.

property owner: OpView | Block

Returns the owner of the value (Operation for results, Block for arguments).

property uses: OpOperandIterator

Returns an iterator over uses of this value.

__eq__(arg: Value, /) bool
__eq__(arg: object, /) bool

Compares value with non-value object (always returns False).

__hash__() int

Returns the hash value of the value.

__str__() str

Returns the string form of the value.

If the value is a block argument, this is the assembly form of its type and the position in the argument list. If the value is an operation result, this is equivalent to printing the operation that produced it.

get_name(use_local_scope: bool = False, use_name_loc_as_prefix: bool = False) str
get_name(state: AsmState) str

Returns the string form of value as an operand (i.e., the ValueID).

property type: _T

Returns the type of the value.

set_type(type: _T)

Sets the type of the value.

replace_all_uses_with(arg: Value, /) None

Replace all uses of value with the new value, updating anything in the IR that uses self to use the other value instead.

replace_all_uses_except(with_: Value, exceptions: Operation) None
replace_all_uses_except(with_: Value, exceptions: collections.abc.Sequence[Operation]) None
maybe_downcast() BlockArgument | OpResult | Value

Downcasts the Value to a more specific kind if possible.

property location: Location

Returns the source location of the value.

class mlir.dialects.transform.debug.StringAttr(cast_from_attr: Attribute)

Bases: Attribute

property type: Type

Returns the type of the Attribute.

static_typeid: _mlir.ir.TypeID = Ellipsis

(arg: object, /) -> _mlir.ir.TypeID

property typeid: TypeID

Returns the TypeID of the attribute.

__repr__() str

Returns a string representation of the attribute.

attr_name: str = Ellipsis

(arg: object, /) -> str

static get(value: str, context: Context | None = None) StringAttr
static get(value: bytes, context: Context | None = None) StringAttr
static get_typed(type: Type, value: str) StringAttr

Gets a uniqued string attribute associated to a type

property value: str

Returns the value of the string attribute

property value_bytes: bytes

Returns the value of the string attribute as bytes

class mlir.dialects.transform.debug.EmitParamAsRemarkOp(param: _ods_ir, *, anchor: _ods_ir | None = None, message: str | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

This operation emits a diagnostic remark containing the string form of the attributes associated with the parameter provided as attribute. It takes as optional arguments:

  • an additional message text to prepend;

  • a handle pointing to operations the location of which will be used to

emit the diagnostic; if multiple operations are associated, the diagnostic is emitted for all of their respective locations.

This operation always succeeds.

OPERATION_NAME = 'transform.debug.emit_param_as_remark'
_ODS_REGIONS = (0, True)
param() _ods_ir
anchor() _ods_ir | None
message() _ods_ir | None
class mlir.dialects.transform.debug.EmitParamAsRemarkOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.transform.debug.EmitParamAsRemarkOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'transform.debug.emit_param_as_remark'
param() _ods_ir
anchor() _ods_ir | None
message() _ods_ir | None
mlir.dialects.transform.debug.debug_emit_param_as_remark(param: _ods_ir, *, anchor: _ods_ir | None = None, message: str | _ods_ir | None = None, loc: _ods_ir | None = None, ip: _ods_ir | None = None) EmitParamAsRemarkOp
class mlir.dialects.transform.debug.EmitRemarkAtOp(at: _ods_ir, message: str | _ods_ir, *, loc: _ods_ir | None = None, ip: _ods_ir | None = None)

Bases: _ods_ir

This operation emits a diagnostic remark with the given message at the location of each payload object associated with the argument. The argument may be an operation or a value handle.

This operation always succeeds.

OPERATION_NAME = 'transform.debug.emit_remark_at'
_ODS_REGIONS = (0, True)
at() _ods_ir
message() _ods_ir
class mlir.dialects.transform.debug.EmitRemarkAtOpAdaptor(operands: list[Value], attributes: OpAttributeMap)
class mlir.dialects.transform.debug.EmitRemarkAtOpAdaptor(operands: list[Value], opview: OpView)

Bases: _ods_ir

OPERATION_NAME = 'transform.debug.emit_remark_at'
at() _ods_ir
message() _ods_ir
mlir.dialects.transform.debug.debug_emit_remark_at(at: _ods_ir, message: str | _ods_ir, *, loc: _ods_ir | None = None, ip: _ods_ir | None = None) EmitRemarkAtOp
class mlir.dialects.transform.debug.EmitParamAsRemarkOp(param: mlir.ir.Attribute, *, anchor: mlir.ir.Operation | None = None, message: mlir.ir.StringAttr | str | None = None, loc=None, ip=None)

Bases: EmitParamAsRemarkOp

This operation emits a diagnostic remark containing the string form of the attributes associated with the parameter provided as attribute. It takes as optional arguments:

  • an additional message text to prepend;

  • a handle pointing to operations the location of which will be used to

emit the diagnostic; if multiple operations are associated, the diagnostic is emitted for all of their respective locations.

This operation always succeeds.

mlir.dialects.transform.debug.emit_param_as_remark(param: mlir.ir.Attribute, *, anchor: mlir.ir.Operation | None = None, message: mlir.ir.StringAttr | str | None = None, loc=None, ip=None)
class mlir.dialects.transform.debug.EmitRemarkAtOp(at: mlir.ir.Operation | mlir.ir.Value, message: mlir.ir.StringAttr | str | None = None, *, loc=None, ip=None)

Bases: EmitRemarkAtOp

This operation emits a diagnostic remark with the given message at the location of each payload object associated with the argument. The argument may be an operation or a value handle.

This operation always succeeds.

mlir.dialects.transform.debug.emit_remark_at(at: mlir.ir.Operation | mlir.ir.Value, message: mlir.ir.StringAttr | str | None = None, *, loc=None, ip=None)