[Mlir-commits] [mlir] [mlir][vector] Account for subview offset in gather lowering. (PR #195359)

Lukas Sommer llvmlistbot at llvm.org
Mon May 4 01:10:43 PDT 2026


================
@@ -134,27 +141,64 @@ struct RemoveStrideFromGatherSource : OpRewritePattern<vector::GatherOp> {
     if (stridedLayoutAttr.getStrides()[0] != srcTrailingDim)
       return failure();
 
+    // The result memref's offset is the linearized position of the subview's
+    // first element within the source memref. Bail out on dynamic offsets so
+    // we don't have to materialize them; the conditional-load fallback will
+    // still produce correct code.
+    int64_t subviewOffset = stridedLayoutAttr.getOffset();
+    if (ShapedType::isDynamic(subviewOffset))
----------------
sommerlukas wrote:

Nit: Also add the `TODO: Support dynamic offsets` here, not just in the test.

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


More information about the Mlir-commits mailing list