| Issue |
239710
|
| Summary |
[mlir][VectorToSCF] `vector.transfer_read` reads wrong dimensions, rejecting valid program
|
| Labels |
mlir
|
| Assignees |
|
| Reporter |
pingshiyu
|
Reproduced with the optimized LLVM Git `main` build at commit `fb288ec4774f8664b165f6e302db5be8b30a41da` from 04/Nov/2026.
```mlir
func.func @test(%t: tensor<3x1x1xi32>, %mask: vector<3x1xi1>) -> vector<1x3xi32> {
%c0 = arith.constant 0 : index
%pad = arith.constant 0 : i32
%x = vector.transfer_read %t[%c0, %c0, %c0], %pad, %mask {permutation_map = affine_map<(d0, d1, d2) -> (d1, d0)>, in_bounds = [true, true]} : tensor<3x1x1xi32>, vector<1x3xi32>
return %x : vector<1x3xi32>
}
```
```console
mlir-opt repro.mlir '--pass-pipeline=builtin.module(func.func(convert-vector-to-scf{lower-tensors=true}))' -o /dev/null
```
The program verifies, but conversion fails with:
```text
error: 'vector.transfer_read' op inferred mask type ('vector<3xi1>') and mask operand type ('vector<1xi1>') don't match
```
The pass peels vector dimension zero and mask dimension zero. With the permutation map, vector dimension zero corresponds to mask dimension one. A memref variant with result `vector<2x3xi32>` and mask `vector<3x2xi1>` lowers to a three-trip loop that dynamically extracts from `vector<2xi1>`, including lane 2.
## Related cases
PR #229852 fixed a different transfer-write mask-rank-extension problem. #71326 concerned broadcast/rank-reduced mask-buffer indices, and #206209 started from invalid transfer input. This case begins with valid permuted transfer-read IR and fails while selecting an existing mask dimension.
## LLM-Suggested Cause
Progressive transfer conversion peels mask dimension zero unconditionally instead of mapping the peeled vector dimension through the transfer permutation.
## LLM Declaration
LLM was used to prepare the bug report, and the bug itself was found and verified by a human.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs