[clang] [CUDA/HIP] fix propagate -cuid to a host-only compilation. (PR #111650)
https://github.com/PankajDwivedi-25 created https://github.com/llvm/llvm-project/pull/111650 build failure is observed in the hip test after patch #107483, which complains about a linking error. "/usr/bin/ld: /opt/rocm/share/hip/samples/2_Cookbook/16_assembly_to_executable/build/square_asm.out: hidden symbol `__hip_gpubin_handle_b21320dde8d193a' isn't defined /usr/bin/ld: final link failed: bad value" >From 7fab0002d9febf440545043d8782d7243a03f17b Mon Sep 17 00:00:00 2001 From: Pankajdwivedi-25 Date: Wed, 9 Oct 2024 14:34:17 +0530 Subject: [PATCH] [HIP] this is pre-commit might not be the solution fixes the linking issue --- clang/lib/Driver/Driver.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index a5d43bdac23735..d6cdc40b0a292e 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -3073,7 +3073,6 @@ class OffloadingActionBuilder final { CUID = llvm::utohexstr(Hash.low(), /*LowerCase=*/true); } } -IA->setId(CUID); if (CompileHostOnly) return ABRT_Success; @@ -3081,6 +3080,8 @@ class OffloadingActionBuilder final { // Replicate inputs for each GPU architecture. auto Ty = IA->getType() == types::TY_HIP ? types::TY_HIP_DEVICE : types::TY_CUDA_DEVICE; +IA->setId(CUID); + for (unsigned I = 0, E = GpuArchList.size(); I != E; ++I) { CudaDeviceActions.push_back( C.MakeAction(IA->getInputArg(), Ty, IA->getId())); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [CUDA/HIP] fix propagate -cuid to a host-only compilation. (PR #111650)
PankajDwivedi-25 wrote: > This does not seem to be the right fix. I tends to think the test > https://github.com/ROCm/hip-tests/tree/amd-staging/samples/2_Cookbook/16_assembly_to_executable > needs fix. Since it does not expect host-only compilation to use CUID, it > should add `-fuse-cuid=none` to the host-only compilation. Yes, It is the same test case that is failing. As you are suggesting these changes I have to make in CMake file only ? https://github.com/llvm/llvm-project/pull/111650 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [CUDA/HIP] fix propagate -cuid to a host-only compilation. (PR #111650)
PankajDwivedi-25 wrote: > > > This does not seem to be the right fix. I tends to think the test > > > https://github.com/ROCm/hip-tests/tree/amd-staging/samples/2_Cookbook/16_assembly_to_executable > > > needs fix. Since it does not expect host-only compilation to use CUID, > > > it should add `-fuse-cuid=none` to the host-only compilation. > > > > > > Yes, It is the same test case that is failing. As you are suggesting these > > changes I have to make in CMake file only ? > > Yes Thank you, it's working. There is another test case that required a similar fix https://github.com/ROCm/hip-tests/tree/amd-staging/samples/2_Cookbook/17_llvm_ir_to_executable. https://github.com/llvm/llvm-project/pull/111650 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [CUDA/HIP] fix propagate -cuid to a host-only compilation. (PR #111650)
PankajDwivedi-25 wrote: Both are separate builds here. 'By Inconsistency' you mean both cases can not be present in same build? https://github.com/llvm/llvm-project/pull/111650 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [CUDA/HIP] fix propagate -cuid to a host-only compilation. (PR #111650)
PankajDwivedi-25 wrote: Looks like this issue is still reproducible in latest build. I'm wondering why then it disappeared in the previously. I'm seeing a minor difference now it is complaining about **__hip_fatbin** earlier it was **__hip_gpubin_handle_2ba9067058fbe93a**. > ld.lld: error: undefined symbol: **__hip_fatbin** >>> referenced by square.cpp >>> >>> /work/downstream/hip-tests/samples/2_Cookbook/16_assembly_to_executable/build/square_host.o:(__hip_fatbin_wrapper) >>> did you mean: **__hip_fatbin_** >>> defined in: >>> /work/downstream/hip-tests/samples/2_Cookbook/16_assembly_to_executable/build/square_device.o clang++: error: linker command failed with exit code 1 (use -v to see invocation) failed to execute:/opt/rocm-6.3.0/lib/llvm/bin/clang++ --driver-mode=g++ -O3 --hip-link /work/downstream/hip-tests/samples/2_Cookbook/16_assembly_to_executable/build/square_host.o /work/downstream/hip-tests/samples/2_Cookbook/16_assembly_to_executable/build/square_device.o -o "/work/downstream/hip-tests/samples/2_Cookbook/16_assembly_to_executable/build/square_asm.out" -O3 -parallel-jobs=4 https://github.com/llvm/llvm-project/pull/111650 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [CUDA/HIP] fix propagate -cuid to a host-only compilation. (PR #111650)
https://github.com/PankajDwivedi-25 closed https://github.com/llvm/llvm-project/pull/111650 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [CUDA/HIP] fix propagate -cuid to a host-only compilation. (PR #111650)
PankajDwivedi-25 wrote: Great, looks it is part of another bug propagated. Including fix path resolved the issue. Closing this PR now. Thank you for your feedback. https://github.com/llvm/llvm-project/pull/111650 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits