[Mlir-commits] [mlir] 701fbe8 - [mlir] NFC: small improvement to how we print a gpu.launch op.

Christian Sigg llvmlistbot at llvm.org
Fri Oct 9 03:45:56 PDT 2020


Author: Christian Sigg
Date: 2020-10-09T12:45:41+02:00
New Revision: 701fbe8725f4be067510b43805b68ec614b71518

URL: https://github.com/llvm/llvm-project/commit/701fbe8725f4be067510b43805b68ec614b71518
DIFF: https://github.com/llvm/llvm-project/commit/701fbe8725f4be067510b43805b68ec614b71518.diff

LOG: [mlir] NFC: small improvement to how we print a gpu.launch op.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D89033

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
index d754177cc8bc..bce590a8fe5b 100644
--- a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
+++ b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
@@ -283,22 +283,20 @@ static LogicalResult verify(LaunchOp op) {
 //   (%size-x = %ssa-use, %size-y = %ssa-use, %size-z = %ssa-use)
 // where %size-* and %iter-* will correspond to the body region arguments.
 static void printSizeAssignment(OpAsmPrinter &p, KernelDim3 size,
-                                ValueRange operands, KernelDim3 ids) {
+                                KernelDim3 operands, KernelDim3 ids) {
   p << '(' << ids.x << ", " << ids.y << ", " << ids.z << ") in (";
-  p << size.x << " = " << operands[0] << ", ";
-  p << size.y << " = " << operands[1] << ", ";
-  p << size.z << " = " << operands[2] << ')';
+  p << size.x << " = " << operands.x << ", ";
+  p << size.y << " = " << operands.y << ", ";
+  p << size.z << " = " << operands.z << ')';
 }
 
 static void printLaunchOp(OpAsmPrinter &p, LaunchOp op) {
-  ValueRange operands = op.getOperands();
-
   // Print the launch configuration.
   p << LaunchOp::getOperationName() << ' ' << op.getBlocksKeyword();
-  printSizeAssignment(p, op.getGridSize(), operands.take_front(3),
+  printSizeAssignment(p, op.getGridSize(), op.getGridSizeOperandValues(),
                       op.getBlockIds());
   p << ' ' << op.getThreadsKeyword();
-  printSizeAssignment(p, op.getBlockSize(), operands.slice(3, 3),
+  printSizeAssignment(p, op.getBlockSize(), op.getBlockSizeOperandValues(),
                       op.getThreadIds());
 
   p.printRegion(op.body(), /*printEntryBlockArgs=*/false);


        


More information about the Mlir-commits mailing list