Skip to content

Commit f1208f2

Browse files
committed
add docstrings
Signed-off-by: dchigarev <[email protected]>
1 parent 027557d commit f1208f2

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

mlir/lib/Dialect/XeGPU/Utils/XeGPUUtils.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,12 @@ xegpu::getDistributeLayoutAttr(const OpOperand &opr) {
185185
return getDistributeLayoutAttr(opr.get());
186186
}
187187

188+
// Returns the permanent layout attribute for the given result if it's
189+
// available on the defining op. Otherwise returns the provided layout.
188190
xegpu::DistributeLayoutAttr
189-
maybePickPermamentLayout(xegpu::DistributeLayoutAttr layout,
190-
const OpResult &result, bool respectPermLayout,
191-
mlir::Operation *owner, const std::string &name) {
192-
if (!respectPermLayout)
193-
return layout;
191+
maybePickPermanentLayout(xegpu::DistributeLayoutAttr layout,
192+
const OpResult &result, mlir::Operation *owner,
193+
const std::string &name) {
194194
xegpu::DistributeLayoutAttr candidate = layout;
195195

196196
if (auto loadOp = dyn_cast<xegpu::LoadGatherOp>(owner)) {
@@ -201,13 +201,12 @@ maybePickPermamentLayout(xegpu::DistributeLayoutAttr layout,
201201
return candidate;
202202
}
203203

204+
// Returns the permanent layout attribute for the given operand if it's
205+
// available on the defining op. Otherwise returns the provided layout.
204206
xegpu::DistributeLayoutAttr
205-
maybePickPermamentLayout(xegpu::DistributeLayoutAttr layout,
206-
const OpOperand &operand, bool respectPermLayout,
207-
mlir::Operation *owner, const std::string &name) {
208-
if (!respectPermLayout)
209-
return layout;
210-
207+
maybePickPermanentLayout(xegpu::DistributeLayoutAttr layout,
208+
const OpOperand &operand, mlir::Operation *owner,
209+
const std::string &name) {
211210
xegpu::DistributeLayoutAttr candidate = layout;
212211
unsigned idx = const_cast<OpOperand &>(operand).getOperandNumber();
213212

@@ -231,8 +230,9 @@ void xegpu::setDistributeLayoutAttr(const T &operandOrResult,
231230
if (owner->hasAttrOfType<DistributeLayoutAttr>(name))
232231
return;
233232

234-
auto candidate = maybePickPermamentLayout(layout, operandOrResult,
235-
respectPermLayout, owner, name);
233+
DistributeLayoutAttr candidate = layout;
234+
if (respectPermLayout)
235+
candidate = maybePickPermanentLayout(layout, operandOrResult, owner, name);
236236

237237
if (candidate)
238238
owner->setAttr(name, candidate);

0 commit comments

Comments
 (0)