Issue 131528
Summary [mlir][vector] Narrow-type-emulation - incorrect result
Labels mlir:vector
Assignees
Reporter banach-space
    Hi,

I was experimenting with [the narrow type emulation](https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/Vector/Transforms/VectorEmulateNarrowType.cpp) and noticed that this "unaligned" example:
```mlir
func.func @experiment(%arg0: vector<4xi2>) {
    %src = "" : memref<3x4xi2>
    %c0 = arith.constant 0 : index
    %c1 = arith.constant 1 : index
    vector.store %arg0, %src[%c0, %c1] : memref<3x4xi2>, vector<4xi2>
    return
}
```

is incorrectly rewritten as (note that the final index is `%c0`):
```bash
$ bin/mlir-opt --test-emulate-narrow-int="arith-compute-bitwidth=1 memref-load-bitwidth=8" file.mlir
  func.func @experiment(%arg0: vector<4xi2>) {
    %alloc = memref.alloc() : memref<3xi8>
    %0 = vector.bitcast %arg0 : vector<4xi2> to vector<1xi8>
    %c0 = arith.constant 0 : index
    vector.store %0, %alloc[%c0] : memref<3xi8>, vector<1xi8>
    return
  }
```

I think I know _what_ needs updating, so will try to fix it whenever I get a chance. Unless there are volunteers in the meantime 😅 

-Andrzej
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to