From 0597cffe0bb32d6c0d52109cc3acd3314921a773 Mon Sep 17 00:00:00 2001 From: Matthew Curtis Date: Mon, 3 Feb 2025 17:38:28 -0600 Subject: [PATCH] Don't emit nvvm "kernel" annotation for amdgcn targets 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) --- tools/flang2/flang2exe/ll_write.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/flang2/flang2exe/ll_write.cpp b/tools/flang2/flang2exe/ll_write.cpp index a60f9c76d9..18f91157df 100644 --- a/tools/flang2/flang2exe/ll_write.cpp +++ b/tools/flang2/flang2exe/ll_write.cpp @@ -2496,11 +2496,15 @@ void ll_build_metadata_device(FILE *out, LLVMModuleRef module) if (!function->is_kernel) continue; - mdb = llmd_init(module); - llmd_add_value(mdb, ll_get_function_pointer(module, function)); - llmd_add_string(mdb, "kernel"); - llmd_add_i32(mdb, 1); - ll_extend_named_md_node(module, MD_nvvm_annotations, llmd_finish(mdb)); +#ifdef OMP_OFFLOAD_AMD + if (!flg.amdgcn_target) { + mdb = llmd_init(module); + llmd_add_value(mdb, ll_get_function_pointer(module, function)); + llmd_add_string(mdb, "kernel"); + llmd_add_i32(mdb, 1); + ll_extend_named_md_node(module, MD_nvvm_annotations, llmd_finish(mdb)); + } +#endif mdb = llmd_init(module); llmd_add_value(mdb, ll_get_function_pointer(module, function));