[Mlir-commits] [mlir] [mlir][vector] Fix vector.gather lowering for strided memrefs. (PR #184706)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Fri Mar 13 04:08:41 PDT 2026
================
@@ -289,3 +291,60 @@ func.func @scalable_gather_1d(%base: tensor<?xf32>, %v: vector<[2]xindex>, %mask
%0 = vector.gather %base[%c0][%v], %mask, %pass_thru : tensor<?xf32>, vector<[2]xindex>, vector<[2]xi1>, vector<[2]xf32> into vector<[2]xf32>
return %0 : vector<[2]xf32>
}
+
+// Verify that gather on a strided 2D memref with zero base offsets
+// delinearizes the gather index directly (linearize and addi fold away).
----------------
banach-space wrote:
IIUC, the fact that the memref is stridded is not relevant here, is it? Indeed, the strides are not used, right? In fact, this is quite similar to `@gather_memref_non_unit_stride_read_more_than_1_element`, but 2D instead of 1D. We also have `@strided_gather` above.
1. Could you re-use one of the existing tests and simply replace 1D with 2D in its name? (so that it's clear what's the most important unique part of this test)
2. Shouldn't all of them use linearize/delinearize?
https://github.com/llvm/llvm-project/pull/184706
More information about the Mlir-commits
mailing list