================
@@ -218,55 +229,156 @@ maybePickPermanentLayout(xegpu::DistributeLayoutAttr
layout,
return candidate;
}
-template <typename T, typename>
-void xegpu::setDistributeLayoutAttr(const T &operandOrResult,
- const DistributeLayoutAttr layout,
- bool respectPermLayout) {
- Operation *owner = operandOrResult.getOwner();
- std::string name = xegpu::getLayoutName(operandOrResult);
+// TODO-LayoutRefactor: Remove this function after replacing use
+// with setTempLayout or setAnchorLayout
+void xegpu::setDistributeLayoutAttr(
+ const mlir::OpResult &result,
+ const mlir::xegpu::DistributeLayoutAttr layout) {
+ Operation *owner = result.getOwner();
- if (owner->hasAttrOfType<DistributeLayoutAttr>(name))
+ if (auto anchorOp = dyn_cast<xegpu::AnchorLayoutInterface>(owner)) {
+ if (anchorOp.getAnchorLayout() == layout)
+ return;
+ anchorOp.setAnchorLayout(layout);
+ return;
+ }
+
+ std::string name = xegpu::getTempLayoutName(result);
+ if (owner->hasAttrOfType<DistributeLayoutAttr>(name)) {
+ return;
+ }
+ if (layout) {
----------------
Jianhui-Li wrote:
Not sure. Maybe just for convenience. The original code does so. Removing this
causing exception.
https://github.com/llvm/llvm-project/pull/172125
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits