[Mlir-commits] [mlir] [mlir][memref] Allow out-of-bounds semantics for memref.subview (PR #152164)

Matthias Springer llvmlistbot at llvm.org
Tue Aug 5 11:51:31 PDT 2025


================
@@ -2047,11 +2047,9 @@ def SubViewOp : MemRef_OpWithOffsetSizesAndStrides<"subview", [
     result_offset = src_offset + dot_product(offset_operands, src_strides)
     ```
 
-    The offset, size and stride operands must be in-bounds with respect to the
-    source memref. When possible, the static operation verifier will detect
-    out-of-bounds subviews. Subviews that cannot be confirmed to be in-bounds
-    or out-of-bounds based on compile-time information are valid. However,
-    performing an out-of-bounds subview at runtime is undefined behavior.
+    The operation does not guarantee if the created subview is in-bounds. It is
+    the responsibility of the user to guarantee there are no out-of-bounds
+    accesses into the subview.
----------------
matthias-springer wrote:

@Groverkss Can you describe the use case that you have in mind? If the result is poisoned (which would make sense to me), loading from it will also be poison (even if the out-of-bounds element will be masked out). I suspect you want to use `memref.subview` just as an op that does index computations


https://github.com/llvm/llvm-project/pull/152164


More information about the Mlir-commits mailing list