Skip to content

Commit 3544073

Browse files
committed
update layout info
1 parent e650862 commit 3544073

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

mlir/lib/Dialect/XeGPU/Transforms/XeGPUWgToSgDistribute.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,4 +498,20 @@ void XeGPUWgToSgDistributePass::runOnOperation() {
498498
if (failed(
499499
applyPartialConversion(getOperation(), target, std::move(patterns))))
500500
return signalPassFailure();
501+
502+
// Remove sg_layout and sg_data attributes from the Layout
503+
// attribute for each VectorType result of the operation.
504+
// For Structured Control Flow ops, the layout is simply removed,
505+
// since in 1:N case, the layout for new results are missing.
506+
// Layout propagation pass will activated.
507+
getOperation()->walk([](Operation *op) {
508+
for (OpResult result : op->getOpResults()) {
509+
std::string name = xegpu::getLayoutName(result);
510+
if (auto layout = op->getAttrOfType<xegpu::LayoutAttr>(name)) {
511+
op->removeAttr(name);
512+
if (!isa<scf::IfOp, scf::ForOp, scf::WhileOp, scf::ConditionOp>(op))
513+
op->setAttr(name, layout.dropInstData());
514+
}
515+
}
516+
});
501517
}

0 commit comments

Comments
 (0)