forked from OSchip/llvm-project
Verification for gpu.launch_func should rely on function type and not on the
actual body of a kernel function. This enables using gpu.launch_func with external kernel declarations. PiperOrigin-RevId: 253639770
This commit is contained in:
parent
31e2a6efe5
commit
cf74e41277
|
@ -369,9 +369,9 @@ LogicalResult LaunchFuncOp::verify() {
|
|||
<< getNumKernelOperands() << " kernel operands but expected "
|
||||
<< numKernelFuncArgs;
|
||||
}
|
||||
auto functionType = kernelFunc->getType();
|
||||
for (unsigned i = 0; i < numKernelFuncArgs; ++i) {
|
||||
if (getKernelOperand(i)->getType() !=
|
||||
kernelFunc->getArgument(i)->getType()) {
|
||||
if (getKernelOperand(i)->getType() != functionType.getInput(i)) {
|
||||
return emitOpError("type of function argument ")
|
||||
<< i << " does not match";
|
||||
}
|
||||
|
|
|
@ -81,6 +81,9 @@ func @kernel_1(%arg0 : f32, %arg1 : memref<?xf32, 1>)
|
|||
return
|
||||
}
|
||||
|
||||
func @kernel_2(f32, memref<?xf32, 1>)
|
||||
attributes { gpu.kernel }
|
||||
|
||||
func @foo() {
|
||||
%0 = "op"() : () -> (f32)
|
||||
%1 = "op"() : () -> (memref<?xf32, 1>)
|
||||
|
@ -90,5 +93,10 @@ func @foo() {
|
|||
// CHECK: "gpu.launch_func"(%c8, %c8, %c8, %c8, %c8, %c8, %0, %1) {kernel: @kernel_1} : (index, index, index, index, index, index, f32, memref<?xf32, 1>) -> ()
|
||||
"gpu.launch_func"(%cst, %cst, %cst, %cst, %cst, %cst, %0, %1) { kernel: @kernel_1 }
|
||||
: (index, index, index, index, index, index, f32, memref<?xf32, 1>) -> ()
|
||||
|
||||
// CHECK: "gpu.launch_func"(%c8, %c8, %c8, %c8, %c8, %c8, %0, %1) {kernel: @kernel_2} : (index, index, index, index, index, index, f32, memref<?xf32, 1>) -> ()
|
||||
"gpu.launch_func"(%cst, %cst, %cst, %cst, %cst, %cst, %0, %1) { kernel: @kernel_2 }
|
||||
: (index, index, index, index, index, index, f32, memref<?xf32, 1>) -> ()
|
||||
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue