[Mlir-commits] [mlir] [mlir][vector-to-gpu]: Extend MMA Lowerings (PR #176785)
Jack Frankland
llvmlistbot at llvm.org
Mon Feb 2 02:34:57 PST 2026
================
@@ -130,7 +147,13 @@ static std::optional<int64_t> getStaticallyKnownRowStride(ShapedType type) {
if (failed(memrefType.getStridesAndOffset(strides, offset)) ||
strides.back() != 1)
return std::nullopt;
- int64_t stride = strides[strides.size() - 2];
+
+ int stridePostion = strides.size() - 2;
+ if (!permutationMap.isPermutation()) {
+ if (auto outerResult = dyn_cast<AffineDimExpr>(permutationMap.getResult(0)))
----------------
FranklandJack wrote:
Good questions.
> So, permutationMap must be 2D. Do we need to add some checking in this function?
This is a precondition of the function and is checked by the caller [here](https://github.com/llvm/llvm-project/pull/176785/changes#diff-b440b410c31f183ebdcce48e43d7fe089095fddb531232ef23b6508046479b9dR165) and [here](https://github.com/llvm/llvm-project/pull/176785/changes#diff-b440b410c31f183ebdcce48e43d7fe089095fddb531232ef23b6508046479b9dR195). But since this is a standalone helper function that could be used elsewhere I think it'd be good to add a check as you suggested.
> When permutationMap[0] is not affine dimension, you skip the updating of stridePostion instead of returning std::nullopt. Can you add a test case to show it is still correct even when permutationMap[0] is not affine dimension.
Good point, I think if any of the results of the permutation map aren't affine dimensions then we are in trouble 😨 I'll add a test case to check the lowering fails if that happens.
https://github.com/llvm/llvm-project/pull/176785
More information about the Mlir-commits
mailing list