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

Mehdi Amini llvmlistbot at llvm.org
Tue Aug 5 11:41:21 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.
----------------
joker-eph wrote:

Shall we use poison?
```suggestion
    It is legal to use this operation to create a subview that is out-of-bounds, however
    the returned value is poison and access to the subview will trigger undefined-behavior.
```

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


More information about the Mlir-commits mailing list