[Mlir-commits] [mlir] [mlir][Vector] Add patterns to lower `vector.shuffle` (PR #157611)

Andrzej WarzyƄski llvmlistbot at llvm.org
Mon Sep 15 03:10:08 PDT 2025


================
@@ -1040,6 +1040,22 @@ struct TestEliminateVectorMasks
                          VscaleRange{vscaleMin, vscaleMax});
   }
 };
+
+struct TestVectorShuffleLowering
+    : public PassWrapper<TestVectorShuffleLowering,
+                         OperationPass<func::FuncOp>> {
+  MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestVectorShuffleLowering)
+
+  StringRef getArgument() const final { return "test-vector-shuffle-lowering"; }
+  StringRef getDescription() const final {
+    return "Test lowering patterns for vector.shuffle with mixed-size inputs";
+  }
+  void runOnOperation() override {
+    RewritePatternSet patterns(&getContext());
+    populateVectorShuffleLoweringPatterns(patterns);
+    (void)applyPatternsGreedily(getOperation(), std::move(patterns));
+  }
+};
----------------
banach-space wrote:

Is this added merely for testing?

My personal view is that TD ops scale better when it comes to testing - especially when a single `populate*` method is to be used (e.g. less boiler plate C++ required). Also, with TD Ops you can write (and nicely annotate) complex lowering pipelines, e.g. https://github.com/llvm/llvm-project/blob/5437d90bb72e38ad767dd2e130d23675130a7857/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/pack-unpack-scalable-inner-tile.mlir#L142-L183

Basically, I do end-up re-using TD Ops in other places. I very rarely re-use these "test passes".  We don't have any official guidelines, but if you don't mind, I'd prefer a TD Op for testing :)

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


More information about the Mlir-commits mailing list