Issue 239698
Summary [mlir][Vector] `test-vector-transfer-unrolling-patterns` crashes on 3-dimensional `vector.transfer_read`
Labels mlir
Assignees
Reporter pingshiyu
    Reproduced with the optimised LLVM Git `main` build at commit `fb288ec4774f8664b165f6e302db5be8b30a41da` from 04/Nov/2026.

```mlir
func.func @test(%t: tensor<2x2x2xi32>) -> vector<2x2x2xi32> {
  %c0 = arith.constant 0 : index
  %pad = arith.constant 0 : i32
  %x = vector.transfer_read %t[%c0, %c0, %c0], %pad {in_bounds = [true, true, true]} : tensor<2x2x2xi32>, vector<2x2x2xi32>
 return %x : vector<2x2x2xi32>
}
```

```console
mlir-opt repro.mlir '--pass-pipeline=builtin.module(func.func(test-vector-transfer-unrolling-patterns))' 
```

The input verifies and contains only rank-three types. When running the vector transfer pass, we get a crash:
```text
error: 'vector.transfer_read' op requires a permutation_map with result dims of the same rank as the vector type
note: ... permutation_map = affine_map<(d0, d1, d2) -> (d0, d1, d2)> ... -> vector<2x2xi32>
```

## Related cases

Closed #148368 fixed the analogous rank mismatch in the transfer-write unroll pattern by adding a source/target rank guard. This is the read counterpart, whose pattern lacks that guard. It is not #216640's multi-reduction slicing failure.

## LLM-Suggested Cause

`UnrollTransferReadPattern` accepts a target shape whose rank differs from the source vector rank, unlike the write pattern. The rewrite then retains rank-three attributes on a rank-two transfer.

## 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

Reply via email to