[clang] [CUDA/HIP] fix propagate -cuid to a host-only compilation. (PR #111650)

via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 9 02:15:18 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-clang

Author: Pankaj Dwivedi (PankajDwivedi-25)

<details>
<summary>Changes</summary>

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"


---
Full diff: https://github.com/llvm/llvm-project/pull/111650.diff


1 Files Affected:

- (modified) clang/lib/Driver/Driver.cpp (+2-1) 


``````````diff
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<InputAction>(IA->getInputArg(), Ty, IA->getId()));

``````````

</details>


https://github.com/llvm/llvm-project/pull/111650


More information about the cfe-commits mailing list