mlir._mlir_libs._mlir.dialects.transform

Classes

Package Contents

class mlir._mlir_libs._mlir.dialects.transform.Type(cast_from_type: Type)
property _CAPIPtr: object

Gets a capsule wrapping the MlirType.

static _CAPICreate(arg: object, /) Type

Creates a Type from a capsule wrapping MlirType.

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

Parses the assembly form of a type.

Returns a Type object or raises an MLIRError if the type cannot be parsed.

See also: https://mlir.llvm.org/docs/LangRef/#type-system

property context: Context

Context that owns the Type.

__eq__(arg: Type, /) bool
__eq__(other: object | None) bool

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

__hash__() int

Returns the hash value of the Type.

dump() None

Dumps a debug representation of the object to stderr.

__str__() str

Returns the assembly form of the Type.

__repr__() str

Returns a string representation of the Type.

maybe_downcast() Type

Downcasts the Type to a more specific Type if possible.

property typeid: TypeID

Returns the TypeID of the Type, or raises ValueError if Type has no TypeID.

class mlir._mlir_libs._mlir.dialects.transform.Context
static _get_live_count() int

Gets the number of live Context objects.

_get_context_again() Context

Gets another reference to the same context.

_get_live_module_count() int

Gets the number of live modules owned by this context.

property _CAPIPtr: object

Gets a capsule wrapping the MlirContext.

static _CAPICreate(arg: object, /) object

Creates a Context from a capsule wrapping MlirContext.

__enter__(/) Context

Enters the context as a context manager.

__exit__(exc_type: object | None, exc_value: object | None, traceback: object | None) None

Exits the context manager.

current: Context | None = Ellipsis

Gets the Context bound to the current thread or returns None if no context is set.

property dialects: Dialects

Gets a container for accessing dialects by name.

property d: Dialects

Alias for dialects.

get_dialect_descriptor(dialect_name: str) DialectDescriptor

Gets or loads a dialect by name, returning its descriptor object.

is_dialect_loaded(dialect_name: str) bool

Checks if a dialect is loaded in the context.

property allow_unregistered_dialects: bool

Controls whether unregistered dialects are allowed in this context.

attach_diagnostic_handler(callback: object) object

Attaches a diagnostic handler that will receive callbacks.

enable_multithreading(enable: bool) None

Enables or disables multi-threading support in the context.

Parameters:

enable – Whether to enable (True) or disable (False) multi-threading.

set_thread_pool(arg: ThreadPool, /) None

Sets a custom thread pool for the context to use.

Parameters:

pool – A ThreadPool object to use for parallel operations.

Note

Multi-threading is automatically disabled before setting the thread pool.

get_num_threads() int

Gets the number of threads in the context’s thread pool.

_mlir_thread_pool_ptr() str

Gets the raw pointer to the LLVM thread pool as a string.

is_registered_operation(operation_name: str) bool

Checks whether an operation with the given name is registered.

Parameters:

operation_name – The fully qualified name of the operation (e.g., arith.addf).

Returns:

True if the operation is registered, False otherwise.

append_dialect_registry(registry: DialectRegistry) None

Appends the contents of a dialect registry to the context.

Parameters:

registry – A DialectRegistry containing dialects to append.

property emit_error_diagnostics: bool

Controls whether error diagnostics are emitted to diagnostic handlers.

By default, error diagnostics are captured and reported through MLIRError exceptions.

load_all_available_dialects() None

Loads all dialects available in the registry into the context.

This eagerly loads all dialects that have been registered, making them immediately available for use.

begin_transient_scope() None

Begins a transient scope on the context, freezing the base layer.

All subsequently allocated types, attributes, and unregistered operations are treated as transient and will be deallocated with end_transient_scope(). Raises a ValueError if the context is already in a transient scope.

end_transient_scope() None

Ends the transient scope and resets the context to the base state.

Prunes all transient types, attributes, affine expressions, distinct attributes, and unregistered operations added during the transient scope.

Note: Any Python objects referencing transient IR entities become invalid after this call and must not be accessed.

property is_in_transient_scope: bool

Returns whether the context is currently in a transient scope.

class mlir._mlir_libs._mlir.dialects.transform.AnyOpType

Bases: mlir.ir.Type

static isinstance(type: mlir.ir.Type) bool
static get(context: mlir.ir.Context | None = None) AnyOpType
class mlir._mlir_libs._mlir.dialects.transform.OperationType

Bases: mlir.ir.Type

static isinstance(type: mlir.ir.Type) bool
static get(operation_name: str, context: mlir.ir.Context | None = None) OperationType
property operation_name: str