Skip to content

Instantly share code, notes, and snippets.

@makslevental
Created September 19, 2025 06:07
Show Gist options
  • Select an option

  • Save makslevental/e6e22e0f2dd09c595649ee31bfdaf60f to your computer and use it in GitHub Desktop.

Select an option

Save makslevental/e6e22e0f2dd09c595649ee31bfdaf60f to your computer and use it in GitHub Desktop.
from collections.abc import Callable, Sequence
import enum
from typing import Any, overload
import WalkOrder
import mlir
import typing_extensions
from _mlir_libs import Context as Context, MLIRError as MLIRError
class DiagnosticSeverity(enum.Enum):
_new_member_ = __new__
_use_args_: bool = False
_member_names_: list = ['ERROR', 'WARNING', 'NOTE', 'REMARK']
_member_map_: dict = ...
_value2member_map_: dict = ...
_unhashable_values_: list = []
_value_repr_: None = None
ERROR = 0
WARNING = 1
NOTE = 2
REMARK = 3
class WalkOrder(enum.Enum):
_new_member_ = __new__
_use_args_: bool = False
_member_names_: list = ['PRE_ORDER', 'POST_ORDER']
_member_map_: dict = ...
_value2member_map_: dict = ...
_unhashable_values_: list = []
_value_repr_: None = None
PRE_ORDER = 0
POST_ORDER = 1
class WalkResult(enum.Enum):
_new_member_ = __new__
_use_args_: bool = False
_member_names_: list = ['ADVANCE', 'INTERRUPT', 'SKIP']
_member_map_: dict = ...
_value2member_map_: dict = ...
_unhashable_values_: list = []
_value_repr_: None = None
ADVANCE = 0
INTERRUPT = 1
SKIP = 2
class Diagnostic:
@property
def severity(self) -> DiagnosticSeverity: ...
@property
def location(self) -> Location: ...
@property
def message(self) -> str: ...
@property
def notes(self) -> tuple: ...
def __str__(self) -> str: ...
class DiagnosticInfo:
def __init__(self, arg: Diagnostic, /) -> None: ...
@property
def severity(self) -> DiagnosticSeverity: ...
@property
def location(self) -> Location: ...
@property
def message(self) -> str: ...
@property
def notes(self) -> list[DiagnosticInfo]: ...
def __str__(self) -> str: ...
class DiagnosticHandler:
def detach(self) -> None: ...
@property
def attached(self) -> bool: ...
@property
def had_error(self) -> bool: ...
def __enter__(self) -> object: ...
def __exit__(self, exc_type: object | None, exc_value: object | None, traceback: object | None) -> None: ...
class ThreadPool:
def __init__(self) -> None: ...
def get_max_concurrency(self) -> int: ...
def _mlir_thread_pool_ptr(self) -> str: ...
class _BaseContext:
def __init__(self) -> None: ...
@staticmethod
def _get_live_count() -> int: ...
def _get_context_again(self) -> object: ...
def _get_live_module_count(self) -> int: ...
@property
def _CAPIPtr(self) -> object: ...
def _CAPICreate(self) -> object: ...
def __enter__(self) -> object: ...
def __exit__(self, exc_type: object | None, exc_value: object | None, traceback: object | None) -> None: ...
current: object = ...
"""Gets the Context bound to the current thread or raises ValueError"""
@property
def dialects(self) -> Dialects:
"""Gets a container for accessing dialects by name"""
@property
def d(self) -> Dialects:
"""Alias for 'dialect'"""
def get_dialect_descriptor(self, dialect_name: str) -> DialectDescriptor:
"""Gets or loads a dialect by name, returning its descriptor object"""
@property
def allow_unregistered_dialects(self) -> bool: ...
@allow_unregistered_dialects.setter
def allow_unregistered_dialects(self, arg: bool, /) -> None: ...
def attach_diagnostic_handler(self, callback: object) -> object:
"""Attaches a diagnostic handler that will receive callbacks"""
def enable_multithreading(self, enable: bool) -> None: ...
def set_thread_pool(self, arg: ThreadPool, /) -> None: ...
def get_num_threads(self) -> int: ...
def _mlir_thread_pool_ptr(self) -> str: ...
def is_registered_operation(self, operation_name: str) -> bool: ...
def append_dialect_registry(self, registry: DialectRegistry) -> None: ...
@property
def emit_error_diagnostics(self) -> bool:
"""
Emit error diagnostics to diagnostic handlers. By default error diagnostics are captured and reported through MLIRError exceptions.
"""
@emit_error_diagnostics.setter
def emit_error_diagnostics(self, arg: bool, /) -> None: ...
def load_all_available_dialects(self) -> None: ...
class DialectDescriptor:
@property
def namespace(self) -> str: ...
def __repr__(self) -> str: ...
class Dialects:
def __getitem__(self, arg: str, /) -> object: ...
def __getattr__(self, arg: str, /) -> object: ...
class Dialect:
def __init__(self, descriptor: object) -> None: ...
@property
def descriptor(self) -> object: ...
def __repr__(self) -> str: ...
class DialectRegistry:
def __init__(self) -> None: ...
@property
def _CAPIPtr(self) -> object: ...
def _CAPICreate(self) -> DialectRegistry: ...
class Location:
@property
def _CAPIPtr(self) -> object: ...
def _CAPICreate(self) -> Location: ...
def __enter__(self) -> object: ...
def __exit__(self, exc_type: object | None, exc_value: object | None, traceback: object | None) -> None: ...
@overload
def __eq__(self, arg: Location, /) -> bool: ...
@overload
def __eq__(self, arg: object, /) -> bool: ...
current: mlir.ir.Location | None = ...
"""Gets the Location bound to the current thread or raises ValueError"""
@staticmethod
def unknown(context: mlir.ir.Context | None = None) -> Location:
"""Gets a Location representing an unknown location"""
@staticmethod
def callsite(callee: Location, frames: Sequence[Location], context: mlir.ir.Context | None = None) -> Location:
"""Gets a Location representing a caller and callsite"""
def is_a_callsite(self) -> bool: ...
@property
def callee(self) -> mlir.ir.Location: ...
@property
def caller(self) -> mlir.ir.Location: ...
@overload
@staticmethod
def file(filename: str, line: int, col: int, context: mlir.ir.Context | None = None) -> Location:
"""Gets a Location representing a file, line and column"""
@overload
@staticmethod
def file(filename: str, start_line: int, start_col: int, end_line: int, end_col: int, context: mlir.ir.Context | None = None) -> Location:
"""Gets a Location representing a file, line and column range"""
def is_a_file(self) -> bool: ...
@property
def filename(self) -> str: ...
@property
def start_line(self) -> int: ...
@property
def start_col(self) -> int: ...
@property
def end_line(self) -> int: ...
@property
def end_col(self) -> int: ...
@staticmethod
def fused(locations: Sequence[Location], metadata: Attribute | None = None, context: mlir.ir.Context | None = None) -> Location:
"""Gets a Location representing a fused location with optional metadata"""
def is_a_fused(self) -> bool: ...
@property
def locations(self) -> list[mlir.ir.Location]: ...
@staticmethod
def name(name: str, childLoc: Location | None = None, context: mlir.ir.Context | None = None) -> Location:
"""
Gets a Location representing a named location with optional child location
"""
def is_a_name(self) -> bool: ...
@property
def name_str(self) -> str: ...
@property
def child_loc(self) -> mlir.ir.Location: ...
@staticmethod
def from_attr(attribute: Attribute, context: mlir.ir.Context | None = None) -> Location:
"""Gets a Location from a LocationAttr"""
@property
def context(self) -> object:
"""Context that owns the Location"""
@property
def attr(self) -> mlir.ir.Attribute:
"""Get the underlying LocationAttr"""
def emit_error(self, message: str) -> None:
"""Emits an error at this location"""
def __repr__(self) -> str: ...
class Module:
@property
def _CAPIPtr(self) -> object: ...
def _CAPICreate(self) -> object:
"""
Creates a Module from a MlirModule wrapped by a capsule (i.e. module._CAPIPtr).
Note this returns a new object BUT _clear_mlir_module(module) must be called to
prevent double-frees (of the underlying mlir::Module).
"""
def _clear_mlir_module(self) -> None: ...
@overload
@staticmethod
def parse(asm: str, context: mlir.ir.Context | None = None) -> object:
"""
Parses a module's assembly format from a string.
Returns a new MlirModule or raises an MLIRError if the parsing fails.
See also: https://mlir.llvm.org/docs/LangRef/
"""
@overload
@staticmethod
def parse(asm: bytes, context: mlir.ir.Context | None = None) -> object: ...
@staticmethod
def parseFile(path: str, context: mlir.ir.Context | None = None) -> object:
"""
Parses a module's assembly format from a string.
Returns a new MlirModule or raises an MLIRError if the parsing fails.
See also: https://mlir.llvm.org/docs/LangRef/
"""
@staticmethod
def create(loc: Location | None = None) -> object:
"""Creates an empty module"""
@property
def context(self) -> object:
"""Context that created the Module"""
@property
def operation(self) -> object:
"""Accesses the module as an operation"""
@property
def body(self) -> Block:
"""Return the block for this module"""
def dump(self) -> None:
"""Dumps a debug representation of the object to stderr."""
def __str__(self) -> str:
"""
Gets the assembly form of the operation with default options.
If more advanced control over the assembly formatting or I/O options is needed,
use the dedicated print or get_asm method, which supports keyword arguments to
customize behavior.
"""
def __eq__(self, other: Module) -> bool: ...
def __hash__(self) -> int: ...
class _OperationBase:
@property
def _CAPIPtr(self) -> object: ...
@overload
def __eq__(self, arg: _OperationBase, /) -> bool: ...
@overload
def __eq__(self, arg: object, /) -> bool: ...
def __hash__(self) -> int: ...
@property
def attributes(self) -> OpAttributeMap: ...
@property
def context(self) -> mlir.ir.Context:
"""Context that owns the Operation"""
@property
def name(self) -> str: ...
@property
def operands(self) -> OpOperandList: ...
@property
def regions(self) -> RegionSequence: ...
@property
def results(self) -> OpResultList:
"""Returns the list of Operation results."""
@property
def result(self) -> mlir.ir.Value:
"""
Shortcut to get an op result if it has only one (throws an error otherwise).
"""
@property
def location(self) -> Location:
"""Returns the source location the operation was defined or derived from."""
@property
def parent(self) -> object: ...
def __str__(self) -> str:
"""Returns the assembly form of the operation."""
@overload
def print(self, state: AsmState, file: object | None = None, binary: bool = False) -> None:
"""
Prints the assembly form of the operation to a file like object.
Args:
file: The file like object to write to. Defaults to sys.stdout.
binary: Whether to write bytes (True) or str (False). Defaults to False.
state: AsmState capturing the operation numbering and flags.
"""
@overload
def print(self, large_elements_limit: int | None = None, large_resource_limit: int | None = None, enable_debug_info: bool = False, pretty_debug_info: bool = False, print_generic_op_form: bool = False, use_local_scope: bool = False, use_name_loc_as_prefix: bool = False, assume_verified: bool = False, file: object | None = None, binary: bool = False, skip_regions: bool = False) -> None:
"""
Prints the assembly form of the operation to a file like object.
Args:
file: The file like object to write to. Defaults to sys.stdout.
binary: Whether to write bytes (True) or str (False). Defaults to False.
large_elements_limit: Whether to elide elements attributes above this
number of elements. Defaults to None (no limit).
large_resource_limit: Whether to elide resource attributes above this
number of characters. Defaults to None (no limit). If large_elements_limit
is set and this is None, the behavior will be to use large_elements_limit
as large_resource_limit.
enable_debug_info: Whether to print debug/location information. Defaults
to False.
pretty_debug_info: Whether to format debug information for easier reading
by a human (warning: the result is unparseable).
print_generic_op_form: Whether to print the generic assembly forms of all
ops. Defaults to False.
use_local_Scope: Whether to print in a way that is more optimized for
multi-threaded access but may not be consistent with how the overall
module prints.
assume_verified: By default, if not printing generic form, the verifier
will be run and if it fails, generic form will be printed with a comment
about failed verification. While a reasonable default for interactive use,
for systematic use, it is often better for the caller to verify explicitly
and report failures in a more robust fashion. Set this to True if doing this
in order to avoid running a redundant verification. If the IR is actually
invalid, behavior is undefined.
skip_regions: Whether to skip printing regions. Defaults to False.
"""
def write_bytecode(self, file: object, desired_version: int | None = None) -> None:
"""
Write the bytecode form of the operation to a file like object.
Args:
file: The file like object to write to.
desired_version: The version of bytecode to emit.
Returns:
The bytecode writer status.
"""
def get_asm(self, binary: bool = False, large_elements_limit: int | None = None, large_resource_limit: int | None = None, enable_debug_info: bool = False, pretty_debug_info: bool = False, print_generic_op_form: bool = False, use_local_scope: bool = False, use_name_loc_as_prefix: bool = False, assume_verified: bool = False, skip_regions: bool = False) -> object:
"""
Gets the assembly form of the operation with all options available.
Args:
binary: Whether to return a bytes (True) or str (False) object. Defaults to
False.
... others ...: See the print() method for common keyword arguments for
configuring the printout.
Returns:
Either a bytes or str object, depending on the setting of the 'binary'
argument.
"""
def verify(self) -> bool:
"""
Verify the operation. Raises MLIRError if verification fails, and returns true otherwise.
"""
def move_after(self, other: _OperationBase) -> None:
"""Puts self immediately after the other operation in its parent block."""
def move_before(self, other: _OperationBase) -> None:
"""Puts self immediately before the other operation in its parent block."""
def is_before_in_block(self, other: _OperationBase) -> bool:
"""
Given an operation 'other' that is within the same parent block, returnwhether the current operation is before 'other' in the operation listof the parent block.
"""
def clone(self, ip: object | None = None) -> object: ...
def detach_from_parent(self) -> object:
"""Detaches the operation from its parent block."""
@property
def attached(self) -> bool:
"""Reports if the operation is attached to its parent block."""
def erase(self) -> None: ...
def walk(self, callback: Callable[[mlir.ir.Operation], mlir.ir.WalkResult], walk_order: mlir.ir.WalkOrder = 'WalkOrder.POST_ORDER') -> None: ...
class Operation(_OperationBase):
@staticmethod
def create(name: str, results: Sequence[Type] | None = None, operands: Sequence[Value] | None = None, attributes: dict | None = None, successors: Sequence[Block] | None = None, regions: int = 0, loc: Location | None = None, ip: object | None = None, infer_type: bool = False) -> object:
"""
Creates a new operation.
Args:
name: Operation name (e.g. "dialect.operation").
results: Sequence of Type representing op result types.
attributes: Dict of str:Attribute.
successors: List of Block for the operation's successors.
regions: Number of regions to create.
location: A Location object (defaults to resolve from context manager).
ip: An 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.
Returns:
A new "detached" Operation object. Detached operations can be added
to blocks, which causes them to become "attached."
"""
@staticmethod
def parse(source: str, *, source_name: str = '', context: mlir.ir.Context | None = None) -> object:
"""
Parses an operation. Supports both text assembly format and binary bytecode format.
"""
@property
def _CAPIPtr(self) -> object: ...
def _CAPICreate(self) -> object: ...
@property
def operation(self) -> object: ...
@property
def opview(self) -> object: ...
@property
def block(self) -> Block: ...
@property
def successors(self) -> OpSuccessors:
"""Returns the list of Operation successors."""
def _set_invalid(self) -> None:
"""Invalidate the operation."""
class OpView(_OperationBase):
@overload
def __init__(self, operation: object) -> None: ...
@overload
def __init__(self, name: str, opRegionSpec: tuple[int, bool], operandSegmentSpecObj: object | None = None, resultSegmentSpecObj: object | None = None, results: list | None = None, operands: list | None = None, attributes: dict | None = None, successors: Sequence[Block] | None = None, regions: int | None = None, loc: Location | None = None, ip: object | None = None) -> None: ...
@property
def operation(self) -> object: ...
@property
def opview(self) -> object: ...
def __str__(self) -> str: ...
@property
def successors(self) -> OpSuccessors:
"""Returns the list of Operation successors."""
def _set_invalid(self) -> None:
"""Invalidate the operation."""
_ODS_REGIONS: tuple = (0, True)
_ODS_OPERAND_SEGMENTS: None = None
_ODS_RESULT_SEGMENTS: None = None
@classmethod
def build_generic(*args, **kwargs) -> Any:
"""
(cls: object, results: list | None = None, operands: list | None = None, attributes: dict | None = None, successors: collections.abc.Sequence[_mlir_libs._mlir.ir.Block] | None = None, regions: int | None = None, loc: _mlir_libs._mlir.ir.Location | None = None, ip: object | None = None) -> object
Builds a specific, generated OpView based on class level attributes.
"""
@classmethod
def parse(*args, **kwargs) -> Any:
r"""
(cls: object, source: str, *, source_name: str = \'\', context: mlir.ir.Context | None = None) -> object
Parses a specific, generated OpView based on class level attributes
"""
class Region:
@property
def blocks(self) -> BlockList:
"""Returns a forward-optimized sequence of blocks."""
@property
def owner(self) -> object:
"""Returns the operation owning this region."""
def __iter__(self) -> BlockIterator:
"""Iterates over blocks in the region."""
@overload
def __eq__(self, arg: Region, /) -> bool: ...
@overload
def __eq__(self, arg: object, /) -> bool: ...
class Block:
@property
def _CAPIPtr(self) -> object: ...
@property
def owner(self) -> object:
"""Returns the owning operation of this block."""
@property
def region(self) -> Region:
"""Returns the owning region of this block."""
@property
def arguments(self) -> BlockArgumentList:
"""Returns a list of block arguments."""
def add_argument(self, type: mlir.ir.Type, loc: mlir.ir.Location) -> mlir.ir.Value:
"""
Append an argument of the specified type to the block and returns the newly added argument.
"""
def erase_argument(self, arg: int, /) -> None:
"""Erase the argument at 'index' and remove it from the argument list."""
@property
def operations(self) -> OperationList:
"""Returns a forward-optimized sequence of operations."""
@staticmethod
def create_at_start(parent: Region, arg_types: Sequence = [], arg_locs: Sequence | None = None) -> Block:
"""
Creates and returns a new Block at the beginning of the given region (with given argument types and locations).
"""
def append_to(self, arg: Region, /) -> None:
"""Append this block to a region, transferring ownership if necessary"""
def create_before(self, *arg_types, arg_locs: Sequence | None = None) -> Block:
"""
Creates and returns a new Block before this block (with given argument types and locations).
"""
def create_after(self, *arg_types, arg_locs: Sequence | None = None) -> Block:
"""
Creates and returns a new Block after this block (with given argument types and locations).
"""
def __iter__(self) -> OperationIterator:
"""Iterates over operations in the block."""
@overload
def __eq__(self, arg: Block, /) -> bool: ...
@overload
def __eq__(self, arg: object, /) -> bool: ...
def __hash__(self) -> int: ...
def __str__(self) -> str:
"""Returns the assembly form of the block."""
def append(self, operation: _OperationBase) -> None:
"""
Appends an operation to this block. If the operation is currently in another block, it will be moved.
"""
@property
def successors(self) -> BlockSuccessors:
"""Returns the list of Block successors."""
@property
def predecessors(self) -> BlockPredecessors:
"""Returns the list of Block predecessors."""
class InsertionPoint:
@overload
def __init__(self, block: Block) -> None:
"""Inserts after the last operation but still inside the block."""
@overload
def __init__(self, beforeOperation: _OperationBase) -> None:
"""Inserts before a referenced operation."""
def __enter__(self) -> object: ...
def __exit__(self, exc_type: object | None, exc_value: object | None, traceback: object | None) -> None: ...
current: mlir.ir.InsertionPoint = ...
"""
Gets the InsertionPoint bound to the current thread or raises ValueError if none has been set
"""
@staticmethod
def at_block_begin(block: Block) -> InsertionPoint:
"""Inserts at the beginning of the block."""
@staticmethod
def at_block_terminator(block: Block) -> InsertionPoint:
"""Inserts before the block terminator."""
@staticmethod
def after(operation: _OperationBase) -> InsertionPoint:
"""Inserts after the operation."""
def insert(self, operation: _OperationBase) -> None:
"""Inserts an operation."""
@property
def block(self) -> Block:
"""Returns the block that this InsertionPoint points to."""
@property
def ref_operation(self) -> object:
"""
The reference operation before which new operations are inserted, or None if the insertion point is at the end of the block
"""
class Attribute:
def __init__(self, cast_from_type: Attribute) -> None:
"""Casts the passed attribute to the generic Attribute"""
@property
def _CAPIPtr(self) -> object: ...
def _CAPICreate(self) -> Attribute: ...
@staticmethod
def parse(asm: str, context: mlir.ir.Context | None = None) -> mlir.ir.Attribute:
"""
Parses an attribute from an assembly form. Raises an MLIRError on failure.
"""
@property
def context(self) -> mlir.ir.Context:
"""Context that owns the Attribute"""
@property
def type(self) -> mlir.ir.Type: ...
def get_named(self, arg: str, /) -> NamedAttribute:
"""Binds a name to the attribute"""
@overload
def __eq__(self, arg: Attribute, /) -> bool: ...
@overload
def __eq__(self, arg: object, /) -> bool: ...
def __hash__(self) -> int: ...
def dump(self) -> None:
"""Dumps a debug representation of the object to stderr."""
def __str__(self) -> str:
"""Returns the assembly form of the Attribute."""
def __repr__(self) -> str: ...
@property
def typeid(self) -> mlir.ir.TypeID: ...
def maybe_downcast(self) -> mlir.ir.Attribute: ...
class NamedAttribute:
def __repr__(self) -> str: ...
@property
def name(self) -> str:
"""The name of the NamedAttribute binding"""
@property
def attr(self) -> mlir.ir.Attribute:
"""The underlying generic attribute of the NamedAttribute binding"""
class Type:
def __init__(self, cast_from_type: Type) -> None:
"""Casts the passed type to the generic Type"""
@property
def _CAPIPtr(self) -> object: ...
def _CAPICreate(self) -> Type: ...
@staticmethod
def parse(asm: str, context: mlir.ir.Context | None = None) -> mlir.ir.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
def context(self) -> mlir.ir.Context:
"""Context that owns the Type"""
@overload
def __eq__(self, arg: Type, /) -> bool: ...
@overload
def __eq__(self, other: object | None) -> bool: ...
def __hash__(self) -> int: ...
def dump(self) -> None:
"""Dumps a debug representation of the object to stderr."""
def __str__(self) -> str:
"""Returns the assembly form of the type."""
def __repr__(self) -> str: ...
def maybe_downcast(self) -> mlir.ir.Type: ...
@property
def typeid(self) -> mlir.ir.TypeID: ...
class TypeID:
@property
def _CAPIPtr(self) -> object: ...
def _CAPICreate(self) -> TypeID: ...
@overload
def __eq__(self, arg: TypeID, /) -> bool: ...
@overload
def __eq__(self, arg: object, /) -> bool: ...
def __hash__(self) -> int: ...
class Value:
def __init__(self, value: Value) -> None: ...
@property
def _CAPIPtr(self) -> object: ...
def _CAPICreate(self) -> Value: ...
@property
def context(self) -> mlir.ir.Context:
"""Context in which the value lives."""
def dump(self) -> None:
"""Dumps a debug representation of the object to stderr."""
@property
def owner(self) -> mlir.ir.Operation | mlir.ir.Block | None: ...
@property
def uses(self) -> OpOperandIterator: ...
@overload
def __eq__(self, arg: Value, /) -> bool: ...
@overload
def __eq__(self, arg: object, /) -> bool: ...
def __hash__(self) -> int: ...
def __str__(self) -> 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.
"""
@overload
def get_name(self, use_local_scope: bool = False, use_name_loc_as_prefix: bool = False) -> str: ...
@overload
def get_name(self, state: AsmState) -> str:
"""Returns the string form of value as an operand (i.e., the ValueID)."""
@property
def type(self) -> mlir.ir.TypeID: ...
def set_type(self, type: Type) -> None: ...
def replace_all_uses_with(self, 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.
"""
@overload
def replace_all_uses_except(self, with_: mlir.ir.Value, exceptions: mlir.ir.Operation) -> None:
"""
"Replace all uses of this value with the 'with' value, except for those
in 'exceptions'. 'exceptions' can be either a single operation or a list of
operations.
"""
@overload
def replace_all_uses_except(self, with_: mlir.ir.Value, exceptions: list[mlir.ir.Operation]) -> None: ...
def maybe_downcast(self) -> mlir.ir.Value: ...
@property
def location(self) -> Location:
"""Returns the source location the value"""
class BlockArgument(Value):
def __init__(self, value: Value) -> None: ...
@staticmethod
def isinstance(other_value: Value) -> bool: ...
def maybe_downcast(self) -> object: ...
@property
def owner(self) -> Block: ...
@property
def arg_number(self) -> int: ...
def set_type(self, type: Type) -> None: ...
class OpResult(Value):
def __init__(self, value: Value) -> None: ...
@staticmethod
def isinstance(other_value: Value) -> bool: ...
def maybe_downcast(self) -> object: ...
@property
def owner(self) -> object: ...
@property
def result_number(self) -> int: ...
class OpOperand:
@property
def owner(self) -> object: ...
@property
def operand_number(self) -> int: ...
class AsmState:
@overload
def __init__(self, value: Value, use_local_scope: bool = False) -> None: ...
@overload
def __init__(self, op: _OperationBase, use_local_scope: bool = False) -> None: ...
class SymbolTable:
def __init__(self, arg: _OperationBase, /) -> None: ...
def __getitem__(self, arg: str, /) -> object: ...
def insert(self, operation: mlir.ir._OperationBase) -> mlir.ir.Attribute: ...
def erase(self, operation: _OperationBase) -> None: ...
def __delitem__(self, arg: str, /) -> None: ...
def __contains__(self, arg: str, /) -> bool: ...
@staticmethod
def set_symbol_name(symbol: _OperationBase, name: str) -> None: ...
@staticmethod
def get_symbol_name(symbol: mlir.ir._OperationBase) -> mlir.ir.Attribute: ...
@staticmethod
def get_visibility(symbol: mlir.ir._OperationBase) -> mlir.ir.Attribute: ...
@staticmethod
def set_visibility(symbol: _OperationBase, visibility: str) -> None: ...
@staticmethod
def replace_all_symbol_uses(old_symbol: str, new_symbol: str, from_op: _OperationBase) -> None: ...
@staticmethod
def walk_symbol_tables(from_op: _OperationBase, all_sym_uses_visible: bool, callback: object) -> None: ...
class BlockArgumentList:
def __add__(self, arg: BlockArgumentList, /) -> list[BlockArgument]: ...
@property
def types(self) -> list[mlir.ir.Type]: ...
class BlockIterator:
def __iter__(self) -> BlockIterator: ...
def __next__(self) -> Block: ...
class BlockList:
def __getitem__(self, arg: int, /) -> Block: ...
def __iter__(self) -> BlockIterator: ...
def __len__(self) -> int: ...
def append(self, *args, arg_locs: Sequence | None = None) -> Block:
"""
Appends a new block, with argument types as positional args.
Returns:
The created block.
"""
class BlockSuccessors:
def __add__(self, arg: BlockSuccessors, /) -> list[Block]: ...
class BlockPredecessors:
def __add__(self, arg: BlockPredecessors, /) -> list[Block]: ...
class OperationIterator:
def __iter__(self) -> OperationIterator: ...
def __next__(self) -> object: ...
class OperationList:
def __getitem__(self, arg: int, /) -> object: ...
def __iter__(self) -> OperationIterator: ...
def __len__(self) -> int: ...
class OpAttributeMap:
def __contains__(self, arg: str, /) -> bool: ...
def __len__(self) -> int: ...
@overload
def __getitem__(self, arg: str, /) -> mlir.ir.Attribute: ...
@overload
def __getitem__(self, arg: int, /) -> mlir.ir.Attribute: ...
def __setitem__(self, arg0: str, arg1: Attribute, /) -> None: ...
def __delitem__(self, arg: str, /) -> None: ...
class OpOperandIterator:
def __iter__(self) -> OpOperandIterator: ...
def __next__(self) -> OpOperand: ...
class OpOperandList:
def __add__(self, arg: OpOperandList, /) -> list[Value]: ...
def __setitem__(self, arg0: int, arg1: Value, /) -> None: ...
class OpResultList:
def __add__(self, arg: OpResultList, /) -> list[OpResult]: ...
@property
def types(self) -> list[mlir.ir.Type]: ...
@property
def owner(self) -> mlir.ir.OpView: ...
class OpSuccessors:
def __add__(self, arg: OpSuccessors, /) -> list[Block]: ...
def __setitem__(self, arg0: int, arg1: Block, /) -> None: ...
class RegionIterator:
def __iter__(self) -> RegionIterator: ...
def __next__(self) -> Region: ...
class RegionSequence:
def __add__(self, arg: RegionSequence, /) -> list[Region]: ...
def __iter__(self) -> RegionIterator: ...
class _GlobalDebug:
flag: bool = ...
"""LLVM-wide debug flag"""
@overload
@staticmethod
def set_types(types: str) -> None:
"""Sets specific debug types to be produced by LLVM"""
@overload
@staticmethod
def set_types(arg: Sequence[str], /) -> None: ...
class AttrBuilder:
@staticmethod
def contains(arg: str, /) -> bool: ...
@staticmethod
def get(arg: str, /) -> Callable: ...
@staticmethod
def insert(attribute_kind: str, attr_builder: Callable, replace: bool = False) -> None:
"""
Register an attribute builder for building MLIR attributes from python values.
"""
class AffineExpr:
@property
def _CAPIPtr(self) -> object: ...
def _CAPICreate(self) -> AffineExpr: ...
@overload
def __add__(self, arg: AffineExpr, /) -> AffineAddExpr: ...
@overload
def __add__(self, arg: int, /) -> AffineAddExpr: ...
def __radd__(self, arg: int, /) -> AffineAddExpr: ...
@overload
def __mul__(self, arg: AffineExpr, /) -> AffineMulExpr: ...
@overload
def __mul__(self, arg: int, /) -> AffineMulExpr: ...
def __rmul__(self, arg: int, /) -> AffineMulExpr: ...
@overload
def __mod__(self, arg: AffineExpr, /) -> AffineModExpr: ...
@overload
def __mod__(self, arg: int, /) -> AffineModExpr: ...
def __rmod__(self, arg: int, /) -> AffineModExpr: ...
@overload
def __sub__(self, arg: AffineExpr, /) -> AffineAddExpr: ...
@overload
def __sub__(self, arg: int, /) -> AffineAddExpr: ...
def __rsub__(self, arg: int, /) -> AffineAddExpr: ...
@overload
def __eq__(self, arg: AffineExpr, /) -> bool: ...
@overload
def __eq__(self, arg: object, /) -> bool: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __hash__(self) -> int: ...
@property
def context(self) -> object: ...
def compose(self, arg: AffineMap, /) -> AffineExpr: ...
def shift_dims(self, num_dims: int, shift: int, offset: int = 0) -> AffineExpr: ...
def shift_symbols(self, num_symbols: int, shift: int, offset: int = 0) -> AffineExpr: ...
@staticmethod
def simplify_affine_expr(expr: AffineExpr, num_dims: int, num_symbols: int) -> AffineExpr:
"""
Simplify an affine expression by flattening and some amount of simple analysis.
"""
@overload
@staticmethod
def get_add(arg0: AffineExpr, arg1: AffineExpr, /) -> AffineAddExpr:
"""Gets an affine expression containing a sum of two expressions."""
@overload
@staticmethod
def get_add(arg0: int, arg1: AffineExpr, /) -> AffineAddExpr:
"""
Gets an affine expression containing a sum of a constant and another expression.
"""
@overload
@staticmethod
def get_add(arg0: AffineExpr, arg1: int, /) -> AffineAddExpr:
"""
Gets an affine expression containing a sum of an expression and a constant.
"""
@overload
@staticmethod
def get_mul(arg0: AffineExpr, arg1: AffineExpr, /) -> AffineMulExpr:
"""Gets an affine expression containing a product of two expressions."""
@overload
@staticmethod
def get_mul(arg0: int, arg1: AffineExpr, /) -> AffineMulExpr:
"""
Gets an affine expression containing a product of a constant and another expression.
"""
@overload
@staticmethod
def get_mul(arg0: AffineExpr, arg1: int, /) -> AffineMulExpr:
"""
Gets an affine expression containing a product of an expression and a constant.
"""
@overload
@staticmethod
def get_mod(arg0: AffineExpr, arg1: AffineExpr, /) -> AffineModExpr:
"""
Gets an affine expression containing the modulo of dividing one expression by another.
"""
@overload
@staticmethod
def get_mod(arg0: int, arg1: AffineExpr, /) -> AffineModExpr:
"""
Gets a semi-affine expression containing the modulo of dividing a constant by an expression.
"""
@overload
@staticmethod
def get_mod(arg0: AffineExpr, arg1: int, /) -> AffineModExpr:
"""
Gets an affine expression containing the module of dividingan expression by a constant.
"""
@overload
@staticmethod
def get_floor_div(arg0: AffineExpr, arg1: AffineExpr, /) -> AffineFloorDivExpr:
"""
Gets an affine expression containing the rounded-down result of dividing one expression by another.
"""
@overload
@staticmethod
def get_floor_div(arg0: int, arg1: AffineExpr, /) -> AffineFloorDivExpr:
"""
Gets a semi-affine expression containing the rounded-down result of dividing a constant by an expression.
"""
@overload
@staticmethod
def get_floor_div(arg0: AffineExpr, arg1: int, /) -> AffineFloorDivExpr:
"""
Gets an affine expression containing the rounded-down result of dividing an expression by a constant.
"""
@overload
@staticmethod
def get_ceil_div(arg0: AffineExpr, arg1: AffineExpr, /) -> AffineCeilDivExpr:
"""
Gets an affine expression containing the rounded-up result of dividing one expression by another.
"""
@overload
@staticmethod
def get_ceil_div(arg0: int, arg1: AffineExpr, /) -> AffineCeilDivExpr:
"""
Gets a semi-affine expression containing the rounded-up result of dividing a constant by an expression.
"""
@overload
@staticmethod
def get_ceil_div(arg0: AffineExpr, arg1: int, /) -> AffineCeilDivExpr:
"""
Gets an affine expression containing the rounded-up result of dividing an expression by a constant.
"""
@staticmethod
def get_constant(value: int, context: mlir.ir.Context | None = None) -> AffineConstantExpr:
"""Gets a constant affine expression with the given value."""
@staticmethod
def get_dim(position: int, context: mlir.ir.Context | None = None) -> AffineDimExpr:
"""Gets an affine expression of a dimension at the given position."""
@staticmethod
def get_symbol(position: int, context: mlir.ir.Context | None = None) -> AffineSymbolExpr:
"""Gets an affine expression of a symbol at the given position."""
def dump(self) -> None:
"""Dumps a debug representation of the object to stderr."""
class AffineConstantExpr(AffineExpr):
def __init__(self, expr: AffineExpr) -> None: ...
@staticmethod
def isinstance(other: AffineExpr) -> bool: ...
@staticmethod
def get(value: int, context: mlir.ir.Context | None = None) -> AffineConstantExpr: ...
@property
def value(self) -> int: ...
class AffineDimExpr(AffineExpr):
def __init__(self, expr: AffineExpr) -> None: ...
@staticmethod
def isinstance(other: AffineExpr) -> bool: ...
@staticmethod
def get(position: int, context: mlir.ir.Context | None = None) -> AffineDimExpr: ...
@property
def position(self) -> int: ...
class AffineSymbolExpr(AffineExpr):
def __init__(self, expr: AffineExpr) -> None: ...
@staticmethod
def isinstance(other: AffineExpr) -> bool: ...
@staticmethod
def get(position: int, context: mlir.ir.Context | None = None) -> AffineSymbolExpr: ...
@property
def position(self) -> int: ...
class AffineBinaryExpr(AffineExpr):
def __init__(self, expr: AffineExpr) -> None: ...
@staticmethod
def isinstance(other: AffineExpr) -> bool: ...
@property
def lhs(self) -> AffineExpr: ...
@property
def rhs(self) -> AffineExpr: ...
class AffineAddExpr(AffineBinaryExpr):
def __init__(self, expr: AffineExpr) -> None: ...
@staticmethod
def isinstance(other: AffineExpr) -> bool: ...
@staticmethod
def get(arg0: AffineExpr, arg1: AffineExpr, /) -> AffineAddExpr: ...
class AffineMulExpr(AffineBinaryExpr):
def __init__(self, expr: AffineExpr) -> None: ...
@staticmethod
def isinstance(other: AffineExpr) -> bool: ...
@staticmethod
def get(arg0: AffineExpr, arg1: AffineExpr, /) -> AffineMulExpr: ...
class AffineModExpr(AffineBinaryExpr):
def __init__(self, expr: AffineExpr) -> None: ...
@staticmethod
def isinstance(other: AffineExpr) -> bool: ...
@staticmethod
def get(arg0: AffineExpr, arg1: AffineExpr, /) -> AffineModExpr: ...
class AffineFloorDivExpr(AffineBinaryExpr):
def __init__(self, expr: AffineExpr) -> None: ...
@staticmethod
def isinstance(other: AffineExpr) -> bool: ...
@staticmethod
def get(arg0: AffineExpr, arg1: AffineExpr, /) -> AffineFloorDivExpr: ...
class AffineCeilDivExpr(AffineBinaryExpr):
def __init__(self, expr: AffineExpr) -> None: ...
@staticmethod
def isinstance(other: AffineExpr) -> bool: ...
@staticmethod
def get(arg0: AffineExpr, arg1: AffineExpr, /) -> AffineCeilDivExpr: ...
class AffineMap:
@property
def _CAPIPtr(self) -> object: ...
def _CAPICreate(self) -> AffineMap: ...
@overload
def __eq__(self, arg: AffineMap, /) -> bool: ...
@overload
def __eq__(self, arg: object, /) -> bool: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __hash__(self) -> int: ...
@staticmethod
def compress_unused_symbols(arg0: list, arg1: mlir.ir.Context, /) -> list[AffineMap]: ...
@property
def context(self) -> object:
"""Context that owns the Affine Map"""
def dump(self) -> None:
"""Dumps a debug representation of the object to stderr."""
@staticmethod
def get(dim_count: int, symbol_count: int, exprs: list, context: mlir.ir.Context | None = None) -> AffineMap:
"""Gets a map with the given expressions as results."""
@staticmethod
def get_constant(value: int, context: mlir.ir.Context | None = None) -> AffineMap:
"""Gets an affine map with a single constant result"""
@staticmethod
def get_empty(context: mlir.ir.Context | None = None) -> AffineMap:
"""Gets an empty affine map."""
@staticmethod
def get_identity(n_dims: int, context: mlir.ir.Context | None = None) -> AffineMap:
"""Gets an identity map with the given number of dimensions."""
@staticmethod
def get_minor_identity(n_dims: int, n_results: int, context: mlir.ir.Context | None = None) -> AffineMap:
"""
Gets a minor identity map with the given number of dimensions and results.
"""
@staticmethod
def get_permutation(permutation: Sequence[int], context: mlir.ir.Context | None = None) -> AffineMap:
"""Gets an affine map that permutes its inputs."""
def get_submap(self, result_positions: Sequence[int]) -> AffineMap: ...
def get_major_submap(self, n_results: int) -> AffineMap: ...
def get_minor_submap(self, n_results: int) -> AffineMap: ...
def replace(self, expr: AffineExpr, replacement: AffineExpr, n_result_dims: int, n_result_syms: int) -> AffineMap: ...
@property
def is_permutation(self) -> bool: ...
@property
def is_projected_permutation(self) -> bool: ...
@property
def n_dims(self) -> int: ...
@property
def n_inputs(self) -> int: ...
@property
def n_symbols(self) -> int: ...
@property
def results(self) -> AffineExprList: ...
class AffineExprList:
def __add__(self, arg: AffineExprList, /) -> list[AffineExpr]: ...
class IntegerSet:
@property
def _CAPIPtr(self) -> object: ...
def _CAPICreate(self) -> IntegerSet: ...
@overload
def __eq__(self, arg: IntegerSet, /) -> bool: ...
@overload
def __eq__(self, arg: object, /) -> bool: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __hash__(self) -> int: ...
@property
def context(self) -> object: ...
def dump(self) -> None:
"""Dumps a debug representation of the object to stderr."""
@staticmethod
def get(num_dims: int, num_symbols: int, exprs: list, eq_flags: Sequence[bool], context: mlir.ir.Context | None = None) -> IntegerSet: ...
@staticmethod
def get_empty(num_dims: int, num_symbols: int, context: mlir.ir.Context | None = None) -> IntegerSet: ...
def get_replaced(self, dim_exprs: list, symbol_exprs: list, num_result_dims: int, num_result_symbols: int) -> IntegerSet: ...
@property
def is_canonical_empty(self) -> bool: ...
@property
def n_dims(self) -> int: ...
@property
def n_symbols(self) -> int: ...
@property
def n_inputs(self) -> int: ...
@property
def n_equalities(self) -> int: ...
@property
def n_inequalities(self) -> int: ...
@property
def constraints(self) -> IntegerSetConstraintList: ...
class IntegerSetConstraint:
@property
def expr(self) -> AffineExpr: ...
@property
def is_eq(self) -> bool: ...
class IntegerSetConstraintList:
def __add__(self, arg: IntegerSetConstraintList, /) -> list[IntegerSetConstraint]: ...
class AffineMapAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(affine_map: AffineMap) -> AffineMapAttr:
"""Gets an attribute wrapping an AffineMap."""
@property
def value(self) -> mlir.ir.AffineMap:
"""Returns the value of the AffineMap attribute"""
class DenseBoolArrayAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(values: Sequence, context: mlir.ir.Context | None = None) -> DenseBoolArrayAttr:
"""Gets a uniqued dense array attribute"""
def __getitem__(self, arg: int, /) -> bool: ...
def __len__(self) -> int: ...
def __iter__(self) -> DenseBoolArrayIterator: ...
def __add__(self, arg: list, /) -> DenseBoolArrayAttr: ...
class DenseBoolArrayIterator:
def __iter__(self) -> DenseBoolArrayIterator: ...
def __next__(self) -> bool: ...
class DenseI8ArrayAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(values: Sequence[int], context: mlir.ir.Context | None = None) -> DenseI8ArrayAttr:
"""Gets a uniqued dense array attribute"""
def __getitem__(self, arg: int, /) -> int: ...
def __len__(self) -> int: ...
def __iter__(self) -> DenseI8ArrayIterator: ...
def __add__(self, arg: list, /) -> DenseI8ArrayAttr: ...
class DenseI8ArrayIterator:
def __iter__(self) -> DenseI8ArrayIterator: ...
def __next__(self) -> int: ...
class DenseI16ArrayAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(values: Sequence[int], context: mlir.ir.Context | None = None) -> DenseI16ArrayAttr:
"""Gets a uniqued dense array attribute"""
def __getitem__(self, arg: int, /) -> int: ...
def __len__(self) -> int: ...
def __iter__(self) -> DenseI16ArrayIterator: ...
def __add__(self, arg: list, /) -> DenseI16ArrayAttr: ...
class DenseI16ArrayIterator:
def __iter__(self) -> DenseI16ArrayIterator: ...
def __next__(self) -> int: ...
class DenseI32ArrayAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(values: Sequence[int], context: mlir.ir.Context | None = None) -> DenseI32ArrayAttr:
"""Gets a uniqued dense array attribute"""
def __getitem__(self, arg: int, /) -> int: ...
def __len__(self) -> int: ...
def __iter__(self) -> DenseI32ArrayIterator: ...
def __add__(self, arg: list, /) -> DenseI32ArrayAttr: ...
class DenseI32ArrayIterator:
def __iter__(self) -> DenseI32ArrayIterator: ...
def __next__(self) -> int: ...
class DenseI64ArrayAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(values: Sequence[int], context: mlir.ir.Context | None = None) -> DenseI64ArrayAttr:
"""Gets a uniqued dense array attribute"""
def __getitem__(self, arg: int, /) -> int: ...
def __len__(self) -> int: ...
def __iter__(self) -> DenseI64ArrayIterator: ...
def __add__(self, arg: list, /) -> DenseI64ArrayAttr: ...
class DenseI64ArrayIterator:
def __iter__(self) -> DenseI64ArrayIterator: ...
def __next__(self) -> int: ...
class DenseF32ArrayAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(values: Sequence[float], context: mlir.ir.Context | None = None) -> DenseF32ArrayAttr:
"""Gets a uniqued dense array attribute"""
def __getitem__(self, arg: int, /) -> float: ...
def __len__(self) -> int: ...
def __iter__(self) -> DenseF32ArrayIterator: ...
def __add__(self, arg: list, /) -> DenseF32ArrayAttr: ...
class DenseF32ArrayIterator:
def __iter__(self) -> DenseF32ArrayIterator: ...
def __next__(self) -> float: ...
class DenseF64ArrayAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(values: Sequence[float], context: mlir.ir.Context | None = None) -> DenseF64ArrayAttr:
"""Gets a uniqued dense array attribute"""
def __getitem__(self, arg: int, /) -> float: ...
def __len__(self) -> int: ...
def __iter__(self) -> DenseF64ArrayIterator: ...
def __add__(self, arg: list, /) -> DenseF64ArrayAttr: ...
class DenseF64ArrayIterator:
def __iter__(self) -> DenseF64ArrayIterator: ...
def __next__(self) -> float: ...
class ArrayAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(attributes: list, context: mlir.ir.Context | None = None) -> ArrayAttr:
"""Gets a uniqued Array attribute"""
def __getitem__(self, arg: int, /) -> mlir.ir.Attribute: ...
def __len__(self) -> int: ...
def __iter__(self) -> ArrayAttributeIterator: ...
def __add__(self, arg: list, /) -> ArrayAttr: ...
class ArrayAttributeIterator:
def __iter__(self) -> ArrayAttributeIterator: ...
def __next__(self) -> mlir.ir.Attribute: ...
class BoolAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(value: bool, context: mlir.ir.Context | None = None) -> BoolAttr:
"""Gets an uniqued bool attribute"""
@property
def value(self) -> bool:
"""Returns the value of the bool attribute"""
def __bool__(self) -> bool:
"""Converts the value of the bool attribute to a Python bool"""
class DenseElementsAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
def __len__(self) -> int: ...
@overload
@staticmethod
def get(array: typing_extensions.Buffer, signless: bool = True, type: mlir.ir.Type | None = None, shape: Sequence[int] | None = None, context: mlir.ir.Context | None = None) -> mlir.ir.DenseElementsAttr:
"""
Gets a DenseElementsAttr from a Python buffer or array.
When `type` is not provided, then some limited type inferencing is done based
on the buffer format. Support presently exists for 8/16/32/64 signed and
unsigned integers and float16/float32/float64. DenseElementsAttrs of these
types can also be converted back to a corresponding buffer.
For conversions outside of these types, a `type=` must be explicitly provided
and the buffer contents must be bit-castable to the MLIR internal
representation:
* Integer types (except for i1): the buffer must be byte aligned to the
next byte boundary.
* Floating point types: Must be bit-castable to the given floating point
size.
* i1 (bool): Bit packed into 8bit words where the bit pattern matches a
row major ordering. An arbitrary Numpy `bool_` array can be bit packed to
this specification with: `np.packbits(ary, axis=None, bitorder='little')`.
If a single element buffer is passed (or for i1, a single byte with value 0
or 255), then a splat will be created.
Args:
array: The array or buffer to convert.
signless: If inferring an appropriate MLIR type, use signless types for
integers (defaults True).
type: Skips inference of the MLIR element type and uses this instead. The
storage size must be consistent with the actual contents of the buffer.
shape: Overrides the shape of the buffer when constructing the MLIR
shaped type. This is needed when the physical and logical shape differ (as
for i1).
context: Explicit context, if not from context manager.
Returns:
DenseElementsAttr on success.
Raises:
ValueError: If the type of the buffer or array cannot be matched to an MLIR
type or if the buffer does not meet expectations.
"""
@overload
@staticmethod
def get(attrs: list, type: Type | None = None, context: mlir.ir.Context | None = None) -> DenseElementsAttr:
"""
Gets a DenseElementsAttr from a Python list of attributes.
Note that it can be expensive to construct attributes individually.
For a large number of elements, consider using a Python buffer or array instead.
Args:
attrs: A list of attributes.
type: The desired shape and type of the resulting DenseElementsAttr.
If not provided, the element type is determined based on the type
of the 0th attribute and the shape is `[len(attrs)]`.
context: Explicit context, if not from context manager.
Returns:
DenseElementsAttr on success.
Raises:
ValueError: If the type of the attributes does not match the type
specified by `shaped_type`.
"""
@staticmethod
def get_splat(shaped_type: Type, element_attr: Attribute) -> DenseElementsAttr:
"""Gets a DenseElementsAttr where all values are the same"""
@property
def is_splat(self) -> bool: ...
def get_splat_value(self) -> mlir.ir.Attribute: ...
class DenseFPElementsAttr(DenseElementsAttr):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
def __getitem__(self, arg: int, /) -> float: ...
class DenseIntElementsAttr(DenseElementsAttr):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
def __getitem__(self, arg: int, /) -> object: ...
class DenseResourceElementsAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get_from_buffer(array: typing_extensions.Buffer, name: str, type: mlir.ir.Type, alignment: int | None = None, is_mutable: bool = False, context: mlir.ir.Context | None = None) -> mlir.ir.DenseResourceElementsAttr:
"""
Gets a DenseResourceElementsAttr from a Python buffer or array.
This function does minimal validation or massaging of the data, and it is
up to the caller to ensure that the buffer meets the characteristics
implied by the shape.
The backing buffer and any user objects will be retained for the lifetime
of the resource blob. This is typically bounded to the context but the
resource can have a shorter lifespan depending on how it is used in
subsequent processing.
Args:
buffer: The array or buffer to convert.
name: Name to provide to the resource (may be changed upon collision).
type: The explicit ShapedType to construct the attribute with.
context: Explicit context, if not from context manager.
Returns:
DenseResourceElementsAttr on success.
Raises:
ValueError: If the type of the buffer or array cannot be matched to an MLIR
type or if the buffer does not meet expectations.
"""
class DictAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
def __contains__(self, arg: str, /) -> bool: ...
def __len__(self) -> int: ...
@staticmethod
def get(value: dict = {}, context: mlir.ir.Context | None = None) -> DictAttr:
"""Gets an uniqued dict attribute"""
@overload
def __getitem__(self, arg: str, /) -> mlir.ir.Attribute: ...
@overload
def __getitem__(self, arg: int, /) -> NamedAttribute: ...
class SymbolRefAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(symbols: Sequence[str], context: mlir.ir.Context | None = None) -> mlir.ir.Attribute:
"""Gets a uniqued SymbolRef attribute from a list of symbol names"""
@property
def value(self) -> list[str]:
"""Returns the value of the SymbolRef attribute as a list[str]"""
class FlatSymbolRefAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(value: str, context: mlir.ir.Context | None = None) -> FlatSymbolRefAttr:
"""Gets a uniqued FlatSymbolRef attribute"""
@property
def value(self) -> str:
"""Returns the value of the FlatSymbolRef attribute as a string"""
class OpaqueAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(dialect_namespace: str, buffer: typing_extensions.Buffer, type: mlir.ir.Type, context: mlir.ir.Context | None = None) -> mlir.ir.OpaqueAttr:
"""Gets an Opaque attribute."""
@property
def dialect_namespace(self) -> str:
"""Returns the dialect namespace for the Opaque attribute as a string"""
@property
def data(self) -> bytes:
"""Returns the data for the Opaqued attributes as `bytes`"""
class FloatAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(type: Type, value: float, loc: mlir.ir.Location | None = None) -> FloatAttr:
"""Gets an uniqued float point attribute associated to a type"""
@staticmethod
def get_f32(value: float, context: mlir.ir.Context | None = None) -> FloatAttr:
"""Gets an uniqued float point attribute associated to a f32 type"""
@staticmethod
def get_f64(value: float, context: mlir.ir.Context | None = None) -> FloatAttr:
"""Gets an uniqued float point attribute associated to a f64 type"""
@property
def value(self) -> float:
"""Returns the value of the float attribute"""
def __float__(self) -> float:
"""Converts the value of the float attribute to a Python float"""
class IntegerAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: mlir.ir.TypeID = ...
"""static_typeid(/) -> mlir.ir.TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(type: Type, value: int) -> IntegerAttr:
"""Gets an uniqued integer attribute associated to a type"""
@property
def value(self) -> int:
"""Returns the value of the integer attribute"""
def __int__(self) -> int:
"""Converts the value of the integer attribute to a Python int"""
class IntegerSetAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(integer_set: IntegerSet) -> IntegerSetAttr:
"""Gets an attribute wrapping an IntegerSet."""
class StringAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@overload
@staticmethod
def get(value: str, context: mlir.ir.Context | None = None) -> StringAttr:
"""Gets a uniqued string attribute"""
@overload
@staticmethod
def get(value: bytes, context: mlir.ir.Context | None = None) -> StringAttr: ...
@staticmethod
def get_typed(type: Type, value: str) -> StringAttr:
"""Gets a uniqued string attribute associated to a type"""
@property
def value(self) -> str:
"""Returns the value of the string attribute"""
@property
def value_bytes(self) -> bytes:
"""Returns the value of the string attribute as `bytes`"""
class TypeAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(value: Type, context: mlir.ir.Context | None = None) -> TypeAttr:
"""Gets a uniqued Type attribute"""
@property
def value(self) -> mlir.ir.Type: ...
class UnitAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(context: mlir.ir.Context | None = None) -> UnitAttr:
"""Create a Unit attribute."""
class StridedLayoutAttr(Attribute):
def __init__(self, cast_from_attr: Attribute) -> None: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@property
def type(self) -> Type: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(offset: int, strides: Sequence[int], context: mlir.ir.Context | None = None) -> StridedLayoutAttr:
"""Gets a strided layout attribute."""
@staticmethod
def get_fully_dynamic(rank: int, context: mlir.ir.Context | None = None) -> StridedLayoutAttr:
"""
Gets a strided layout attribute with dynamic offset and strides of a given rank.
"""
@property
def offset(self) -> int:
"""Returns the value of the float point attribute"""
@property
def strides(self) -> list[int]:
"""Returns the value of the float point attribute"""
class InferTypeOpInterface:
def __init__(self, object: object, context: mlir.ir.Context | None = None) -> None:
"""
Creates an interface from a given operation/opview object or from a
subclass of OpView. Raises ValueError if the operation does not implement the
interface.
"""
@property
def operation(self) -> object:
"""Returns an Operation for which the interface was constructed."""
@property
def opview(self) -> object:
"""
Returns an OpView subclass _instance_ for which the interface was
constructed
"""
def inferReturnTypes(self, operands: list | None = None, attributes: Attribute | None = None, properties: typing_extensions.CapsuleType | None = None, regions: Sequence[Region] | None = None, context: mlir.ir.Context | None = None, loc: mlir.ir.Location | None = None) -> list[Type]:
"""
Given the arguments required to build an operation, attempts to infer
its return types. Raises ValueError on failure.
"""
class ShapedTypeComponents:
@property
def element_type(self) -> mlir.ir.Type:
"""Returns the element type of the shaped type components."""
@overload
@staticmethod
def get(element_type: Type) -> ShapedTypeComponents:
"""Create an shaped type components object with only the element type."""
@overload
@staticmethod
def get(shape: list, element_type: Type) -> ShapedTypeComponents:
"""Create a ranked shaped type components object."""
@overload
@staticmethod
def get(shape: list, element_type: Type, attribute: Attribute) -> ShapedTypeComponents:
"""Create a ranked shaped type components object with attribute."""
@property
def has_rank(self) -> bool:
"""Returns whether the given shaped type component is ranked."""
@property
def rank(self) -> object:
"""
Returns the rank of the given ranked shaped type components. If the shaped type components does not have a rank, None is returned.
"""
@property
def shape(self) -> object:
"""
Returns the shape of the ranked shaped type components as a list of integers. Returns none if the shaped type component does not have a rank.
"""
class InferShapedTypeOpInterface:
def __init__(self, object: object, context: mlir.ir.Context | None = None) -> None:
"""
Creates an interface from a given operation/opview object or from a
subclass of OpView. Raises ValueError if the operation does not implement the
interface.
"""
@property
def operation(self) -> object:
"""Returns an Operation for which the interface was constructed."""
@property
def opview(self) -> object:
"""
Returns an OpView subclass _instance_ for which the interface was
constructed
"""
def inferReturnTypeComponents(self, operands: list | None = None, attributes: Attribute | None = None, regions: typing_extensions.CapsuleType | None = None, properties: Sequence[Region] | None = None, context: mlir.ir.Context | None = None, loc: mlir.ir.Location | None = None) -> list[ShapedTypeComponents]:
"""
Given the arguments required to build an operation, attempts to infer
its return shaped type components. Raises ValueError on failure.
"""
class IntegerType(Type):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get_signless(width: int, context: mlir.ir.Context | None = None) -> IntegerType:
"""Create a signless integer type"""
@staticmethod
def get_signed(width: int, context: mlir.ir.Context | None = None) -> IntegerType:
"""Create a signed integer type"""
@staticmethod
def get_unsigned(width: int, context: mlir.ir.Context | None = None) -> IntegerType:
"""Create an unsigned integer type"""
@property
def width(self) -> int:
"""Returns the width of the integer type"""
@property
def is_signless(self) -> bool:
"""Returns whether this is a signless integer"""
@property
def is_signed(self) -> bool:
"""Returns whether this is a signed integer"""
@property
def is_unsigned(self) -> bool:
"""Returns whether this is an unsigned integer"""
class FloatType(Type):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@property
def width(self) -> int:
"""Returns the width of the floating-point type"""
class IndexType(Type):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(context: mlir.ir.Context | None = None) -> IndexType:
"""Create a index type."""
class Float4E2M1FNType(FloatType):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(context: mlir.ir.Context | None = None) -> Float4E2M1FNType:
"""Create a float4_e2m1fn type."""
class Float6E2M3FNType(FloatType):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(context: mlir.ir.Context | None = None) -> Float6E2M3FNType:
"""Create a float6_e2m3fn type."""
class Float6E3M2FNType(FloatType):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(context: mlir.ir.Context | None = None) -> Float6E3M2FNType:
"""Create a float6_e3m2fn type."""
class Float8E4M3FNType(FloatType):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(context: mlir.ir.Context | None = None) -> Float8E4M3FNType:
"""Create a float8_e4m3fn type."""
class Float8E5M2Type(FloatType):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(context: mlir.ir.Context | None = None) -> Float8E5M2Type:
"""Create a float8_e5m2 type."""
class Float8E4M3Type(FloatType):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(context: mlir.ir.Context | None = None) -> Float8E4M3Type:
"""Create a float8_e4m3 type."""
class Float8E4M3FNUZType(FloatType):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(context: mlir.ir.Context | None = None) -> Float8E4M3FNUZType:
"""Create a float8_e4m3fnuz type."""
class Float8E4M3B11FNUZType(FloatType):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(context: mlir.ir.Context | None = None) -> Float8E4M3B11FNUZType:
"""Create a float8_e4m3b11fnuz type."""
class Float8E5M2FNUZType(FloatType):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(context: mlir.ir.Context | None = None) -> Float8E5M2FNUZType:
"""Create a float8_e5m2fnuz type."""
class Float8E3M4Type(FloatType):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(context: mlir.ir.Context | None = None) -> Float8E3M4Type:
"""Create a float8_e3m4 type."""
class Float8E8M0FNUType(FloatType):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(context: mlir.ir.Context | None = None) -> Float8E8M0FNUType:
"""Create a float8_e8m0fnu type."""
class BF16Type(FloatType):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(context: mlir.ir.Context | None = None) -> BF16Type:
"""Create a bf16 type."""
class F16Type(FloatType):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(context: mlir.ir.Context | None = None) -> F16Type:
"""Create a f16 type."""
class FloatTF32Type(FloatType):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(context: mlir.ir.Context | None = None) -> FloatTF32Type:
"""Create a tf32 type."""
class F32Type(FloatType):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(context: mlir.ir.Context | None = None) -> F32Type:
"""Create a f32 type."""
class F64Type(FloatType):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(context: mlir.ir.Context | None = None) -> F64Type:
"""Create a f64 type."""
class NoneType(Type):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(context: mlir.ir.Context | None = None) -> NoneType:
"""Create a none type."""
class ComplexType(Type):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(arg: Type, /) -> ComplexType:
"""Create a complex type"""
@property
def element_type(self) -> mlir.ir.Type:
"""Returns element type."""
class ShapedType(Type):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@property
def element_type(self) -> mlir.ir.Type:
"""Returns the element type of the shaped type."""
@property
def has_rank(self) -> bool:
"""Returns whether the given shaped type is ranked."""
@property
def rank(self) -> int:
"""Returns the rank of the given ranked shaped type."""
@property
def has_static_shape(self) -> bool:
"""Returns whether the given shaped type has a static shape."""
def is_dynamic_dim(self, dim: int) -> bool:
"""
Returns whether the dim-th dimension of the given shaped type is dynamic.
"""
def is_static_dim(self, dim: int) -> bool:
"""
Returns whether the dim-th dimension of the given shaped type is static.
"""
def get_dim_size(self, dim: int) -> int:
"""Returns the dim-th dimension of the given ranked shaped type."""
@staticmethod
def is_dynamic_size(dim_size: int) -> bool:
"""
Returns whether the given dimension size indicates a dynamic dimension.
"""
@staticmethod
def is_static_size(dim_size: int) -> bool:
"""Returns whether the given dimension size indicates a static dimension."""
def is_dynamic_stride_or_offset(self, dim_size: int) -> bool:
"""
Returns whether the given value is used as a placeholder for dynamic strides and offsets in shaped types.
"""
def is_static_stride_or_offset(self, dim_size: int) -> bool:
"""
Returns whether the given shaped type stride or offset value is statically-sized.
"""
@property
def shape(self) -> list[int]:
"""Returns the shape of the ranked shaped type as a list of integers."""
@staticmethod
def get_dynamic_size() -> int:
"""Returns the value used to indicate dynamic dimensions in shaped types."""
@staticmethod
def get_dynamic_stride_or_offset() -> int:
"""
Returns the value used to indicate dynamic strides or offsets in shaped types.
"""
class VectorType(ShapedType):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(shape: Sequence[int], element_type: Type, *, scalable: list | None = None, scalable_dims: Sequence[int] | None = None, loc: mlir.ir.Location | None = None) -> VectorType:
"""Create a vector type"""
@property
def scalable(self) -> bool: ...
@property
def scalable_dims(self) -> list[bool]: ...
class RankedTensorType(ShapedType):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(shape: Sequence[int], element_type: Type, encoding: Attribute | None = None, loc: mlir.ir.Location | None = None) -> RankedTensorType:
"""Create a ranked tensor type"""
@property
def encoding(self) -> mlir.ir.Attribute | None: ...
class UnrankedTensorType(ShapedType):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(element_type: Type, loc: mlir.ir.Location | None = None) -> UnrankedTensorType:
"""Create a unranked tensor type"""
class MemRefType(ShapedType):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(shape: Sequence[int], element_type: Type, layout: Attribute | None = None, memory_space: Attribute | None = None, loc: mlir.ir.Location | None = None) -> MemRefType:
"""Create a memref type"""
@property
def layout(self) -> mlir.ir.Attribute:
"""The layout of the MemRef type."""
def get_strides_and_offset(self) -> tuple[list[int], int]:
"""The strides and offset of the MemRef type."""
@property
def affine_map(self) -> AffineMap:
"""The layout of the MemRef type as an affine map."""
@property
def memory_space(self) -> mlir.ir.Attribute | None:
"""Returns the memory space of the given MemRef type."""
class UnrankedMemRefType(ShapedType):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(element_type: Type, memory_space: Attribute | None, loc: mlir.ir.Location | None = None) -> UnrankedMemRefType:
"""Create a unranked memref type"""
@property
def memory_space(self) -> mlir.ir.Attribute | None:
"""Returns the memory space of the given Unranked MemRef type."""
class TupleType(Type):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get_tuple(elements: Sequence[mlir.ir.Type], context: mlir.ir.Context | None = None) -> mlir.ir.TupleType:
"""Create a tuple type"""
def get_type(self, pos: int) -> mlir.ir.Type:
"""Returns the pos-th type in the tuple type."""
@property
def num_types(self) -> int:
"""Returns the number of types contained in a tuple."""
class FunctionType(Type):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(inputs: Sequence[mlir.ir.Type], results: Sequence[mlir.ir.Type], context: mlir.ir.Context | None = None) -> mlir.ir.FunctionType:
"""Gets a FunctionType from a list of input and result types"""
@property
def inputs(self) -> list:
"""Returns the list of input types in the FunctionType."""
@property
def results(self) -> list:
"""Returns the list of result types in the FunctionType."""
class OpaqueType(Type):
def __init__(self, cast_from_type: Type) -> None: ...
@staticmethod
def isinstance(other: Type) -> bool: ...
static_typeid: TypeID = ...
"""static_typeid(/) -> TypeID"""
@property
def typeid(self) -> TypeID: ...
def __repr__(self) -> str: ...
@staticmethod
def get(dialect_namespace: str, buffer: str, context: mlir.ir.Context | None = None) -> OpaqueType:
"""Create an unregistered (opaque) dialect type."""
@property
def dialect_namespace(self) -> str:
"""Returns the dialect namespace for the Opaque type as a string."""
@property
def data(self) -> str:
"""Returns the data for the Opaque type as a string."""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment