[libc-commits] [libc] 597cef4 - [libc] Fix GPU fatbinary dependencies for multi-source object libraries

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Tue Mar 14 13:04:48 PDT 2023


Author: Joseph Huber
Date: 2023-03-14T15:04:37-05:00
New Revision: 597cef44869af2d7a8c123f2b44f3713bdc54a30

URL: https://github.com/llvm/llvm-project/commit/597cef44869af2d7a8c123f2b44f3713bdc54a30
DIFF: https://github.com/llvm/llvm-project/commit/597cef44869af2d7a8c123f2b44f3713bdc54a30.diff

LOG: [libc] Fix GPU fatbinary dependencies for multi-source object libraries

Summary:
Multi-source object libraries require some additional handling, this
logic wasn't correctly settending the dependency on each filename
individually and was instead using the last one. This meant that only
the last file was built for multi-object libraries.

Added: 
    

Modified: 
    libc/cmake/modules/LLVMLibCObjectRules.cmake

Removed: 
    


################################################################################
diff  --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake
index eac480e8b8da4..0630cf598e885 100644
--- a/libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -139,7 +139,8 @@ function(_build_gpu_objects fq_target_name internal_target_name)
                                ${packager_images} -o ${packaged_output_name}
                        DEPENDS ${gpu_target_names} ${add_gpu_obj_src} ${ADD_GPU_OBJ_HDRS}
                        COMMENT "Packaging LLVM offloading binary")
-    add_custom_target(${packaged_target_name} DEPENDS ${packaged_output_name} ${gpu_target_name})
+    add_custom_target(${packaged_target_name} DEPENDS ${packaged_output_name})
+    list(APPEND packaged_gpu_names ${packaged_target_name})
     list(APPEND packaged_gpu_binaries ${packaged_output_name})
   endforeach()
 
@@ -177,7 +178,7 @@ function(_build_gpu_objects fq_target_name internal_target_name)
   endforeach()
   target_include_directories(${fq_target_name} PRIVATE ${include_dirs})
   add_dependencies(${fq_target_name}
-                   ${full_deps_list} ${packaged_target_name} ${stub_target_name})
+                   ${full_deps_list} ${packaged_gpu_names} ${stub_target_name})
 
   # We only build the internal target for a single supported architecture.
   if(LIBC_GPU_TARGET_ARCHITECTURE_IS_AMDGPU OR


        


More information about the libc-commits mailing list