pdhaliwal created this revision. pdhaliwal added reviewers: JonChesterfield, jdoerfert, ABataev. Herald added subscribers: guansong, t-tye, tpr, dstuttard, yaxunl, jvesely, kzhuravl. pdhaliwal requested review of this revision. Herald added subscribers: cfe-commits, sstefan1, wdng. Herald added a project: clang.
AMDGPU backend requires entry functions/kernels to have AMDGPU_KERNEL calling convention for proper linking. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D94060 Files: clang/lib/CodeGen/CGOpenMPRuntime.cpp clang/test/OpenMP/amdgcn_target_codegen.cpp Index: clang/test/OpenMP/amdgcn_target_codegen.cpp =================================================================== --- clang/test/OpenMP/amdgcn_target_codegen.cpp +++ clang/test/OpenMP/amdgcn_target_codegen.cpp @@ -9,7 +9,7 @@ #define N 1000 int test_amdgcn_target_tid_threads() { -// CHECK-LABEL: define weak void @{{.*}}test_amdgcn_target_tid_threads +// CHECK-LABEL: define weak amdgpu_kernel void @{{.*}}test_amdgcn_target_tid_threads int arr[N]; @@ -26,7 +26,7 @@ } int test_amdgcn_target_tid_threads_simd() { -// CHECK-LABEL: define weak void @{{.*}}test_amdgcn_target_tid_threads_simd +// CHECK-LABEL: define weak amdgpu_kernel void @{{.*}}test_amdgcn_target_tid_threads_simd int arr[N]; Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp =================================================================== --- clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -6471,6 +6471,8 @@ OutlinedFnID = llvm::ConstantExpr::getBitCast(OutlinedFn, CGM.Int8PtrTy); OutlinedFn->setLinkage(llvm::GlobalValue::WeakAnyLinkage); OutlinedFn->setDSOLocal(false); + if (CGM.getTriple().isAMDGCN()) + OutlinedFn->setCallingConv(llvm::CallingConv::AMDGPU_KERNEL); } else { std::string Name = getName({EntryFnName, "region_id"}); OutlinedFnID = new llvm::GlobalVariable(
Index: clang/test/OpenMP/amdgcn_target_codegen.cpp =================================================================== --- clang/test/OpenMP/amdgcn_target_codegen.cpp +++ clang/test/OpenMP/amdgcn_target_codegen.cpp @@ -9,7 +9,7 @@ #define N 1000 int test_amdgcn_target_tid_threads() { -// CHECK-LABEL: define weak void @{{.*}}test_amdgcn_target_tid_threads +// CHECK-LABEL: define weak amdgpu_kernel void @{{.*}}test_amdgcn_target_tid_threads int arr[N]; @@ -26,7 +26,7 @@ } int test_amdgcn_target_tid_threads_simd() { -// CHECK-LABEL: define weak void @{{.*}}test_amdgcn_target_tid_threads_simd +// CHECK-LABEL: define weak amdgpu_kernel void @{{.*}}test_amdgcn_target_tid_threads_simd int arr[N]; Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp =================================================================== --- clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -6471,6 +6471,8 @@ OutlinedFnID = llvm::ConstantExpr::getBitCast(OutlinedFn, CGM.Int8PtrTy); OutlinedFn->setLinkage(llvm::GlobalValue::WeakAnyLinkage); OutlinedFn->setDSOLocal(false); + if (CGM.getTriple().isAMDGCN()) + OutlinedFn->setCallingConv(llvm::CallingConv::AMDGPU_KERNEL); } else { std::string Name = getName({EntryFnName, "region_id"}); OutlinedFnID = new llvm::GlobalVariable(
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits