[Mlir-commits] [mlir] [mlir][python] add type wrappers (PR #71218)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Tue Nov 14 06:39:38 PST 2023


================
@@ -0,0 +1,207 @@
+from functools import partial
+from typing import Optional
+
+from .ir import (
+    Attribute,
+    BF16Type,
+    ComplexType,
+    F16Type,
+    F32Type,
+    F64Type,
+    Float8E4M3B11FNUZType,
+    Float8E4M3FNType,
+    Float8E5M2Type,
+    FunctionType,
+    IndexType,
+    IntegerType,
+    MemRefType,
+    NoneType,
+    OpaqueType,
+    RankedTensorType,
+    StridedLayoutAttr,
+    StringAttr,
+    TupleType,
+    Type,
+    UnrankedMemRefType,
+    UnrankedTensorType,
+    VectorType,
+)
+
+from .dialects import transform
+from .dialects import pdl
----------------
ftynse wrote:

We don't want to import dialects from "main" mlir module. These dialects can provide similar functionality in additional modules, so one can do something like `import mlir.dialects.transform.types as transform_type`. 

We can consider some injection mechanism to keep everything under one namespace, but honestly `transform_type.any_op` doesn't read much worse than `T.transform_any_op` and is slightly clearer as to which dialect does the type belong to.

https://github.com/llvm/llvm-project/pull/71218


More information about the Mlir-commits mailing list