Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions flang/lib/Optimizer/Dialect/CUF/CUFOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,12 @@ mlir::LogicalResult cuf::RegisterKernelOp::verify() {

mlir::SymbolTable gpuSymTab(gpuMod);
auto func = gpuSymTab.lookup<mlir::gpu::GPUFuncOp>(getKernelName());
if (!func)
return emitOpError("device function not found");

if (!func.isKernel())
return emitOpError("only kernel gpu.func can be registered");

if (func) {
// Only check if the gpu.func is found. It might be converted to LLVMFuncOp
// already.
if (!func.isKernel())
return emitOpError("only kernel gpu.func can be registered");
}
return mlir::success();
}

Expand Down
15 changes: 0 additions & 15 deletions flang/test/Fir/cuf-invalid.fir
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,6 @@ module attributes {gpu.container_module} {

// -----

module attributes {gpu.container_module} {
gpu.module @cuda_device_mod {
gpu.func @_QPsub_device1() {
gpu.return
}
}
llvm.func internal @__cudaFortranConstructor() {
// expected-error@+1{{'cuf.register_kernel' op device function not found}}
cuf.register_kernel @cuda_device_mod::@_QPsub_device2
llvm.return
}
}

// -----

module attributes {gpu.container_module} {
llvm.func internal @__cudaFortranConstructor() {
// expected-error@+1{{'cuf.register_kernel' op gpu module not found}}
Expand Down
Loading