[Mlir-commits] [mlir] [mlir][vector] Relax constraints on shape_cast (PR #136587)

Andrzej WarzyƄski llvmlistbot at llvm.org
Mon Apr 28 07:41:03 PDT 2025


================
@@ -543,6 +543,20 @@ func.func @vector_print_on_scalar(%arg0: i64) {
   return
 }
 
+// CHECK-LABEL: @shape_cast_valid_rank_reduction
+func.func @shape_cast_valid_rank_reduction(%arg0 : vector<5x1x3x2xf32>) {
+  // CHECK: vector.shape_cast %{{.*}} : vector<5x1x3x2xf32> to vector<2x15xf32>
+  %0 = vector.shape_cast %arg0 : vector<5x1x3x2xf32> to vector<2x15xf32>
+  return
+}
----------------
banach-space wrote:

This is super similar to the example below (from `@shape_cast`):
```mlir
  %0 = vector.shape_cast %arg0 : vector<5x1x3x2xf32> to vector<15x2xf32>
```

What makes this example different? Is it about "collapsing" vs "expanding"? If yes, it would be could to capture (somehow) via e.g. function names (or with comments).

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


More information about the Mlir-commits mailing list