@@ -62,18 +62,12 @@ struct Layout {
6262 Layout (std::initializer_list<int64_t > list) : layout(list) {}
6363 void print (llvm::raw_ostream &os) const ;
6464 size_t size () const { return layout.size (); }
65- int64_t operator [](size_t idx) const ;
6665};
6766
6867void Layout::print (llvm::raw_ostream &os) const {
6968 os << llvm::interleaved_array (layout);
7069}
7170
72- int64_t Layout::operator [](size_t idx) const {
73- assert (idx < layout.size () && " Index out of bounds." );
74- return layout[idx];
75- }
76-
7771// / LaneLayout represents the logical layout of lanes within a subgroup when it
7872// / accesses some value. LaneData represents the logical layout of data owned by
7973// / each work item.
@@ -679,15 +673,15 @@ RunLayoutInfoPropagation::printAnalysisResult(llvm::raw_ostream &os) {
679673
680674using GetLayoutFnTy = function_ref<xegpu::LayoutAttr(Value)>;
681675// / Helper to update the users of a value with a given layout.
682- static void updateUsers (Value v, xegpu::LayoutAttr layout) {
683- // Update all users of the value with the layout.
684- for (OpOperand &user : v.getUses ()) {
685- Operation *owner = user.getOwner ();
686- // Add temporary layout attribute at the user op.
687- std::string attrName = xegpu::getLayoutName (user);
688- owner->setAttr (attrName, layout);
689- }
690- }
676+ // static void updateUsers(Value v, xegpu::LayoutAttr layout) {
677+ // // Update all users of the value with the layout.
678+ // for (OpOperand &user : v.getUses()) {
679+ // Operation *owner = user.getOwner();
680+ // // Add temporary layout attribute at the user op.
681+ // std::string attrName = xegpu::getLayoutName(user);
682+ // owner->setAttr(attrName, layout);
683+ // }
684+ // }
691685
692686// / Update an operation with the layout of its results. If the result type is a
693687// / vector type, a temporary layout attribute is added to the operation. If the
@@ -721,9 +715,7 @@ static void updateOp(mlir::OpBuilder &builder, mlir::Operation *op,
721715 // If the result is a vector type, add a temporary layout attribute to the
722716 // op.
723717 std::string resultLayoutName = xegpu::getLayoutName (result);
724- op->setAttr (resultLayoutName, layout);
725- // Update all users of the result with the layout.
726- updateUsers (result, layout);
718+ xegpu::setLayoutAttr (result, layout);
727719 }
728720}
729721
@@ -854,9 +846,7 @@ static void updateBranchOpInterface(mlir::OpBuilder &builder,
854846 // If the result is a vector type, add a temporary layout attribute to
855847 // the op.
856848 std::string resultLayoutName = xegpu::getLayoutName (r);
857- op->setAttr (resultLayoutName, layout);
858- // Update all users of the result with the layout.
859- updateUsers (r, layout);
849+ xegpu::setLayoutAttr (r, layout);
860850 }
861851}
862852
@@ -885,9 +875,6 @@ static void updateFunctionOpInterface(mlir::OpBuilder &builder,
885875 newArgTypes.back () = newTdescTy;
886876 continue ;
887877 }
888- // If the argument is a vector type, update all the users of the argument
889- // with the layout.
890- updateUsers (arg, layout);
891878 }
892879 // Update the function type with the new argument types.
893880 // NOTE: We assume that function results are not expected to have layouts.
0 commit comments