[Mlir-commits] [mlir] [mlir][xegpu] Minor fixes in XeGPU subgroup distribution. (PR #147846)
Chao Chen
llvmlistbot at llvm.org
Thu Jul 17 11:56:00 PDT 2025
================
@@ -184,6 +184,33 @@ void xegpu::setLayoutAttrs(Operation *op,
});
}
+template <typename T, typename>
+void xegpu::removeLayoutAttr(const T &operandOrResult) {
+ Operation *owner = operandOrResult.getOwner();
+ std::string name = xegpu::getLayoutName(operandOrResult);
+ if (owner->hasAttrOfType<LayoutAttr>(name))
+ owner->removeAttr(name);
+}
+
+// Explicit instantiation for OpResult
+template void
+xegpu::removeLayoutAttr<mlir::OpResult>(const mlir::OpResult &result);
+
+// Explicit instantiation for OpOperand
+template void
+xegpu::removeLayoutAttr<mlir::OpOperand>(const mlir::OpOperand &operand);
+
+void xegpu::removeLayoutAttrs(Operation *op) {
+ op->walk([&](Operation *nestOp) {
+ for (OpOperand &opr : nestOp->getOpOperands()) {
+ removeLayoutAttr(opr);
+ }
----------------
chencha3 wrote:
nit: single statement braces.
https://github.com/llvm/llvm-project/pull/147846
More information about the Mlir-commits
mailing list