[Mlir-commits] [clang-tools-extra] [mlir] [MLIR][XeGPU] Refactor Layout access interface (PR #172125)

Jianhui Li llvmlistbot at llvm.org
Tue Dec 16 11:50:52 PST 2025


================
@@ -901,8 +903,8 @@ struct WgToSgLoadGatherOpWithOffset
       return failure();
     ArrayRef<int64_t> wgShape = resultType.getShape();
 
-    xegpu::DistributeLayoutAttr layout =
-        xegpu::getDistributeLayoutAttr(op.getResult());
+    xegpu::DistributeLayoutAttr layout = op.getLayoutAttr();
----------------
Jianhui-Li wrote:

Here it is fine to use getLayoutAttr() directly as these pattern works at the lower level knowing the operation type. 
If we use getAnchorLayout(), then we need to dynamic cast the op to AnchorLayoutInterface and then call the interface.   That is unnecessary step in this pattern.

getAnchorLayout() is used when the pass processes the IR without matching the specific operations, or some generic call back function where only a generic operation is available. 

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


More information about the Mlir-commits mailing list