[Mlir-commits] [mlir] 91ef1f7 - A few tweaks to the MLIR .pyi files (#110488)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Oct 1 04:49:21 PDT 2024
Author: Sergei Lebedev
Date: 2024-10-01T07:49:18-04:00
New Revision: 91ef1f7caa4c8029952fd6d36e0858811d286bab
URL: https://github.com/llvm/llvm-project/commit/91ef1f7caa4c8029952fd6d36e0858811d286bab
DIFF: https://github.com/llvm/llvm-project/commit/91ef1f7caa4c8029952fd6d36e0858811d286bab.diff
LOG: A few tweaks to the MLIR .pyi files (#110488)
Added:
Modified:
mlir/python/mlir/_mlir_libs/_mlir/__init__.pyi
mlir/python/mlir/_mlir_libs/_mlir/dialects/pdl.pyi
mlir/python/mlir/_mlir_libs/_mlir/dialects/quant.pyi
mlir/python/mlir/_mlir_libs/_mlir/dialects/transform/__init__.pyi
mlir/python/mlir/_mlir_libs/_mlir/ir.pyi
mlir/python/mlir/_mlir_libs/_mlir/passmanager.pyi
mlir/python/mlir/_mlir_libs/_mlirExecutionEngine.pyi
Removed:
################################################################################
diff --git a/mlir/python/mlir/_mlir_libs/_mlir/__init__.pyi b/mlir/python/mlir/_mlir_libs/_mlir/__init__.pyi
index 93b978c75540f4..42694747e5f24f 100644
--- a/mlir/python/mlir/_mlir_libs/_mlir/__init__.pyi
+++ b/mlir/python/mlir/_mlir_libs/_mlir/__init__.pyi
@@ -1,9 +1,8 @@
-from typing import List
globals: "_Globals"
class _Globals:
- dialect_search_modules: List[str]
+ dialect_search_modules: list[str]
def _register_dialect_impl(self, dialect_namespace: str, dialect_class: type) -> None: ...
def _register_operation_impl(self, operation_name: str, operation_class: type) -> None: ...
def append_dialect_search_prefix(self, module_name: str) -> None: ...
diff --git a/mlir/python/mlir/_mlir_libs/_mlir/dialects/pdl.pyi b/mlir/python/mlir/_mlir_libs/_mlir/dialects/pdl.pyi
index 8ec944d191c6ff..d12c6839deabaf 100644
--- a/mlir/python/mlir/_mlir_libs/_mlir/dialects/pdl.pyi
+++ b/mlir/python/mlir/_mlir_libs/_mlir/dialects/pdl.pyi
@@ -2,7 +2,6 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-from typing import Optional
from mlir.ir import Type, Context
@@ -26,7 +25,7 @@ class AttributeType(Type):
def isinstance(type: Type) -> bool: ...
@staticmethod
- def get(context: Optional[Context] = None) -> AttributeType: ...
+ def get(context: Context | None = None) -> AttributeType: ...
class OperationType(Type):
@@ -34,7 +33,7 @@ class OperationType(Type):
def isinstance(type: Type) -> bool: ...
@staticmethod
- def get(context: Optional[Context] = None) -> OperationType: ...
+ def get(context: Context | None = None) -> OperationType: ...
class RangeType(Type):
@@ -53,7 +52,7 @@ class TypeType(Type):
def isinstance(type: Type) -> bool: ...
@staticmethod
- def get(context: Optional[Context] = None) -> TypeType: ...
+ def get(context: Context | None = None) -> TypeType: ...
class ValueType(Type):
@@ -61,4 +60,4 @@ class ValueType(Type):
def isinstance(type: Type) -> bool: ...
@staticmethod
- def get(context: Optional[Context] = None) -> ValueType: ...
+ def get(context: Context | None = None) -> ValueType: ...
diff --git a/mlir/python/mlir/_mlir_libs/_mlir/dialects/quant.pyi b/mlir/python/mlir/_mlir_libs/_mlir/dialects/quant.pyi
index c9c66d52b8c250..a10bc693ba6001 100644
--- a/mlir/python/mlir/_mlir_libs/_mlir/dialects/quant.pyi
+++ b/mlir/python/mlir/_mlir_libs/_mlir/dialects/quant.pyi
@@ -2,7 +2,6 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-from typing import List
from mlir.ir import Type
@@ -94,15 +93,15 @@ class UniformQuantizedPerAxisType(QuantizedType):
@classmethod
def get(cls, flags: int, storage_type: Type, expressed_type: Type,
- scales: List[float], zero_points: List[int], quantized_dimension: int,
+ scales: list[float], zero_points: list[int], quantized_dimension: int,
storage_type_min: int, storage_type_max: int):
...
@property
- def scales(self) -> List[float]: ...
+ def scales(self) -> list[float]: ...
@property
- def zero_points(self) -> List[float]: ...
+ def zero_points(self) -> list[float]: ...
@property
def quantized_dimension(self) -> int: ...
diff --git a/mlir/python/mlir/_mlir_libs/_mlir/dialects/transform/__init__.pyi b/mlir/python/mlir/_mlir_libs/_mlir/dialects/transform/__init__.pyi
index 2a29541734a821..a3f1b09102379f 100644
--- a/mlir/python/mlir/_mlir_libs/_mlir/dialects/transform/__init__.pyi
+++ b/mlir/python/mlir/_mlir_libs/_mlir/dialects/transform/__init__.pyi
@@ -2,7 +2,6 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-from typing import Optional
from mlir.ir import Type, Context
@@ -12,7 +11,7 @@ class AnyOpType(Type):
def isinstance(type: Type) -> bool: ...
@staticmethod
- def get(context: Optional[Context] = None) -> AnyOpType: ...
+ def get(context: Context | None = None) -> AnyOpType: ...
class OperationType(Type):
@@ -20,7 +19,7 @@ class OperationType(Type):
def isinstance(type: Type) -> bool: ...
@staticmethod
- def get(operation_name: str, context: Optional[Context] = None) -> OperationType: ...
+ def get(operation_name: str, context: Context | None = None) -> OperationType: ...
@property
def operation_name(self) -> str: ...
diff --git a/mlir/python/mlir/_mlir_libs/_mlir/ir.pyi b/mlir/python/mlir/_mlir_libs/_mlir/ir.pyi
index 4d5b4cef9d8aa8..41ed84e0467254 100644
--- a/mlir/python/mlir/_mlir_libs/_mlir/ir.pyi
+++ b/mlir/python/mlir/_mlir_libs/_mlir/ir.pyi
@@ -44,22 +44,9 @@ from __future__ import annotations
import abc
import collections
+from collections.abc import Callable, Sequence
import io
-from typing import (
- Any,
- Callable,
- ClassVar,
- Dict,
- List,
- Optional,
- Sequence,
- Tuple,
- Type as _Type,
- TypeVar,
- Union,
-)
-
-from typing import overload
+from typing import Any, ClassVar, TypeVar, overload
__all__ = [
"AffineAddExpr",
@@ -210,14 +197,14 @@ class _OperationBase:
def get_asm(
self,
binary: bool = False,
- large_elements_limit: Optional[int] = None,
+ large_elements_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,
assume_verified: bool = False,
skip_regions: bool = False,
- ) -> Union[io.BytesIO, io.StringIO]:
+ ) -> io.BytesIO | io.StringIO:
"""
Gets the assembly form of the operation with all options available.
@@ -242,7 +229,7 @@ class _OperationBase:
def print(
self,
state: AsmState,
- file: Optional[Any] = None,
+ file: Any | None = None,
binary: bool = False,
) -> None:
"""
@@ -256,13 +243,13 @@ class _OperationBase:
@overload
def print(
self,
- large_elements_limit: Optional[int] = None,
+ large_elements_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,
assume_verified: bool = False,
- file: Optional[Any] = None,
+ file: Any | None = None,
binary: bool = False,
skip_regions: bool = False,
) -> None:
@@ -296,7 +283,7 @@ class _OperationBase:
"""
Verify the operation. Raises MLIRError if verification fails, and returns true otherwise.
"""
- def write_bytecode(self, file: Any, desired_version: Optional[int] = None) -> None:
+ def write_bytecode(self, file: Any, desired_version: int | None = None) -> None:
"""
Write the bytecode form of the operation to a file like object.
@@ -325,7 +312,7 @@ class _OperationBase:
@property
def operands(self) -> OpOperandList: ...
@property
- def parent(self) -> Optional[_OperationBase]: ...
+ def parent(self) -> _OperationBase | None: ...
@property
def regions(self) -> RegionSequence: ...
@property
@@ -380,13 +367,13 @@ class AffineExpr:
"""
@staticmethod
def get_constant(
- value: int, context: Optional[Context] = None
+ value: int, context: Context | None = None
) -> AffineConstantExpr:
"""
Gets a constant affine expression with the given value.
"""
@staticmethod
- def get_dim(position: int, context: Optional[Context] = None) -> AffineDimExpr:
+ def get_dim(position: int, context: Context | None = None) -> AffineDimExpr:
"""
Gets an affine expression of a dimension at the given position.
"""
@@ -446,7 +433,7 @@ class AffineExpr:
"""
@staticmethod
def get_symbol(
- position: int, context: Optional[Context] = None
+ position: int, context: Context | None = None
) -> AffineSymbolExpr:
"""
Gets an affine expression of a symbol at the given position.
@@ -489,7 +476,7 @@ class AffineExpr:
class Attribute:
@staticmethod
- def parse(asm: str | bytes, context: Optional[Context] = None) -> Attribute:
+ def parse(asm: str | bytes, context: Context | None = None) -> Attribute:
"""
Parses an attribute from an assembly form. Raises an MLIRError on failure.
"""
@@ -530,7 +517,7 @@ class Attribute:
class Type:
@staticmethod
- def parse(asm: str | bytes, context: Optional[Context] = None) -> Type:
+ def parse(asm: str | bytes, context: Context | None = None) -> Type:
"""
Parses the assembly form of a type.
@@ -640,7 +627,7 @@ class AffineCeilDivExpr(AffineBinaryExpr):
class AffineConstantExpr(AffineExpr):
@staticmethod
- def get(value: int, context: Optional[Context] = None) -> AffineConstantExpr: ...
+ def get(value: int, context: Context | None = None) -> AffineConstantExpr: ...
@staticmethod
def isinstance(other: AffineExpr) -> bool: ...
def __init__(self, expr: AffineExpr) -> None: ...
@@ -649,7 +636,7 @@ class AffineConstantExpr(AffineExpr):
class AffineDimExpr(AffineExpr):
@staticmethod
- def get(position: int, context: Optional[Context] = None) -> AffineDimExpr: ...
+ def get(position: int, context: Context | None = None) -> AffineDimExpr: ...
@staticmethod
def isinstance(other: AffineExpr) -> bool: ...
def __init__(self, expr: AffineExpr) -> None: ...
@@ -657,7 +644,7 @@ class AffineDimExpr(AffineExpr):
def position(self) -> int: ...
class AffineExprList:
- def __add__(self, arg0: AffineExprList) -> List[AffineExpr]: ...
+ def __add__(self, arg0: AffineExprList) -> list[AffineExpr]: ...
class AffineFloorDivExpr(AffineBinaryExpr):
@staticmethod
@@ -669,43 +656,43 @@ class AffineFloorDivExpr(AffineBinaryExpr):
class AffineMap:
@staticmethod
def compress_unused_symbols(
- arg0: List, arg1: Optional[Context]
- ) -> List[AffineMap]: ...
+ arg0: list, arg1: Context | None
+ ) -> list[AffineMap]: ...
@staticmethod
def get(
dim_count: int,
symbol_count: int,
- exprs: List,
- context: Optional[Context] = None,
+ exprs: list,
+ context: Context | None = None,
) -> AffineMap:
"""
Gets a map with the given expressions as results.
"""
@staticmethod
- def get_constant(value: int, context: Optional[Context] = None) -> AffineMap:
+ def get_constant(value: int, context: Context | None = None) -> AffineMap:
"""
Gets an affine map with a single constant result
"""
@staticmethod
- def get_empty(context: Optional[Context] = None) -> AffineMap:
+ def get_empty(context: Context | None = None) -> AffineMap:
"""
Gets an empty affine map.
"""
@staticmethod
- def get_identity(n_dims: int, context: Optional[Context] = None) -> AffineMap:
+ def get_identity(n_dims: int, context: 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: Optional[Context] = None
+ n_dims: int, n_results: int, context: Context | None = None
) -> AffineMap:
"""
Gets a minor identity map with the given number of dimensions and results.
"""
@staticmethod
def get_permutation(
- permutation: List[int], context: Optional[Context] = None
+ permutation: list[int], context: Context | None = None
) -> AffineMap:
"""
Gets an affine map that permutes its inputs.
@@ -722,7 +709,7 @@ class AffineMap:
"""
def get_major_submap(self, n_results: int) -> AffineMap: ...
def get_minor_submap(self, n_results: int) -> AffineMap: ...
- def get_submap(self, result_positions: List[int]) -> AffineMap: ...
+ def get_submap(self, result_positions: list[int]) -> AffineMap: ...
def replace(
self,
expr: AffineExpr,
@@ -748,7 +735,7 @@ class AffineMap:
@property
def n_symbols(self) -> int: ...
@property
- def results(self) -> "AffineMapExprList": ...
+ def results(self) -> AffineMapExprList: ...
class AffineMapAttr(Attribute):
static_typeid: ClassVar[TypeID]
@@ -781,7 +768,7 @@ class AffineMulExpr(AffineBinaryExpr):
class AffineSymbolExpr(AffineExpr):
@staticmethod
- def get(position: int, context: Optional[Context] = None) -> AffineSymbolExpr: ...
+ def get(position: int, context: Context | None = None) -> AffineSymbolExpr: ...
@staticmethod
def isinstance(other: AffineExpr) -> bool: ...
def __init__(self, expr: AffineExpr) -> None: ...
@@ -791,13 +778,13 @@ class AffineSymbolExpr(AffineExpr):
class ArrayAttr(Attribute):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(attributes: List, context: Optional[Context] = None) -> ArrayAttr:
+ def get(attributes: list, context: Context | None = None) -> ArrayAttr:
"""
Gets a uniqued Array attribute
"""
@staticmethod
def isinstance(other: Attribute) -> bool: ...
- def __add__(self, arg0: List) -> ArrayAttr: ...
+ def __add__(self, arg0: list) -> ArrayAttr: ...
def __getitem__(self, arg0: int) -> Attribute: ...
def __init__(self, cast_from_attr: Attribute) -> None: ...
def __iter__(
@@ -835,7 +822,7 @@ class AttrBuilder:
class BF16Type(Type):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(context: Optional[Context] = None) -> BF16Type:
+ def get(context: Context | None = None) -> BF16Type:
"""
Create a bf16 type.
"""
@@ -849,8 +836,8 @@ class Block:
@staticmethod
def create_at_start(
parent: Region,
- arg_types: List[Type],
- arg_locs: Optional[Sequence] = None,
+ arg_types: list[Type],
+ 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).
@@ -876,11 +863,11 @@ class Block:
"""
Append this block to a region, transferring ownership if necessary
"""
- def create_after(self, *args, arg_locs: Optional[Sequence] = None) -> Block:
+ def create_after(self, *args, arg_locs: Sequence | None = None) -> Block:
"""
Creates and returns a new Block after this block (with given argument types and locations).
"""
- def create_before(self, *args, arg_locs: Optional[Sequence] = None) -> Block:
+ def create_before(self, *args, arg_locs: Sequence | None = None) -> Block:
"""
Creates and returns a new Block before this block (with given argument types and locations).
"""
@@ -924,9 +911,9 @@ class BlockArgumentList:
@overload
def __getitem__(self, arg0: slice) -> BlockArgumentList: ...
def __len__(self) -> int: ...
- def __add__(self, arg0: BlockArgumentList) -> List[BlockArgument]: ...
+ def __add__(self, arg0: BlockArgumentList) -> list[BlockArgument]: ...
@property
- def types(self) -> List[Type]: ...
+ def types(self) -> list[Type]: ...
class BlockIterator:
def __iter__(self) -> BlockIterator: ...
@@ -936,7 +923,7 @@ class BlockList:
def __getitem__(self, arg0: int) -> Block: ...
def __iter__(self) -> BlockIterator: ...
def __len__(self) -> int: ...
- def append(self, *args, arg_locs: Optional[Sequence] = None) -> Block:
+ def append(self, *args, arg_locs: Sequence | None = None) -> Block:
"""
Appends a new block, with argument types as positional args.
@@ -946,7 +933,7 @@ class BlockList:
class BoolAttr(Attribute):
@staticmethod
- def get(value: bool, context: Optional[Context] = None) -> BoolAttr:
+ def get(value: bool, context: Context | None = None) -> BoolAttr:
"""
Gets an uniqued bool attribute
"""
@@ -1000,7 +987,7 @@ class Context:
def _get_context_again(self) -> Context: ...
def _get_live_module_count(self) -> int: ...
def _get_live_operation_count(self) -> int: ...
- def _get_live_operation_objects(self) -> List[Operation]: ...
+ def _get_live_operation_objects(self) -> list[Operation]: ...
def append_dialect_registry(self, registry: DialectRegistry) -> None: ...
def attach_diagnostic_handler(
self, callback: Callable[[Diagnostic], bool]
@@ -1031,14 +1018,14 @@ class Context:
class DenseBoolArrayAttr(Attribute):
@staticmethod
def get(
- values: Sequence[bool], context: Optional[Context] = None
+ values: Sequence[bool], context: Context | None = None
) -> DenseBoolArrayAttr:
"""
Gets a uniqued dense array attribute
"""
@staticmethod
def isinstance(other: Attribute) -> bool: ...
- def __add__(self, arg0: List) -> DenseBoolArrayAttr: ...
+ def __add__(self, arg0: list) -> DenseBoolArrayAttr: ...
def __getitem__(self, arg0: int) -> bool: ...
def __init__(self, cast_from_attr: Attribute) -> None: ...
def __iter__(
@@ -1061,9 +1048,9 @@ class DenseElementsAttr(Attribute):
def get(
array: Buffer,
signless: bool = True,
- type: Optional[Type] = None,
- shape: Optional[List[int]] = None,
- context: Optional[Context] = None,
+ type: Type | None = None,
+ shape: list[int] | None = None,
+ context: Context | None = None,
) -> DenseElementsAttr:
"""
Gets a DenseElementsAttr from a Python buffer or array.
@@ -1128,14 +1115,14 @@ class DenseElementsAttr(Attribute):
class DenseF32ArrayAttr(Attribute):
@staticmethod
def get(
- values: Sequence[float], context: Optional[Context] = None
+ values: Sequence[float], context: Context | None = None
) -> DenseF32ArrayAttr:
"""
Gets a uniqued dense array attribute
"""
@staticmethod
def isinstance(other: Attribute) -> bool: ...
- def __add__(self, arg0: List) -> DenseF32ArrayAttr: ...
+ def __add__(self, arg0: list) -> DenseF32ArrayAttr: ...
def __getitem__(self, arg0: int) -> float: ...
def __init__(self, cast_from_attr: Attribute) -> None: ...
def __iter__(
@@ -1156,14 +1143,14 @@ class DenseF32ArrayIterator:
class DenseF64ArrayAttr(Attribute):
@staticmethod
def get(
- values: Sequence[float], context: Optional[Context] = None
+ values: Sequence[float], context: Context | None = None
) -> DenseF64ArrayAttr:
"""
Gets a uniqued dense array attribute
"""
@staticmethod
def isinstance(other: Attribute) -> bool: ...
- def __add__(self, arg0: List) -> DenseF64ArrayAttr: ...
+ def __add__(self, arg0: list) -> DenseF64ArrayAttr: ...
def __getitem__(self, arg0: int) -> float: ...
def __init__(self, cast_from_attr: Attribute) -> None: ...
def __iter__(
@@ -1186,9 +1173,9 @@ class DenseFPElementsAttr(DenseElementsAttr):
def get(
array: Buffer,
signless: bool = True,
- type: Optional[Type] = None,
- shape: Optional[List[int]] = None,
- context: Optional[Context] = None,
+ type: Type | None = None,
+ shape: list[int] | None = None,
+ context: Context | None = None,
) -> DenseFPElementsAttr: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@@ -1203,13 +1190,13 @@ class DenseFPElementsAttr(DenseElementsAttr):
class DenseI16ArrayAttr(Attribute):
@staticmethod
- def get(values: Sequence[int], context: Optional[Context] = None) -> DenseI16ArrayAttr:
+ def get(values: Sequence[int], context: Context | None = None) -> DenseI16ArrayAttr:
"""
Gets a uniqued dense array attribute
"""
@staticmethod
def isinstance(other: Attribute) -> bool: ...
- def __add__(self, arg0: List) -> DenseI16ArrayAttr: ...
+ def __add__(self, arg0: list) -> DenseI16ArrayAttr: ...
def __getitem__(self, arg0: int) -> int: ...
def __init__(self, cast_from_attr: Attribute) -> None: ...
def __iter__(
@@ -1229,13 +1216,13 @@ class DenseI16ArrayIterator:
class DenseI32ArrayAttr(Attribute):
@staticmethod
- def get(values: Sequence[int], context: Optional[Context] = None) -> DenseI32ArrayAttr:
+ def get(values: Sequence[int], context: Context | None = None) -> DenseI32ArrayAttr:
"""
Gets a uniqued dense array attribute
"""
@staticmethod
def isinstance(other: Attribute) -> bool: ...
- def __add__(self, arg0: List) -> DenseI32ArrayAttr: ...
+ def __add__(self, arg0: list) -> DenseI32ArrayAttr: ...
def __getitem__(self, arg0: int) -> int: ...
def __init__(self, cast_from_attr: Attribute) -> None: ...
def __iter__(
@@ -1255,13 +1242,13 @@ class DenseI32ArrayIterator:
class DenseI64ArrayAttr(Attribute):
@staticmethod
- def get(values: Sequence[int], context: Optional[Context] = None) -> DenseI64ArrayAttr:
+ def get(values: Sequence[int], context: Context | None = None) -> DenseI64ArrayAttr:
"""
Gets a uniqued dense array attribute
"""
@staticmethod
def isinstance(other: Attribute) -> bool: ...
- def __add__(self, arg0: List) -> DenseI64ArrayAttr: ...
+ def __add__(self, arg0: list) -> DenseI64ArrayAttr: ...
def __getitem__(self, arg0: int) -> int: ...
def __init__(self, cast_from_attr: Attribute) -> None: ...
def __iter__(
@@ -1281,13 +1268,13 @@ class DenseI64ArrayIterator:
class DenseI8ArrayAttr(Attribute):
@staticmethod
- def get(values: Sequence[int], context: Optional[Context] = None) -> DenseI8ArrayAttr:
+ def get(values: Sequence[int], context: Context | None = None) -> DenseI8ArrayAttr:
"""
Gets a uniqued dense array attribute
"""
@staticmethod
def isinstance(other: Attribute) -> bool: ...
- def __add__(self, arg0: List) -> DenseI8ArrayAttr: ...
+ def __add__(self, arg0: list) -> DenseI8ArrayAttr: ...
def __getitem__(self, arg0: int) -> int: ...
def __init__(self, cast_from_attr: Attribute) -> None: ...
def __iter__(
@@ -1310,9 +1297,9 @@ class DenseIntElementsAttr(DenseElementsAttr):
def get(
array: Buffer,
signless: bool = True,
- type: Optional[Type] = None,
- shape: Optional[List[int]] = None,
- context: Optional[Context] = None,
+ type: Type | None = None,
+ shape: list[int] | None = None,
+ context: Context | None = None,
) -> DenseIntElementsAttr: ...
@staticmethod
def isinstance(other: Attribute) -> bool: ...
@@ -1331,9 +1318,9 @@ class DenseResourceElementsAttr(Attribute):
array: Buffer,
name: str,
type: Type,
- alignment: Optional[int] = None,
+ alignment: int | None = None,
is_mutable: bool = False,
- context: Optional[Context] = None,
+ context: Context | None = None,
) -> DenseResourceElementsAttr:
"""
Gets a DenseResourceElementsAttr from a Python buffer or array.
@@ -1376,7 +1363,7 @@ class Diagnostic:
@property
def message(self) -> str: ...
@property
- def notes(self) -> Tuple[Diagnostic]: ...
+ def notes(self) -> tuple[Diagnostic]: ...
@property
def severity(self) -> DiagnosticSeverity: ...
@@ -1396,7 +1383,7 @@ class DiagnosticInfo:
@property
def message(self) -> str: ...
@property
- def notes(self) -> List[DiagnosticInfo]: ...
+ def notes(self) -> list[DiagnosticInfo]: ...
@property
def severity(self) -> DiagnosticSeverity: ...
@@ -1418,7 +1405,7 @@ class DiagnosticSeverity:
REMARK: ClassVar[DiagnosticSeverity] # value = <DiagnosticSeverity.REMARK: 3>
WARNING: ClassVar[DiagnosticSeverity] # value = <DiagnosticSeverity.WARNING: 1>
__members__: ClassVar[
- Dict[str, DiagnosticSeverity]
+ dict[str, DiagnosticSeverity]
] # value = {'ERROR': <DiagnosticSeverity.ERROR: 0>, 'WARNING': <DiagnosticSeverity.WARNING: 1>, 'NOTE': <DiagnosticSeverity.NOTE: 2>, 'REMARK': <DiagnosticSeverity.REMARK: 3>}
def __eq__(self, other: Any) -> bool: ...
def __getstate__(self) -> int: ...
@@ -1455,7 +1442,7 @@ class Dialects:
class DictAttr(Attribute):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(value: Dict = {}, context: Optional[Context] = None) -> DictAttr:
+ def get(value: dict = {}, context: Context | None = None) -> DictAttr:
"""
Gets an uniqued Dict attribute
"""
@@ -1486,7 +1473,7 @@ class FloatType(Type):
class F16Type(FloatType):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(context: Optional[Context] = None) -> F16Type:
+ def get(context: Context | None = None) -> F16Type:
"""
Create a f16 type.
"""
@@ -1499,7 +1486,7 @@ class F16Type(FloatType):
class F32Type(FloatType):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(context: Optional[Context] = None) -> F32Type:
+ def get(context: Context | None = None) -> F32Type:
"""
Create a f32 type.
"""
@@ -1512,7 +1499,7 @@ class F32Type(FloatType):
class F64Type(FloatType):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(context: Optional[Context] = None) -> F64Type:
+ def get(context: Context | None = None) -> F64Type:
"""
Create a f64 type.
"""
@@ -1524,7 +1511,7 @@ class F64Type(FloatType):
class FlatSymbolRefAttr(Attribute):
@staticmethod
- def get(value: str, context: Optional[Context] = None) -> FlatSymbolRefAttr:
+ def get(value: str, context: Context | None = None) -> FlatSymbolRefAttr:
"""
Gets a uniqued FlatSymbolRef attribute
"""
@@ -1546,7 +1533,7 @@ class FlatSymbolRefAttr(Attribute):
class Float4E2M1FNType(FloatType):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(context: Optional[Context] = None) -> Float4E2M1FNType:
+ def get(context: Context | None = None) -> Float4E2M1FNType:
"""
Create a float4_e2m1fn type.
"""
@@ -1559,7 +1546,7 @@ class Float4E2M1FNType(FloatType):
class Float6E2M3FNType(FloatType):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(context: Optional[Context] = None) -> Float6E2M3FNType:
+ def get(context: Context | None = None) -> Float6E2M3FNType:
"""
Create a float6_e2m3fn type.
"""
@@ -1572,7 +1559,7 @@ class Float6E2M3FNType(FloatType):
class Float6E3M2FNType(FloatType):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(context: Optional[Context] = None) -> Float6E3M2FNType:
+ def get(context: Context | None = None) -> Float6E3M2FNType:
"""
Create a float6_e3m2fn type.
"""
@@ -1585,7 +1572,7 @@ class Float6E3M2FNType(FloatType):
class Float8E3M4Type(FloatType):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(context: Optional[Context] = None) -> Float8E3M4Type:
+ def get(context: Context | None = None) -> Float8E3M4Type:
"""
Create a float8_e3m4 type.
"""
@@ -1598,7 +1585,7 @@ class Float8E3M4Type(FloatType):
class Float8E4M3B11FNUZType(FloatType):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(context: Optional[Context] = None) -> Float8E4M3B11FNUZType:
+ def get(context: Context | None = None) -> Float8E4M3B11FNUZType:
"""
Create a float8_e4m3b11fnuz type.
"""
@@ -1611,7 +1598,7 @@ class Float8E4M3B11FNUZType(FloatType):
class Float8E4M3FNType(FloatType):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(context: Optional[Context] = None) -> Float8E4M3FNType:
+ def get(context: Context | None = None) -> Float8E4M3FNType:
"""
Create a float8_e4m3fn type.
"""
@@ -1624,7 +1611,7 @@ class Float8E4M3FNType(FloatType):
class Float8E4M3FNUZType(FloatType):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(context: Optional[Context] = None) -> Float8E4M3FNUZType:
+ def get(context: Context | None = None) -> Float8E4M3FNUZType:
"""
Create a float8_e4m3fnuz type.
"""
@@ -1637,7 +1624,7 @@ class Float8E4M3FNUZType(FloatType):
class Float8E4M3Type(FloatType):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(context: Optional[Context] = None) -> Float8E4M3Type:
+ def get(context: Context | None = None) -> Float8E4M3Type:
"""
Create a float8_e4m3 type.
"""
@@ -1650,7 +1637,7 @@ class Float8E4M3Type(FloatType):
class Float8E5M2FNUZType(FloatType):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(context: Optional[Context] = None) -> Float8E5M2FNUZType:
+ def get(context: Context | None = None) -> Float8E5M2FNUZType:
"""
Create a float8_e5m2fnuz type.
"""
@@ -1663,7 +1650,7 @@ class Float8E5M2FNUZType(FloatType):
class Float8E5M2Type(FloatType):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(context: Optional[Context] = None) -> Float8E5M2Type:
+ def get(context: Context | None = None) -> Float8E5M2Type:
"""
Create a float8_e5m2 type.
"""
@@ -1676,17 +1663,17 @@ class Float8E5M2Type(FloatType):
class FloatAttr(Attribute):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(type: Type, value: float, loc: Optional[Location] = None) -> FloatAttr:
+ def get(type: Type, value: float, loc: Location | None = None) -> FloatAttr:
"""
Gets an uniqued float point attribute associated to a type
"""
@staticmethod
- def get_f32(value: float, context: Optional[Context] = None) -> FloatAttr:
+ def get_f32(value: float, context: Context | None = None) -> FloatAttr:
"""
Gets an uniqued float point attribute associated to a f32 type
"""
@staticmethod
- def get_f64(value: float, context: Optional[Context] = None) -> FloatAttr:
+ def get_f64(value: float, context: Context | None = None) -> FloatAttr:
"""
Gets an uniqued float point attribute associated to a f64 type
"""
@@ -1710,7 +1697,7 @@ class FloatAttr(Attribute):
class FloatTF32Type(FloatType):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(context: Optional[Context] = None) -> FloatTF32Type:
+ def get(context: Context | None = None) -> FloatTF32Type:
"""
Create a tf32 type.
"""
@@ -1724,7 +1711,7 @@ class FunctionType(Type):
static_typeid: ClassVar[TypeID]
@staticmethod
def get(
- inputs: List[Type], results: List[Type], context: Optional[Context] = None
+ inputs: list[Type], results: list[Type], context: Context | None = None
) -> FunctionType:
"""
Gets a FunctionType from a List of input and result types
@@ -1733,12 +1720,12 @@ class FunctionType(Type):
def isinstance(other: Type) -> bool: ...
def __init__(self, cast_from_type: Type) -> None: ...
@property
- def inputs(self) -> List:
+ def inputs(self) -> list:
"""
Returns the List of input types in the FunctionType.
"""
@property
- def results(self) -> List:
+ def results(self) -> list:
"""
Returns the List of result types in the FunctionType.
"""
@@ -1748,7 +1735,7 @@ class FunctionType(Type):
class IndexType(Type):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(context: Optional[Context] = None) -> IndexType:
+ def get(context: Context | None = None) -> IndexType:
"""
Create a index type.
"""
@@ -1759,7 +1746,7 @@ class IndexType(Type):
def typeid(self) -> TypeID: ...
class InferShapedTypeOpInterface:
- def __init__(self, object: object, context: Optional[Context] = None) -> None:
+ def __init__(self, object: object, context: 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
@@ -1767,13 +1754,13 @@ class InferShapedTypeOpInterface:
"""
def inferReturnTypeComponents(
self,
- operands: Optional[List] = None,
- attributes: Optional[Attribute] = None,
+ operands: list | None = None,
+ attributes: Attribute | None = None,
properties=None,
- regions: Optional[List[Region]] = None,
- context: Optional[Context] = None,
- loc: Optional[Location] = None,
- ) -> List[ShapedTypeComponents]:
+ regions: list[Region] | None = None,
+ context: Context | None = None,
+ loc: 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.
@@ -1791,7 +1778,7 @@ class InferShapedTypeOpInterface:
"""
class InferTypeOpInterface:
- def __init__(self, object: object, context: Optional[Context] = None) -> None:
+ def __init__(self, object: object, context: 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
@@ -1799,13 +1786,13 @@ class InferTypeOpInterface:
"""
def inferReturnTypes(
self,
- operands: Optional[List] = None,
- attributes: Optional[Attribute] = None,
+ operands: list | None = None,
+ attributes: Attribute | None = None,
properties=None,
- regions: Optional[List[Region]] = None,
- context: Optional[Context] = None,
- loc: Optional[Location] = None,
- ) -> List[Type]:
+ regions: list[Region] | None = None,
+ context: Context | None = None,
+ loc: Location | None = None,
+ ) -> list[Type]:
"""
Given the arguments required to build an operation, attempts to infer
its return types. Raises ValueError on failure.
@@ -1856,7 +1843,7 @@ class InsertionPoint:
Returns the block that this InsertionPoint points to.
"""
@property
- def ref_operation(self) -> Optional[_OperationBase]:
+ def ref_operation(self) -> _OperationBase | None:
"""
The reference operation before which new operations are inserted, or None if the insertion point is at the end of the block
"""
@@ -1890,13 +1877,13 @@ class IntegerSet:
def get(
num_dims: int,
num_symbols: int,
- exprs: List,
- eq_flags: List[bool],
- context: Optional[Context] = None,
+ exprs: list,
+ eq_flags: list[bool],
+ context: Context | None = None,
) -> IntegerSet: ...
@staticmethod
def get_empty(
- num_dims: int, num_symbols: int, context: Optional[Context] = None
+ num_dims: int, num_symbols: int, context: Context | None = None
) -> IntegerSet: ...
def _CAPICreate(self) -> IntegerSet: ...
@overload
@@ -1910,8 +1897,8 @@ class IntegerSet:
"""
def get_replaced(
self,
- dim_exprs: List,
- symbol_exprs: List,
+ dim_exprs: list,
+ symbol_exprs: list,
num_result_dims: int,
num_result_symbols: int,
) -> IntegerSet: ...
@@ -1958,7 +1945,7 @@ class IntegerSetConstraint:
class IntegerSetConstraintList:
def __init__(self, *args, **kwargs) -> None: ...
- def __add__(self, arg0: IntegerSetConstraintList) -> List[IntegerSetConstraint]: ...
+ def __add__(self, arg0: IntegerSetConstraintList) -> list[IntegerSetConstraint]: ...
@overload
def __getitem__(self, arg0: int) -> IntegerSetConstraint: ...
@overload
@@ -1968,17 +1955,17 @@ class IntegerSetConstraintList:
class IntegerType(Type):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get_signed(width: int, context: Optional[Context] = None) -> IntegerType:
+ def get_signed(width: int, context: Context | None = None) -> IntegerType:
"""
Create a signed integer type
"""
@staticmethod
- def get_signless(width: int, context: Optional[Context] = None) -> IntegerType:
+ def get_signless(width: int, context: Context | None = None) -> IntegerType:
"""
Create a signless integer type
"""
@staticmethod
- def get_unsigned(width: int, context: Optional[Context] = None) -> IntegerType:
+ def get_unsigned(width: int, context: Context | None = None) -> IntegerType:
"""
Create an unsigned integer type
"""
@@ -2013,28 +2000,28 @@ class Location:
__hash__: ClassVar[None] = None
@staticmethod
def callsite(
- callee: Location, frames: Sequence[Location], context: Optional[Context] = None
+ callee: Location, frames: Sequence[Location], context: Context | None = None
) -> Location:
"""
Gets a Location representing a caller and callsite
"""
@staticmethod
def file(
- filename: str, line: int, col: int, context: Optional[Context] = None
+ filename: str, line: int, col: int, context: Context | None = None
) -> Location:
"""
Gets a Location representing a file, line and column
"""
@staticmethod
- def from_attr(attribute: Attribute, context: Optional[Context] = None) -> Location:
+ def from_attr(attribute: Attribute, context: Context | None = None) -> Location:
"""
Gets a Location from a LocationAttr
"""
@staticmethod
def fused(
locations: Sequence[Location],
- metadata: Optional[Attribute] = None,
- context: Optional[Context] = None,
+ metadata: Attribute | None = None,
+ context: Context | None = None,
) -> Location:
"""
Gets a Location representing a fused location with optional metadata
@@ -2042,14 +2029,14 @@ class Location:
@staticmethod
def name(
name: str,
- childLoc: Optional[Location] = None,
- context: Optional[Context] = None,
+ childLoc: Location | None = None,
+ context: Context | None = None,
) -> Location:
"""
Gets a Location representing a named location with optional child location
"""
@staticmethod
- def unknown(context: Optional[Context] = None) -> Location:
+ def unknown(context: Context | None = None) -> Location:
"""
Gets a Location representing an unknown location
"""
@@ -2081,11 +2068,11 @@ class MemRefType(ShapedType):
static_typeid: ClassVar[TypeID]
@staticmethod
def get(
- shape: List[int],
+ shape: list[int],
element_type: Type,
layout: Attribute = None,
memory_space: Attribute = None,
- loc: Optional[Location] = None,
+ loc: Location | None = None,
) -> MemRefType:
"""
Create a memref type
@@ -2104,21 +2091,25 @@ class MemRefType(ShapedType):
The layout of the MemRef type.
"""
@property
- def memory_space(self) -> Optional[Attribute]:
+ def memory_space(self) -> Attribute | None:
"""
Returns the memory space of the given MemRef type.
"""
@property
def typeid(self) -> TypeID: ...
+ def get_strides_and_offset(self) -> tuple[list[int], list[int]]:
+ """
+ The strides and offset of the MemRef type.
+ """
class Module:
@staticmethod
- def create(loc: Optional[Location] = None) -> Module:
+ def create(loc: Location | None = None) -> Module:
"""
Creates an empty module
"""
@staticmethod
- def parse(asm: str | bytes, context: Optional[Context] = None) -> Module:
+ def parse(asm: str | bytes, context: Context | None = None) -> Module:
"""
Parses a module's assembly format from a string.
@@ -2159,7 +2150,7 @@ class Module:
class MLIRError(Exception):
def __init__(
- self, message: str, error_diagnostics: List[DiagnosticInfo]
+ self, message: str, error_diagnostics: list[DiagnosticInfo]
) -> None: ...
class NamedAttribute:
@@ -2177,7 +2168,7 @@ class NamedAttribute:
class NoneType(Type):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(context: Optional[Context] = None) -> NoneType:
+ def get(context: Context | None = None) -> NoneType:
"""
Create a none type.
"""
@@ -2208,7 +2199,7 @@ class OpOperandIterator:
def __next__(self) -> OpOperand: ...
class OpOperandList:
- def __add__(self, arg0: OpOperandList) -> List[Value]: ...
+ def __add__(self, arg0: OpOperandList) -> list[Value]: ...
@overload
def __getitem__(self, arg0: int) -> Value: ...
@overload
@@ -2228,7 +2219,7 @@ class OpResult(Value):
def result_number(self) -> int: ...
class OpResultList:
- def __add__(self, arg0: OpResultList) -> List[OpResult]: ...
+ def __add__(self, arg0: OpResultList) -> list[OpResult]: ...
@overload
def __getitem__(self, arg0: int) -> OpResult: ...
@overload
@@ -2237,10 +2228,10 @@ class OpResultList:
@property
def owner(self) -> _OperationBase: ...
@property
- def types(self) -> List[Type]: ...
+ def types(self) -> list[Type]: ...
class OpSuccessors:
- def __add__(self, arg0: OpSuccessors) -> List[Block]: ...
+ def __add__(self, arg0: OpSuccessors) -> list[Block]: ...
@overload
def __getitem__(self, arg0: int) -> Block: ...
@overload
@@ -2255,25 +2246,25 @@ class OpView(_OperationBase):
def __init__(self, operation: _OperationBase) -> None: ...
@classmethod
def build_generic(
- cls: _Type[_TOperation],
- 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,
+ cls: type[_TOperation],
+ results: Sequence[Type] | None = None,
+ operands: Sequence[Value] | None = None,
+ attributes: dict[str, Attribute] | None = None,
+ successors: Sequence[Block] | None = None,
+ regions: int | None = None,
+ loc: Location | None = None,
+ ip: InsertionPoint | None = None,
) -> _TOperation:
"""
Builds a specific, generated OpView based on class level attributes.
"""
@classmethod
def parse(
- cls: _Type[_TOperation],
+ cls: type[_TOperation],
source: str | bytes,
*,
source_name: str = "",
- context: Optional[Context] = None,
+ context: Context | None = None,
) -> _TOperation:
"""
Parses a specific, generated OpView based on class level attributes
@@ -2296,7 +2287,7 @@ class OpaqueAttr(Attribute):
dialect_namespace: str,
buffer: Buffer,
type: Type,
- context: Optional[Context] = None,
+ context: Context | None = None,
) -> OpaqueAttr:
"""
Gets an Opaque attribute.
@@ -2323,7 +2314,7 @@ class OpaqueType(Type):
static_typeid: ClassVar[TypeID]
@staticmethod
def get(
- dialect_namespace: str, buffer: str, context: Optional[Context] = None
+ dialect_namespace: str, buffer: str, context: Context | None = None
) -> OpaqueType:
"""
Create an unregistered (opaque) dialect type.
@@ -2349,13 +2340,13 @@ class Operation(_OperationBase):
@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,
+ results: Sequence[Type] | None = None,
+ operands: Sequence[Value] | None = None,
+ attributes: dict[str, Attribute] | None = None,
+ successors: Sequence[Block] | None = None,
regions: int = 0,
- loc: Optional[Location] = None,
- ip: Optional[InsertionPoint] = None,
+ loc: Location | None = None,
+ ip: InsertionPoint | None = None,
infer_type: bool = False,
) -> Operation:
"""
@@ -2378,7 +2369,7 @@ class Operation(_OperationBase):
"""
@staticmethod
def parse(
- source: str | bytes, *, source_name: str = "", context: Optional[Context] = None
+ source: str | bytes, *, source_name: str = "", context: Context | None = None
) -> Operation:
"""
Parses an operation. Supports both text assembly format and binary bytecode format.
@@ -2409,10 +2400,10 @@ class RankedTensorType(ShapedType):
static_typeid: ClassVar[TypeID]
@staticmethod
def get(
- shape: List[int],
+ shape: list[int],
element_type: Type,
- encoding: Optional[Attribute] = None,
- loc: Optional[Location] = None,
+ encoding: Attribute | None = None,
+ loc: Location | None = None,
) -> RankedTensorType:
"""
Create a ranked tensor type
@@ -2421,7 +2412,7 @@ class RankedTensorType(ShapedType):
def isinstance(other: Type) -> bool: ...
def __init__(self, cast_from_type: Type) -> None: ...
@property
- def encoding(self) -> Optional[Attribute]: ...
+ def encoding(self) -> Attribute | None: ...
@property
def typeid(self) -> TypeID: ...
@@ -2507,7 +2498,7 @@ class ShapedType(Type):
Returns the rank of the given ranked shaped type.
"""
@property
- def shape(self) -> List[int]:
+ def shape(self) -> list[int]:
"""
Returns the shape of the ranked shaped type as a List of integers.
"""
@@ -2525,14 +2516,14 @@ class ShapedTypeComponents:
"""
@staticmethod
@overload
- def get(shape: List, element_type: Type) -> ShapedTypeComponents:
+ def get(shape: list, element_type: Type) -> ShapedTypeComponents:
"""
Create a ranked shaped type components object.
"""
@staticmethod
@overload
def get(
- shape: List, element_type: Type, attribute: Attribute
+ shape: list, element_type: Type, attribute: Attribute
) -> ShapedTypeComponents:
"""
Create a ranked shaped type components object with attribute.
@@ -2553,7 +2544,7 @@ class ShapedTypeComponents:
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) -> List[int]:
+ def shape(self) -> list[int]:
"""
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.
"""
@@ -2562,14 +2553,14 @@ class StridedLayoutAttr(Attribute):
static_typeid: ClassVar[TypeID]
@staticmethod
def get(
- offset: int, strides: List[int], context: Optional[Context] = None
+ offset: int, strides: list[int], context: Context | None = None
) -> StridedLayoutAttr:
"""
Gets a strided layout attribute.
"""
@staticmethod
def get_fully_dynamic(
- rank: int, context: Optional[Context] = None
+ rank: int, context: Context | None = None
) -> StridedLayoutAttr:
"""
Gets a strided layout attribute with dynamic offset and strides of a given rank.
@@ -2583,7 +2574,7 @@ class StridedLayoutAttr(Attribute):
Returns the value of the float point attribute
"""
@property
- def strides(self) -> List[int]:
+ def strides(self) -> list[int]:
"""
Returns the value of the float point attribute
"""
@@ -2595,7 +2586,7 @@ class StridedLayoutAttr(Attribute):
class StringAttr(Attribute):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(value: str | bytes, context: Optional[Context] = None) -> StringAttr:
+ def get(value: str | bytes, context: Context | None = None) -> StringAttr:
"""
Gets a uniqued string attribute
"""
@@ -2624,7 +2615,7 @@ class StringAttr(Attribute):
class SymbolRefAttr(Attribute):
@staticmethod
- def get(symbols: List[str], context: Optional[Context] = None) -> Attribute:
+ def get(symbols: list[str], context: Context | None = None) -> Attribute:
"""
Gets a uniqued SymbolRef attribute from a List of symbol names
"""
@@ -2638,7 +2629,7 @@ class SymbolRefAttr(Attribute):
@property
def typeid(self) -> TypeID: ...
@property
- def value(self) -> List[str]:
+ def value(self) -> list[str]:
"""
Returns the value of the SymbolRef attribute as a List[str]
"""
@@ -2672,7 +2663,7 @@ class SymbolTable:
class TupleType(Type):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get_tuple(elements: List[Type], context: Optional[Context] = None) -> TupleType:
+ def get_tuple(elements: list[Type], context: Context | None = None) -> TupleType:
"""
Create a Tuple type
"""
@@ -2694,7 +2685,7 @@ class TupleType(Type):
class TypeAttr(Attribute):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(value: Type, context: Optional[Context] = None) -> TypeAttr:
+ def get(value: Type, context: Context | None = None) -> TypeAttr:
"""
Gets a uniqued Type attribute
"""
@@ -2721,7 +2712,7 @@ class TypeID:
class UnitAttr(Attribute):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(context: Optional[Context] = None) -> UnitAttr:
+ def get(context: Context | None = None) -> UnitAttr:
"""
Create a Unit attribute.
"""
@@ -2737,7 +2728,7 @@ class UnrankedMemRefType(ShapedType):
static_typeid: ClassVar[TypeID]
@staticmethod
def get(
- element_type: Type, memory_space: Attribute, loc: Optional[Location] = None
+ element_type: Type, memory_space: Attribute, loc: Location | None = None
) -> UnrankedMemRefType:
"""
Create a unranked memref type
@@ -2746,7 +2737,7 @@ class UnrankedMemRefType(ShapedType):
def isinstance(other: Type) -> bool: ...
def __init__(self, cast_from_type: Type) -> None: ...
@property
- def memory_space(self) -> Optional[Attribute]:
+ def memory_space(self) -> Attribute | None:
"""
Returns the memory space of the given Unranked MemRef type.
"""
@@ -2756,7 +2747,7 @@ class UnrankedMemRefType(ShapedType):
class UnrankedTensorType(ShapedType):
static_typeid: ClassVar[TypeID]
@staticmethod
- def get(element_type: Type, loc: Optional[Location] = None) -> UnrankedTensorType:
+ def get(element_type: Type, loc: Location | None = None) -> UnrankedTensorType:
"""
Create a unranked tensor type
"""
@@ -2770,12 +2761,12 @@ class VectorType(ShapedType):
static_typeid: ClassVar[TypeID]
@staticmethod
def get(
- shape: List[int],
+ shape: list[int],
element_type: Type,
*,
- scalable: Optional[List] = None,
- scalable_dims: Optional[List[int]] = None,
- loc: Optional[Location] = None,
+ scalable: list | None = None,
+ scalable_dims: list[int] | None = None,
+ loc: Location | None = None,
) -> VectorType:
"""
Create a vector type
@@ -2786,7 +2777,7 @@ class VectorType(ShapedType):
@property
def scalable(self) -> bool: ...
@property
- def scalable_dims(self) -> List[bool]: ...
+ def scalable_dims(self) -> list[bool]: ...
@property
def typeid(self) -> TypeID: ...
diff --git a/mlir/python/mlir/_mlir_libs/_mlir/passmanager.pyi b/mlir/python/mlir/_mlir_libs/_mlir/passmanager.pyi
index 5d115e8222d730..229979ae33608c 100644
--- a/mlir/python/mlir/_mlir_libs/_mlir/passmanager.pyi
+++ b/mlir/python/mlir/_mlir_libs/_mlir/passmanager.pyi
@@ -4,7 +4,6 @@
# * Relative imports for cross-module references.
# * Add __all__
-from typing import Any, Optional
from . import ir as _ir
@@ -13,7 +12,7 @@ __all__ = [
]
class PassManager:
- def __init__(self, context: Optional[_ir.Context] = None) -> None: ...
+ def __init__(self, context: _ir.Context | None = None) -> None: ...
def _CAPICreate(self) -> object: ...
def _testing_release(self) -> None: ...
def enable_ir_printing(
@@ -26,7 +25,7 @@ class PassManager:
) -> None: ...
def enable_verifier(self, enable: bool) -> None: ...
@staticmethod
- def parse(pipeline: str, context: Optional[_ir.Context] = None) -> PassManager: ...
+ def parse(pipeline: str, context: _ir.Context | None = None) -> PassManager: ...
def run(self, module: _ir._OperationBase) -> None: ...
@property
def _CAPIPtr(self) -> object: ...
diff --git a/mlir/python/mlir/_mlir_libs/_mlirExecutionEngine.pyi b/mlir/python/mlir/_mlir_libs/_mlirExecutionEngine.pyi
index 893dab8a431fd1..58d453d2b2d37c 100644
--- 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, Sequence
+from collections.abc import Sequence
from ._mlir import ir as _ir
More information about the Mlir-commits
mailing list