[Mlir-commits] [mlir] [mlir][xegpu] Add vector layout conflict handling in XeGPU layout propagation pass. (PR #182402)
Jianhui Li
llvmlistbot at llvm.org
Fri Feb 20 15:13:20 PST 2026
================
@@ -1270,32 +1387,36 @@ LogicalResult ResolveLayoutConflicts::run() {
return r.wasInterrupted() ? failure() : success();
}
-/// Helper to get the defining CreateNdDescOp of a tensor descriptor value. This
-/// function tries to find the defining CreateNdDescOp recursively accross
-/// control-flow boundaries.
-static xegpu::CreateNdDescOp getDefiningCreateNdDescOp(Value tdescValue) {
- // Try to get the defining CreateNdDescOp of the tensor descriptor.
- auto definingOp = tdescValue.getDefiningOp<xegpu::CreateNdDescOp>();
- if (definingOp)
- return definingOp;
- // If tdescValue is an argument, try to get the tied init value from the
- // parent loop-like op.
- if (auto arg = dyn_cast<BlockArgument>(tdescValue)) {
- auto *parentOp = arg.getOwner()->getParentOp();
- if (auto loop = dyn_cast<LoopLikeOpInterface>(parentOp)) {
- OpOperand *tiedInit = loop.getTiedLoopInit(arg);
- if (tiedInit)
- return getDefiningCreateNdDescOp(tiedInit->get());
- }
- }
- // If not found, return null.
- return nullptr;
-}
-
LogicalResult
ResolveLayoutConflicts::resolveVectorConsumer(OpOperand &operand) {
- // TODO: Implement vector consumer layout conflict resolution. Requires layout
- // utilities.
+ Value vectorValue = operand.get();
+ Operation *consumerOp = operand.getOwner();
+ // Get the current layout of the vector value.
+ auto currLayout = xegpu::getDistributeLayoutAttr(vectorValue);
----------------
Jianhui-Li wrote:
The name "current layout" is vague. Here the layout is retrieved from the producer op, how about call it "producerLayout"? And "expectedLayout" as "cusomerLayout"?
Layout conflict happens when producer and consumer doesn't agree on the layout.
https://github.com/llvm/llvm-project/pull/182402
More information about the Mlir-commits
mailing list