[libc-commits] [PATCH] D155837: [libc] Add an override option for specifying the loader implementation

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Jul 20 06:32:33 PDT 2023


jhuber6 created this revision.
jhuber6 added reviewers: sivachandra, JonChesterfield.
Herald added projects: libc-project, All.
Herald added a subscriber: libc-commits.
jhuber6 requested review of this revision.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155837

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


Index: libc/utils/gpu/loader/CMakeLists.txt
===================================================================
--- libc/utils/gpu/loader/CMakeLists.txt
+++ libc/utils/gpu/loader/CMakeLists.txt
@@ -29,7 +29,15 @@
 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(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155837.542490.patch
Type: text/x-patch
Size: 829 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230720/c8b0bcbb/attachment.bin>


More information about the libc-commits mailing list