[Mlir-commits] [mlir] 0702838 - [mlir][vector] Clarify OOB semantics of remaining load/store ops
Jakub Kuderski
llvmlistbot at llvm.org
Tue Mar 14 08:02:32 PDT 2023
Author: Jakub Kuderski
Date: 2023-03-14T11:02:21-04:00
New Revision: 070283825aaff778f7fb527ebc4ef74c84b6c889
URL: https://github.com/llvm/llvm-project/commit/070283825aaff778f7fb527ebc4ef74c84b6c889
DIFF: https://github.com/llvm/llvm-project/commit/070283825aaff778f7fb527ebc4ef74c84b6c889.diff
LOG: [mlir][vector] Clarify OOB semantics of remaining load/store ops
This is a follow up for https://reviews.llvm.org/D145824 that clarifies
the out-of-bounds behavior for other masked load/store ops. It uses the
same wording and informal semantics syntax as `gather` and `scatter`.
Issue: https://github.com/llvm/llvm-project/issues/60905
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D145975
Added:
Modified:
mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td b/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
index b9815664dfed0..539486f48d49d 100644
--- a/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
+++ b/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
@@ -1751,10 +1751,16 @@ def Vector_MaskedLoadOp :
element is read from memory. Otherwise, the corresponding element is taken
from a 1-D pass-through vector. Informally the semantics are:
```
- result[0] := mask[0] ? base[i+0] : pass_thru[0]
- result[1] := mask[1] ? base[i+1] : pass_thru[1]
+ result[0] := if mask[0] then base[i + 0] else pass_thru[0]
+ result[1] := if mask[1] then base[i + 1] else pass_thru[1]
etc.
```
+
+ If a mask bit is set and the corresponding index is out-of-bounds for the
+ given base, the behavior is undefined. If a mask bit is not set, the value
+ comes from the pass-through vector regardless of the index, and the index is
+ allowed to be out-of-bounds.
+
The masked load can be used directly where applicable, or can be used
during progressively lowering to bring other memory operations closer to
hardware ISA support for a masked load. The semantics of the operation
@@ -1811,6 +1817,12 @@ def Vector_MaskedStoreOp :
if (mask[1]) base[i+1] = value[1]
etc.
```
+
+ If a mask bit is set and the corresponding index is out-of-bounds for the
+ given base, the behavior is undefined. If a mask bit is not set, no value
+ is stored regardless of the index, and the index is allowed to be
+ out-of-bounds.
+
The masked store can be used directly where applicable, or can be used
during progressively lowering to bring other memory operations closer to
hardware ISA support for a masked store. The semantics of the operation
@@ -2008,12 +2020,17 @@ def Vector_ExpandLoadOp :
is taken from a 1-D pass-through vector. Informally the semantics are:
```
index = i
- result[0] := mask[0] ? base[index++] : pass_thru[0]
- result[1] := mask[1] ? base[index++] : pass_thru[1]
+ result[0] := if mask[0] then base[index++] else pass_thru[0]
+ result[1] := if mask[1] then base[index++] else pass_thru[1]
etc.
```
Note that the index increment is done conditionally.
+ If a mask bit is set and the corresponding index is out-of-bounds for the
+ given base, the behavior is undefined. If a mask bit is not set, the value
+ comes from the pass-through vector regardless of the index, and the index is
+ allowed to be out-of-bounds.
+
The expand load can be used directly where applicable, or can be used
during progressively lowering to bring other memory operations closer to
hardware ISA support for an expand. The semantics of the operation closely
@@ -2072,6 +2089,11 @@ def Vector_CompressStoreOp :
```
Note that the index increment is done conditionally.
+ If a mask bit is set and the corresponding index is out-of-bounds for the
+ given base, the behavior is undefined. If a mask bit is not set, no value
+ is stored regardless of the index, and the index is allowed to be
+ out-of-bounds.
+
The compress store can be used directly where applicable, or can be used
during progressively lowering to bring other memory operations closer to
hardware ISA support for a compress. The semantics of the operation closely
More information about the Mlir-commits
mailing list