diff --git a/mlir/python/mlir/_mlir_libs/_mlir/__init__.pyi b/mlir/python/mlir/_mlir_libs/_mlir/__init__.pyi --- a/mlir/python/mlir/_mlir_libs/_mlir/__init__.pyi +++ b/mlir/python/mlir/_mlir_libs/_mlir/__init__.pyi @@ -1,13 +1,12 @@ from typing import List -globals: _Globals +globals: "_Globals" class _Globals: dialect_search_modules: List[str] - def __init__(self, *args, **kwargs) -> None: ... - def _register_dialect_impl(self, dialect_namespace: str, dialect_class: object) -> None: ... - def _register_operation_impl(self, operation_name: str, operation_class: object, raw_opview_class: object) -> None: ... + def _register_dialect_impl(self, dialect_namespace: str, dialect_class: type) -> None: ... + def _register_operation_impl(self, operation_name: str, operation_class: type, raw_opview_class: type) -> None: ... def append_dialect_search_prefix(self, module_name: str) -> None: ... -def register_dialect(dialect_class: object) -> object: ... -def register_operation(dialect_class: object) -> object: ... +def register_dialect(dialect_class: type) -> object: ... +def register_operation(dialect_class: type) -> object: ... diff --git a/mlir/python/mlir/_mlir_libs/_mlir/ir.pyi b/mlir/python/mlir/_mlir_libs/_mlir/ir.pyi --- a/mlir/python/mlir/_mlir_libs/_mlir/ir.pyi +++ b/mlir/python/mlir/_mlir_libs/_mlir/ir.pyi @@ -7,7 +7,7 @@ # * Local edits to signatures and types that MyPy did not auto detect (or # detected incorrectly). -from typing import Any, Callable, ClassVar, List, Optional +from typing import Any, Callable, ClassVar, Dict, List, Optional, Sequence from typing import overload @@ -92,33 +92,33 @@ # Base classes: declared first to simplify declarations below. class _OperationBase: - def __init__(self, *args, **kwargs) -> None: ... - def detach_from_parent(self) -> object: ... - def get_asm(self, binary: bool = ..., large_elements_limit: Optional[int] = ..., enable_debug_info: bool = ..., pretty_debug_info: bool = ..., print_generic_op_form: bool = ..., use_local_scope: bool = ...) -> object: ... - def move_after(self, other: _OperationBase) -> None: ... - def move_before(self, other: _OperationBase) -> None: ... - def print(self, file: object = ..., binary: bool = ..., large_elements_limit: Optional[int] = ..., enable_debug_info: bool = ..., pretty_debug_info: bool = ..., print_generic_op_form: bool = ..., use_local_scope: bool = ...) -> None: ... + def detach_from_parent(self) -> "OpView": ... + def get_asm(self, binary: bool = False, large_elements_limit: Optional[int] = None, enable_debug_info: bool = False, pretty_debug_info: bool = False, print_generic_op_form: bool = False, use_local_scope: bool = False, assume_verified: bool = False) -> object: ... + def move_after(self, other: "_OperationBase") -> None: ... + def move_before(self, other: "_OperationBase") -> None: ... + def print(self, file: Optional[Any] = None, binary: bool = False, large_elements_limit: Optional[int] = None, enable_debug_info: bool = False, pretty_debug_info: bool = False, print_generic_op_form: bool = False, use_local_scope: bool = False, assume_verified: bool = False) -> None: ... def verify(self) -> bool: ... @overload - def __eq__(self, arg0: _OperationBase) -> bool: ... + def __eq__(self, arg0: "_OperationBase") -> bool: ... @overload def __eq__(self, arg0: object) -> bool: ... def __hash__(self) -> int: ... @property def _CAPIPtr(self) -> object: ... @property - def attributes(self) -> Any: ... + def attributes(self) -> "OpAttributeMap": ... @property - def location(self) -> Location: ... + def location(self) -> "Location": ... @property - def operands(self) -> Any: ... + def operands(self) -> "OpOperandList": ... @property - def regions(self) -> Any: ... + def regions(self) -> "RegionSequence": ... @property - def result(self) -> Any: ... + def result(self) -> "OpResult": ... @property - def results(self) -> Any: ... + def results(self) -> "OpResultList": ... +# TODO: Auto-generated. Audit and fix. class AffineExpr: def __init__(self, *args, **kwargs) -> None: ... def _CAPICreate(self) -> AffineExpr: ... @@ -151,63 +151,66 @@ def context(self) -> object: ... class Attribute: - def __init__(self, cast_from_type: Attribute) -> None: ... - def _CAPICreate(self) -> Attribute: ... + def __init__(self, cast_from_type: "Attribute") -> None: ... + def _CAPICreate(self) -> "Attribute": ... def dump(self) -> None: ... def get_named(self, *args, **kwargs) -> Any: ... - def parse(self, *args, **kwargs) -> Any: ... + @staticmethod + def parse(asm: str, context: Optional["Context"] = None) -> Any: ... @overload - def __eq__(self, arg0: Attribute) -> bool: ... + def __eq__(self, arg0: "Attribute") -> bool: ... @overload def __eq__(self, arg0: object) -> bool: ... def __hash__(self) -> int: ... @property def _CAPIPtr(self) -> object: ... @property - def context(self) -> object: ... + def context(self) -> "Context"": ... @property - def type(self) -> Any: ... + def type(self) -> "Type": ... class Type: - def __init__(self, cast_from_type: Type) -> None: ... + def __init__(self, cast_from_type: "Type") -> None: ... def _CAPICreate(self) -> Type: ... def dump(self) -> None: ... - def parse(self, *args, **kwargs) -> Any: ... + @staticmethod + def parse(asm: str, context: Optional["Context"] = None) -> "Type": ... @overload - def __eq__(self, arg0: Type) -> bool: ... + def __eq__(self, arg0: "Type") -> bool: ... @overload def __eq__(self, arg0: object) -> bool: ... def __hash__(self) -> int: ... @property def _CAPIPtr(self) -> object: ... @property - def context(self) -> object: ... + def context(self) -> "Context": ... class Value: - def __init__(self, *args, **kwargs) -> None: ... - def _CAPICreate(self) -> Value: ... + def _CAPICreate(self) -> "Value": ... def dump(self) -> None: ... @overload - def __eq__(self, arg0: Value) -> bool: ... + def __eq__(self, arg0: "Value") -> bool: ... @overload def __eq__(self, arg0: object) -> bool: ... def __hash__(self) -> int: ... @property def _CAPIPtr(self) -> object: ... @property - def context(self) -> Any: ... + def context(self) -> "Context": ... @property - def owner(self) -> object: ... + def owner(self) -> "_OperationBase": ... @property - def type(self) -> Type: ... + def type(self) -> "Type": ... # Classes with no particular order sensitivity in alpha order. +# TODO: Auto-generated. Audit and fix. class AffineAddExpr(AffineBinaryExpr): def __init__(self, expr: AffineExpr) -> None: ... def get(self, *args, **kwargs) -> Any: ... def isinstance(self, *args, **kwargs) -> Any: ... +# TODO: Auto-generated. Audit and fix. class AffineBinaryExpr(AffineExpr): def __init__(self, expr: AffineExpr) -> None: ... def isinstance(self, *args, **kwargs) -> Any: ... @@ -216,11 +219,13 @@ @property def rhs(self) -> AffineExpr: ... +# TODO: Auto-generated. Audit and fix. class AffineCeilDivExpr(AffineBinaryExpr): def __init__(self, expr: AffineExpr) -> None: ... def get(self, *args, **kwargs) -> Any: ... def isinstance(self, *args, **kwargs) -> Any: ... +# TODO: Auto-generated. Audit and fix. class AffineConstantExpr(AffineExpr): def __init__(self, expr: AffineExpr) -> None: ... def get(self, *args, **kwargs) -> Any: ... @@ -228,6 +233,7 @@ @property def value(self) -> int: ... +# TODO: Auto-generated. Audit and fix. class AffineDimExpr(AffineExpr): def __init__(self, expr: AffineExpr) -> None: ... def get(self, *args, **kwargs) -> Any: ... @@ -235,6 +241,7 @@ @property def position(self) -> int: ... +# TODO: Auto-generated. Audit and fix. class AffineExprList: def __init__(self, *args, **kwargs) -> None: ... def __add__(self, arg0: AffineExprList) -> List[AffineExpr]: ... @@ -244,11 +251,13 @@ def __getitem__(self, arg0: slice) -> AffineExprList: ... def __len__(self) -> int: ... +# TODO: Auto-generated. Audit and fix. class AffineFloorDivExpr(AffineBinaryExpr): def __init__(self, expr: AffineExpr) -> None: ... def get(self, *args, **kwargs) -> Any: ... def isinstance(self, *args, **kwargs) -> Any: ... +# TODO: Auto-generated. Audit and fix. class AffineMap: def __init__(self, *args, **kwargs) -> None: ... def _CAPICreate(self) -> AffineMap: ... @@ -286,6 +295,7 @@ @property def results(self) -> Any: ... +# TODO: Auto-generated. Audit and fix. class AffineMapAttr(Attribute): def __init__(self, cast_from_attr: Attribute) -> None: ... def get(self, *args, **kwargs) -> Any: ... @@ -293,16 +303,19 @@ @property def type(self) -> Type: ... +# TODO: Auto-generated. Audit and fix. class AffineModExpr(AffineBinaryExpr): def __init__(self, expr: AffineExpr) -> None: ... def get(self, *args, **kwargs) -> Any: ... def isinstance(self, *args, **kwargs) -> Any: ... +# TODO: Auto-generated. Audit and fix. class AffineMulExpr(AffineBinaryExpr): def __init__(self, expr: AffineExpr) -> None: ... def get(self, *args, **kwargs) -> Any: ... def isinstance(self, *args, **kwargs) -> Any: ... +# TODO: Auto-generated. Audit and fix. class AffineSymbolExpr(AffineExpr): def __init__(self, expr: AffineExpr) -> None: ... def get(self, *args, **kwargs) -> Any: ... @@ -310,6 +323,7 @@ @property def position(self) -> int: ... +# TODO: Auto-generated. Audit and fix. class ArrayAttr(Attribute): def __init__(self, cast_from_attr: Attribute) -> None: ... def get(self, *args, **kwargs) -> Any: ... @@ -321,11 +335,13 @@ @property def type(self) -> Type: ... +# TODO: Auto-generated. Audit and fix. class ArrayAttributeIterator: def __init__(self, *args, **kwargs) -> None: ... def __iter__(self) -> ArrayAttributeIterator: ... def __next__(self) -> Attribute: ... +# TODO: Auto-generated. Audit and fix. class BF16Type(Type): def __init__(self, cast_from_type: Type) -> None: ... def get(self, *args, **kwargs) -> Any: ... @@ -333,57 +349,55 @@ class Block: __hash__: ClassVar[None] = ... - def __init__(self, *args, **kwargs) -> None: ... def append(self, operation: _OperationBase) -> None: ... - def create_after(self, *args) -> Block: ... - def create_at_start(self, *args, **kwargs) -> Any: ... - def create_before(self, *args) -> Block: ... + def create_after(self, *args: "Type") -> "Block": ... + @staticmethod + def create_at_start(parent: "Region", arg_types: List["Type"]) -> "Block": ... + def create_before(self, *args: "Type") -> "Block": ... @overload - def __eq__(self, arg0: Block) -> bool: ... + def __eq__(self, arg0: "Block") -> bool: ... @overload def __eq__(self, arg0: object) -> bool: ... def __iter__(self) -> Any: ... @property - def arguments(self) -> Any: ... + def arguments(self) -> "BlockArgumentList": ... @property - def operations(self) -> Any: ... + def operations(self) -> "OperationList": ... @property - def owner(self) -> object: ... + def owner(self) -> "OpView": ... @property - def region(self) -> Region: ... + def region(self) -> "Region": ... class BlockArgument(Value): - def __init__(self, value: Value) -> None: ... def isinstance(self, *args, **kwargs) -> Any: ... - def set_type(self, type: Type) -> None: ... + def set_type(self, type: "Type") -> None: ... @property def arg_number(self) -> int: ... @property - def owner(self) -> Block: ... + def owner(self) -> "Block": ... class BlockArgumentList: - def __init__(self, *args, **kwargs) -> None: ... - def __add__(self, arg0: BlockArgumentList) -> List[BlockArgument]: ... + def __add__(self, arg0: "BlockArgumentList") -> List["BlockArgument"]: ... @overload - def __getitem__(self, arg0: int) -> BlockArgument: ... + def __getitem__(self, arg0: int) -> "BlockArgument": ... @overload - def __getitem__(self, arg0: slice) -> BlockArgumentList: ... + def __getitem__(self, arg0: slice) -> "BlockArgumentList": ... def __len__(self) -> int: ... @property - def types(self) -> List[Type]: ... + def types(self) -> List["Type"]: ... class BlockIterator: def __init__(self, *args, **kwargs) -> None: ... - def __iter__(self) -> BlockIterator: ... - def __next__(self) -> Block: ... + def __iter__(self) -> "BlockIterator": ... + def __next__(self) -> "Block": ... class BlockList: - def __init__(self, *args, **kwargs) -> None: ... - def append(self, *args) -> Block: ... - def __getitem__(self, arg0: int) -> Block: ... - def __iter__(self) -> BlockIterator: ... + def append(self, *args) -> "Block": ... + def __getitem__(self, arg0: int) -> "Block": ... + def __iter__(self) -> "BlockIterator": ... def __len__(self) -> int: ... +# TODO: Auto-generated. Audit and fix. class BoolAttr(Attribute): def __init__(self, cast_from_attr: Attribute) -> None: ... def get(self, *args, **kwargs) -> Any: ... @@ -393,6 +407,7 @@ @property def value(self) -> bool: ... +# TODO: Auto-generated. Audit and fix. class ComplexType(Type): def __init__(self, cast_from_type: Type) -> None: ... def get(self, *args, **kwargs) -> Any: ... @@ -401,26 +416,28 @@ def element_type(self) -> Type: ... class Context: - current: ClassVar[Context] = ... # read-only + current: ClassVar["Context"] = ... # read-only allow_unregistered_dialects: bool def __init__(self) -> None: ... def _CAPICreate(self) -> object: ... - def _get_context_again(self) -> object: ... - def _get_live_count(self, *args, **kwargs) -> Any: ... + def _get_context_again(self) -> "Context": ... + @staticmethod + def _get_live_count() -> int: ... def _get_live_module_count(self) -> int: ... def _get_live_operation_count(self) -> int: ... def enable_multithreading(self, enable: bool) -> None: ... - def get_dialect_descriptor(self, *args, **kwargs) -> Any: ... + def get_dialect_descriptor(name: dialect_name: str) -> "DialectDescriptor": ... def is_registered_operation(self, operation_name: str) -> bool: ... - def __enter__(self) -> object: ... + def __enter__(self) -> "Context": ... def __exit__(self, arg0: object, arg1: object, arg2: object) -> None: ... @property def _CAPIPtr(self) -> object: ... @property - def d(self) -> Any: ... + def d(self) -> "Dialects": ... @property - def dialects(self) -> Any: ... + def dialects(self) -> "Dialects": ... +# TODO: Auto-generated. Audit and fix. class DenseElementsAttr(Attribute): def __init__(self, cast_from_attr: Attribute) -> None: ... def get(self, *args, **kwargs) -> Any: ... @@ -432,6 +449,7 @@ @property def type(self) -> Type: ... +# TODO: Auto-generated. Audit and fix. class DenseFPElementsAttr(DenseElementsAttr): def __init__(self, cast_from_attr: Attribute) -> None: ... def isinstance(self, *args, **kwargs) -> Any: ... @@ -439,6 +457,7 @@ @property def type(self) -> Type: ... +# TODO: Auto-generated. Audit and fix. class DenseIntElementsAttr(DenseElementsAttr): def __init__(self, cast_from_attr: Attribute) -> None: ... def isinstance(self, *args, **kwargs) -> Any: ... @@ -447,20 +466,20 @@ def type(self) -> Type: ... class Dialect: - def __init__(self, descriptor: object) -> None: ... + def __init__(self, descriptor: "DialectDescriptor") -> None: ... @property - def descriptor(self) -> object: ... + def descriptor(self) -> "DialectDescriptor": ... class DialectDescriptor: - def __init__(self, *args, **kwargs) -> None: ... @property def namespace(self) -> str: ... class Dialects: def __init__(self, *args, **kwargs) -> None: ... - def __getattr__(self, arg0: str) -> object: ... - def __getitem__(self, arg0: str) -> object: ... + def __getattr__(self, arg0: str) -> "Dialect": ... + def __getitem__(self, arg0: str) -> "Dialect": ... +# TODO: Auto-generated. Audit and fix. class DictAttr(Attribute): def __init__(self, cast_from_attr: Attribute) -> None: ... def get(self, *args, **kwargs) -> Any: ... @@ -474,21 +493,25 @@ @property def type(self) -> Type: ... +# TODO: Auto-generated. Audit and fix. class F16Type(Type): def __init__(self, cast_from_type: Type) -> None: ... def get(self, *args, **kwargs) -> Any: ... def isinstance(self, *args, **kwargs) -> Any: ... +# TODO: Auto-generated. Audit and fix. class F32Type(Type): def __init__(self, cast_from_type: Type) -> None: ... def get(self, *args, **kwargs) -> Any: ... def isinstance(self, *args, **kwargs) -> Any: ... +# TODO: Auto-generated. Audit and fix. class F64Type(Type): def __init__(self, cast_from_type: Type) -> None: ... def get(self, *args, **kwargs) -> Any: ... def isinstance(self, *args, **kwargs) -> Any: ... +# TODO: Auto-generated. Audit and fix. class FlatSymbolRefAttr(Attribute): def __init__(self, cast_from_attr: Attribute) -> None: ... def get(self, *args, **kwargs) -> Any: ... @@ -498,6 +521,7 @@ @property def value(self) -> str: ... +# TODO: Auto-generated. Audit and fix. class FloatAttr(Attribute): def __init__(self, cast_from_attr: Attribute) -> None: ... def get(self, *args, **kwargs) -> Any: ... @@ -509,6 +533,7 @@ @property def value(self) -> float: ... +# TODO: Auto-generated. Audit and fix. class FunctionType(Type): def __init__(self, cast_from_type: Type) -> None: ... def get(self, *args, **kwargs) -> Any: ... @@ -518,33 +543,37 @@ @property def results(self) -> list: ... +# TODO: Auto-generated. Audit and fix. class IndexType(Type): def __init__(self, cast_from_type: Type) -> None: ... def get(self, *args, **kwargs) -> Any: ... def isinstance(self, *args, **kwargs) -> Any: ... class InferTypeOpInterface: - def __init__(self, object: object, context: Context = ...) -> None: ... - def inferReturnTypes(self, operands: Optional[List[Value]] = ..., attributes: Optional[Attribute] = ..., regions: Optional[List[Region]] = ..., context: Context = ..., loc: Location = ...) -> List[Type]: ... + def __init__(self, object: object, context: Optional["Context"] = None) -> None: ... + def inferReturnTypes(self, operands: Optional[List["Value"]] = None, attributes: Optional["Attribute"] = None, regions: Optional[List["Region"]] = None, context: Optional["Context"] = None, loc: Optional["Location"] = None) -> List[Type]: ... @property - def operation(self) -> object: ... + def operation(self) -> "_OperationBase": ... @property - def opview(self) -> object: ... + def opview(self) -> "OpView": ... class InsertionPoint: - current: ClassVar[InsertionPoint] = ... # read-only + current: ClassVar["InsertionPoint"] = ... # read-only @overload - def __init__(self, block: Block) -> None: ... + def __init__(self, block: "Block") -> None: ... @overload - def __init__(self, beforeOperation: _OperationBase) -> None: ... - def at_block_begin(self, *args, **kwargs) -> Any: ... - def at_block_terminator(self, *args, **kwargs) -> Any: ... - def insert(self, operation: _OperationBase) -> None: ... - def __enter__(self) -> object: ... + def __init__(self, beforeOperation: "_OperationBase") -> None: ... + @staticmethod + def at_block_begin(block: "Block") -> "InsertionPoint": ... + @staticmethod + def at_block_terminator(block: "Block") -> "InsertionPoint": ... + def insert(self, operation: "_OperationBase") -> None: ... + def __enter__(self) -> "InsertionPoint": ... def __exit__(self, arg0: object, arg1: object, arg2: object) -> None: ... @property - def block(self) -> Block: ... + def block(self) -> "Block": ... +# TODO: Auto-generated. Audit and fix. class IntegerAttr(Attribute): def __init__(self, cast_from_attr: Attribute) -> None: ... def get(self, *args, **kwargs) -> Any: ... @@ -554,6 +583,7 @@ @property def value(self) -> int: ... +# TODO: Auto-generated. Audit and fix. class IntegerSet: def __init__(self, *args, **kwargs) -> None: ... def _CAPICreate(self) -> IntegerSet: ... @@ -585,6 +615,7 @@ @property def n_symbols(self) -> int: ... +# TODO: Auto-generated. Audit and fix. class IntegerSetConstraint: def __init__(self, *args, **kwargs) -> None: ... @property @@ -592,6 +623,7 @@ @property def is_eq(self) -> bool: ... +# TODO: Auto-generated. Audit and fix. class IntegerSetConstraintList: def __init__(self, *args, **kwargs) -> None: ... def __add__(self, arg0: IntegerSetConstraintList) -> List[IntegerSetConstraint]: ... @@ -601,6 +633,7 @@ def __getitem__(self, arg0: slice) -> IntegerSetConstraintList: ... def __len__(self) -> int: ... +# TODO: Auto-generated. Audit and fix. class IntegerType(Type): def __init__(self, cast_from_type: Type) -> None: ... def get_signed(self, *args, **kwargs) -> Any: ... @@ -617,25 +650,29 @@ def width(self) -> int: ... class Location: - current: ClassVar[Location] = ... # read-only + current: ClassVar["Location"] = ... # read-only __hash__: ClassVar[None] = ... - def __init__(self, *args, **kwargs) -> None: ... - def _CAPICreate(self) -> Location: ... - def callsite(self, *args, **kwargs) -> Any: ... - def file(self, *args, **kwargs) -> Any: ... - def name(self, *args, **kwargs) -> Any: ... - def unknown(self, *args, **kwargs) -> Any: ... - def __enter__(self) -> object: ... + def _CAPICreate(self) -> "Location": ... + @staticmethod + def callsite(callee: "Location", frames: Sequence["Location"], context: Optional["Context"] = None) -> "Location": ... + @staticmethod + def file(filename: str, line: int, col: int, context: Optional["Context"] = None) -> "Location": ... + @staticmethod + def name(name: str, childLoc: Optional["Location"] = None, context: Optional["Context"] = None) -> "Location": ... + @staticmethod + def unknown(context: Optional["Context"] = None) -> Any: ... + def __enter__(self) -> "Location": ... @overload - def __eq__(self, arg0: Location) -> bool: ... + def __eq__(self, arg0: "Location") -> bool: ... @overload def __eq__(self, arg0: object) -> bool: ... def __exit__(self, arg0: object, arg1: object, arg2: object) -> None: ... @property def _CAPIPtr(self) -> object: ... @property - def context(self) -> object: ... + def context(self) -> "Context": ... +# TODO: Auto-generated. Audit and fix. class MemRefType(ShapedType): def __init__(self, cast_from_type: Type) -> None: ... def get(self, *args, **kwargs) -> Any: ... @@ -648,50 +685,48 @@ def memory_space(self) -> Attribute: ... class Module: - def __init__(self, *args, **kwargs) -> None: ... def _CAPICreate(self) -> object: ... - def create(self, *args, **kwargs) -> Any: ... + def create(loc: Optional["Location"] = None) -> "Module": ... def dump(self) -> None: ... - def parse(self, *args, **kwargs) -> Any: ... + @staticmethod + def parse(asm: str, context: Optional[Context] = None) -> "Module": ... @property def _CAPIPtr(self) -> object: ... @property - def body(self) -> Any: ... + def body(self) -> "Block": ... @property def context(self) -> object: ... @property - def operation(self) -> object: ... + def operation(self) -> "_OperationBase": ... class NamedAttribute: - def __init__(self, *args, **kwargs) -> None: ... @property - def attr(self) -> Attribute: ... + def attr(self) -> "Attribute": ... @property def name(self) -> str: ... +# TODO: Auto-generated. Audit and fix. class NoneType(Type): def __init__(self, cast_from_type: Type) -> None: ... def get(self, *args, **kwargs) -> Any: ... def isinstance(self, *args, **kwargs) -> Any: ... class OpAttributeMap: - def __init__(self, *args, **kwargs) -> None: ... def __contains__(self, arg0: str) -> bool: ... def __delitem__(self, arg0: str) -> None: ... @overload - def __getitem__(self, arg0: str) -> Attribute: ... + def __getitem__(self, arg0: str) -> "Attribute": ... @overload - def __getitem__(self, arg0: int) -> NamedAttribute: ... + def __getitem__(self, arg0: int) -> "NamedAttribute": ... def __len__(self) -> int: ... - def __setitem__(self, arg0: str, arg1: Attribute) -> None: ... + def __setitem__(self, arg0: str, arg1: "Attribute") -> None: ... class OpOperandList: - def __init__(self, *args, **kwargs) -> None: ... - def __add__(self, arg0: OpOperandList) -> List[Value]: ... + def __add__(self, arg0: "OpOperandList") -> List[Value]: ... @overload def __getitem__(self, arg0: int) -> Value: ... @overload - def __getitem__(self, arg0: slice) -> OpOperandList: ... + def __getitem__(self, arg0: slice) -> "OpOperandList": ... def __len__(self) -> int: ... def __setitem__(self, arg0: int, arg1: Value) -> None: ... @@ -699,60 +734,70 @@ def __init__(self, value: Value) -> None: ... def isinstance(self, *args, **kwargs) -> Any: ... @property - def owner(self) -> object: ... + def owner(self) -> "_OperationBase": ... @property def result_number(self) -> int: ... class OpResultList: - def __init__(self, *args, **kwargs) -> None: ... - def __add__(self, arg0: OpResultList) -> List[OpResult]: ... + def __add__(self, arg0: "OpResultList") -> List["OpResult"]: ... @overload - def __getitem__(self, arg0: int) -> OpResult: ... + def __getitem__(self, arg0: int) -> "OpResult": ... @overload - def __getitem__(self, arg0: slice) -> OpResultList: ... + def __getitem__(self, arg0: slice) -> "OpResultList": ... def __len__(self) -> int: ... @property - def types(self) -> List[Type]: ... + def types(self) -> List["Type"]: ... class OpView(_OperationBase): _ODS_OPERAND_SEGMENTS: ClassVar[None] = ... _ODS_REGIONS: ClassVar[tuple] = ... _ODS_RESULT_SEGMENTS: ClassVar[None] = ... - def __init__(self, operation: object) -> None: ... + def __init__(self, operation: "_OperationBase") -> None: ... @classmethod - def build_generic(self, *args, **kwargs) -> Any: ... + def build_generic(cls, results: Optional[Sequence["Type"]] = None, + operands: Optional[Sequence["Value"]] = None, + attributes: Optional[Dict[str, "Attribute"]] = None, + successors: Optional[Sequence["Block"]] = None, + regions: Optional[int] = None, + loc: Optional["Location"] = None, + ip: Optional["InsertionPoint"] = None) -> "_OperationBase": ... @property - def context(self) -> object: ... + def context(self) -> "Context": ... @property - def operation(self) -> object: ... + def operation(self) -> "_OperationBase": ... class Operation(_OperationBase): - def __init__(self, *args, **kwargs) -> None: ... def _CAPICreate(self) -> object: ... - def create(self, *args, **kwargs) -> Any: ... + @staticmethod + def create(name: str, results: Optional[Sequence["Type"]] = None, + operands: Optional[Sequence["Value"]] = None, + attributes: Optional[Dict[str, "Attribute"]] = None, + successors: Optional[Sequence["Block"]] = None, + regions: int = 0, + loc: Optional["Location"] = None, + ip: Optional["InsertionPoint"] = None) -> "_OperationBase": ... def erase(self) -> None: ... @property def _CAPIPtr(self) -> object: ... @property - def context(self) -> object: ... + def context(self) -> "Context": ... @property def name(self) -> str: ... @property - def opview(self) -> object: ... + def opview(self) -> "OpView": ... @property - def parent(self) -> object: ... + def parent(self) -> Optional["_OperationBase"]: ... class OperationIterator: - def __init__(self, *args, **kwargs) -> None: ... - def __iter__(self) -> OperationIterator: ... - def __next__(self) -> object: ... + def __iter__(self) -> "OperationIterator": ... + def __next__(self) -> "OpView": ... class OperationList: - def __init__(self, *args, **kwargs) -> None: ... - def __getitem__(self, arg0: int) -> object: ... - def __iter__(self) -> OperationIterator: ... + def __getitem__(self, arg0: int) -> "OpView": ... + def __iter__(self) -> "OperationIterator": ... def __len__(self) -> int: ... +# TODO: Auto-generated. Audit and fix. class RankedTensorType(ShapedType): def __init__(self, cast_from_type: Type) -> None: ... def get(self, *args, **kwargs) -> Any: ... @@ -762,27 +807,25 @@ class Region: __hash__: ClassVar[None] = ... - def __init__(self, *args, **kwargs) -> None: ... @overload - def __eq__(self, arg0: Region) -> bool: ... + def __eq__(self, arg0: "Region") -> bool: ... @overload def __eq__(self, arg0: object) -> bool: ... - def __iter__(self) -> Any: ... + def __iter__(self) -> "BlockIterator": ... @property - def blocks(self) -> Any: ... + def blocks(self) -> "BlockList": ... @property - def owner(self) -> object: ... + def owner(self) -> "OpView": ... class RegionIterator: - def __init__(self, *args, **kwargs) -> None: ... - def __iter__(self) -> RegionIterator: ... - def __next__(self) -> Region: ... + def __iter__(self) -> "RegionIterator": ... + def __next__(self) -> "Region": ... class RegionSequence: - def __init__(self, *args, **kwargs) -> None: ... - def __getitem__(self, arg0: int) -> Region: ... + def __getitem__(self, arg0: int) -> "Region": ... def __len__(self) -> int: ... +# TODO: Auto-generated. Audit and fix. class ShapedType(Type): def __init__(self, cast_from_type: Type) -> None: ... def get_dim_size(self, dim: int) -> int: ... @@ -801,6 +844,7 @@ @property def shape(self) -> List[int]: ... +# TODO: Auto-generated. Audit and fix. class StringAttr(Attribute): def __init__(self, cast_from_attr: Attribute) -> None: ... def get(self, *args, **kwargs) -> Any: ... @@ -829,8 +873,9 @@ def walk_symbol_tables(from_op: _OperationBase, all_sym_uses_visible: bool, callback: Callable[[_OperationBase, bool], None) -> None: ... def __contains__(self, arg0: str) -> bool: ... def __delitem__(self, arg0: str) -> None: ... - def __getitem__(self, arg0: str) -> object: ... + def __getitem__(self, arg0: str) -> "OpView": ... +# TODO: Auto-generated. Audit and fix. class TupleType(Type): def __init__(self, cast_from_type: Type) -> None: ... def get_tuple(self, *args, **kwargs) -> Any: ... @@ -839,6 +884,7 @@ @property def num_types(self) -> int: ... +# TODO: Auto-generated. Audit and fix. class TypeAttr(Attribute): def __init__(self, cast_from_attr: Attribute) -> None: ... def get(self, *args, **kwargs) -> Any: ... @@ -848,6 +894,7 @@ @property def value(self) -> Type: ... +# TODO: Auto-generated. Audit and fix. class UnitAttr(Attribute): def __init__(self, cast_from_attr: Attribute) -> None: ... def get(self, *args, **kwargs) -> Any: ... @@ -855,6 +902,7 @@ @property def type(self) -> Type: ... +# TODO: Auto-generated. Audit and fix. class UnrankedMemRefType(ShapedType): def __init__(self, cast_from_type: Type) -> None: ... def get(self, *args, **kwargs) -> Any: ... @@ -862,11 +910,13 @@ @property def memory_space(self) -> Attribute: ... +# TODO: Auto-generated. Audit and fix. class UnrankedTensorType(ShapedType): def __init__(self, cast_from_type: Type) -> None: ... def get(self, *args, **kwargs) -> Any: ... def isinstance(self, *args, **kwargs) -> Any: ... +# TODO: Auto-generated. Audit and fix. class VectorType(ShapedType): def __init__(self, cast_from_type: Type) -> None: ... def get(self, *args, **kwargs) -> Any: ... @@ -874,4 +924,3 @@ class _GlobalDebug: flag: ClassVar[bool] = ... - def __init__(self, *args, **kwargs) -> None: ... diff --git a/mlir/python/mlir/_mlir_libs/_mlir/passmanager.pyi b/mlir/python/mlir/_mlir_libs/_mlir/passmanager.pyi --- a/mlir/python/mlir/_mlir_libs/_mlir/passmanager.pyi +++ b/mlir/python/mlir/_mlir_libs/_mlir/passmanager.pyi @@ -4,7 +4,7 @@ # * Relative imports for cross-module references. # * Add __all__ -from typing import Any +from typing import Any, Optional from . import ir as _ir @@ -13,12 +13,13 @@ ] class PassManager: - def __init__(self, context: _ir.Context = ...) -> None: ... + def __init__(self, context: Optional[_ir.Context] = None) -> None: ... def _CAPICreate(self) -> object: ... def _testing_release(self) -> None: ... def enable_ir_printing(self) -> None: ... def enable_verifier(self, enable: bool) -> None: ... - def parse(self, *args, **kwargs) -> Any: ... + @staticmethod + def parse(pipeline: str, context: Optional[_ir.Context] = None) -> "PassManager": ... def run(self, module: _ir.Module) -> None: ... @property def _CAPIPtr(self) -> object: ... diff --git a/mlir/python/mlir/_mlir_libs/_mlirExecutionEngine.pyi b/mlir/python/mlir/_mlir_libs/_mlirExecutionEngine.pyi --- a/mlir/python/mlir/_mlir_libs/_mlirExecutionEngine.pyi +++ b/mlir/python/mlir/_mlir_libs/_mlirExecutionEngine.pyi @@ -4,7 +4,7 @@ # * Relative imports for cross-module references. # * Add __all__ -from typing import List +from typing import List, Sequence from ._mlir import ir as _ir @@ -13,7 +13,7 @@ ] class ExecutionEngine: - def __init__(self, module: _ir.Module, opt_level: int = ..., shared_libs: List[str] = ...) -> None: ... + def __init__(self, module: _ir.Module, opt_level: int = 2, shared_libs: Sequence[str] = ...) -> None: ... def _CAPICreate(self) -> object: ... def _testing_release(self) -> None: ... def dump_to_object_file(self, file_name: str) -> None: ...