diff --git a/mlir/include/mlir/Dialect/GPU/GPUOps.td b/mlir/include/mlir/Dialect/GPU/GPUOps.td --- a/mlir/include/mlir/Dialect/GPU/GPUOps.td +++ b/mlir/include/mlir/Dialect/GPU/GPUOps.td @@ -426,15 +426,15 @@ ]; let extraClassDeclaration = [{ - /// The number of operands passed to the kernel function. - unsigned getNumKernelOperands(); - /// The name of the kernel's containing module. StringAttr getKernelModuleName(); /// The name of the kernel. StringAttr getKernelName(); + /// The number of operands passed to the kernel function. + unsigned getNumKernelOperands(); + /// The i-th operand passed to the kernel function. Value getKernelOperand(unsigned i); @@ -444,10 +444,6 @@ /// Get the SSA values passed as operands to specify the block size. KernelDim3 getBlockSizeOperandValues(); - /// The number of launch configuration operands, placed at the leading - /// positions of the operand list. - static constexpr unsigned kNumConfigOperands = 6; - // This needs to quietly verify if attributes with names defined below are // present since it is run before the verifier of this op. friend LogicalResult GPUDialect::verifyOperationAttribute(Operation *, diff --git a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp --- a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp +++ b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp @@ -716,21 +716,15 @@ builder.getI32VectorAttr(segmentSizes)); } -unsigned LaunchFuncOp::getNumKernelOperands() { - return getNumOperands() - asyncDependencies().size() - kNumConfigOperands - - (dynamicSharedMemorySize() ? 1 : 0); -} - StringAttr LaunchFuncOp::getKernelModuleName() { return kernel().getRootReference(); } StringAttr LaunchFuncOp::getKernelName() { return kernel().getLeafReference(); } -Value LaunchFuncOp::getKernelOperand(unsigned i) { - return getOperand(asyncDependencies().size() + kNumConfigOperands + - (dynamicSharedMemorySize() ? 1 : 0) + i); -} +unsigned LaunchFuncOp::getNumKernelOperands() { return operands().size(); } + +Value LaunchFuncOp::getKernelOperand(unsigned i) { return operands()[i]; } KernelDim3 LaunchFuncOp::getGridSizeOperandValues() { auto operands = getOperands().drop_front(asyncDependencies().size());