[Mlir-commits] [mlir] [mlir][Vector] Handle 0-rank case in fold instead of RewriterPattern (PR #130168)

Andrzej WarzyƄski llvmlistbot at llvm.org
Mon Mar 10 03:54:30 PDT 2025


================
@@ -2159,13 +2159,11 @@ class ExtractOpFromBroadcast final : public OpRewritePattern<ExtractOp> {
     // folding patterns.
     if (extractResultRank < broadcastSrcRank)
       return failure();
+    // For scalar result, the input can only be a zero-dim vector, which will
+    // be handled by the folder.
----------------
banach-space wrote:

"zero-dim" is IMO ambiguous and we should avoid that term. Note:
* `vector<0xf32>` - zero-dim vector
* `vector<f32>` - rank-zero vector

I know that in many places we use the term `0D`, but that usually means "zero dimensional` (and e.g. "2D" means two-dimensional). My suggest:
> For scalar results, let the fold pattern/method handle it.

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


More information about the Mlir-commits mailing list