Skip to content

Commit f2b8a71

Browse files
authored
Don't emit nvvm "kernel" annotation for amdgcn targets (#94)
Presence of both nvvm "kernel" annotation and 'amdgpu_kernel' calling convention conflicts with recent llvm commit: de7438e47283 [NVPTX] Auto-Upgrade some nvvm.annotations to attributes (#119261)
1 parent 0c8f086 commit f2b8a71

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tools/flang2/flang2exe/ll_write.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2496,11 +2496,15 @@ void ll_build_metadata_device(FILE *out, LLVMModuleRef module)
24962496
if (!function->is_kernel)
24972497
continue;
24982498

2499-
mdb = llmd_init(module);
2500-
llmd_add_value(mdb, ll_get_function_pointer(module, function));
2501-
llmd_add_string(mdb, "kernel");
2502-
llmd_add_i32(mdb, 1);
2503-
ll_extend_named_md_node(module, MD_nvvm_annotations, llmd_finish(mdb));
2499+
#ifdef OMP_OFFLOAD_AMD
2500+
if (!flg.amdgcn_target) {
2501+
mdb = llmd_init(module);
2502+
llmd_add_value(mdb, ll_get_function_pointer(module, function));
2503+
llmd_add_string(mdb, "kernel");
2504+
llmd_add_i32(mdb, 1);
2505+
ll_extend_named_md_node(module, MD_nvvm_annotations, llmd_finish(mdb));
2506+
}
2507+
#endif
25042508

25052509
mdb = llmd_init(module);
25062510
llmd_add_value(mdb, ll_get_function_pointer(module, function));

0 commit comments

Comments
 (0)