[all-commits] [llvm/llvm-project] 4e9eaa: [mlir][vector] Allow out-of-bounds starting positi...
Matthias Springer via All-commits
all-commits at lists.llvm.org
Wed Aug 2 06:37:23 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 4e9eaa2e521dc4e0e5f01df9a9ea56204271519e
https://github.com/llvm/llvm-project/commit/4e9eaa2e521dc4e0e5f01df9a9ea56204271519e
Author: Matthias Springer <me at m-sp.org>
Date: 2023-08-02 (Wed, 02 Aug 2023)
Changed paths:
M mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
M mlir/test/Integration/Dialect/Vector/CPU/test-transfer-read-1d.mlir
M mlir/test/Integration/Dialect/Vector/CPU/test-transfer-read-2d.mlir
Log Message:
-----------
[mlir][vector] Allow out-of-bounds starting positition for vector transfer ops
The starting indices of all vector dimensions are allowed to be out-of-bounds.
E.g.:
```
// %j is allowed to be out-of-bounds (but not %i).
%0 = vector.transfer_read %m[%i, %j] ... {in_bounds = [false]} : memref<?x?xf32>, vector<5xf32>
```
This revision just updates the op documentation and adds extra test cases. Out-of-bounds starting points are already supported by the respective lowerings:
* 2D and higher-dimensional transfers are lowered to 1D transfers by `VectorToScf`. These patterns generate an `scf.if` check for every (potentially unrolled) loop iteration if the dimension is `in_bounds = false`, including the first loop iteration.
- 1D out-of-bounds transfers are lowered to in-bounds transfers by `MaterializeTransferMask`, which adds a mask to the op. The mask is defined by `vector.create_mask (dim-size) - (index)`. In case of an out-of-bounds starting point, the operand of the `vector.create_mask` op is 0 or negative. Negative operands are treated like 0 according to the documentation of `vector.create_mask`.
Differential Revision: https://reviews.llvm.org/D155719
More information about the All-commits
mailing list