[Mlir-commits] [mlir] [mlir][python] add type wrappers (PR #71218)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Tue Nov 14 06:39:37 PST 2023
================
@@ -772,3 +773,97 @@ def testCustomTypeTypeCaster():
print(t)
# CHECK: OperationType(!transform.op<"foo.bar">)
print(repr(t))
+
+
+# CHECK-LABEL: TEST: testTypeWrappers
+ at run
+def testTypeWrappers():
+ try:
+ from mlir.types import i32
+ except RuntimeError as e:
+ assert e.args[0].startswith(
+ "An MLIR function requires a Context but none was provided"
+ )
+
+ from mlir.types import vector, tensor
----------------
ftynse wrote:
This is rather unfortunate that "primitive" types cannot be imported and raise a cryptic exception on import while "compound" types can be. How about having keeping primitive type builders as functions as well, i.e. `T.i32()`? It's slightly longer and less nice, but has a benefit of being more consistent in both import and usage.
https://github.com/llvm/llvm-project/pull/71218
More information about the Mlir-commits
mailing list