[Mlir-commits] [mlir] [MLIR][Python] enhance python ir printing with pringing flags (PR #117836)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Thu Dec 5 00:17:44 PST 2024
================
@@ -342,6 +342,33 @@ def testPrintIrBeforeAndAfterAll():
pm.run(module)
+# CHECK-LABEL: TEST: testPrintIrLargeLimitElements
+ at run
+def testPrintIrLargeLimitElements():
+ with Context() as ctx:
+ module = ModuleOp.parse(
+ """
+ module {
+ func.func @main() -> tensor<3xi64> {
+ %0 = arith.constant dense<[1, 2, 3]> : tensor<3xi64>
+ return %0 : tensor<3xi64>
+ }
+ }
+ """
+ )
+ pm = PassManager.parse("builtin.module(canonicalize)")
+ ctx.enable_multithreading(False)
+ pm.enable_ir_printing(large_elements_limit=2)
+ # CHECK: // -----// IR Dump After Canonicalizer (canonicalize) //----- //
+ # CHECK: module {
+ # CHECK: func.func @main() -> tensor<3xi64> {
+ # CHECK: %[[CST:.*]] = arith.constant dense_resource<__elided__> : tensor<3xi64>
+ # CHECK: return %[[CST]] : tensor<3xi64>
+ # CHECK: }
+ # CHECK: }
----------------
ftynse wrote:
```suggestion
```
It is sufficient to check for the specific behavior the flag is changing: large resource elision. The rest is likely to get spuriously broken when syntax changes.
https://github.com/llvm/llvm-project/pull/117836
More information about the Mlir-commits
mailing list