[libc-commits] [PATCH] D153157: [libc] Add an option to use a job pool for GPU tests

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Jun 16 10:44:46 PDT 2023


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

Currently the GPU has restrictions on how many tests can be run in
parallel due to resource constraints. However, building these tests can
take a long time so we want to be able to build them in parallel. This
patch introduces the option `LIBC_GPU_TEST_JOBS` which is set to the
number of threads to run in parallel.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153157

Files:
  libc/cmake/modules/LLVMLibCTestRules.cmake
  libc/cmake/modules/prepare_libc_gpu_build.cmake


Index: libc/cmake/modules/prepare_libc_gpu_build.cmake
===================================================================
--- libc/cmake/modules/prepare_libc_gpu_build.cmake
+++ libc/cmake/modules/prepare_libc_gpu_build.cmake
@@ -71,6 +71,14 @@
                       "build")
 endif()
 
+# Optionally set up a job pool to limit the number of GPU tests run in parallel.
+# This is sometimes necessary as running too many tests in parallel can cause
+# the GPU or driver to run out of resources.
+if(LIBC_GPU_TEST_JOBS)
+  set_property(GLOBAL PROPERTY JOB_POOLS LIBC_GPU_TEST_POOL=${LIBC_GPU_TEST_JOBS})
+  set(LIBC_HERMETIC_TEST_JOB_POOL JOB_POOL LIBC_GPU_TEST_POOL)
+endif()
+
 set(LIBC_GPU_TEST_ARCHITECTURE "" CACHE STRING "Architecture for the GPU tests")
 
 set(gpu_test_architecture "")
Index: libc/cmake/modules/LLVMLibCTestRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCTestRules.cmake
+++ libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -725,6 +725,7 @@
     COMMAND ${test_cmd}
     COMMAND_EXPAND_LISTS
     COMMENT "Running hermetic test ${fq_target_name}"
+    ${LIBC_HERMETIC_TEST_JOB_POOL}
   )
 
   add_dependencies(${HERMETIC_TEST_SUITE} ${fq_target_name})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153157.532222.patch
Type: text/x-patch
Size: 1237 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230616/0cfe7523/attachment.bin>


More information about the libc-commits mailing list