[Mlir-commits] [mlir] [MLIR] [AMX] Fix strides used by AMX lowering for tile loads and stores. (PR #113476)

Renato Golin llvmlistbot at llvm.org
Mon Oct 28 11:53:23 PDT 2024


================
@@ -55,21 +55,25 @@ Value getStride(ConversionPatternRewriter &rewriter,
                 const LLVMTypeConverter &typeConverter, MemRefType mType,
                 Value base, Location loc) {
   assert(mType.getRank() >= 2);
-  int64_t last = mType.getRank() - 1;
+  int64_t preLast = mType.getRank() - 2;
----------------
rengolin wrote:

But one could call this method where the last stride isn't one, not having called `verifyStride`.

My point is that this is a static local function that is only ever used by this file and doesn't need to be split this way. You're also calling `getStridesAndOffset` twice (verify and get), which is unnecessary.

I'd just move the verify logic inside `getStride`, call `getStridesAndOffset` and return `failure`. You'd also need to change the return value of `getStride` to `failure or<Value>` and wrap around the two existing calls.

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


More information about the Mlir-commits mailing list