Skip to content

Commit 701fbe8

Browse files
committed
[mlir] NFC: small improvement to how we print a gpu.launch op.
Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D89033
1 parent 32f2f0d commit 701fbe8

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

mlir/lib/Dialect/GPU/IR/GPUDialect.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -283,22 +283,20 @@ static LogicalResult verify(LaunchOp op) {
283283
// (%size-x = %ssa-use, %size-y = %ssa-use, %size-z = %ssa-use)
284284
// where %size-* and %iter-* will correspond to the body region arguments.
285285
static void printSizeAssignment(OpAsmPrinter &p, KernelDim3 size,
286-
ValueRange operands, KernelDim3 ids) {
286+
KernelDim3 operands, KernelDim3 ids) {
287287
p << '(' << ids.x << ", " << ids.y << ", " << ids.z << ") in (";
288-
p << size.x << " = " << operands[0] << ", ";
289-
p << size.y << " = " << operands[1] << ", ";
290-
p << size.z << " = " << operands[2] << ')';
288+
p << size.x << " = " << operands.x << ", ";
289+
p << size.y << " = " << operands.y << ", ";
290+
p << size.z << " = " << operands.z << ')';
291291
}
292292

293293
static void printLaunchOp(OpAsmPrinter &p, LaunchOp op) {
294-
ValueRange operands = op.getOperands();
295-
296294
// Print the launch configuration.
297295
p << LaunchOp::getOperationName() << ' ' << op.getBlocksKeyword();
298-
printSizeAssignment(p, op.getGridSize(), operands.take_front(3),
296+
printSizeAssignment(p, op.getGridSize(), op.getGridSizeOperandValues(),
299297
op.getBlockIds());
300298
p << ' ' << op.getThreadsKeyword();
301-
printSizeAssignment(p, op.getBlockSize(), operands.slice(3, 3),
299+
printSizeAssignment(p, op.getBlockSize(), op.getBlockSizeOperandValues(),
302300
op.getThreadIds());
303301

304302
p.printRegion(op.body(), /*printEntryBlockArgs=*/false);

0 commit comments

Comments
 (0)