|
| 1 | +diff --git a/mlir/lib/Conversion/XeGPUToXeVM/XeGPUToXeVM.cpp b/mlir/lib/Conversion/XeGPUToXeVM/XeGPUToXeVM.cpp |
| 2 | +index 9ead1d89069d..3822d24c8579 100644 |
| 3 | +--- a/mlir/lib/Conversion/XeGPUToXeVM/XeGPUToXeVM.cpp |
| 4 | ++++ b/mlir/lib/Conversion/XeGPUToXeVM/XeGPUToXeVM.cpp |
| 5 | +@@ -189,9 +189,10 @@ class CreateNdDescToXeVMPattern |
| 6 | + // If source is a memref, we need to extract the aligned pointer as index. |
| 7 | + // Pointer type is passed as i32 or i64 by type converter. |
| 8 | + if (sourceMemrefTy) { |
| 9 | +- if (!sourceMemrefTy.hasStaticShape()) { |
| 10 | +- return rewriter.notifyMatchFailure(op, "Expected static memref shape."); |
| 11 | +- } |
| 12 | ++ // if (!sourceMemrefTy.hasStaticShape()) { |
| 13 | ++ // return rewriter.notifyMatchFailure(op, "Expected static memref |
| 14 | ++ // shape."); |
| 15 | ++ // } |
| 16 | + baseAddr = |
| 17 | + memref::ExtractAlignedPointerAsIndexOp::create(rewriter, loc, source); |
| 18 | + } else { |
| 19 | +diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp |
| 20 | +index e95338f7d18b..2615d225dc1d 100644 |
| 21 | +--- a/mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp |
| 22 | ++++ b/mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp |
| 23 | +@@ -348,6 +349,9 @@ private: |
| 24 | + /// d1) and return vector<16x2x64> |
| 25 | + static VectorType getDistributedType(VectorType originalType, AffineMap map, |
| 26 | + int64_t warpSize) { |
| 27 | ++ // If the map has zero results, that means no distribution. |
| 28 | ++ if (map.getNumResults() == 0) |
| 29 | ++ return originalType; |
| 30 | + SmallVector<int64_t> targetShape(originalType.getShape()); |
| 31 | + for (unsigned i = 0, e = map.getNumResults(); i < e; i++) { |
| 32 | + unsigned position = map.getDimPosition(i); |
| 33 | +diff --git a/mlir/lib/Dialect/XeGPU/Transforms/XeGPUSubgroupDistribute.cpp b/mlir/lib/Dialect/XeGPU/Transforms/XeGPUSubgroupDistribute.cpp |
| 34 | +index f1dbc5ddb202..3023c65d4bc3 100644 |
| 35 | +--- a/mlir/lib/Dialect/XeGPU/Transforms/XeGPUSubgroupDistribute.cpp |
| 36 | ++++ b/mlir/lib/Dialect/XeGPU/Transforms/XeGPUSubgroupDistribute.cpp |
| 37 | +@@ -1506,9 +1506,14 @@ void XeGPUSubgroupDistributePass::runOnOperation() { |
| 38 | + if (!layout) |
| 39 | + return AffineMap::getMultiDimMapWithTargets( |
| 40 | + vecRank, {static_cast<unsigned int>(vecRank - 1)}, val.getContext()); |
| 41 | ++ // Expecting layout and vector rank to match. |
| 42 | ++ assert(layout.getRank() == vecRank && |
| 43 | ++ "vector rank and layout rank must match"); |
| 44 | ++ // A dimension is distributed if its layout value is > 1 and the dimension |
| 45 | ++ // size is evenly divisible by the layout value. |
| 46 | + SmallVector<unsigned int> distributedDims; |
| 47 | + for (auto [i, v] : llvm::enumerate(layout.getEffectiveLaneLayoutAsInt())) { |
| 48 | +- if (v > 1) |
| 49 | ++ if (v > 1 && vecType.getShape()[i] % v == 0) |
| 50 | + distributedDims.push_back(i); |
| 51 | + } |
| 52 | + return AffineMap::getMultiDimMapWithTargets(vecRank, distributedDims, |
0 commit comments