[Mlir-commits] [mlir] [mlir][vector] Remove unit-stride check in Gather1DToConditionalLoads (PR #189178)

Jorn Tuyls llvmlistbot at llvm.org
Mon Mar 30 00:52:35 PDT 2026


================
@@ -195,16 +195,6 @@ struct Gather1DToConditionalLoads : OpRewritePattern<vector::GatherOp> {
     // correct N-D load indices from the 1-D gather index.
     bool useDelinearization = false;
     if (auto memType = dyn_cast<MemRefType>(base.getType())) {
-      // vector.load requires the most minor memref dim to have unit stride
-      // (unless reading exactly 1 element).
-      if (auto stridesAttr =
-              dyn_cast_if_present<StridedLayoutAttr>(memType.getLayout())) {
-        if (stridesAttr.getStrides().back() != 1 &&
-            resultTy.getNumElements() != 1)
----------------
jtuyls wrote:

> Do we always lower to scalar loads though? Normally I'd check myself, but I am reading this on my phone - I'm OOO ATM.

In this pattern set yes (`Gather1DToConditionalLoads`, `RemoveStrideFromGatherSource`), which will typically run for cpu (and it seems some GPU) targets.

> Sadly, I won't be able to properly engage with this PR until after Easter. Sorry for the delay!

No worries, happy to wait until after Easter. Thanks for the discussion already!

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


More information about the Mlir-commits mailing list