[Mlir-commits] [mlir] [mlir][vector] Extend vector.gather e2e test (PR #187071)

Han-Chung Wang llvmlistbot at llvm.org
Tue Mar 17 10:47:23 PDT 2026


================
@@ -16,22 +31,29 @@ func.func @entry() {
   %c0 = arith.constant 0: index
   %c1 = arith.constant 1: index
   %c10 = arith.constant 10: index
-  %A = memref.alloc(%c10) : memref<?xf32>
+  %c5 = arith.constant 5: index
+  %A = memref.alloc(%c10, %c5) : memref<?x?xf32>
   scf.for %i = %c0 to %c10 step %c1 {
-    %i32 = arith.index_cast %i : index to i32
-    %fi = arith.sitofp %i32 : i32 to f32
-    memref.store %fi, %A[%i] : memref<?xf32>
+    scf.for %j = %c0 to %c5 step %c1 {
+      %off = arith.muli %i, %c10 : index
----------------
hanhanW wrote:

I thought that it is writing `[0, n)` to the memory, but I was wrong. Is it intended to use `%c10` but not `%c5` here? The current values are:

```
  ┌─────┬─────┬─────┬─────┬─────┬─────┐
  │     │ j=0 │ j=1 │ j=2 │ j=3 │ j=4 │
  ├─────┼─────┼─────┼─────┼─────┼─────┤
  │ i=0 │ 0   │ 1   │ 2   │ 3   │ 4   │
  ├─────┼─────┼─────┼─────┼─────┼─────┤
  │ i=1 │ 10  │ 11  │ 12  │ 13  │ 14  │
  ├─────┼─────┼─────┼─────┼─────┼─────┤
  │ i=2 │ 20  │ 21  │ 22  │ 23  │ 24  │
  ├─────┼─────┼─────┼─────┼─────┼─────┤
  │ i=3 │ 30  │ 31  │ 32  │ 33  │ 34  │
  ├─────┼─────┼─────┼─────┼─────┼─────┤
  │ i=4 │ 40  │ 41  │ 42  │ 43  │ 44  │
  ├─────┼─────┼─────┼─────┼─────┼─────┤
  │ ... │     │     │     │     │     │
  ├─────┼─────┼─────┼─────┼─────┼─────┤
  │ i=8 │ 80  │ 81  │ 82  │ 83  │ 84  │
  └─────┴─────┴─────┴─────┴─────┴─────┘
```

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


More information about the Mlir-commits mailing list