[Mlir-commits] [mlir] [MLIR][XeGPU] add dpas_mx op definition and layout propagation rule (PR #194117)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Apr 24 22:59:10 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- mlir/include/mlir/Dialect/XeGPU/Transforms/XeGPULayoutImpl.h mlir/include/mlir/Dialect/XeGPU/uArch/IntelGpuXe2.h mlir/include/mlir/Dialect/XeGPU/uArch/uArchBase.h mlir/lib/Dialect/XeGPU/Transforms/XeGPULayoutImpl.cpp mlir/lib/Dialect/XeGPU/Transforms/XeGPUPropagateLayout.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/include/mlir/Dialect/XeGPU/Transforms/XeGPULayoutImpl.h b/mlir/include/mlir/Dialect/XeGPU/Transforms/XeGPULayoutImpl.h
index 5defec222..75fb3fdcf 100644
--- a/mlir/include/mlir/Dialect/XeGPU/Transforms/XeGPULayoutImpl.h
+++ b/mlir/include/mlir/Dialect/XeGPU/Transforms/XeGPULayoutImpl.h
@@ -202,9 +202,9 @@ setupDpasLayout(LayoutKind layoutKind, VectorType aTy, VectorType bTy,
/// Sets up the anchor layouts for dpas_mx operands (A, B, C/D, A_scale, and
/// B_scale). The numSg and consumerLayout (optional) are only used by sg layout
/// creation. A_scale and B_scale are optional.
-std::optional<std::tuple<DistributeLayoutAttr, DistributeLayoutAttr,
- DistributeLayoutAttr, DistributeLayoutAttr,
- DistributeLayoutAttr>>
+std::optional<
+ std::tuple<DistributeLayoutAttr, DistributeLayoutAttr, DistributeLayoutAttr,
+ DistributeLayoutAttr, DistributeLayoutAttr>>
setupDpasMxLayout(LayoutKind layoutKind, VectorType aTy, VectorType bTy,
VectorType cdTy, std::optional<VectorType> aScaleTy,
std::optional<VectorType> bScaleTy,
diff --git a/mlir/lib/Dialect/XeGPU/Transforms/XeGPUPropagateLayout.cpp b/mlir/lib/Dialect/XeGPU/Transforms/XeGPUPropagateLayout.cpp
index e99af29b2..b5557677b 100644
--- a/mlir/lib/Dialect/XeGPU/Transforms/XeGPUPropagateLayout.cpp
+++ b/mlir/lib/Dialect/XeGPU/Transforms/XeGPUPropagateLayout.cpp
@@ -319,7 +319,8 @@ private:
void visitDpasOp(xegpu::DpasOp dpas, ArrayRef<LayoutInfoLattice *> operands,
ArrayRef<const LayoutInfoLattice *> results);
- void visitDpasMxOp(xegpu::DpasMxOp dpasMx, ArrayRef<LayoutInfoLattice *> operands,
+ void visitDpasMxOp(xegpu::DpasMxOp dpasMx,
+ ArrayRef<LayoutInfoLattice *> operands,
ArrayRef<const LayoutInfoLattice *> results);
void visitStoreNdOp(xegpu::StoreNdOp store,
@@ -825,9 +826,9 @@ void LayoutInfoPropagation::visitDpasOp(
propagateIfChanged(operands[2], operands[2]->meet(dpasCDLayout));
}
-
/// Propagate layout for DpasMxOp operands using the layout attributes.
-/// DpasMxOp has operands: a, b, acc (optional), scale_a (optional), scale_b (optional)
+/// DpasMxOp has operands: a, b, acc (optional), scale_a (optional), scale_b
+/// (optional)
void LayoutInfoPropagation::visitDpasMxOp(
xegpu::DpasMxOp dpasMx, ArrayRef<LayoutInfoLattice *> operands,
ArrayRef<const LayoutInfoLattice *> results) {
@@ -851,8 +852,10 @@ void LayoutInfoPropagation::visitDpasMxOp(
dpasMxCDLayout = LayoutInfo(anchorLayoutCD);
// Get scale layouts if available
- xegpu::DistributeLayoutAttr anchorLayoutAScale = dpasMx.getLayoutAScaleAttr();
- xegpu::DistributeLayoutAttr anchorLayoutBScale = dpasMx.getLayoutBScaleAttr();
+ xegpu::DistributeLayoutAttr anchorLayoutAScale =
+ dpasMx.getLayoutAScaleAttr();
+ xegpu::DistributeLayoutAttr anchorLayoutBScale =
+ dpasMx.getLayoutBScaleAttr();
if (anchorLayoutAScale)
dpasMxAScaleLayout = LayoutInfo(anchorLayoutAScale);
if (anchorLayoutBScale)
@@ -897,9 +900,9 @@ void LayoutInfoPropagation::visitDpasMxOp(
numSg = numSgOrErr.value();
}
- auto layouts = xegpu::setupDpasMxLayout(layoutKind, aTy, bTy, cdTy,
- aScaleTy, bScaleTy,
- consumerLayoutAttr, numSg, uArch);
+ auto layouts =
+ xegpu::setupDpasMxLayout(layoutKind, aTy, bTy, cdTy, aScaleTy, bScaleTy,
+ consumerLayoutAttr, numSg, uArch);
if (!layouts.has_value()) {
dpasMx.emitWarning(
"Failed to determine required layouts for DPAS_MX operands.");
``````````
</details>
https://github.com/llvm/llvm-project/pull/194117
More information about the Mlir-commits
mailing list