[libc-commits] [libc] cf26941 - [libc] Add an override option for specifying the loader implementation

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Thu Jul 20 06:45:23 PDT 2023


Author: Joseph Huber
Date: 2023-07-20T08:44:58-05:00
New Revision: cf269417b20fc768d36ab55dbfd9187d256534ae

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

LOG: [libc] Add an override option for specifying the loader implementation

There are some cases when testing we want to override the logic for not
building tests if the loader is not present. This allows users to
specify an external binary that fulfils the same duties which will force
the tests to be built even without meeting the dependencies.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D155837

Added: 
    

Modified: 
    libc/utils/gpu/loader/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/utils/gpu/loader/CMakeLists.txt b/libc/utils/gpu/loader/CMakeLists.txt
index 65f346dd0b8ab0..f195b887c9af6a 100644
--- a/libc/utils/gpu/loader/CMakeLists.txt
+++ b/libc/utils/gpu/loader/CMakeLists.txt
@@ -29,7 +29,15 @@ else()
 endif()
 
 # Add a custom target to be used for testing.
-if(TARGET amdhsa_loader AND LIBC_GPU_TARGET_ARCHITECTURE_IS_AMDGPU)
+set(LIBC_GPU_LOADER_EXECUTABLE "" CACHE STRING "Overriding binary for the GPU loader.")
+if(LIBC_GPU_LOADER_EXECUTABLE)
+  add_custom_target(libc.utils.gpu.loader)
+  set_target_properties(
+    libc.utils.gpu.loader
+    PROPERTIES
+      EXECUTABLE "${LIBC_GPU_LOADER_EXECUTABLE}"
+  )
+elseif(TARGET amdhsa_loader AND LIBC_GPU_TARGET_ARCHITECTURE_IS_AMDGPU)
   add_custom_target(libc.utils.gpu.loader)
   add_dependencies(libc.utils.gpu.loader amdhsa_loader)
   set_target_properties(


        


More information about the libc-commits mailing list