[clang] [HIP] Allow partial linking for `-fgpu-rdc` (PR #81700)

via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 13 20:18:58 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff ec5f4a4bc6f27b044bc73668414ecefe9690d283 318117089831345caa13d8b4eeea23d0aa2c8588 -- clang/lib/CodeGen/CGCUDANV.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/Driver/ToolChains/HIPUtility.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/CodeGen/CGCUDANV.cpp b/clang/lib/CodeGen/CGCUDANV.cpp
index 7d23f94473..49f93451db 100644
--- a/clang/lib/CodeGen/CGCUDANV.cpp
+++ b/clang/lib/CodeGen/CGCUDANV.cpp
@@ -827,7 +827,7 @@ llvm::Function *CGNVCUDARuntime::makeModuleCtorFunction() {
     GpuBinaryHandle = new llvm::GlobalVariable(
         TheModule, PtrTy, /*isConstant=*/false, Linkage,
         /*Initializer=*/
-            CudaGpuBinary ? llvm::ConstantPointerNull::get(PtrTy) : nullptr,
+        CudaGpuBinary ? llvm::ConstantPointerNull::get(PtrTy) : nullptr,
         CudaGpuBinary
             ? "__hip_gpubin_handle"
             : "__hip_gpubin_handle_" + CGM.getContext().getCUIDHash());
diff --git a/clang/lib/Driver/ToolChains/HIPUtility.cpp b/clang/lib/Driver/ToolChains/HIPUtility.cpp
index 4bd6926ec6..67519a8a54 100644
--- a/clang/lib/Driver/ToolChains/HIPUtility.cpp
+++ b/clang/lib/Driver/ToolChains/HIPUtility.cpp
@@ -56,7 +56,7 @@ public:
                   DiagnosticsEngine::Error,
                   "Error collecting HIP undefined fatbin symbols: %0")),
         Quiet(C.getArgs().hasArg(options::OPT__HASH_HASH_HASH)),
-        Verbose(C.getArgs().hasArg(options::OPT_v)){
+        Verbose(C.getArgs().hasArg(options::OPT_v)) {
     populateSymbols();
     if (Verbose) {
       for (auto Name : FatBinSymbols)
@@ -284,17 +284,12 @@ void HIP::constructGenerateObjFileFromHIPFatBinary(
   HIPUndefinedFatBinSymbols Symbols(C);
 
   std::string PrimaryHipFatbinSymbol;
-  std::string
-      PrimaryGpuBinHandleSymbol;
-  bool FoundPrimaryHipFatbinSymbol =
-      false;
-  bool FoundPrimaryGpuBinHandleSymbol =
-      false;
-
-  std::vector<std::string>
-      AliasHipFatbinSymbols;
-  std::vector<std::string>
-      AliasGpuBinHandleSymbols;
+  std::string PrimaryGpuBinHandleSymbol;
+  bool FoundPrimaryHipFatbinSymbol = false;
+  bool FoundPrimaryGpuBinHandleSymbol = false;
+
+  std::vector<std::string> AliasHipFatbinSymbols;
+  std::vector<std::string> AliasGpuBinHandleSymbols;
 
   // Iterate through symbols to find the primary ones and collect others for
   // aliasing

``````````

</details>


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


More information about the cfe-commits mailing list