[libc] Honour LIBC_GPU_TEST_JOBS in lit test runs (#193797)

Under CTest, LIBC_GPU_TEST_JOBS controlled a ninja job pool that limited
concurrent GPU test processes. The AMD GPU buildbot sets this to 4 to
avoid overloading the GPU driver.

When running tests via lit, this constraint was lost because lit uses
its own -j flag (defaulting to nproc, or set to 64 on the AMD bot via
LLVM_LIT_ARGS). All GPU loader processes launched simultaneously,
leading to hangs from GPU resource exhaustion.

Propagated LIBC_GPU_TEST_JOBS into the lit site config as a parallelism
group so lit throttles GPU test concurrency independently of the global
-j setting.
This commit is contained in:
Jeff Bailey
2026-04-24 08:20:03 +01:00
committed by GitHub
parent 7758ee59e7
commit 65e766dfda
2 changed files with 6 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ 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)
else()
set(LIBC_GPU_TEST_JOBS 1)
set_property(GLOBAL PROPERTY JOB_POOLS LIBC_GPU_TEST_POOL=1)
set(LIBC_HERMETIC_TEST_JOB_POOL JOB_POOL LIBC_GPU_TEST_POOL)
endif()

View File

@@ -40,3 +40,8 @@ if hasattr(config, "llvm_tools_dir") and config.llvm_tools_dir:
[config.llvm_tools_dir, config.environment.get("PATH", "")]
)
# Limit concurrent GPU tests to avoid overloading the GPU driver.
libc_gpu_test_jobs = "@LIBC_GPU_TEST_JOBS@"
if libc_gpu_test_jobs:
lit_config.parallelism_groups["libc-gpu"] = int(libc_gpu_test_jobs)
config.parallelism_group = "libc-gpu"