1# Originally imported via: 2# pybind11-stubgen --print-invalid-expressions-as-is mlir._mlir_libs._mlir.ir 3# but with the following diff (in order to remove pipes from types, 4# which we won't support until bumping minimum python to 3.10) 5# 6# --------------------- diff begins ------------------------------------ 7# 8# diff --git a/pybind11_stubgen/printer.py b/pybind11_stubgen/printer.py 9# index 1f755aa..4924927 100644 10# --- a/pybind11_stubgen/printer.py 11# +++ b/pybind11_stubgen/printer.py 12# @@ -283,14 +283,6 @@ class Printer: 13# return split[0] + "..." 14# 15# def print_type(self, type_: ResolvedType) -> str: 16# - if ( 17# - str(type_.name) == "typing.Optional" 18# - and type_.parameters is not None 19# - and len(type_.parameters) == 1 20# - ): 21# - return f"{self.print_annotation(type_.parameters[0])} | None" 22# - if str(type_.name) == "typing.Union" and type_.parameters is not None: 23# - return " | ".join(self.print_annotation(p) for p in type_.parameters) 24# if type_.parameters: 25# param_str = ( 26# "[" 27# 28# --------------------- diff ends ------------------------------------ 29# 30# Local modifications: 31# * Rewrite references to 'mlir.ir' to local types. 32# * Drop `typing.` everywhere (top-level import instead). 33# * List -> List, dict -> Dict, Tuple -> Tuple. 34# * copy-paste Buffer type from typing_extensions. 35# * Shuffle _OperationBase, AffineExpr, Attribute, Type, Value to the top. 36# * Patch raw C++ types (like "PyAsmState") with a regex like `Py(.*)`. 37# * _BaseContext -> Context, MlirType -> Type, MlirTypeID -> TypeID, MlirAttribute -> Attribute. 38# * Local edits to signatures and types that pybind11-stubgen did not auto detect (or detected incorrectly). 39# * Add MLIRError, _GlobalDebug, _OperationBase to __all__ by hand. 40# * Fill in `Any`s where possible. 41# * black formatting. 42 43from __future__ import annotations 44 45import abc 46import collections 47from collections.abc import Callable, Sequence 48import io 49from typing import Any, ClassVar, TypeVar, overload 50 51__all__ = [ 52 "AffineAddExpr", 53 "AffineBinaryExpr", 54 "AffineCeilDivExpr", 55 "AffineConstantExpr", 56 "AffineDimExpr", 57 "AffineExpr", 58 "AffineExprList", 59 "AffineFloorDivExpr", 60 "AffineMap", 61 "AffineMapAttr", 62 "AffineModExpr", 63 "AffineMulExpr", 64 "AffineSymbolExpr", 65 "ArrayAttr", 66 "ArrayAttributeIterator", 67 "AsmState", 68 "AttrBuilder", 69 "Attribute", 70 "BF16Type", 71 "Block", 72 "BlockArgument", 73 "BlockArgumentList", 74 "BlockIterator", 75 "BlockList", 76 "BoolAttr", 77 "ComplexType", 78 "Context", 79 "DenseBoolArrayAttr", 80 "DenseBoolArrayIterator", 81 "DenseElementsAttr", 82 "DenseF32ArrayAttr", 83 "DenseF32ArrayIterator", 84 "DenseF64ArrayAttr", 85 "DenseF64ArrayIterator", 86 "DenseFPElementsAttr", 87 "DenseI16ArrayAttr", 88 "DenseI16ArrayIterator", 89 "DenseI32ArrayAttr", 90 "DenseI32ArrayIterator", 91 "DenseI64ArrayAttr", 92 "DenseI64ArrayIterator", 93 "DenseI8ArrayAttr", 94 "DenseI8ArrayIterator", 95 "DenseIntElementsAttr", 96 "DenseResourceElementsAttr", 97 "Diagnostic", 98 "DiagnosticHandler", 99 "DiagnosticInfo", 100 "DiagnosticSeverity", 101 "Dialect", 102 "DialectDescriptor", 103 "DialectRegistry", 104 "Dialects", 105 "DictAttr", 106 "F16Type", 107 "F32Type", 108 "F64Type", 109 "FlatSymbolRefAttr", 110 "Float4E2M1FNType", 111 "Float6E2M3FNType", 112 "Float6E3M2FNType", 113 "Float8E3M4Type", 114 "Float8E4M3B11FNUZType", 115 "Float8E4M3FNType", 116 "Float8E4M3FNUZType", 117 "Float8E4M3Type", 118 "Float8E5M2FNUZType", 119 "Float8E5M2Type", 120 "Float8E8M0FNUType", 121 "FloatAttr", 122 "FloatTF32Type", 123 "FloatType", 124 "FunctionType", 125 "IndexType", 126 "InferShapedTypeOpInterface", 127 "InferTypeOpInterface", 128 "InsertionPoint", 129 "IntegerAttr", 130 "IntegerSet", 131 "IntegerSetAttr", 132 "IntegerSetConstraint", 133 "IntegerSetConstraintList", 134 "IntegerType", 135 "Location", 136 "MemRefType", 137 "Module", 138 "NamedAttribute", 139 "NoneType", 140 "OpAttributeMap", 141 "OpOperand", 142 "OpOperandIterator", 143 "OpOperandList", 144 "OpResult", 145 "OpResultList", 146 "OpSuccessors", 147 "OpView", 148 "OpaqueAttr", 149 "OpaqueType", 150 "Operation", 151 "OperationIterator", 152 "OperationList", 153 "RankedTensorType", 154 "Region", 155 "RegionIterator", 156 "RegionSequence", 157 "ShapedType", 158 "ShapedTypeComponents", 159 "StridedLayoutAttr", 160 "StringAttr", 161 "SymbolRefAttr", 162 "SymbolTable", 163 "TupleType", 164 "Type", 165 "TypeAttr", 166 "TypeID", 167 "UnitAttr", 168 "UnrankedMemRefType", 169 "UnrankedTensorType", 170 "Value", 171 "VectorType", 172 "_GlobalDebug", 173 "_OperationBase", 174] 175 176if hasattr(collections.abc, "Buffer"): 177 Buffer = collections.abc.Buffer 178else: 179 class Buffer(abc.ABC): 180 pass 181 182class _OperationBase: 183 @overload 184 def __eq__(self, arg0: _OperationBase) -> bool: ... 185 @overload 186 def __eq__(self, arg0: _OperationBase) -> bool: ... 187 def __hash__(self) -> int: ... 188 def __str__(self) -> str: 189 """ 190 Returns the assembly form of the operation. 191 """ 192 def clone(self, ip: InsertionPoint = None) -> OpView: ... 193 def detach_from_parent(self) -> OpView: 194 """ 195 Detaches the operation from its parent block. 196 """ 197 def erase(self) -> None: ... 198 def get_asm( 199 self, 200 binary: bool = False, 201 large_elements_limit: int | None = None, 202 enable_debug_info: bool = False, 203 pretty_debug_info: bool = False, 204 print_generic_op_form: bool = False, 205 use_local_scope: bool = False, 206 assume_verified: bool = False, 207 skip_regions: bool = False, 208 ) -> io.BytesIO | io.StringIO: 209 """ 210 Gets the assembly form of the operation with all options available. 211 212 Args: 213 binary: Whether to return a bytes (True) or str (False) object. Defaults to 214 False. 215 ... others ...: See the print() method for common keyword arguments for 216 configuring the printout. 217 Returns: 218 Either a bytes or str object, depending on the setting of the 'binary' 219 argument. 220 """ 221 def move_after(self, other: _OperationBase) -> None: 222 """ 223 Puts self immediately after the other operation in its parent block. 224 """ 225 def move_before(self, other: _OperationBase) -> None: 226 """ 227 Puts self immediately before the other operation in its parent block. 228 """ 229 @overload 230 def print( 231 self, 232 state: AsmState, 233 file: Any | None = None, 234 binary: bool = False, 235 ) -> None: 236 """ 237 Prints the assembly form of the operation to a file like object. 238 239 Args: 240 file: The file like object to write to. Defaults to sys.stdout. 241 binary: Whether to write bytes (True) or str (False). Defaults to False. 242 state: AsmState capturing the operation numbering and flags. 243 """ 244 @overload 245 def print( 246 self, 247 large_elements_limit: int | None = None, 248 enable_debug_info: bool = False, 249 pretty_debug_info: bool = False, 250 print_generic_op_form: bool = False, 251 use_local_scope: bool = False, 252 assume_verified: bool = False, 253 file: Any | None = None, 254 binary: bool = False, 255 skip_regions: bool = False, 256 ) -> None: 257 """ 258 Prints the assembly form of the operation to a file like object. 259 260 Args: 261 file: The file like object to write to. Defaults to sys.stdout. 262 binary: Whether to write bytes (True) or str (False). Defaults to False. 263 large_elements_limit: Whether to elide elements attributes above this 264 number of elements. Defaults to None (no limit). 265 enable_debug_info: Whether to print debug/location information. Defaults 266 to False. 267 pretty_debug_info: Whether to format debug information for easier reading 268 by a human (warning: the result is unparseable). 269 print_generic_op_form: Whether to print the generic assembly forms of all 270 ops. Defaults to False. 271 use_local_Scope: Whether to print in a way that is more optimized for 272 multi-threaded access but may not be consistent with how the overall 273 module prints. 274 assume_verified: By default, if not printing generic form, the verifier 275 will be run and if it fails, generic form will be printed with a comment 276 about failed verification. While a reasonable default for interactive use, 277 for systematic use, it is often better for the caller to verify explicitly 278 and report failures in a more robust fashion. Set this to True if doing this 279 in order to avoid running a redundant verification. If the IR is actually 280 invalid, behavior is undefined. 281 skip_regions: Whether to skip printing regions. Defaults to False. 282 """ 283 def verify(self) -> bool: 284 """ 285 Verify the operation. Raises MLIRError if verification fails, and returns true otherwise. 286 """ 287 def write_bytecode(self, file: Any, desired_version: int | None = None) -> None: 288 """ 289 Write the bytecode form of the operation to a file like object. 290 291 Args: 292 file: The file like object to write to. 293 desired_version: The version of bytecode to emit. 294 Returns: 295 The bytecode writer status. 296 """ 297 @property 298 def _CAPIPtr(self) -> object: ... 299 @property 300 def attributes(self) -> OpAttributeMap: ... 301 @property 302 def context(self) -> Context: 303 """ 304 Context that owns the Operation 305 """ 306 @property 307 def location(self) -> Location: 308 """ 309 Returns the source location the operation was defined or derived from. 310 """ 311 @property 312 def name(self) -> str: ... 313 @property 314 def operands(self) -> OpOperandList: ... 315 @property 316 def parent(self) -> _OperationBase | None: ... 317 @property 318 def regions(self) -> RegionSequence: ... 319 @property 320 def result(self) -> OpResult: 321 """ 322 Shortcut to get an op result if it has only one (throws an error otherwise). 323 """ 324 @property 325 def results(self) -> OpResultList: 326 """ 327 Returns the List of Operation results. 328 """ 329 330_TOperation = TypeVar("_TOperation", bound=_OperationBase) 331 332class AffineExpr: 333 @staticmethod 334 @overload 335 def get_add(arg0: AffineExpr, arg1: AffineExpr) -> AffineAddExpr: 336 """ 337 Gets an affine expression containing a sum of two expressions. 338 """ 339 @staticmethod 340 @overload 341 def get_add(arg0: int, arg1: AffineExpr) -> AffineAddExpr: 342 """ 343 Gets an affine expression containing a sum of a constant and another expression. 344 """ 345 @staticmethod 346 @overload 347 def get_add(arg0: AffineExpr, arg1: int) -> AffineAddExpr: 348 """ 349 Gets an affine expression containing a sum of an expression and a constant. 350 """ 351 @staticmethod 352 @overload 353 def get_ceil_div(arg0: AffineExpr, arg1: AffineExpr) -> AffineCeilDivExpr: 354 """ 355 Gets an affine expression containing the rounded-up result of dividing one expression by another. 356 """ 357 @staticmethod 358 @overload 359 def get_ceil_div(arg0: int, arg1: AffineExpr) -> AffineCeilDivExpr: 360 """ 361 Gets a semi-affine expression containing the rounded-up result of dividing a constant by an expression. 362 """ 363 @staticmethod 364 @overload 365 def get_ceil_div(arg0: AffineExpr, arg1: int) -> AffineCeilDivExpr: 366 """ 367 Gets an affine expression containing the rounded-up result of dividing an expression by a constant. 368 """ 369 @staticmethod 370 def get_constant( 371 value: int, context: Context | None = None 372 ) -> AffineConstantExpr: 373 """ 374 Gets a constant affine expression with the given value. 375 """ 376 @staticmethod 377 def get_dim(position: int, context: Context | None = None) -> AffineDimExpr: 378 """ 379 Gets an affine expression of a dimension at the given position. 380 """ 381 @staticmethod 382 @overload 383 def get_floor_div(arg0: AffineExpr, arg1: AffineExpr) -> AffineFloorDivExpr: 384 """ 385 Gets an affine expression containing the rounded-down result of dividing one expression by another. 386 """ 387 @staticmethod 388 @overload 389 def get_floor_div(arg0: int, arg1: AffineExpr) -> AffineFloorDivExpr: 390 """ 391 Gets a semi-affine expression containing the rounded-down result of dividing a constant by an expression. 392 """ 393 @staticmethod 394 @overload 395 def get_floor_div(arg0: AffineExpr, arg1: int) -> AffineFloorDivExpr: 396 """ 397 Gets an affine expression containing the rounded-down result of dividing an expression by a constant. 398 """ 399 @staticmethod 400 @overload 401 def get_mod(arg0: AffineExpr, arg1: AffineExpr) -> AffineModExpr: 402 """ 403 Gets an affine expression containing the modulo of dividing one expression by another. 404 """ 405 @staticmethod 406 @overload 407 def get_mod(arg0: int, arg1: AffineExpr) -> AffineModExpr: 408 """ 409 Gets a semi-affine expression containing the modulo of dividing a constant by an expression. 410 """ 411 @staticmethod 412 @overload 413 def get_mod(arg0: AffineExpr, arg1: int) -> AffineModExpr: 414 """ 415 Gets an affine expression containing the module of dividingan expression by a constant. 416 """ 417 @staticmethod 418 @overload 419 def get_mul(arg0: AffineExpr, arg1: AffineExpr) -> AffineMulExpr: 420 """ 421 Gets an affine expression containing a product of two expressions. 422 """ 423 @staticmethod 424 @overload 425 def get_mul(arg0: int, arg1: AffineExpr) -> AffineMulExpr: 426 """ 427 Gets an affine expression containing a product of a constant and another expression. 428 """ 429 @staticmethod 430 @overload 431 def get_mul(arg0: AffineExpr, arg1: int) -> AffineMulExpr: 432 """ 433 Gets an affine expression containing a product of an expression and a constant. 434 """ 435 @staticmethod 436 def get_symbol( 437 position: int, context: Context | None = None 438 ) -> AffineSymbolExpr: 439 """ 440 Gets an affine expression of a symbol at the given position. 441 """ 442 def _CAPICreate(self) -> AffineExpr: ... 443 @overload 444 def __add__(self, arg0: AffineExpr) -> AffineAddExpr: ... 445 @overload 446 def __add__(self, arg0: int) -> AffineAddExpr: ... 447 @overload 448 def __eq__(self, arg0: AffineExpr) -> bool: ... 449 @overload 450 def __eq__(self, arg0: Any) -> bool: ... 451 def __hash__(self) -> int: ... 452 @overload 453 def __mod__(self, arg0: AffineExpr) -> AffineModExpr: ... 454 @overload 455 def __mod__(self, arg0: int) -> AffineModExpr: ... 456 @overload 457 def __mul__(self, arg0: AffineExpr) -> AffineMulExpr: ... 458 @overload 459 def __mul__(self, arg0: int) -> AffineMulExpr: ... 460 def __radd__(self, arg0: int) -> AffineAddExpr: ... 461 def __rmod__(self, arg0: int) -> AffineModExpr: ... 462 def __rmul__(self, arg0: int) -> AffineMulExpr: ... 463 def __rsub__(self, arg0: int) -> AffineAddExpr: ... 464 @overload 465 def __sub__(self, arg0: AffineExpr) -> AffineAddExpr: ... 466 @overload 467 def __sub__(self, arg0: int) -> AffineAddExpr: ... 468 def compose(self, arg0: AffineMap) -> AffineExpr: ... 469 def dump(self) -> None: 470 """ 471 Dumps a debug representation of the object to stderr. 472 """ 473 @property 474 def _CAPIPtr(self) -> object: ... 475 @property 476 def context(self) -> Context: ... 477 478class Attribute: 479 @staticmethod 480 def parse(asm: str | bytes, context: Context | None = None) -> Attribute: 481 """ 482 Parses an attribute from an assembly form. Raises an MLIRError on failure. 483 """ 484 def _CAPICreate(self) -> Attribute: ... 485 @overload 486 def __eq__(self, arg0: Attribute) -> bool: ... 487 @overload 488 def __eq__(self, arg0: object) -> bool: ... 489 def __hash__(self) -> int: ... 490 def __init__(self, cast_from_type: Attribute) -> None: 491 """ 492 Casts the passed attribute to the generic Attribute 493 """ 494 def __str__(self) -> str: 495 """ 496 Returns the assembly form of the Attribute. 497 """ 498 def dump(self) -> None: 499 """ 500 Dumps a debug representation of the object to stderr. 501 """ 502 def get_named(self, arg0: str) -> NamedAttribute: 503 """ 504 Binds a name to the attribute 505 """ 506 def maybe_downcast(self) -> Any: ... 507 @property 508 def _CAPIPtr(self) -> object: ... 509 @property 510 def context(self) -> Context: 511 """ 512 Context that owns the Attribute 513 """ 514 @property 515 def type(self) -> Type: ... 516 @property 517 def typeid(self) -> TypeID: ... 518 519class Type: 520 @staticmethod 521 def parse(asm: str | bytes, context: Context | None = None) -> Type: 522 """ 523 Parses the assembly form of a type. 524 525 Returns a Type object or raises an MLIRError if the type cannot be parsed. 526 527 See also: https://mlir.llvm.org/docs/LangRef/#type-system 528 """ 529 def _CAPICreate(self) -> Type: ... 530 @overload 531 def __eq__(self, arg0: Type) -> bool: ... 532 @overload 533 def __eq__(self, arg0: object) -> bool: ... 534 def __hash__(self) -> int: ... 535 def __init__(self, cast_from_type: Type) -> None: 536 """ 537 Casts the passed type to the generic Type 538 """ 539 def __str__(self) -> str: 540 """ 541 Returns the assembly form of the type. 542 """ 543 def dump(self) -> None: 544 """ 545 Dumps a debug representation of the object to stderr. 546 """ 547 def maybe_downcast(self) -> Any: ... 548 @property 549 def _CAPIPtr(self) -> object: ... 550 @property 551 def context(self) -> Context: 552 """ 553 Context that owns the Type 554 """ 555 @property 556 def typeid(self) -> TypeID: ... 557 558class Value: 559 def _CAPICreate(self) -> Value: ... 560 @overload 561 def __eq__(self, arg0: Value) -> bool: ... 562 @overload 563 def __eq__(self, arg0: object) -> bool: ... 564 def __hash__(self) -> int: ... 565 def __init__(self, value: Value) -> None: ... 566 def __str__(self) -> str: 567 """ 568 Returns the string form of the value. 569 570 If the value is a block argument, this is the assembly form of its type and the 571 position in the argument List. If the value is an operation result, this is 572 equivalent to printing the operation that produced it. 573 """ 574 def dump(self) -> None: 575 """ 576 Dumps a debug representation of the object to stderr. 577 """ 578 @overload 579 def get_name(self, use_local_scope: bool = False) -> str: ... 580 @overload 581 def get_name(self, state: AsmState) -> str: 582 """ 583 Returns the string form of value as an operand (i.e., the ValueID). 584 """ 585 def maybe_downcast(self) -> Any: ... 586 def replace_all_uses_with(self, arg0: Value) -> None: 587 """ 588 Replace all uses of value with the new value, updating anything in 589 the IR that uses 'self' to use the other value instead. 590 """ 591 def set_type(self, type: Type) -> None: ... 592 @property 593 def _CAPIPtr(self) -> object: ... 594 @property 595 def context(self) -> Context: 596 """ 597 Context in which the value lives. 598 """ 599 @property 600 def owner(self) -> _OperationBase: ... 601 @property 602 def type(self) -> Type: ... 603 @property 604 def uses(self) -> OpOperandIterator: ... 605 606class AffineAddExpr(AffineBinaryExpr): 607 @staticmethod 608 def get(arg0: AffineExpr, arg1: AffineExpr) -> AffineAddExpr: ... 609 @staticmethod 610 def isinstance(other: AffineExpr) -> bool: ... 611 def __init__(self, expr: AffineExpr) -> None: ... 612 613class AffineBinaryExpr(AffineExpr): 614 @staticmethod 615 def isinstance(other: AffineExpr) -> bool: ... 616 def __init__(self, expr: AffineExpr) -> None: ... 617 @property 618 def lhs(self) -> AffineExpr: ... 619 @property 620 def rhs(self) -> AffineExpr: ... 621 622class AffineCeilDivExpr(AffineBinaryExpr): 623 @staticmethod 624 def get(arg0: AffineExpr, arg1: AffineExpr) -> AffineCeilDivExpr: ... 625 @staticmethod 626 def isinstance(other: AffineExpr) -> bool: ... 627 def __init__(self, expr: AffineExpr) -> None: ... 628 629class AffineConstantExpr(AffineExpr): 630 @staticmethod 631 def get(value: int, context: Context | None = None) -> AffineConstantExpr: ... 632 @staticmethod 633 def isinstance(other: AffineExpr) -> bool: ... 634 def __init__(self, expr: AffineExpr) -> None: ... 635 @property 636 def value(self) -> int: ... 637 638class AffineDimExpr(AffineExpr): 639 @staticmethod 640 def get(position: int, context: Context | None = None) -> AffineDimExpr: ... 641 @staticmethod 642 def isinstance(other: AffineExpr) -> bool: ... 643 def __init__(self, expr: AffineExpr) -> None: ... 644 @property 645 def position(self) -> int: ... 646 647class AffineExprList: 648 def __add__(self, arg0: AffineExprList) -> list[AffineExpr]: ... 649 650class AffineFloorDivExpr(AffineBinaryExpr): 651 @staticmethod 652 def get(arg0: AffineExpr, arg1: AffineExpr) -> AffineFloorDivExpr: ... 653 @staticmethod 654 def isinstance(other: AffineExpr) -> bool: ... 655 def __init__(self, expr: AffineExpr) -> None: ... 656 657class AffineMap: 658 @staticmethod 659 def compress_unused_symbols( 660 arg0: list, arg1: Context | None 661 ) -> list[AffineMap]: ... 662 @staticmethod 663 def get( 664 dim_count: int, 665 symbol_count: int, 666 exprs: list, 667 context: Context | None = None, 668 ) -> AffineMap: 669 """ 670 Gets a map with the given expressions as results. 671 """ 672 @staticmethod 673 def get_constant(value: int, context: Context | None = None) -> AffineMap: 674 """ 675 Gets an affine map with a single constant result 676 """ 677 @staticmethod 678 def get_empty(context: Context | None = None) -> AffineMap: 679 """ 680 Gets an empty affine map. 681 """ 682 @staticmethod 683 def get_identity(n_dims: int, context: Context | None = None) -> AffineMap: 684 """ 685 Gets an identity map with the given number of dimensions. 686 """ 687 @staticmethod 688 def get_minor_identity( 689 n_dims: int, n_results: int, context: Context | None = None 690 ) -> AffineMap: 691 """ 692 Gets a minor identity map with the given number of dimensions and results. 693 """ 694 @staticmethod 695 def get_permutation( 696 permutation: list[int], context: Context | None = None 697 ) -> AffineMap: 698 """ 699 Gets an affine map that permutes its inputs. 700 """ 701 def _CAPICreate(self) -> AffineMap: ... 702 @overload 703 def __eq__(self, arg0: AffineMap) -> bool: ... 704 @overload 705 def __eq__(self, arg0: object) -> bool: ... 706 def __hash__(self) -> int: ... 707 def dump(self) -> None: 708 """ 709 Dumps a debug representation of the object to stderr. 710 """ 711 def get_major_submap(self, n_results: int) -> AffineMap: ... 712 def get_minor_submap(self, n_results: int) -> AffineMap: ... 713 def get_submap(self, result_positions: list[int]) -> AffineMap: ... 714 def replace( 715 self, 716 expr: AffineExpr, 717 replacement: AffineExpr, 718 n_result_dims: int, 719 n_result_syms: int, 720 ) -> AffineMap: ... 721 @property 722 def _CAPIPtr(self) -> object: ... 723 @property 724 def context(self) -> Context: 725 """ 726 Context that owns the Affine Map 727 """ 728 @property 729 def is_permutation(self) -> bool: ... 730 @property 731 def is_projected_permutation(self) -> bool: ... 732 @property 733 def n_dims(self) -> int: ... 734 @property 735 def n_inputs(self) -> int: ... 736 @property 737 def n_symbols(self) -> int: ... 738 @property 739 def results(self) -> AffineMapExprList: ... 740 741class AffineMapAttr(Attribute): 742 static_typeid: ClassVar[TypeID] 743 @staticmethod 744 def get(affine_map: AffineMap) -> AffineMapAttr: 745 """ 746 Gets an attribute wrapping an AffineMap. 747 """ 748 @staticmethod 749 def isinstance(other: Attribute) -> bool: ... 750 def __init__(self, cast_from_attr: Attribute) -> None: ... 751 @property 752 def type(self) -> Type: ... 753 @property 754 def typeid(self) -> TypeID: ... 755 756class AffineModExpr(AffineBinaryExpr): 757 @staticmethod 758 def get(arg0: AffineExpr, arg1: AffineExpr) -> AffineModExpr: ... 759 @staticmethod 760 def isinstance(other: AffineExpr) -> bool: ... 761 def __init__(self, expr: AffineExpr) -> None: ... 762 763class AffineMulExpr(AffineBinaryExpr): 764 @staticmethod 765 def get(arg0: AffineExpr, arg1: AffineExpr) -> AffineMulExpr: ... 766 @staticmethod 767 def isinstance(other: AffineExpr) -> bool: ... 768 def __init__(self, expr: AffineExpr) -> None: ... 769 770class AffineSymbolExpr(AffineExpr): 771 @staticmethod 772 def get(position: int, context: Context | None = None) -> AffineSymbolExpr: ... 773 @staticmethod 774 def isinstance(other: AffineExpr) -> bool: ... 775 def __init__(self, expr: AffineExpr) -> None: ... 776 @property 777 def position(self) -> int: ... 778 779class ArrayAttr(Attribute): 780 static_typeid: ClassVar[TypeID] 781 @staticmethod 782 def get(attributes: list, context: Context | None = None) -> ArrayAttr: 783 """ 784 Gets a uniqued Array attribute 785 """ 786 @staticmethod 787 def isinstance(other: Attribute) -> bool: ... 788 def __add__(self, arg0: list) -> ArrayAttr: ... 789 def __getitem__(self, arg0: int) -> Attribute: ... 790 def __init__(self, cast_from_attr: Attribute) -> None: ... 791 def __iter__( 792 self, 793 ) -> ArrayAttributeIterator: ... 794 def __len__(self) -> int: ... 795 @property 796 def type(self) -> Type: ... 797 @property 798 def typeid(self) -> TypeID: ... 799 800class ArrayAttributeIterator: 801 def __iter__(self) -> ArrayAttributeIterator: ... 802 def __next__(self) -> Attribute: ... 803 804class AsmState: 805 @overload 806 def __init__(self, value: Value, use_local_scope: bool = False) -> None: ... 807 @overload 808 def __init__(self, op: _OperationBase, use_local_scope: bool = False) -> None: ... 809 810class AttrBuilder: 811 @staticmethod 812 def contains(arg0: str) -> bool: ... 813 @staticmethod 814 def get(arg0: str) -> Callable: ... 815 @staticmethod 816 def insert( 817 attribute_kind: str, attr_builder: Callable, replace: bool = False 818 ) -> None: 819 """ 820 Register an attribute builder for building MLIR attributes from python values. 821 """ 822 823class BF16Type(Type): 824 static_typeid: ClassVar[TypeID] 825 @staticmethod 826 def get(context: Context | None = None) -> BF16Type: 827 """ 828 Create a bf16 type. 829 """ 830 @staticmethod 831 def isinstance(other: Type) -> bool: ... 832 def __init__(self, cast_from_type: Type) -> None: ... 833 @property 834 def typeid(self) -> TypeID: ... 835 836class Block: 837 @staticmethod 838 def create_at_start( 839 parent: Region, 840 arg_types: list[Type], 841 arg_locs: Sequence | None = None, 842 ) -> Block: 843 """ 844 Creates and returns a new Block at the beginning of the given region (with given argument types and locations). 845 """ 846 @overload 847 def __eq__(self, arg0: Block) -> bool: ... 848 @overload 849 def __eq__(self, arg0: Any) -> bool: ... 850 def __hash__(self) -> int: ... 851 def __iter__(self) -> OperationIterator: 852 """ 853 Iterates over operations in the block. 854 """ 855 def __str__(self) -> str: 856 """ 857 Returns the assembly form of the block. 858 """ 859 def append(self, operation: _OperationBase) -> None: 860 """ 861 Appends an operation to this block. If the operation is currently in another block, it will be moved. 862 """ 863 def append_to(self, arg0: Region) -> None: 864 """ 865 Append this block to a region, transferring ownership if necessary 866 """ 867 def create_after(self, *args, arg_locs: Sequence | None = None) -> Block: 868 """ 869 Creates and returns a new Block after this block (with given argument types and locations). 870 """ 871 def create_before(self, *args, arg_locs: Sequence | None = None) -> Block: 872 """ 873 Creates and returns a new Block before this block (with given argument types and locations). 874 """ 875 @property 876 def _CAPIPtr(self) -> object: ... 877 @property 878 def arguments(self) -> BlockArgumentList: 879 """ 880 Returns a List of block arguments. 881 """ 882 @property 883 def operations(self) -> OperationList: 884 """ 885 Returns a forward-optimized sequence of operations. 886 """ 887 @property 888 def owner(self) -> OpView: 889 """ 890 Returns the owning operation of this block. 891 """ 892 @property 893 def region(self) -> Region: 894 """ 895 Returns the owning region of this block. 896 """ 897 898class BlockArgument(Value): 899 @staticmethod 900 def isinstance(other_value: Value) -> bool: ... 901 def __init__(self, value: Value) -> None: ... 902 def maybe_downcast(self) -> Any: ... 903 def set_type(self, type: Type) -> None: ... 904 @property 905 def arg_number(self) -> int: ... 906 @property 907 def owner(self) -> Block: ... 908 909class BlockArgumentList: 910 @overload 911 def __getitem__(self, arg0: int) -> BlockArgument: ... 912 @overload 913 def __getitem__(self, arg0: slice) -> BlockArgumentList: ... 914 def __len__(self) -> int: ... 915 def __add__(self, arg0: BlockArgumentList) -> list[BlockArgument]: ... 916 @property 917 def types(self) -> list[Type]: ... 918 919class BlockIterator: 920 def __iter__(self) -> BlockIterator: ... 921 def __next__(self) -> Block: ... 922 923class BlockList: 924 def __getitem__(self, arg0: int) -> Block: ... 925 def __iter__(self) -> BlockIterator: ... 926 def __len__(self) -> int: ... 927 def append(self, *args, arg_locs: Sequence | None = None) -> Block: 928 """ 929 Appends a new block, with argument types as positional args. 930 931 Returns: 932 The created block. 933 """ 934 935class BoolAttr(Attribute): 936 @staticmethod 937 def get(value: bool, context: Context | None = None) -> BoolAttr: 938 """ 939 Gets an uniqued bool attribute 940 """ 941 @staticmethod 942 def isinstance(other: Attribute) -> bool: ... 943 def __bool__(self: Attribute) -> bool: 944 """ 945 Converts the value of the bool attribute to a Python bool 946 """ 947 def __init__(self, cast_from_attr: Attribute) -> None: ... 948 @property 949 def static_typeid(self) -> TypeID: ... 950 @property 951 def type(self) -> Type: ... 952 @property 953 def typeid(self) -> TypeID: ... 954 @property 955 def value(self) -> bool: 956 """ 957 Returns the value of the bool attribute 958 """ 959 960class ComplexType(Type): 961 static_typeid: ClassVar[TypeID] 962 @staticmethod 963 def get(arg0: Type) -> ComplexType: 964 """ 965 Create a complex type 966 """ 967 @staticmethod 968 def isinstance(other: Type) -> bool: ... 969 def __init__(self, cast_from_type: Type) -> None: ... 970 @property 971 def element_type(self) -> Type: 972 """ 973 Returns element type. 974 """ 975 @property 976 def typeid(self) -> TypeID: ... 977 978class Context: 979 current: ClassVar[Context] = ... # read-only 980 allow_unregistered_dialects: bool 981 @staticmethod 982 def _get_live_count() -> int: ... 983 def _CAPICreate(self) -> object: ... 984 def __enter__(self) -> Context: ... 985 def __exit__(self, arg0: Any, arg1: Any, arg2: Any) -> None: ... 986 def __init__(self) -> None: ... 987 def _clear_live_operations(self) -> int: ... 988 def _get_context_again(self) -> Context: ... 989 def _get_live_module_count(self) -> int: ... 990 def _get_live_operation_count(self) -> int: ... 991 def _get_live_operation_objects(self) -> list[Operation]: ... 992 def append_dialect_registry(self, registry: DialectRegistry) -> None: ... 993 def attach_diagnostic_handler( 994 self, callback: Callable[[Diagnostic], bool] 995 ) -> DiagnosticHandler: 996 """ 997 Attaches a diagnostic handler that will receive callbacks 998 """ 999 def enable_multithreading(self, enable: bool) -> None: ... 1000 def get_dialect_descriptor(self, dialect_name: str) -> DialectDescriptor: 1001 """ 1002 Gets or loads a dialect by name, returning its descriptor object 1003 """ 1004 def is_registered_operation(self, operation_name: str) -> bool: ... 1005 def load_all_available_dialects(self) -> None: ... 1006 @property 1007 def _CAPIPtr(self) -> object: ... 1008 @property 1009 def d(self) -> Dialects: 1010 """ 1011 Alias for 'dialect' 1012 """ 1013 @property 1014 def dialects(self) -> Dialects: 1015 """ 1016 Gets a container for accessing dialects by name 1017 """ 1018 1019class DenseBoolArrayAttr(Attribute): 1020 @staticmethod 1021 def get( 1022 values: Sequence[bool], context: Context | None = None 1023 ) -> DenseBoolArrayAttr: 1024 """ 1025 Gets a uniqued dense array attribute 1026 """ 1027 @staticmethod 1028 def isinstance(other: Attribute) -> bool: ... 1029 def __add__(self, arg0: list) -> DenseBoolArrayAttr: ... 1030 def __getitem__(self, arg0: int) -> bool: ... 1031 def __init__(self, cast_from_attr: Attribute) -> None: ... 1032 def __iter__( 1033 self, 1034 ) -> DenseBoolArrayIterator: ... 1035 def __len__(self) -> int: ... 1036 @property 1037 def static_typeid(self) -> TypeID: ... 1038 @property 1039 def type(self) -> Type: ... 1040 @property 1041 def typeid(self) -> TypeID: ... 1042 1043class DenseBoolArrayIterator: 1044 def __iter__(self) -> DenseBoolArrayIterator: ... 1045 def __next__(self) -> bool: ... 1046 1047class DenseElementsAttr(Attribute): 1048 @staticmethod 1049 def get( 1050 array: Buffer, 1051 signless: bool = True, 1052 type: Type | None = None, 1053 shape: list[int] | None = None, 1054 context: Context | None = None, 1055 ) -> DenseElementsAttr: 1056 """ 1057 Gets a DenseElementsAttr from a Python buffer or array. 1058 1059 When `type` is not provided, then some limited type inferencing is done based 1060 on the buffer format. Support presently exists for 8/16/32/64 signed and 1061 unsigned integers and float16/float32/float64. DenseElementsAttrs of these 1062 types can also be converted back to a corresponding buffer. 1063 1064 For conversions outside of these types, a `type=` must be explicitly provided 1065 and the buffer contents must be bit-castable to the MLIR internal 1066 representation: 1067 1068 * Integer types (except for i1): the buffer must be byte aligned to the 1069 next byte boundary. 1070 * Floating point types: Must be bit-castable to the given floating point 1071 size. 1072 * i1 (bool): Bit packed into 8bit words where the bit pattern matches a 1073 row major ordering. An arbitrary Numpy `bool_` array can be bit packed to 1074 this specification with: `np.packbits(ary, axis=None, bitorder='little')`. 1075 1076 If a single element buffer is passed (or for i1, a single byte with value 0 1077 or 255), then a splat will be created. 1078 1079 Args: 1080 array: The array or buffer to convert. 1081 signless: If inferring an appropriate MLIR type, use signless types for 1082 integers (defaults True). 1083 type: Skips inference of the MLIR element type and uses this instead. The 1084 storage size must be consistent with the actual contents of the buffer. 1085 shape: Overrides the shape of the buffer when constructing the MLIR 1086 shaped type. This is needed when the physical and logical shape differ (as 1087 for i1). 1088 context: Explicit context, if not from context manager. 1089 1090 Returns: 1091 DenseElementsAttr on success. 1092 1093 Raises: 1094 ValueError: If the type of the buffer or array cannot be matched to an MLIR 1095 type or if the buffer does not meet expectations. 1096 """ 1097 @staticmethod 1098 def get_splat(shaped_type: Type, element_attr: Attribute) -> DenseElementsAttr: 1099 """ 1100 Gets a DenseElementsAttr where all values are the same 1101 """ 1102 @staticmethod 1103 def isinstance(other: Attribute) -> bool: ... 1104 def __init__(self, cast_from_attr: Attribute) -> None: ... 1105 def __len__(self) -> int: ... 1106 def get_splat_value(self) -> Attribute: ... 1107 @property 1108 def is_splat(self) -> bool: ... 1109 @property 1110 def static_typeid(self) -> TypeID: ... 1111 @property 1112 def type(self) -> Type: ... 1113 @property 1114 def typeid(self) -> TypeID: ... 1115 1116class DenseF32ArrayAttr(Attribute): 1117 @staticmethod 1118 def get( 1119 values: Sequence[float], context: Context | None = None 1120 ) -> DenseF32ArrayAttr: 1121 """ 1122 Gets a uniqued dense array attribute 1123 """ 1124 @staticmethod 1125 def isinstance(other: Attribute) -> bool: ... 1126 def __add__(self, arg0: list) -> DenseF32ArrayAttr: ... 1127 def __getitem__(self, arg0: int) -> float: ... 1128 def __init__(self, cast_from_attr: Attribute) -> None: ... 1129 def __iter__( 1130 self, 1131 ) -> DenseF32ArrayIterator: ... 1132 def __len__(self) -> int: ... 1133 @property 1134 def static_typeid(self) -> TypeID: ... 1135 @property 1136 def type(self) -> Type: ... 1137 @property 1138 def typeid(self) -> TypeID: ... 1139 1140class DenseF32ArrayIterator: 1141 def __iter__(self) -> DenseF32ArrayIterator: ... 1142 def __next__(self) -> float: ... 1143 1144class DenseF64ArrayAttr(Attribute): 1145 @staticmethod 1146 def get( 1147 values: Sequence[float], context: Context | None = None 1148 ) -> DenseF64ArrayAttr: 1149 """ 1150 Gets a uniqued dense array attribute 1151 """ 1152 @staticmethod 1153 def isinstance(other: Attribute) -> bool: ... 1154 def __add__(self, arg0: list) -> DenseF64ArrayAttr: ... 1155 def __getitem__(self, arg0: int) -> float: ... 1156 def __init__(self, cast_from_attr: Attribute) -> None: ... 1157 def __iter__( 1158 self, 1159 ) -> DenseF64ArrayIterator: ... 1160 def __len__(self) -> int: ... 1161 @property 1162 def static_typeid(self) -> TypeID: ... 1163 @property 1164 def type(self) -> Type: ... 1165 @property 1166 def typeid(self) -> TypeID: ... 1167 1168class DenseF64ArrayIterator: 1169 def __iter__(self) -> DenseF64ArrayIterator: ... 1170 def __next__(self) -> float: ... 1171 1172class DenseFPElementsAttr(DenseElementsAttr): 1173 @staticmethod 1174 def get( 1175 array: Buffer, 1176 signless: bool = True, 1177 type: Type | None = None, 1178 shape: list[int] | None = None, 1179 context: Context | None = None, 1180 ) -> DenseFPElementsAttr: ... 1181 @staticmethod 1182 def isinstance(other: Attribute) -> bool: ... 1183 def __getitem__(self, arg0: int) -> float: ... 1184 def __init__(self, cast_from_attr: Attribute) -> None: ... 1185 @property 1186 def static_typeid(self) -> TypeID: ... 1187 @property 1188 def type(self) -> Type: ... 1189 @property 1190 def typeid(self) -> TypeID: ... 1191 1192class DenseI16ArrayAttr(Attribute): 1193 @staticmethod 1194 def get(values: Sequence[int], context: Context | None = None) -> DenseI16ArrayAttr: 1195 """ 1196 Gets a uniqued dense array attribute 1197 """ 1198 @staticmethod 1199 def isinstance(other: Attribute) -> bool: ... 1200 def __add__(self, arg0: list) -> DenseI16ArrayAttr: ... 1201 def __getitem__(self, arg0: int) -> int: ... 1202 def __init__(self, cast_from_attr: Attribute) -> None: ... 1203 def __iter__( 1204 self, 1205 ) -> DenseI16ArrayIterator: ... 1206 def __len__(self) -> int: ... 1207 @property 1208 def static_typeid(self) -> TypeID: ... 1209 @property 1210 def type(self) -> Type: ... 1211 @property 1212 def typeid(self) -> TypeID: ... 1213 1214class DenseI16ArrayIterator: 1215 def __iter__(self) -> DenseI16ArrayIterator: ... 1216 def __next__(self) -> int: ... 1217 1218class DenseI32ArrayAttr(Attribute): 1219 @staticmethod 1220 def get(values: Sequence[int], context: Context | None = None) -> DenseI32ArrayAttr: 1221 """ 1222 Gets a uniqued dense array attribute 1223 """ 1224 @staticmethod 1225 def isinstance(other: Attribute) -> bool: ... 1226 def __add__(self, arg0: list) -> DenseI32ArrayAttr: ... 1227 def __getitem__(self, arg0: int) -> int: ... 1228 def __init__(self, cast_from_attr: Attribute) -> None: ... 1229 def __iter__( 1230 self, 1231 ) -> DenseI32ArrayIterator: ... 1232 def __len__(self) -> int: ... 1233 @property 1234 def static_typeid(self) -> TypeID: ... 1235 @property 1236 def type(self) -> Type: ... 1237 @property 1238 def typeid(self) -> TypeID: ... 1239 1240class DenseI32ArrayIterator: 1241 def __iter__(self) -> DenseI32ArrayIterator: ... 1242 def __next__(self) -> int: ... 1243 1244class DenseI64ArrayAttr(Attribute): 1245 @staticmethod 1246 def get(values: Sequence[int], context: Context | None = None) -> DenseI64ArrayAttr: 1247 """ 1248 Gets a uniqued dense array attribute 1249 """ 1250 @staticmethod 1251 def isinstance(other: Attribute) -> bool: ... 1252 def __add__(self, arg0: list) -> DenseI64ArrayAttr: ... 1253 def __getitem__(self, arg0: int) -> int: ... 1254 def __init__(self, cast_from_attr: Attribute) -> None: ... 1255 def __iter__( 1256 self, 1257 ) -> DenseI16ArrayIterator: ... 1258 def __len__(self) -> int: ... 1259 @property 1260 def static_typeid(self) -> TypeID: ... 1261 @property 1262 def type(self) -> Type: ... 1263 @property 1264 def typeid(self) -> TypeID: ... 1265 1266class DenseI64ArrayIterator: 1267 def __iter__(self) -> DenseI64ArrayIterator: ... 1268 def __next__(self) -> int: ... 1269 1270class DenseI8ArrayAttr(Attribute): 1271 @staticmethod 1272 def get(values: Sequence[int], context: Context | None = None) -> DenseI8ArrayAttr: 1273 """ 1274 Gets a uniqued dense array attribute 1275 """ 1276 @staticmethod 1277 def isinstance(other: Attribute) -> bool: ... 1278 def __add__(self, arg0: list) -> DenseI8ArrayAttr: ... 1279 def __getitem__(self, arg0: int) -> int: ... 1280 def __init__(self, cast_from_attr: Attribute) -> None: ... 1281 def __iter__( 1282 self, 1283 ) -> DenseI8ArrayIterator: ... 1284 def __len__(self) -> int: ... 1285 @property 1286 def static_typeid(self) -> TypeID: ... 1287 @property 1288 def type(self) -> Type: ... 1289 @property 1290 def typeid(self) -> TypeID: ... 1291 1292class DenseI8ArrayIterator: 1293 def __iter__(self) -> DenseI8ArrayIterator: ... 1294 def __next__(self) -> int: ... 1295 1296class DenseIntElementsAttr(DenseElementsAttr): 1297 @staticmethod 1298 def get( 1299 array: Buffer, 1300 signless: bool = True, 1301 type: Type | None = None, 1302 shape: list[int] | None = None, 1303 context: Context | None = None, 1304 ) -> DenseIntElementsAttr: ... 1305 @staticmethod 1306 def isinstance(other: Attribute) -> bool: ... 1307 def __getitem__(self, arg0: int) -> int: ... 1308 def __init__(self, cast_from_attr: Attribute) -> None: ... 1309 @property 1310 def static_typeid(self) -> TypeID: ... 1311 @property 1312 def type(self) -> Type: ... 1313 @property 1314 def typeid(self) -> TypeID: ... 1315 1316class DenseResourceElementsAttr(Attribute): 1317 @staticmethod 1318 def get_from_buffer( 1319 array: Buffer, 1320 name: str, 1321 type: Type, 1322 alignment: int | None = None, 1323 is_mutable: bool = False, 1324 context: Context | None = None, 1325 ) -> DenseResourceElementsAttr: 1326 """ 1327 Gets a DenseResourceElementsAttr from a Python buffer or array. 1328 1329 This function does minimal validation or massaging of the data, and it is 1330 up to the caller to ensure that the buffer meets the characteristics 1331 implied by the shape. 1332 1333 The backing buffer and any user objects will be retained for the lifetime 1334 of the resource blob. This is typically bounded to the context but the 1335 resource can have a shorter lifespan depending on how it is used in 1336 subsequent processing. 1337 1338 Args: 1339 buffer: The array or buffer to convert. 1340 name: Name to provide to the resource (may be changed upon collision). 1341 type: The explicit ShapedType to construct the attribute with. 1342 context: Explicit context, if not from context manager. 1343 1344 Returns: 1345 DenseResourceElementsAttr on success. 1346 1347 Raises: 1348 ValueError: If the type of the buffer or array cannot be matched to an MLIR 1349 type or if the buffer does not meet expectations. 1350 """ 1351 @staticmethod 1352 def isinstance(other: Attribute) -> bool: ... 1353 def __init__(self, cast_from_attr: Attribute) -> None: ... 1354 @property 1355 def static_typeid(self) -> TypeID: ... 1356 @property 1357 def type(self) -> Type: ... 1358 @property 1359 def typeid(self) -> TypeID: ... 1360 1361class Diagnostic: 1362 @property 1363 def location(self) -> Location: ... 1364 @property 1365 def message(self) -> str: ... 1366 @property 1367 def notes(self) -> tuple[Diagnostic]: ... 1368 @property 1369 def severity(self) -> DiagnosticSeverity: ... 1370 1371class DiagnosticHandler: 1372 def __enter__(self) -> DiagnosticHandler: ... 1373 def __exit__(self, arg0: object, arg1: object, arg2: object) -> None: ... 1374 def detach(self) -> None: ... 1375 @property 1376 def attached(self) -> bool: ... 1377 @property 1378 def had_error(self) -> bool: ... 1379 1380class DiagnosticInfo: 1381 def __init__(self, arg0: Diagnostic) -> None: ... 1382 @property 1383 def location(self) -> Location: ... 1384 @property 1385 def message(self) -> str: ... 1386 @property 1387 def notes(self) -> list[DiagnosticInfo]: ... 1388 @property 1389 def severity(self) -> DiagnosticSeverity: ... 1390 1391class DiagnosticSeverity: 1392 """ 1393 Members: 1394 1395 ERROR 1396 1397 WARNING 1398 1399 NOTE 1400 1401 REMARK 1402 """ 1403 1404 ERROR: ClassVar[DiagnosticSeverity] # value = <DiagnosticSeverity.ERROR: 0> 1405 NOTE: ClassVar[DiagnosticSeverity] # value = <DiagnosticSeverity.NOTE: 2> 1406 REMARK: ClassVar[DiagnosticSeverity] # value = <DiagnosticSeverity.REMARK: 3> 1407 WARNING: ClassVar[DiagnosticSeverity] # value = <DiagnosticSeverity.WARNING: 1> 1408 __members__: ClassVar[ 1409 dict[str, DiagnosticSeverity] 1410 ] # value = {'ERROR': <DiagnosticSeverity.ERROR: 0>, 'WARNING': <DiagnosticSeverity.WARNING: 1>, 'NOTE': <DiagnosticSeverity.NOTE: 2>, 'REMARK': <DiagnosticSeverity.REMARK: 3>} 1411 def __eq__(self, other: Any) -> bool: ... 1412 def __getstate__(self) -> int: ... 1413 def __hash__(self) -> int: ... 1414 def __index__(self) -> int: ... 1415 def __init__(self, value: int) -> None: ... 1416 def __int__(self) -> int: ... 1417 def __ne__(self, other: Any) -> bool: ... 1418 def __setstate__(self, state: int) -> None: ... 1419 @property 1420 def name(self) -> str: ... 1421 @property 1422 def value(self) -> int: ... 1423 1424class Dialect: 1425 def __init__(self, descriptor: DialectDescriptor) -> None: ... 1426 @property 1427 def descriptor(self) -> DialectDescriptor: ... 1428 1429class DialectDescriptor: 1430 @property 1431 def namespace(self) -> str: ... 1432 1433class DialectRegistry: 1434 def _CAPICreate(self) -> DialectRegistry: ... 1435 def __init__(self) -> None: ... 1436 @property 1437 def _CAPIPtr(self) -> object: ... 1438 1439class Dialects: 1440 def __getattr__(self, arg0: str) -> Dialect: ... 1441 def __getitem__(self, arg0: str) -> Dialect: ... 1442 1443class DictAttr(Attribute): 1444 static_typeid: ClassVar[TypeID] 1445 @staticmethod 1446 def get(value: dict = {}, context: Context | None = None) -> DictAttr: 1447 """ 1448 Gets an uniqued Dict attribute 1449 """ 1450 @staticmethod 1451 def isinstance(other: Attribute) -> bool: ... 1452 def __contains__(self, arg0: str) -> bool: ... 1453 @overload 1454 def __getitem__(self, arg0: str) -> Attribute: ... 1455 @overload 1456 def __getitem__(self, arg0: int) -> NamedAttribute: ... 1457 def __init__(self, cast_from_attr: Attribute) -> None: ... 1458 def __len__(self) -> int: ... 1459 @property 1460 def type(self) -> Type: ... 1461 @property 1462 def typeid(self) -> TypeID: ... 1463 1464class FloatType(Type): 1465 @staticmethod 1466 def isinstance(other: Type) -> bool: ... 1467 def __init__(self, cast_from_type: Type) -> None: ... 1468 @property 1469 def width(self) -> int: 1470 """ 1471 Returns the width of the floating-point type. 1472 """ 1473 1474class F16Type(FloatType): 1475 static_typeid: ClassVar[TypeID] 1476 @staticmethod 1477 def get(context: Context | None = None) -> F16Type: 1478 """ 1479 Create a f16 type. 1480 """ 1481 @staticmethod 1482 def isinstance(other: Type) -> bool: ... 1483 def __init__(self, cast_from_type: Type) -> None: ... 1484 @property 1485 def typeid(self) -> TypeID: ... 1486 1487class F32Type(FloatType): 1488 static_typeid: ClassVar[TypeID] 1489 @staticmethod 1490 def get(context: Context | None = None) -> F32Type: 1491 """ 1492 Create a f32 type. 1493 """ 1494 @staticmethod 1495 def isinstance(other: Type) -> bool: ... 1496 def __init__(self, cast_from_type: Type) -> None: ... 1497 @property 1498 def typeid(self) -> TypeID: ... 1499 1500class F64Type(FloatType): 1501 static_typeid: ClassVar[TypeID] 1502 @staticmethod 1503 def get(context: Context | None = None) -> F64Type: 1504 """ 1505 Create a f64 type. 1506 """ 1507 @staticmethod 1508 def isinstance(other: Type) -> bool: ... 1509 def __init__(self, cast_from_type: Type) -> None: ... 1510 @property 1511 def typeid(self) -> TypeID: ... 1512 1513class FlatSymbolRefAttr(Attribute): 1514 @staticmethod 1515 def get(value: str, context: Context | None = None) -> FlatSymbolRefAttr: 1516 """ 1517 Gets a uniqued FlatSymbolRef attribute 1518 """ 1519 @staticmethod 1520 def isinstance(other: Attribute) -> bool: ... 1521 def __init__(self, cast_from_attr: Attribute) -> None: ... 1522 @property 1523 def static_typeid(self) -> TypeID: ... 1524 @property 1525 def type(self) -> Type: ... 1526 @property 1527 def typeid(self) -> TypeID: ... 1528 @property 1529 def value(self) -> str: 1530 """ 1531 Returns the value of the FlatSymbolRef attribute as a string 1532 """ 1533 1534class Float4E2M1FNType(FloatType): 1535 static_typeid: ClassVar[TypeID] 1536 @staticmethod 1537 def get(context: Context | None = None) -> Float4E2M1FNType: 1538 """ 1539 Create a float4_e2m1fn type. 1540 """ 1541 @staticmethod 1542 def isinstance(other: Type) -> bool: ... 1543 def __init__(self, cast_from_type: Type) -> None: ... 1544 @property 1545 def typeid(self) -> TypeID: ... 1546 1547class Float6E2M3FNType(FloatType): 1548 static_typeid: ClassVar[TypeID] 1549 @staticmethod 1550 def get(context: Context | None = None) -> Float6E2M3FNType: 1551 """ 1552 Create a float6_e2m3fn type. 1553 """ 1554 @staticmethod 1555 def isinstance(other: Type) -> bool: ... 1556 def __init__(self, cast_from_type: Type) -> None: ... 1557 @property 1558 def typeid(self) -> TypeID: ... 1559 1560class Float6E3M2FNType(FloatType): 1561 static_typeid: ClassVar[TypeID] 1562 @staticmethod 1563 def get(context: Context | None = None) -> Float6E3M2FNType: 1564 """ 1565 Create a float6_e3m2fn type. 1566 """ 1567 @staticmethod 1568 def isinstance(other: Type) -> bool: ... 1569 def __init__(self, cast_from_type: Type) -> None: ... 1570 @property 1571 def typeid(self) -> TypeID: ... 1572 1573class Float8E3M4Type(FloatType): 1574 static_typeid: ClassVar[TypeID] 1575 @staticmethod 1576 def get(context: Context | None = None) -> Float8E3M4Type: 1577 """ 1578 Create a float8_e3m4 type. 1579 """ 1580 @staticmethod 1581 def isinstance(other: Type) -> bool: ... 1582 def __init__(self, cast_from_type: Type) -> None: ... 1583 @property 1584 def typeid(self) -> TypeID: ... 1585 1586class Float8E4M3B11FNUZType(FloatType): 1587 static_typeid: ClassVar[TypeID] 1588 @staticmethod 1589 def get(context: Context | None = None) -> Float8E4M3B11FNUZType: 1590 """ 1591 Create a float8_e4m3b11fnuz type. 1592 """ 1593 @staticmethod 1594 def isinstance(other: Type) -> bool: ... 1595 def __init__(self, cast_from_type: Type) -> None: ... 1596 @property 1597 def typeid(self) -> TypeID: ... 1598 1599class Float8E4M3FNType(FloatType): 1600 static_typeid: ClassVar[TypeID] 1601 @staticmethod 1602 def get(context: Context | None = None) -> Float8E4M3FNType: 1603 """ 1604 Create a float8_e4m3fn type. 1605 """ 1606 @staticmethod 1607 def isinstance(other: Type) -> bool: ... 1608 def __init__(self, cast_from_type: Type) -> None: ... 1609 @property 1610 def typeid(self) -> TypeID: ... 1611 1612class Float8E4M3FNUZType(FloatType): 1613 static_typeid: ClassVar[TypeID] 1614 @staticmethod 1615 def get(context: Context | None = None) -> Float8E4M3FNUZType: 1616 """ 1617 Create a float8_e4m3fnuz type. 1618 """ 1619 @staticmethod 1620 def isinstance(other: Type) -> bool: ... 1621 def __init__(self, cast_from_type: Type) -> None: ... 1622 @property 1623 def typeid(self) -> TypeID: ... 1624 1625class Float8E4M3Type(FloatType): 1626 static_typeid: ClassVar[TypeID] 1627 @staticmethod 1628 def get(context: Context | None = None) -> Float8E4M3Type: 1629 """ 1630 Create a float8_e4m3 type. 1631 """ 1632 @staticmethod 1633 def isinstance(other: Type) -> bool: ... 1634 def __init__(self, cast_from_type: Type) -> None: ... 1635 @property 1636 def typeid(self) -> TypeID: ... 1637 1638class Float8E5M2FNUZType(FloatType): 1639 static_typeid: ClassVar[TypeID] 1640 @staticmethod 1641 def get(context: Context | None = None) -> Float8E5M2FNUZType: 1642 """ 1643 Create a float8_e5m2fnuz type. 1644 """ 1645 @staticmethod 1646 def isinstance(other: Type) -> bool: ... 1647 def __init__(self, cast_from_type: Type) -> None: ... 1648 @property 1649 def typeid(self) -> TypeID: ... 1650 1651class Float8E5M2Type(FloatType): 1652 static_typeid: ClassVar[TypeID] 1653 @staticmethod 1654 def get(context: Context | None = None) -> Float8E5M2Type: 1655 """ 1656 Create a float8_e5m2 type. 1657 """ 1658 @staticmethod 1659 def isinstance(other: Type) -> bool: ... 1660 def __init__(self, cast_from_type: Type) -> None: ... 1661 @property 1662 def typeid(self) -> TypeID: ... 1663 1664class Float8E8M0FNUType(FloatType): 1665 static_typeid: ClassVar[TypeID] 1666 @staticmethod 1667 def get(context: Context | None = None) -> Float8E8M0FNUType: 1668 """ 1669 Create a float8_e8m0fnu type. 1670 """ 1671 @staticmethod 1672 def isinstance(other: Type) -> bool: ... 1673 def __init__(self, cast_from_type: Type) -> None: ... 1674 @property 1675 def typeid(self) -> TypeID: ... 1676 1677class FloatAttr(Attribute): 1678 static_typeid: ClassVar[TypeID] 1679 @staticmethod 1680 def get(type: Type, value: float, loc: Location | None = None) -> FloatAttr: 1681 """ 1682 Gets an uniqued float point attribute associated to a type 1683 """ 1684 @staticmethod 1685 def get_f32(value: float, context: Context | None = None) -> FloatAttr: 1686 """ 1687 Gets an uniqued float point attribute associated to a f32 type 1688 """ 1689 @staticmethod 1690 def get_f64(value: float, context: Context | None = None) -> FloatAttr: 1691 """ 1692 Gets an uniqued float point attribute associated to a f64 type 1693 """ 1694 @staticmethod 1695 def isinstance(other: Attribute) -> bool: ... 1696 def __float__(self: Attribute) -> float: 1697 """ 1698 Converts the value of the float attribute to a Python float 1699 """ 1700 def __init__(self, cast_from_attr: Attribute) -> None: ... 1701 @property 1702 def type(self) -> Type: ... 1703 @property 1704 def typeid(self) -> TypeID: ... 1705 @property 1706 def value(self) -> float: 1707 """ 1708 Returns the value of the float attribute 1709 """ 1710 1711class FloatTF32Type(FloatType): 1712 static_typeid: ClassVar[TypeID] 1713 @staticmethod 1714 def get(context: Context | None = None) -> FloatTF32Type: 1715 """ 1716 Create a tf32 type. 1717 """ 1718 @staticmethod 1719 def isinstance(other: Type) -> bool: ... 1720 def __init__(self, cast_from_type: Type) -> None: ... 1721 @property 1722 def typeid(self) -> TypeID: ... 1723 1724class FunctionType(Type): 1725 static_typeid: ClassVar[TypeID] 1726 @staticmethod 1727 def get( 1728 inputs: list[Type], results: list[Type], context: Context | None = None 1729 ) -> FunctionType: 1730 """ 1731 Gets a FunctionType from a List of input and result types 1732 """ 1733 @staticmethod 1734 def isinstance(other: Type) -> bool: ... 1735 def __init__(self, cast_from_type: Type) -> None: ... 1736 @property 1737 def inputs(self) -> list: 1738 """ 1739 Returns the List of input types in the FunctionType. 1740 """ 1741 @property 1742 def results(self) -> list: 1743 """ 1744 Returns the List of result types in the FunctionType. 1745 """ 1746 @property 1747 def typeid(self) -> TypeID: ... 1748 1749class IndexType(Type): 1750 static_typeid: ClassVar[TypeID] 1751 @staticmethod 1752 def get(context: Context | None = None) -> IndexType: 1753 """ 1754 Create a index type. 1755 """ 1756 @staticmethod 1757 def isinstance(other: Type) -> bool: ... 1758 def __init__(self, cast_from_type: Type) -> None: ... 1759 @property 1760 def typeid(self) -> TypeID: ... 1761 1762class InferShapedTypeOpInterface: 1763 def __init__(self, object: object, context: Context | None = None) -> None: 1764 """ 1765 Creates an interface from a given operation/opview object or from a 1766 subclass of OpView. Raises ValueError if the operation does not implement the 1767 interface. 1768 """ 1769 def inferReturnTypeComponents( 1770 self, 1771 operands: list | None = None, 1772 attributes: Attribute | None = None, 1773 properties=None, 1774 regions: list[Region] | None = None, 1775 context: Context | None = None, 1776 loc: Location | None = None, 1777 ) -> list[ShapedTypeComponents]: 1778 """ 1779 Given the arguments required to build an operation, attempts to infer 1780 its return shaped type components. Raises ValueError on failure. 1781 """ 1782 @property 1783 def operation(self) -> Operation: 1784 """ 1785 Returns an Operation for which the interface was constructed. 1786 """ 1787 @property 1788 def opview(self) -> OpView: 1789 """ 1790 Returns an OpView subclass _instance_ for which the interface was 1791 constructed 1792 """ 1793 1794class InferTypeOpInterface: 1795 def __init__(self, object: object, context: Context | None = None) -> None: 1796 """ 1797 Creates an interface from a given operation/opview object or from a 1798 subclass of OpView. Raises ValueError if the operation does not implement the 1799 interface. 1800 """ 1801 def inferReturnTypes( 1802 self, 1803 operands: list | None = None, 1804 attributes: Attribute | None = None, 1805 properties=None, 1806 regions: list[Region] | None = None, 1807 context: Context | None = None, 1808 loc: Location | None = None, 1809 ) -> list[Type]: 1810 """ 1811 Given the arguments required to build an operation, attempts to infer 1812 its return types. Raises ValueError on failure. 1813 """ 1814 @property 1815 def operation(self) -> Operation: 1816 """ 1817 Returns an Operation for which the interface was constructed. 1818 """ 1819 @property 1820 def opview(self) -> OpView: 1821 """ 1822 Returns an OpView subclass _instance_ for which the interface was 1823 constructed 1824 """ 1825 1826class InsertionPoint: 1827 current: ClassVar[InsertionPoint] = ... # read-only 1828 @staticmethod 1829 def at_block_begin(block: Block) -> InsertionPoint: 1830 """ 1831 Inserts at the beginning of the block. 1832 """ 1833 @staticmethod 1834 def at_block_terminator(block: Block) -> InsertionPoint: 1835 """ 1836 Inserts before the block terminator. 1837 """ 1838 def __enter__(self) -> InsertionPoint: ... 1839 def __exit__(self, arg0: Any, arg1: Any, arg2: Any) -> None: ... 1840 @overload 1841 def __init__(self, block: Block) -> None: 1842 """ 1843 Inserts after the last operation but still inside the block. 1844 """ 1845 @overload 1846 def __init__(self, beforeOperation: _OperationBase) -> None: 1847 """ 1848 Inserts before a referenced operation. 1849 """ 1850 def insert(self, operation: _OperationBase) -> None: 1851 """ 1852 Inserts an operation. 1853 """ 1854 @property 1855 def block(self) -> Block: 1856 """ 1857 Returns the block that this InsertionPoint points to. 1858 """ 1859 @property 1860 def ref_operation(self) -> _OperationBase | None: 1861 """ 1862 The reference operation before which new operations are inserted, or None if the insertion point is at the end of the block 1863 """ 1864 1865class IntegerAttr(Attribute): 1866 static_typeid: ClassVar[TypeID] 1867 @staticmethod 1868 def get(type: Type, value: int) -> IntegerAttr: 1869 """ 1870 Gets an uniqued integer attribute associated to a type 1871 """ 1872 @staticmethod 1873 def isinstance(other: Attribute) -> bool: ... 1874 def __init__(self, cast_from_attr: Attribute) -> None: ... 1875 def __int__(self) -> int: 1876 """ 1877 Converts the value of the integer attribute to a Python int 1878 """ 1879 @property 1880 def type(self) -> Type: ... 1881 @property 1882 def typeid(self) -> TypeID: ... 1883 @property 1884 def value(self) -> int: 1885 """ 1886 Returns the value of the integer attribute 1887 """ 1888 1889class IntegerSet: 1890 @staticmethod 1891 def get( 1892 num_dims: int, 1893 num_symbols: int, 1894 exprs: list, 1895 eq_flags: list[bool], 1896 context: Context | None = None, 1897 ) -> IntegerSet: ... 1898 @staticmethod 1899 def get_empty( 1900 num_dims: int, num_symbols: int, context: Context | None = None 1901 ) -> IntegerSet: ... 1902 def _CAPICreate(self) -> IntegerSet: ... 1903 @overload 1904 def __eq__(self, arg0: IntegerSet) -> bool: ... 1905 @overload 1906 def __eq__(self, arg0: object) -> bool: ... 1907 def __hash__(self) -> int: ... 1908 def dump(self) -> None: 1909 """ 1910 Dumps a debug representation of the object to stderr. 1911 """ 1912 def get_replaced( 1913 self, 1914 dim_exprs: list, 1915 symbol_exprs: list, 1916 num_result_dims: int, 1917 num_result_symbols: int, 1918 ) -> IntegerSet: ... 1919 @property 1920 def _CAPIPtr(self) -> object: ... 1921 @property 1922 def constraints(self) -> IntegerSetConstraintList: ... 1923 @property 1924 def context(self) -> Context: ... 1925 @property 1926 def is_canonical_empty(self) -> bool: ... 1927 @property 1928 def n_dims(self) -> int: ... 1929 @property 1930 def n_equalities(self) -> int: ... 1931 @property 1932 def n_inequalities(self) -> int: ... 1933 @property 1934 def n_inputs(self) -> int: ... 1935 @property 1936 def n_symbols(self) -> int: ... 1937 1938class IntegerSetAttr(Attribute): 1939 static_typeid: ClassVar[TypeID] 1940 @staticmethod 1941 def get(integer_set) -> IntegerSetAttr: 1942 """ 1943 Gets an attribute wrapping an IntegerSet. 1944 """ 1945 @staticmethod 1946 def isinstance(other: Attribute) -> bool: ... 1947 def __init__(self, cast_from_attr: Attribute) -> None: ... 1948 @property 1949 def type(self) -> Type: ... 1950 @property 1951 def typeid(self) -> TypeID: ... 1952 1953class IntegerSetConstraint: 1954 def __init__(self, *args, **kwargs) -> None: ... 1955 @property 1956 def expr(self) -> AffineExpr: ... 1957 @property 1958 def is_eq(self) -> bool: ... 1959 1960class IntegerSetConstraintList: 1961 def __init__(self, *args, **kwargs) -> None: ... 1962 def __add__(self, arg0: IntegerSetConstraintList) -> list[IntegerSetConstraint]: ... 1963 @overload 1964 def __getitem__(self, arg0: int) -> IntegerSetConstraint: ... 1965 @overload 1966 def __getitem__(self, arg0: slice) -> IntegerSetConstraintList: ... 1967 def __len__(self) -> int: ... 1968 1969class IntegerType(Type): 1970 static_typeid: ClassVar[TypeID] 1971 @staticmethod 1972 def get_signed(width: int, context: Context | None = None) -> IntegerType: 1973 """ 1974 Create a signed integer type 1975 """ 1976 @staticmethod 1977 def get_signless(width: int, context: Context | None = None) -> IntegerType: 1978 """ 1979 Create a signless integer type 1980 """ 1981 @staticmethod 1982 def get_unsigned(width: int, context: Context | None = None) -> IntegerType: 1983 """ 1984 Create an unsigned integer type 1985 """ 1986 @staticmethod 1987 def isinstance(other: Type) -> bool: ... 1988 def __init__(self, cast_from_type: Type) -> None: ... 1989 @property 1990 def is_signed(self) -> bool: 1991 """ 1992 Returns whether this is a signed integer 1993 """ 1994 @property 1995 def is_signless(self) -> bool: 1996 """ 1997 Returns whether this is a signless integer 1998 """ 1999 @property 2000 def is_unsigned(self) -> bool: 2001 """ 2002 Returns whether this is an unsigned integer 2003 """ 2004 @property 2005 def typeid(self) -> TypeID: ... 2006 @property 2007 def width(self) -> int: 2008 """ 2009 Returns the width of the integer type 2010 """ 2011 2012class Location: 2013 current: ClassVar[Location] = ... # read-only 2014 __hash__: ClassVar[None] = None 2015 @staticmethod 2016 def callsite( 2017 callee: Location, frames: Sequence[Location], context: Context | None = None 2018 ) -> Location: 2019 """ 2020 Gets a Location representing a caller and callsite 2021 """ 2022 @staticmethod 2023 def file( 2024 filename: str, line: int, col: int, context: Context | None = None 2025 ) -> Location: 2026 """ 2027 Gets a Location representing a file, line and column 2028 """ 2029 @staticmethod 2030 def from_attr(attribute: Attribute, context: Context | None = None) -> Location: 2031 """ 2032 Gets a Location from a LocationAttr 2033 """ 2034 @staticmethod 2035 def fused( 2036 locations: Sequence[Location], 2037 metadata: Attribute | None = None, 2038 context: Context | None = None, 2039 ) -> Location: 2040 """ 2041 Gets a Location representing a fused location with optional metadata 2042 """ 2043 @staticmethod 2044 def name( 2045 name: str, 2046 childLoc: Location | None = None, 2047 context: Context | None = None, 2048 ) -> Location: 2049 """ 2050 Gets a Location representing a named location with optional child location 2051 """ 2052 @staticmethod 2053 def unknown(context: Context | None = None) -> Location: 2054 """ 2055 Gets a Location representing an unknown location 2056 """ 2057 def _CAPICreate(self) -> Location: ... 2058 def __enter__(self) -> Location: ... 2059 @overload 2060 def __eq__(self, arg0: Location) -> bool: ... 2061 @overload 2062 def __eq__(self, arg0: Location) -> bool: ... 2063 def __exit__(self, arg0: object, arg1: object, arg2: object) -> None: ... 2064 def emit_error(self, message: str) -> None: 2065 """ 2066 Emits an error at this location 2067 """ 2068 @property 2069 def _CAPIPtr(self) -> object: ... 2070 @property 2071 def attr(self) -> Attribute: 2072 """ 2073 Get the underlying LocationAttr 2074 """ 2075 @property 2076 def context(self) -> Context: 2077 """ 2078 Context that owns the Location 2079 """ 2080 2081class MemRefType(ShapedType): 2082 static_typeid: ClassVar[TypeID] 2083 @staticmethod 2084 def get( 2085 shape: list[int], 2086 element_type: Type, 2087 layout: Attribute = None, 2088 memory_space: Attribute = None, 2089 loc: Location | None = None, 2090 ) -> MemRefType: 2091 """ 2092 Create a memref type 2093 """ 2094 @staticmethod 2095 def isinstance(other: Type) -> bool: ... 2096 def __init__(self, cast_from_type: Type) -> None: ... 2097 @property 2098 def affine_map(self) -> AffineMap: 2099 """ 2100 The layout of the MemRef type as an affine map. 2101 """ 2102 @property 2103 def layout(self) -> Attribute: 2104 """ 2105 The layout of the MemRef type. 2106 """ 2107 @property 2108 def memory_space(self) -> Attribute | None: 2109 """ 2110 Returns the memory space of the given MemRef type. 2111 """ 2112 @property 2113 def typeid(self) -> TypeID: ... 2114 def get_strides_and_offset(self) -> tuple[list[int], list[int]]: 2115 """ 2116 The strides and offset of the MemRef type. 2117 """ 2118 2119class Module: 2120 @staticmethod 2121 def create(loc: Location | None = None) -> Module: 2122 """ 2123 Creates an empty module 2124 """ 2125 @staticmethod 2126 def parse(asm: str | bytes, context: Context | None = None) -> Module: 2127 """ 2128 Parses a module's assembly format from a string. 2129 2130 Returns a new MlirModule or raises an MLIRError if the parsing fails. 2131 2132 See also: https://mlir.llvm.org/docs/LangRef/ 2133 """ 2134 def _CAPICreate(self) -> Any: ... 2135 def __str__(self) -> str: 2136 """ 2137 Gets the assembly form of the operation with default options. 2138 2139 If more advanced control over the assembly formatting or I/O options is needed, 2140 use the dedicated print or get_asm method, which supports keyword arguments to 2141 customize behavior. 2142 """ 2143 def dump(self) -> None: 2144 """ 2145 Dumps a debug representation of the object to stderr. 2146 """ 2147 @property 2148 def _CAPIPtr(self) -> object: ... 2149 @property 2150 def body(self) -> Block: 2151 """ 2152 Return the block for this module 2153 """ 2154 @property 2155 def context(self) -> Context: 2156 """ 2157 Context that created the Module 2158 """ 2159 @property 2160 def operation(self) -> Operation: 2161 """ 2162 Accesses the module as an operation 2163 """ 2164 2165class MLIRError(Exception): 2166 def __init__( 2167 self, message: str, error_diagnostics: list[DiagnosticInfo] 2168 ) -> None: ... 2169 2170class NamedAttribute: 2171 @property 2172 def attr(self) -> Attribute: 2173 """ 2174 The underlying generic attribute of the NamedAttribute binding 2175 """ 2176 @property 2177 def name(self) -> str: 2178 """ 2179 The name of the NamedAttribute binding 2180 """ 2181 2182class NoneType(Type): 2183 static_typeid: ClassVar[TypeID] 2184 @staticmethod 2185 def get(context: Context | None = None) -> NoneType: 2186 """ 2187 Create a none type. 2188 """ 2189 @staticmethod 2190 def isinstance(other: Type) -> bool: ... 2191 def __init__(self, cast_from_type: Type) -> None: ... 2192 @property 2193 def typeid(self) -> TypeID: ... 2194 2195class OpAttributeMap: 2196 def __contains__(self, arg0: str) -> bool: ... 2197 def __delitem__(self, arg0: str) -> None: ... 2198 @overload 2199 def __getitem__(self, arg0: str) -> Attribute: ... 2200 @overload 2201 def __getitem__(self, arg0: int) -> NamedAttribute: ... 2202 def __len__(self) -> int: ... 2203 def __setitem__(self, arg0: str, arg1: Attribute) -> None: ... 2204 2205class OpOperand: 2206 @property 2207 def operand_number(self) -> int: ... 2208 @property 2209 def owner(self) -> _OperationBase: ... 2210 2211class OpOperandIterator: 2212 def __iter__(self) -> OpOperandIterator: ... 2213 def __next__(self) -> OpOperand: ... 2214 2215class OpOperandList: 2216 def __add__(self, arg0: OpOperandList) -> list[Value]: ... 2217 @overload 2218 def __getitem__(self, arg0: int) -> Value: ... 2219 @overload 2220 def __getitem__(self, arg0: slice) -> OpOperandList: ... 2221 def __len__(self) -> int: ... 2222 def __setitem__(self, arg0: int, arg1: Value) -> None: ... 2223 2224class OpResult(Value): 2225 @staticmethod 2226 def isinstance(other_value: Value) -> bool: ... 2227 def __init__(self, value: Value) -> None: ... 2228 @staticmethod 2229 def isinstance(arg: Any) -> bool: ... 2230 @property 2231 def owner(self) -> _OperationBase: ... 2232 @property 2233 def result_number(self) -> int: ... 2234 2235class OpResultList: 2236 def __add__(self, arg0: OpResultList) -> list[OpResult]: ... 2237 @overload 2238 def __getitem__(self, arg0: int) -> OpResult: ... 2239 @overload 2240 def __getitem__(self, arg0: slice) -> OpResultList: ... 2241 def __len__(self) -> int: ... 2242 @property 2243 def owner(self) -> _OperationBase: ... 2244 @property 2245 def types(self) -> list[Type]: ... 2246 2247class OpSuccessors: 2248 def __add__(self, arg0: OpSuccessors) -> list[Block]: ... 2249 @overload 2250 def __getitem__(self, arg0: int) -> Block: ... 2251 @overload 2252 def __getitem__(self, arg0: slice) -> OpSuccessors: ... 2253 def __setitem__(self, arg0: int, arg1: Block) -> None: ... 2254 def __len__(self) -> int: ... 2255 2256class OpView(_OperationBase): 2257 _ODS_OPERAND_SEGMENTS: ClassVar[None] = ... 2258 _ODS_REGIONS: ClassVar[tuple] = ... 2259 _ODS_RESULT_SEGMENTS: ClassVar[None] = ... 2260 def __init__(self, operation: _OperationBase) -> None: ... 2261 @classmethod 2262 def build_generic( 2263 cls: type[_TOperation], 2264 results: Sequence[Type] | None = None, 2265 operands: Sequence[Value] | None = None, 2266 attributes: dict[str, Attribute] | None = None, 2267 successors: Sequence[Block] | None = None, 2268 regions: int | None = None, 2269 loc: Location | None = None, 2270 ip: InsertionPoint | None = None, 2271 ) -> _TOperation: 2272 """ 2273 Builds a specific, generated OpView based on class level attributes. 2274 """ 2275 @classmethod 2276 def parse( 2277 cls: type[_TOperation], 2278 source: str | bytes, 2279 *, 2280 source_name: str = "", 2281 context: Context | None = None, 2282 ) -> _TOperation: 2283 """ 2284 Parses a specific, generated OpView based on class level attributes 2285 """ 2286 def __init__(self, operation: _OperationBase) -> None: ... 2287 @property 2288 def operation(self) -> _OperationBase: ... 2289 @property 2290 def opview(self) -> OpView: ... 2291 @property 2292 def successors(self) -> OpSuccessors: 2293 """ 2294 Returns the List of Operation successors. 2295 """ 2296 2297class OpaqueAttr(Attribute): 2298 static_typeid: ClassVar[TypeID] 2299 @staticmethod 2300 def get( 2301 dialect_namespace: str, 2302 buffer: Buffer, 2303 type: Type, 2304 context: Context | None = None, 2305 ) -> OpaqueAttr: 2306 """ 2307 Gets an Opaque attribute. 2308 """ 2309 @staticmethod 2310 def isinstance(other: Attribute) -> bool: ... 2311 def __init__(self, cast_from_attr: Attribute) -> None: ... 2312 @property 2313 def data(self) -> bytes: 2314 """ 2315 Returns the data for the Opaqued attributes as `bytes` 2316 """ 2317 @property 2318 def dialect_namespace(self) -> str: 2319 """ 2320 Returns the dialect namespace for the Opaque attribute as a string 2321 """ 2322 @property 2323 def type(self) -> Type: ... 2324 @property 2325 def typeid(self) -> TypeID: ... 2326 2327class OpaqueType(Type): 2328 static_typeid: ClassVar[TypeID] 2329 @staticmethod 2330 def get( 2331 dialect_namespace: str, buffer: str, context: Context | None = None 2332 ) -> OpaqueType: 2333 """ 2334 Create an unregistered (opaque) dialect type. 2335 """ 2336 @staticmethod 2337 def isinstance(other: Type) -> bool: ... 2338 def __init__(self, cast_from_type: Type) -> None: ... 2339 @property 2340 def data(self) -> str: 2341 """ 2342 Returns the data for the Opaque type as a string. 2343 """ 2344 @property 2345 def dialect_namespace(self) -> str: 2346 """ 2347 Returns the dialect namespace for the Opaque type as a string. 2348 """ 2349 @property 2350 def typeid(self) -> TypeID: ... 2351 2352class Operation(_OperationBase): 2353 def _CAPICreate(self) -> object: ... 2354 @staticmethod 2355 def create( 2356 name: str, 2357 results: Sequence[Type] | None = None, 2358 operands: Sequence[Value] | None = None, 2359 attributes: dict[str, Attribute] | None = None, 2360 successors: Sequence[Block] | None = None, 2361 regions: int = 0, 2362 loc: Location | None = None, 2363 ip: InsertionPoint | None = None, 2364 infer_type: bool = False, 2365 ) -> Operation: 2366 """ 2367 Creates a new operation. 2368 2369 Args: 2370 name: Operation name (e.g. "dialect.operation"). 2371 results: Sequence of Type representing op result types. 2372 attributes: Dict of str:Attribute. 2373 successors: List of Block for the operation's successors. 2374 regions: Number of regions to create. 2375 location: A Location object (defaults to resolve from context manager). 2376 ip: An InsertionPoint (defaults to resolve from context manager or set to 2377 False to disable insertion, even with an insertion point set in the 2378 context manager). 2379 infer_type: Whether to infer result types. 2380 Returns: 2381 A new "detached" Operation object. Detached operations can be added 2382 to blocks, which causes them to become "attached." 2383 """ 2384 @staticmethod 2385 def parse( 2386 source: str | bytes, *, source_name: str = "", context: Context | None = None 2387 ) -> Operation: 2388 """ 2389 Parses an operation. Supports both text assembly format and binary bytecode format. 2390 """ 2391 def _CAPICreate(self) -> object: ... 2392 @property 2393 def _CAPIPtr(self) -> object: ... 2394 @property 2395 def operation(self) -> Operation: ... 2396 @property 2397 def opview(self) -> OpView: ... 2398 @property 2399 def successors(self) -> OpSuccessors: 2400 """ 2401 Returns the List of Operation successors. 2402 """ 2403 2404class OperationIterator: 2405 def __iter__(self) -> OperationIterator: ... 2406 def __next__(self) -> OpView: ... 2407 2408class OperationList: 2409 def __getitem__(self, arg0: int) -> OpView: ... 2410 def __iter__(self) -> OperationIterator: ... 2411 def __len__(self) -> int: ... 2412 2413class RankedTensorType(ShapedType): 2414 static_typeid: ClassVar[TypeID] 2415 @staticmethod 2416 def get( 2417 shape: list[int], 2418 element_type: Type, 2419 encoding: Attribute | None = None, 2420 loc: Location | None = None, 2421 ) -> RankedTensorType: 2422 """ 2423 Create a ranked tensor type 2424 """ 2425 @staticmethod 2426 def isinstance(other: Type) -> bool: ... 2427 def __init__(self, cast_from_type: Type) -> None: ... 2428 @property 2429 def encoding(self) -> Attribute | None: ... 2430 @property 2431 def typeid(self) -> TypeID: ... 2432 2433class Region: 2434 __hash__: ClassVar[None] = None 2435 @overload 2436 def __eq__(self, arg0: Region) -> bool: ... 2437 @overload 2438 def __eq__(self, arg0: object) -> bool: ... 2439 def __iter__(self) -> BlockIterator: 2440 """ 2441 Iterates over blocks in the region. 2442 """ 2443 @property 2444 def blocks(self) -> BlockList: 2445 """ 2446 Returns a forward-optimized sequence of blocks. 2447 """ 2448 @property 2449 def owner(self) -> OpView: 2450 """ 2451 Returns the operation owning this region. 2452 """ 2453 2454class RegionIterator: 2455 def __iter__(self) -> RegionIterator: ... 2456 def __next__(self) -> Region: ... 2457 2458class RegionSequence: 2459 def __getitem__(self, arg0: int) -> Region: ... 2460 def __iter__(self) -> RegionIterator: ... 2461 def __len__(self) -> int: ... 2462 2463class ShapedType(Type): 2464 @staticmethod 2465 def get_dynamic_size() -> int: 2466 """ 2467 Returns the value used to indicate dynamic dimensions in shaped types. 2468 """ 2469 @staticmethod 2470 def get_dynamic_stride_or_offset() -> int: 2471 """ 2472 Returns the value used to indicate dynamic strides or offsets in shaped types. 2473 """ 2474 @staticmethod 2475 def is_dynamic_size(dim_size: int) -> bool: 2476 """ 2477 Returns whether the given dimension size indicates a dynamic dimension. 2478 """ 2479 @staticmethod 2480 def isinstance(other: Type) -> bool: ... 2481 def __init__(self, cast_from_type: Type) -> None: ... 2482 def get_dim_size(self, dim: int) -> int: 2483 """ 2484 Returns the dim-th dimension of the given ranked shaped type. 2485 """ 2486 def is_dynamic_dim(self, dim: int) -> bool: 2487 """ 2488 Returns whether the dim-th dimension of the given shaped type is dynamic. 2489 """ 2490 def is_dynamic_stride_or_offset(self, dim_size: int) -> bool: 2491 """ 2492 Returns whether the given value is used as a placeholder for dynamic strides and offsets in shaped types. 2493 """ 2494 @property 2495 def element_type(self) -> Type: 2496 """ 2497 Returns the element type of the shaped type. 2498 """ 2499 @property 2500 def has_rank(self) -> bool: 2501 """ 2502 Returns whether the given shaped type is ranked. 2503 """ 2504 @property 2505 def has_static_shape(self) -> bool: 2506 """ 2507 Returns whether the given shaped type has a static shape. 2508 """ 2509 @property 2510 def rank(self) -> int: 2511 """ 2512 Returns the rank of the given ranked shaped type. 2513 """ 2514 @property 2515 def shape(self) -> list[int]: 2516 """ 2517 Returns the shape of the ranked shaped type as a List of integers. 2518 """ 2519 @property 2520 def static_typeid(self) -> TypeID: ... 2521 @property 2522 def typeid(self) -> TypeID: ... 2523 2524class ShapedTypeComponents: 2525 @staticmethod 2526 @overload 2527 def get(element_type: Type) -> ShapedTypeComponents: 2528 """ 2529 Create an shaped type components object with only the element type. 2530 """ 2531 @staticmethod 2532 @overload 2533 def get(shape: list, element_type: Type) -> ShapedTypeComponents: 2534 """ 2535 Create a ranked shaped type components object. 2536 """ 2537 @staticmethod 2538 @overload 2539 def get( 2540 shape: list, element_type: Type, attribute: Attribute 2541 ) -> ShapedTypeComponents: 2542 """ 2543 Create a ranked shaped type components object with attribute. 2544 """ 2545 @property 2546 def element_type(self) -> Type: 2547 """ 2548 Returns the element type of the shaped type components. 2549 """ 2550 @property 2551 def has_rank(self) -> bool: 2552 """ 2553 Returns whether the given shaped type component is ranked. 2554 """ 2555 @property 2556 def rank(self) -> int: 2557 """ 2558 Returns the rank of the given ranked shaped type components. If the shaped type components does not have a rank, None is returned. 2559 """ 2560 @property 2561 def shape(self) -> list[int]: 2562 """ 2563 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. 2564 """ 2565 2566class StridedLayoutAttr(Attribute): 2567 static_typeid: ClassVar[TypeID] 2568 @staticmethod 2569 def get( 2570 offset: int, strides: list[int], context: Context | None = None 2571 ) -> StridedLayoutAttr: 2572 """ 2573 Gets a strided layout attribute. 2574 """ 2575 @staticmethod 2576 def get_fully_dynamic( 2577 rank: int, context: Context | None = None 2578 ) -> StridedLayoutAttr: 2579 """ 2580 Gets a strided layout attribute with dynamic offset and strides of a given rank. 2581 """ 2582 @staticmethod 2583 def isinstance(other: Attribute) -> bool: ... 2584 def __init__(self, cast_from_attr: Attribute) -> None: ... 2585 @property 2586 def offset(self) -> int: 2587 """ 2588 Returns the value of the float point attribute 2589 """ 2590 @property 2591 def strides(self) -> list[int]: 2592 """ 2593 Returns the value of the float point attribute 2594 """ 2595 @property 2596 def type(self) -> Type: ... 2597 @property 2598 def typeid(self) -> TypeID: ... 2599 2600class StringAttr(Attribute): 2601 static_typeid: ClassVar[TypeID] 2602 @staticmethod 2603 def get(value: str | bytes, context: Context | None = None) -> StringAttr: 2604 """ 2605 Gets a uniqued string attribute 2606 """ 2607 @staticmethod 2608 def get_typed(type: Type, value: str) -> StringAttr: 2609 """ 2610 Gets a uniqued string attribute associated to a type 2611 """ 2612 @staticmethod 2613 def isinstance(other: Attribute) -> bool: ... 2614 def __init__(self, cast_from_attr: Attribute) -> None: ... 2615 @property 2616 def type(self) -> Type: ... 2617 @property 2618 def typeid(self) -> TypeID: ... 2619 @property 2620 def value(self) -> str: 2621 """ 2622 Returns the value of the string attribute 2623 """ 2624 @property 2625 def value_bytes(self) -> bytes: 2626 """ 2627 Returns the value of the string attribute as `bytes` 2628 """ 2629 2630class SymbolRefAttr(Attribute): 2631 @staticmethod 2632 def get(symbols: list[str], context: Context | None = None) -> Attribute: 2633 """ 2634 Gets a uniqued SymbolRef attribute from a List of symbol names 2635 """ 2636 @staticmethod 2637 def isinstance(other: Attribute) -> bool: ... 2638 def __init__(self, cast_from_attr: Attribute) -> None: ... 2639 @property 2640 def static_typeid(self) -> TypeID: ... 2641 @property 2642 def type(self) -> Type: ... 2643 @property 2644 def typeid(self) -> TypeID: ... 2645 @property 2646 def value(self) -> list[str]: 2647 """ 2648 Returns the value of the SymbolRef attribute as a List[str] 2649 """ 2650 2651class SymbolTable: 2652 @staticmethod 2653 def get_symbol_name(symbol: _OperationBase) -> Attribute: ... 2654 @staticmethod 2655 def get_visibility(symbol: _OperationBase) -> Attribute: ... 2656 @staticmethod 2657 def replace_all_symbol_uses( 2658 old_symbol: str, new_symbol: str, from_op: _OperationBase 2659 ) -> None: ... 2660 @staticmethod 2661 def set_symbol_name(symbol: _OperationBase, name: str) -> None: ... 2662 @staticmethod 2663 def set_visibility(symbol: _OperationBase, visibility: str) -> None: ... 2664 @staticmethod 2665 def walk_symbol_tables( 2666 from_op: _OperationBase, 2667 all_sym_uses_visible: bool, 2668 callback: Callable[[_OperationBase, bool], None], 2669 ) -> None: ... 2670 def __contains__(self, arg0: str) -> bool: ... 2671 def __delitem__(self, arg0: str) -> None: ... 2672 def __getitem__(self, arg0: str) -> OpView: ... 2673 def __init__(self, arg0: _OperationBase) -> None: ... 2674 def erase(self, operation: _OperationBase) -> None: ... 2675 def insert(self, operation: _OperationBase) -> Attribute: ... 2676 2677class TupleType(Type): 2678 static_typeid: ClassVar[TypeID] 2679 @staticmethod 2680 def get_tuple(elements: list[Type], context: Context | None = None) -> TupleType: 2681 """ 2682 Create a Tuple type 2683 """ 2684 @staticmethod 2685 def isinstance(other: Type) -> bool: ... 2686 def __init__(self, cast_from_type: Type) -> None: ... 2687 def get_type(self, pos: int) -> Type: 2688 """ 2689 Returns the pos-th type in the Tuple type. 2690 """ 2691 @property 2692 def num_types(self) -> int: 2693 """ 2694 Returns the number of types contained in a Tuple. 2695 """ 2696 @property 2697 def typeid(self) -> TypeID: ... 2698 2699class TypeAttr(Attribute): 2700 static_typeid: ClassVar[TypeID] 2701 @staticmethod 2702 def get(value: Type, context: Context | None = None) -> TypeAttr: 2703 """ 2704 Gets a uniqued Type attribute 2705 """ 2706 @staticmethod 2707 def isinstance(other: Attribute) -> bool: ... 2708 def __init__(self, cast_from_attr: Attribute) -> None: ... 2709 @property 2710 def type(self) -> Type: ... 2711 @property 2712 def typeid(self) -> TypeID: ... 2713 @property 2714 def value(self) -> Type: ... 2715 2716class TypeID: 2717 def _CAPICreate(self) -> TypeID: ... 2718 @overload 2719 def __eq__(self, arg0: TypeID) -> bool: ... 2720 @overload 2721 def __eq__(self, arg0: Any) -> bool: ... 2722 def __hash__(self) -> int: ... 2723 @property 2724 def _CAPIPtr(self) -> object: ... 2725 2726class UnitAttr(Attribute): 2727 static_typeid: ClassVar[TypeID] 2728 @staticmethod 2729 def get(context: Context | None = None) -> UnitAttr: 2730 """ 2731 Create a Unit attribute. 2732 """ 2733 @staticmethod 2734 def isinstance(other: Attribute) -> bool: ... 2735 def __init__(self, cast_from_attr: Attribute) -> None: ... 2736 @property 2737 def type(self) -> Type: ... 2738 @property 2739 def typeid(self) -> TypeID: ... 2740 2741class UnrankedMemRefType(ShapedType): 2742 static_typeid: ClassVar[TypeID] 2743 @staticmethod 2744 def get( 2745 element_type: Type, memory_space: Attribute, loc: Location | None = None 2746 ) -> UnrankedMemRefType: 2747 """ 2748 Create a unranked memref type 2749 """ 2750 @staticmethod 2751 def isinstance(other: Type) -> bool: ... 2752 def __init__(self, cast_from_type: Type) -> None: ... 2753 @property 2754 def memory_space(self) -> Attribute | None: 2755 """ 2756 Returns the memory space of the given Unranked MemRef type. 2757 """ 2758 @property 2759 def typeid(self) -> TypeID: ... 2760 2761class UnrankedTensorType(ShapedType): 2762 static_typeid: ClassVar[TypeID] 2763 @staticmethod 2764 def get(element_type: Type, loc: Location | None = None) -> UnrankedTensorType: 2765 """ 2766 Create a unranked tensor type 2767 """ 2768 @staticmethod 2769 def isinstance(other: Type) -> bool: ... 2770 def __init__(self, cast_from_type: Type) -> None: ... 2771 @property 2772 def typeid(self) -> TypeID: ... 2773 2774class VectorType(ShapedType): 2775 static_typeid: ClassVar[TypeID] 2776 @staticmethod 2777 def get( 2778 shape: list[int], 2779 element_type: Type, 2780 *, 2781 scalable: list | None = None, 2782 scalable_dims: list[int] | None = None, 2783 loc: Location | None = None, 2784 ) -> VectorType: 2785 """ 2786 Create a vector type 2787 """ 2788 @staticmethod 2789 def isinstance(other: Type) -> bool: ... 2790 def __init__(self, cast_from_type: Type) -> None: ... 2791 @property 2792 def scalable(self) -> bool: ... 2793 @property 2794 def scalable_dims(self) -> list[bool]: ... 2795 @property 2796 def typeid(self) -> TypeID: ... 2797 2798class _GlobalDebug: 2799 flag: ClassVar[bool] = False 2800