[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;
   Type llvmInt64Type = IntegerType::get(&typeConverter.getContext(), 64);
   unsigned width = mType.getElementType().getIntOrFloatBitWidth();
   assert(llvm::isPowerOf2_64(width) && width >= 8);
   unsigned bytes = width >> 3;
-  if (mType.isDynamicDim(last)) {
-    // Dynamic size needs code to compute the stride at runtime.
+  int64_t offset;
+  SmallVector<int64_t, 4> strides;
+  getStridesAndOffset(mType, strides, offset);
----------------
rengolin wrote:

I see what you mean. `getStridesAndOffset` will get the actual strides, regardless if they're implicit or explicit. There's a lot of afine computations in that function, so we should avoid calling it too many times, and fuse the two utility functions as described above.

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


More information about the Mlir-commits mailing list