[Mlir-commits] [mlir] [mlir][memref] Verify out-of-bounds access for `memref.subview` (PR #131876)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Tue Mar 25 02:46:10 PDT 2025
================
@@ -1876,118 +1876,73 @@ def SubViewOp : MemRef_OpWithOffsetSizesAndStrides<"subview", [
The representation based on offsets, sizes and strides support a
partially-static specification via attributes specified through the
`static_offsets`, `static_sizes` and `static_strides` arguments. A special
- sentinel value ShapedType::kDynamic encodes that the corresponding entry has
- a dynamic value.
+ sentinel value `ShapedType::kDynamic` encodes that the corresponding entry
+ has a dynamic value.
- A subview operation may additionally reduce the rank of the resulting view
- by removing dimensions that are statically known to be of size 1.
+ A `subview` operation may additionally reduce the rank of the resulting
+ view by removing dimensions that are statically known to be of size 1.
+
+ In the absence of rank reductions, the resulting memref type is computed
+ as follows:
+ ```
+ result_offset = src_offset + dot_product(offset_operands, src_strides)
----------------
banach-space wrote:
[nit] It's hard to find the definition of `MemRef` offset. IIUC, that's only used for strided access:
* https://mlir.llvm.org/docs/Dialects/Builtin/#strided-layout
If that's the most rarely used parameter (leas significant?), than I'd listed it as last rather than first.
https://github.com/llvm/llvm-project/pull/131876
More information about the Mlir-commits
mailing list