From 99e3ef6ae0b8c0c31c04ddcc6ba8bf84c033efc8 Mon Sep 17 00:00:00 2001 From: Robin Kobus <19427718+Funatiq@users.noreply.github.com> Date: Tue, 6 Oct 2026 10:38:49 +0000 Subject: [PATCH 01/16] build: mark remaining common and runtime tests as full-stack Replace legacy add_gtest calls in common, runtime, batch-manager, multi-GPU and Torch-operator suites with explicit add_tllm_gtest FULL_STACK declarations. Add unit/full-stack discovery labels while preserving sources, conditional feature gates and supplemental links, including Torch/Python and the OSS all-reduce GEMM backend. These targets retain their existing shared-library dependency and remain in google-tests. Leave them without component ownership so common-tests, runtime-tests and the other focused aggregates continue to build without the monolith. The explicit helper excludes these tests from the default product build and retains PRE_TEST discovery, its 30-second timeout, CUDA lazy-loading environment and enabled multi-device definition. Validation: configure the actual CUDA 13.4/SM80, MPI and Torch build; check all 29 configured conversions retain identical source compile commands, shared-library graph edges, discovery properties and google-tests membership. Verify all five component aggregate graphs exclude libtensorrt_llm.so. No test source or production code changes; GPU and multi-GPU execution is unavailable in this environment. Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com> --- .../unit_tests/batch_manager/CMakeLists.txt | 10 +++-- cpp/tests/unit_tests/common/CMakeLists.txt | 15 ++++--- cpp/tests/unit_tests/multi_gpu/CMakeLists.txt | 28 +++++++++---- .../multi_gpu/kernels/CMakeLists.txt | 11 +++-- cpp/tests/unit_tests/runtime/CMakeLists.txt | 42 ++++++++++++------- cpp/tests/unit_tests/thop/CMakeLists.txt | 10 ++++- 6 files changed, 81 insertions(+), 35 deletions(-) diff --git a/cpp/tests/unit_tests/batch_manager/CMakeLists.txt b/cpp/tests/unit_tests/batch_manager/CMakeLists.txt index 69f9e6a6aa02..c7bd2933f7ff 100644 --- a/cpp/tests/unit_tests/batch_manager/CMakeLists.txt +++ b/cpp/tests/unit_tests/batch_manager/CMakeLists.txt @@ -103,7 +103,9 @@ add_tllm_gtest( "unit;batch-manager;gpu" REQUIRES_GPU) -add_gtest(contextTransferCoordinatorTest contextTransferCoordinatorTest.cpp) +add_tllm_gtest( + contextTransferCoordinatorTest SOURCES contextTransferCoordinatorTest.cpp + FULL_STACK LABELS "unit;full-stack") add_tllm_gtest( evictionPolicyTest @@ -348,9 +350,11 @@ add_tllm_gtest( "unit;batch-manager;gpu" REQUIRES_GPU) -add_gtest(peftCacheManagerTest peftCacheManagerTest.cpp) +add_tllm_gtest(peftCacheManagerTest SOURCES peftCacheManagerTest.cpp FULL_STACK + LABELS "unit;full-stack") -add_gtest(rnnCacheFormatterTest rnnCacheFormatterTest.cpp) +add_tllm_gtest(rnnCacheFormatterTest SOURCES rnnCacheFormatterTest.cpp + FULL_STACK LABELS "unit;full-stack") add_tllm_gtest( agentTreeTest diff --git a/cpp/tests/unit_tests/common/CMakeLists.txt b/cpp/tests/unit_tests/common/CMakeLists.txt index 4630d6324a38..0e4ead1760c7 100644 --- a/cpp/tests/unit_tests/common/CMakeLists.txt +++ b/cpp/tests/unit_tests/common/CMakeLists.txt @@ -13,10 +13,14 @@ # License for the specific language governing permissions and limitations under # the License. -add_gtest(cudaProfilerUtilsTest cudaProfilerUtilsTest.cpp) -add_gtest(cudaUtilsTest cudaUtilsTest.cpp) -add_gtest(attentionWorkspaceTest attentionWorkspaceTest.cpp) -add_gtest(memoryUtilsTest memoryUtilsTest.cu) +add_tllm_gtest(cudaProfilerUtilsTest SOURCES cudaProfilerUtilsTest.cpp + FULL_STACK LABELS "unit;full-stack") +add_tllm_gtest(cudaUtilsTest SOURCES cudaUtilsTest.cpp FULL_STACK LABELS + "unit;full-stack") +add_tllm_gtest(attentionWorkspaceTest SOURCES attentionWorkspaceTest.cpp + FULL_STACK LABELS "unit;full-stack") +add_tllm_gtest(memoryUtilsTest SOURCES memoryUtilsTest.cu FULL_STACK LABELS + "unit;full-stack") add_tllm_gtest( optionalRefTest OWNER @@ -78,7 +82,8 @@ add_tllm_gtest( tllm::common_logging LABELS "unit;common;host") -add_gtest(cudaDriverWrapperTest cudaDriverWrapperTest.cpp) +add_tllm_gtest(cudaDriverWrapperTest SOURCES cudaDriverWrapperTest.cpp + FULL_STACK LABELS "unit;full-stack") add_tllm_gtest( loggerTest OWNER diff --git a/cpp/tests/unit_tests/multi_gpu/CMakeLists.txt b/cpp/tests/unit_tests/multi_gpu/CMakeLists.txt index 263c393b9a75..b8e250df10cb 100644 --- a/cpp/tests/unit_tests/multi_gpu/CMakeLists.txt +++ b/cpp/tests/unit_tests/multi_gpu/CMakeLists.txt @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2023-2025 NVIDIA CORPORATION & +# SPDX-FileCopyrightText: Copyright (c) 2023-2026 NVIDIA CORPORATION & # AFFILIATES. All rights reserved. SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -15,22 +15,34 @@ add_subdirectory(kernels) -add_gtest(cacheTransceiverTest cacheTransceiverTest.cpp) +add_tllm_gtest(cacheTransceiverTest SOURCES cacheTransceiverTest.cpp FULL_STACK + LABELS "unit;full-stack") target_link_libraries(cacheTransceiverTest PRIVATE ${Python3_LIBRARIES}) -add_gtest( +add_tllm_gtest( kvCacheManagerV2HostMemNumaTest - "kvCacheManagerV2HostMemNumaTest.cpp;../batch_manager/kvCacheManagerV2PoisonCheck.cpp" -) + OWNER + batch-manager + SOURCES + kvCacheManagerV2HostMemNumaTest.cpp + LINK_LIBRARIES + $ + FULL_STACK + LABELS + "unit;full-stack;batch-manager;gpu" + REQUIRES_GPU) target_include_directories( kvCacheManagerV2HostMemNumaTest PRIVATE ${PROJECT_SOURCE_DIR}/tensorrt_llm/batch_manager) # Queries libnuma and get_mempolicy directly to see where pages landed. target_link_libraries(kvCacheManagerV2HostMemNumaTest PRIVATE numa) -add_gtest(mpiUtilsTest mpiUtilsTest.cpp) -add_gtest(userBufferTest userBufferTest.cpp) -add_gtest(ncclUtilsTest ncclUtilsTest.cpp) +add_tllm_gtest(mpiUtilsTest SOURCES mpiUtilsTest.cpp FULL_STACK LABELS + "unit;full-stack") +add_tllm_gtest(userBufferTest SOURCES userBufferTest.cpp FULL_STACK LABELS + "unit;full-stack") +add_tllm_gtest(ncclUtilsTest SOURCES ncclUtilsTest.cpp FULL_STACK LABELS + "unit;full-stack") target_link_libraries(ncclUtilsTest PRIVATE ${Python3_LIBRARIES}) if(BUILD_PYT) target_compile_definitions(cacheTransceiverTest PUBLIC BUILD_PYT) diff --git a/cpp/tests/unit_tests/multi_gpu/kernels/CMakeLists.txt b/cpp/tests/unit_tests/multi_gpu/kernels/CMakeLists.txt index db7554f49950..66a1e9fd9ecd 100644 --- a/cpp/tests/unit_tests/multi_gpu/kernels/CMakeLists.txt +++ b/cpp/tests/unit_tests/multi_gpu/kernels/CMakeLists.txt @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2023-2025 NVIDIA CORPORATION & +# SPDX-FileCopyrightText: Copyright (c) 2023-2026 NVIDIA CORPORATION & # AFFILIATES. All rights reserved. SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -14,9 +14,12 @@ # the License. if(NOT ENABLE_MULTI_DEVICE EQUAL 0) - add_gtest(allReduceKernelTest allReduce/allReduceKernelTest.cu) - add_gtest(allReduceFusionTest allReduce/allReduceFusionTest.cu) - add_gtest(gemmAllReduceTest allReduce/gemmAllReduceTest.cu) + add_tllm_gtest(allReduceKernelTest SOURCES allReduce/allReduceKernelTest.cu + FULL_STACK LABELS "unit;full-stack") + add_tllm_gtest(allReduceFusionTest SOURCES allReduce/allReduceFusionTest.cu + FULL_STACK LABELS "unit;full-stack") + add_tllm_gtest(gemmAllReduceTest SOURCES allReduce/gemmAllReduceTest.cu + FULL_STACK LABELS "unit;full-stack") if(USING_OSS_CUTLASS_ALLREDUCE_GEMM) target_link_libraries(gemmAllReduceTest PRIVATE ar_gemm_src) target_compile_definitions(gemmAllReduceTest diff --git a/cpp/tests/unit_tests/runtime/CMakeLists.txt b/cpp/tests/unit_tests/runtime/CMakeLists.txt index 045d71dfadf9..f26ce93f4ddc 100644 --- a/cpp/tests/unit_tests/runtime/CMakeLists.txt +++ b/cpp/tests/unit_tests/runtime/CMakeLists.txt @@ -35,9 +35,11 @@ add_tllm_gtest( LABELS "unit;runtime;gpu" REQUIRES_GPU) -add_gtest(gdrcopyTest gdrcopyTest.cpp) -add_gtest(hostAccessibleDeviceAllocatorTest - hostAccessibleDeviceAllocatorTest.cu) +add_tllm_gtest(gdrcopyTest SOURCES gdrcopyTest.cpp FULL_STACK LABELS + "unit;full-stack") +add_tllm_gtest( + hostAccessibleDeviceAllocatorTest SOURCES + hostAccessibleDeviceAllocatorTest.cu FULL_STACK LABELS "unit;full-stack") add_tllm_gtest( iBufferTest OWNER @@ -48,7 +50,8 @@ add_tllm_gtest( tllm::runtime_buffers LABELS "unit;runtime;host") -add_gtest(ipcNvlsMemoryTest ipcNvlsMemoryTest.cpp) +add_tllm_gtest(ipcNvlsMemoryTest SOURCES ipcNvlsMemoryTest.cpp FULL_STACK + LABELS "unit;full-stack") add_tllm_gtest( iTensorTest OWNER @@ -59,9 +62,12 @@ add_tllm_gtest( tllm::runtime_buffers LABELS "unit;runtime;host") -add_gtest(loraCacheTest loraCacheTest.cpp) -add_gtest(loraUtilsTest loraUtilsTest.cpp) -add_gtest(moeLoadBalancerTest moeLoadBalancerTest.cpp) +add_tllm_gtest(loraCacheTest SOURCES loraCacheTest.cpp FULL_STACK LABELS + "unit;full-stack") +add_tllm_gtest(loraUtilsTest SOURCES loraUtilsTest.cpp FULL_STACK LABELS + "unit;full-stack") +add_tllm_gtest(moeLoadBalancerTest SOURCES moeLoadBalancerTest.cpp FULL_STACK + LABELS "unit;full-stack") add_tllm_gtest( runtimeMpiUtilsTest OWNER @@ -72,9 +78,13 @@ add_tllm_gtest( tllm::runtime_distributed LABELS "unit;runtime;host") -add_gtest(localizationTest localizationTest.cu) -add_gtest(localityDomainPublicConfigTest localityDomainPublicConfigTest.cpp) -add_gtest(sanitizerTest sanitizerTest.cpp) +add_tllm_gtest(localizationTest SOURCES localizationTest.cu FULL_STACK LABELS + "unit;full-stack") +add_tllm_gtest( + localityDomainPublicConfigTest SOURCES localityDomainPublicConfigTest.cpp + FULL_STACK LABELS "unit;full-stack") +add_tllm_gtest(sanitizerTest SOURCES sanitizerTest.cpp FULL_STACK LABELS + "unit;full-stack") add_tllm_gtest( tllmBuffersTest OWNER @@ -86,8 +96,10 @@ add_tllm_gtest( LABELS "unit;runtime;gpu" REQUIRES_GPU) -add_gtest(transposeKVKernelTest transposeKVKernelTest.cpp) -add_gtest(utilsTest utilsTest.cpp) +add_tllm_gtest(transposeKVKernelTest SOURCES transposeKVKernelTest.cpp + FULL_STACK LABELS "unit;full-stack") +add_tllm_gtest(utilsTest SOURCES utilsTest.cpp FULL_STACK LABELS + "unit;full-stack") add_tllm_gtest( virtualMemoryTest OWNER @@ -99,7 +111,8 @@ add_tllm_gtest( LABELS "unit;runtime;gpu" REQUIRES_GPU) -add_gtest(workerPoolTest workerPoolTest.cpp) +add_tllm_gtest(workerPoolTest SOURCES workerPoolTest.cpp FULL_STACK LABELS + "unit;full-stack") add_tllm_gtest( worldConfigTest OWNER @@ -112,6 +125,7 @@ add_tllm_gtest( "unit;runtime;host") if(${BUILD_PYT}) - add_gtest(torchTest torchTest.cpp) + add_tllm_gtest(torchTest SOURCES torchTest.cpp FULL_STACK LABELS + "unit;full-stack") target_link_libraries(torchTest PUBLIC ${TORCH_LIBRARIES}) endif() diff --git a/cpp/tests/unit_tests/thop/CMakeLists.txt b/cpp/tests/unit_tests/thop/CMakeLists.txt index e078db4a2186..2286f0a4966c 100644 --- a/cpp/tests/unit_tests/thop/CMakeLists.txt +++ b/cpp/tests/unit_tests/thop/CMakeLists.txt @@ -14,7 +14,15 @@ # the License. if(${BUILD_PYT}) - add_gtest(thUtilsTest thUtilsTest.cpp eagerMoeWorkspaceTest.cpp) + add_tllm_gtest( + thUtilsTest + SOURCES + thUtilsTest.cpp + eagerMoeWorkspaceTest.cpp + FULL_STACK + LABELS + "unit;full-stack" + REQUIRES_GPU) target_link_libraries(thUtilsTest PUBLIC th_utils ${Python3_LIBRARIES} ${TORCH_LIBRARIES}) endif() From 5e744618db7680988aa4ebc46d45a69bea9d48bb Mon Sep 17 00:00:00 2001 From: Robin Kobus <19427718+Funatiq@users.noreply.github.com> Date: Tue, 6 Oct 2026 10:41:40 +0000 Subject: [PATCH 02/16] build: declare remaining executor and transport tests full-stack Convert every remaining executor and NIXL bounce add_gtest declaration to add_tllm_gtest with explicit FULL_STACK linkage and unit/full-stack labels. Convert the shared reactor-test function as well so transport, failure-path and optional ThreadSanitizer variants follow the same policy. Preserve UCX's 60-second timeout, directly compiled bounce support sources, Python and transport libraries, NIXL/Mooncake/backend gates, ZMQ availability checks and TSan instrumentation. Keep these tests in google-tests without adding monolithic dependencies to executor-tests. The old helper remains unchanged for the later migration steps; there are now no remaining calls to it in the repository's CMake files. Validation: actual CUDA 13.4/SM80, MPI, Torch and NIXL configuration passes. All 52 configured full-stack targets retain their original source compile commands, shared-library graph edges, lazy-loading/discovery settings and google-tests membership, including both reactor expansions. The UCX timeout remains 60 seconds. All five component aggregate graphs remain independent of libtensorrt_llm.so. Representative common, executor, runtime, kernel and batch-manager leaves build independently in a fresh full-project tree without producing the monolith; all 41 existing host cases in stringUtilsTest, executorConfigTest and radixTreeTest pass. GPU, multi-GPU and transport test execution is unavailable here. Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com> --- cpp/tests/unit_tests/executor/CMakeLists.txt | 37 ++++++++++++++----- .../unit_tests/executor/bounce/CMakeLists.txt | 32 ++++++++++------ 2 files changed, 48 insertions(+), 21 deletions(-) diff --git a/cpp/tests/unit_tests/executor/CMakeLists.txt b/cpp/tests/unit_tests/executor/CMakeLists.txt index 5ea2f47cb368..98ca7ea1bb15 100644 --- a/cpp/tests/unit_tests/executor/CMakeLists.txt +++ b/cpp/tests/unit_tests/executor/CMakeLists.txt @@ -33,8 +33,10 @@ add_tllm_gtest( tllm::executor_types LABELS "unit;executor;host") -add_gtest(requestTest requestTest.cpp) -add_gtest(responseTest responseTest.cpp) +add_tllm_gtest(requestTest SOURCES requestTest.cpp FULL_STACK LABELS + "unit;full-stack") +add_tllm_gtest(responseTest SOURCES responseTest.cpp FULL_STACK LABELS + "unit;full-stack") add_tllm_gtest( executorConfigTest @@ -46,13 +48,26 @@ add_tllm_gtest( tllm::executor_types LABELS "unit;executor;host") -add_gtest(executorTensorTest tensorTest.cpp) -add_gtest(serializeUtilsTest serializeUtilsTest.cpp) -add_gtest(loraConfigTest loraConfigTest.cpp) -add_gtest(coalesceTest coalesceTest.cpp) -add_gtest(genUniqueAgentNameTest genUniqueAgentNameTest.cpp) +add_tllm_gtest(executorTensorTest SOURCES tensorTest.cpp FULL_STACK LABELS + "unit;full-stack") +add_tllm_gtest(serializeUtilsTest SOURCES serializeUtilsTest.cpp FULL_STACK + LABELS "unit;full-stack") +add_tllm_gtest(loraConfigTest SOURCES loraConfigTest.cpp FULL_STACK LABELS + "unit;full-stack") +add_tllm_gtest(coalesceTest SOURCES coalesceTest.cpp FULL_STACK LABELS + "unit;full-stack") +add_tllm_gtest(genUniqueAgentNameTest SOURCES genUniqueAgentNameTest.cpp + FULL_STACK LABELS "unit;full-stack") target_link_libraries(genUniqueAgentNameTest PRIVATE ${Python3_LIBRARIES}) -add_gtest(ucxCommTest ucxCommTest.cpp TIMEOUT 60) +add_tllm_gtest( + ucxCommTest + SOURCES + ucxCommTest.cpp + FULL_STACK + LABELS + "unit;full-stack" + TIMEOUT + 60) target_link_libraries(ucxCommTest PRIVATE ${Python3_LIBRARIES}) target_link_libraries(serializeUtilsTest PRIVATE ${Python3_LIBRARIES}) @@ -68,8 +83,10 @@ if(EXISTS "/etc/redhat-release") endif() if(NIXL_ROOT OR (MOONCAKE_ROOT AND NOT IS_ROCKY8)) - add_gtest(agentCommTest agentCommTest.cpp) - add_gtest(transferAgentTest transferAgentTest.cpp) + add_tllm_gtest(agentCommTest SOURCES agentCommTest.cpp FULL_STACK LABELS + "unit;full-stack") + add_tllm_gtest(transferAgentTest SOURCES transferAgentTest.cpp FULL_STACK + LABELS "unit;full-stack") if(NIXL_ROOT) target_link_libraries(transferAgentTest PRIVATE tensorrt_llm_nixl_wrapper) diff --git a/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt b/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt index 76edc38937d9..96ab26db8e23 100644 --- a/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt +++ b/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt @@ -25,30 +25,38 @@ set(BOUNCE_DIR ) # ---- Pure-logic + GPU unit tests (no NIXL / zmq / network) ---- -add_gtest(creditSchedulerTest creditSchedulerTest.cpp) +add_tllm_gtest(creditSchedulerTest SOURCES creditSchedulerTest.cpp FULL_STACK + LABELS "unit;full-stack") target_sources(creditSchedulerTest PRIVATE ${BOUNCE_DIR}/CreditScheduler.cpp ${BOUNCE_DIR}/BuddyAllocator.cpp) -add_gtest(bounceTransferPlanTest bounceTransferPlanTest.cpp) +add_tllm_gtest(bounceTransferPlanTest SOURCES bounceTransferPlanTest.cpp + FULL_STACK LABELS "unit;full-stack") target_sources(bounceTransferPlanTest PRIVATE ${BOUNCE_DIR}/BounceTransferPlan.cpp) -add_gtest(bounceMessageCodecTest bounceMessageCodecTest.cpp) +add_tllm_gtest(bounceMessageCodecTest SOURCES bounceMessageCodecTest.cpp + FULL_STACK LABELS "unit;full-stack") target_sources(bounceMessageCodecTest PRIVATE ${BOUNCE_DIR}/BounceMessage.cpp) # Header-only: knob resolution (agent_bounce_params dict > TRTLLM_NIXL_BOUNCE_* # env > default), byte-size suffixes, garbage fallback, derived-timeout # invariants. -add_gtest(bounceConfigTest bounceConfigTest.cpp) -add_gtest(buddyAllocatorTest buddyAllocatorTest.cpp) +add_tllm_gtest(bounceConfigTest SOURCES bounceConfigTest.cpp FULL_STACK LABELS + "unit;full-stack") +add_tllm_gtest(buddyAllocatorTest SOURCES buddyAllocatorTest.cpp FULL_STACK + LABELS "unit;full-stack") target_sources(buddyAllocatorTest PRIVATE ${BOUNCE_DIR}/BuddyAllocator.cpp) # GPU test: execution-context pool (stream/event/scratch/hostPinned) # acquire/release. -add_gtest(execPoolTest execPoolTest.cpp) +add_tllm_gtest(execPoolTest SOURCES execPoolTest.cpp FULL_STACK LABELS + "unit;full-stack") target_sources(execPoolTest PRIVATE ${BOUNCE_DIR}/ExecPool.cpp) # GPU test: gather/scatter CUDA kernel round-trip (needs a CUDA device to run). -add_gtest(gatherScatterKernelTest gatherScatterKernelTest.cpp) +add_tllm_gtest(gatherScatterKernelTest SOURCES gatherScatterKernelTest.cpp + FULL_STACK LABELS "unit;full-stack") target_sources(gatherScatterKernelTest PRIVATE ${BOUNCE_DIR}/GatherScatterKernel.cu) # GPU test: shared data-arena alloc / address mapping / shutdown. -add_gtest(bounceArenaTest bounceArenaTest.cpp) +add_tllm_gtest(bounceArenaTest SOURCES bounceArenaTest.cpp FULL_STACK LABELS + "unit;full-stack") target_sources(bounceArenaTest PRIVATE ${BOUNCE_DIR}/BounceArena.cpp) # ---- Control-plane unit test — needs only zmq (+ the fetched cppzmq header), @@ -65,7 +73,8 @@ else() set(BOUNCE_CPPZMQ_AVAILABLE FALSE) endif() if(BOUNCE_CPPZMQ_AVAILABLE) - add_gtest(zmqControlChannelTest zmqControlChannelTest.cpp) + add_tllm_gtest(zmqControlChannelTest SOURCES zmqControlChannelTest.cpp + FULL_STACK LABELS "unit;full-stack") target_sources( zmqControlChannelTest PRIVATE ${BOUNCE_DIR}/ZmqControlChannel.cpp ${BOUNCE_DIR}/BounceMessage.cpp) @@ -102,7 +111,7 @@ if(NIXL_ROOT) # One reactor test target: the bounce sources compiled in, plus the shared # include/link sets. function(add_bounce_reactor_test name src) - add_gtest(${name} ${src}) + add_tllm_gtest(${name} SOURCES ${src} FULL_STACK LABELS "unit;full-stack") target_sources(${name} PRIVATE ${BOUNCE_REACTOR_SRCS}) target_include_directories(${name} PRIVATE ${BOUNCE_TEST_INCS}) target_link_libraries(${name} PRIVATE ${BOUNCE_TEST_LIBS}) @@ -138,7 +147,8 @@ if(NIXL_ROOT) # wrapper; this test only uses the public agent API (the zmq include is # needed only because the shared bounceTestNixlNode.h helpers pull in # ZmqControlChannel.h at compile time). - add_gtest(bounceAgentE2ETest bounceAgentE2ETest.cpp) + add_tllm_gtest(bounceAgentE2ETest SOURCES bounceAgentE2ETest.cpp FULL_STACK + LABELS "unit;full-stack") target_include_directories(bounceAgentE2ETest PRIVATE ${BOUNCE_TEST_INCS}) target_link_libraries( bounceAgentE2ETest PRIVATE tensorrt_llm_nixl_wrapper NIXL::nixl From 438c629a82c6129887c4cf7eee06416d18caf132 Mon Sep 17 00:00:00 2001 From: Robin Kobus <19427718+Funatiq@users.noreply.github.com> Date: Tue, 6 Oct 2026 11:11:51 +0000 Subject: [PATCH 03/16] build: migrate common CUDA utility tests to focused components Replace FULL_STACK linkage in cudaUtilsTest, memoryUtilsTest and cudaDriverWrapperTest with the existing runtime-buffer and common-CUDA components. Declare CUDA::cuda_driver explicitly for the driver test's direct cuMem allocation calls rather than inheriting it from the monolith. Register the three leaves with common-tests and add unit/common/GPU labels and GPU resource locks. Preserve their source files and existing GoogleTest discovery behavior; no production implementation is duplicated or extracted for this step. Validation: compile and link all three leaves with CUDA 13.4/SM80. Inspect the generated target graphs to exclude libtensorrt_llm.so, Torch, residual common/runtime/kernel objects and the batch-manager/executor backends. Verify component aggregate membership and GPU discovery properties. GPU execution is unavailable in this environment. Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com> --- cpp/tests/unit_tests/common/CMakeLists.txt | 40 ++++++++++++++++++---- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/cpp/tests/unit_tests/common/CMakeLists.txt b/cpp/tests/unit_tests/common/CMakeLists.txt index 0e4ead1760c7..06973426c766 100644 --- a/cpp/tests/unit_tests/common/CMakeLists.txt +++ b/cpp/tests/unit_tests/common/CMakeLists.txt @@ -15,12 +15,30 @@ add_tllm_gtest(cudaProfilerUtilsTest SOURCES cudaProfilerUtilsTest.cpp FULL_STACK LABELS "unit;full-stack") -add_tllm_gtest(cudaUtilsTest SOURCES cudaUtilsTest.cpp FULL_STACK LABELS - "unit;full-stack") +add_tllm_gtest( + cudaUtilsTest + OWNER + common + SOURCES + cudaUtilsTest.cpp + LINK_LIBRARIES + tllm::runtime_buffers + LABELS + "unit;common;gpu" + REQUIRES_GPU) add_tllm_gtest(attentionWorkspaceTest SOURCES attentionWorkspaceTest.cpp FULL_STACK LABELS "unit;full-stack") -add_tllm_gtest(memoryUtilsTest SOURCES memoryUtilsTest.cu FULL_STACK LABELS - "unit;full-stack") +add_tllm_gtest( + memoryUtilsTest + OWNER + common + SOURCES + memoryUtilsTest.cu + LINK_LIBRARIES + tllm::common_cuda + LABELS + "unit;common;gpu" + REQUIRES_GPU) add_tllm_gtest( optionalRefTest OWNER @@ -82,8 +100,18 @@ add_tllm_gtest( tllm::common_logging LABELS "unit;common;host") -add_tllm_gtest(cudaDriverWrapperTest SOURCES cudaDriverWrapperTest.cpp - FULL_STACK LABELS "unit;full-stack") +add_tllm_gtest( + cudaDriverWrapperTest + OWNER + common + SOURCES + cudaDriverWrapperTest.cpp + LINK_LIBRARIES + tllm::common_cuda + CUDA::cuda_driver + LABELS + "unit;common;gpu" + REQUIRES_GPU) add_tllm_gtest( loggerTest OWNER From 8d3d8446331e52e810a46f597ba5fc2eca410e83 Mon Sep 17 00:00:00 2001 From: Robin Kobus <19427718+Funatiq@users.noreply.github.com> Date: Tue, 6 Oct 2026 11:13:49 +0000 Subject: [PATCH 04/16] build: migrate executor value and bounce configuration tests Remove FULL_STACK from requestTest, responseTest, executorTensorTest, loraConfigTest, requestWithIdTest and coalesceTest. Link the existing executor values, request utilities and transfer-agent components directly so these tests no longer build the executor backend or shared library. Migrate the header-only bounceConfigTest using common logging alone. Register all seven leaves with executor-tests and label CPU-only tests as host tests. Mark tensor and LoRA tests as GPU tests with resource locking, since their suites include device allocation and CUDA streams. Preserve the original sources and GoogleTest discovery setup. Validation: compile/link all seven with CUDA 13.4/SM80. Audit their graphs to exclude the monolith, Torch, residual objects and batch-manager/executor backends; verify owner aggregate membership and discovery labels/locks. All 45 existing CPU cases pass across request, response, request-with-ID, coalescing, bounce configuration and the LoRA serialization filter. GPU cases require a device unavailable in this environment. Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com> --- cpp/tests/unit_tests/executor/CMakeLists.txt | 62 ++++++++++++++++--- .../unit_tests/executor/bounce/CMakeLists.txt | 12 +++- 2 files changed, 62 insertions(+), 12 deletions(-) diff --git a/cpp/tests/unit_tests/executor/CMakeLists.txt b/cpp/tests/unit_tests/executor/CMakeLists.txt index 98ca7ea1bb15..cdfae9c1e0cb 100644 --- a/cpp/tests/unit_tests/executor/CMakeLists.txt +++ b/cpp/tests/unit_tests/executor/CMakeLists.txt @@ -33,10 +33,26 @@ add_tllm_gtest( tllm::executor_types LABELS "unit;executor;host") -add_tllm_gtest(requestTest SOURCES requestTest.cpp FULL_STACK LABELS - "unit;full-stack") -add_tllm_gtest(responseTest SOURCES responseTest.cpp FULL_STACK LABELS - "unit;full-stack") +add_tllm_gtest( + requestTest + OWNER + executor + SOURCES + requestTest.cpp + LINK_LIBRARIES + tllm::executor_values + LABELS + "unit;executor;host") +add_tllm_gtest( + responseTest + OWNER + executor + SOURCES + responseTest.cpp + LINK_LIBRARIES + tllm::executor_values + LABELS + "unit;executor;host") add_tllm_gtest( executorConfigTest @@ -48,14 +64,40 @@ add_tllm_gtest( tllm::executor_types LABELS "unit;executor;host") -add_tllm_gtest(executorTensorTest SOURCES tensorTest.cpp FULL_STACK LABELS - "unit;full-stack") +add_tllm_gtest( + executorTensorTest + OWNER + executor + SOURCES + tensorTest.cpp + LINK_LIBRARIES + tllm::executor_values + LABELS + "unit;executor;gpu" + REQUIRES_GPU) add_tllm_gtest(serializeUtilsTest SOURCES serializeUtilsTest.cpp FULL_STACK LABELS "unit;full-stack") -add_tllm_gtest(loraConfigTest SOURCES loraConfigTest.cpp FULL_STACK LABELS - "unit;full-stack") -add_tllm_gtest(coalesceTest SOURCES coalesceTest.cpp FULL_STACK LABELS - "unit;full-stack") +add_tllm_gtest( + loraConfigTest + OWNER + executor + SOURCES + loraConfigTest.cpp + LINK_LIBRARIES + tllm::executor_values + LABELS + "unit;executor;gpu" + REQUIRES_GPU) +add_tllm_gtest( + coalesceTest + OWNER + executor + SOURCES + coalesceTest.cpp + LINK_LIBRARIES + tllm::executor_transfer_agent + LABELS + "unit;executor;host") add_tllm_gtest(genUniqueAgentNameTest SOURCES genUniqueAgentNameTest.cpp FULL_STACK LABELS "unit;full-stack") target_link_libraries(genUniqueAgentNameTest PRIVATE ${Python3_LIBRARIES}) diff --git a/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt b/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt index 96ab26db8e23..562455b3ab6a 100644 --- a/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt +++ b/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt @@ -39,8 +39,16 @@ target_sources(bounceMessageCodecTest PRIVATE ${BOUNCE_DIR}/BounceMessage.cpp) # Header-only: knob resolution (agent_bounce_params dict > TRTLLM_NIXL_BOUNCE_* # env > default), byte-size suffixes, garbage fallback, derived-timeout # invariants. -add_tllm_gtest(bounceConfigTest SOURCES bounceConfigTest.cpp FULL_STACK LABELS - "unit;full-stack") +add_tllm_gtest( + bounceConfigTest + OWNER + executor + SOURCES + bounceConfigTest.cpp + LINK_LIBRARIES + tllm::common_logging + LABELS + "unit;executor;host") add_tllm_gtest(buddyAllocatorTest SOURCES buddyAllocatorTest.cpp FULL_STACK LABELS "unit;full-stack") target_sources(buddyAllocatorTest PRIVATE ${BOUNCE_DIR}/BuddyAllocator.cpp) From d259974056b983dfd2633143614b95eae8df4751 Mon Sep 17 00:00:00 2001 From: Robin Kobus <19427718+Funatiq@users.noreply.github.com> Date: Fri, 23 Oct 2026 11:48:36 +0000 Subject: [PATCH 05/16] build: migrate runtime buffer and MPI tests to focused components Remove FULL_STACK from localityDomainPublicConfigTest, sanitizerTest, torchTest and the multi-GPU MPI utility suite. Use common/CUDA headers for pure locality configuration arithmetic, runtime buffers for sanitizer and Torch interop tests, the existing RoPE/QKV kernel component for KV transpose, and distributed/buffer components for MPI operations. Declare NCCL explicitly under ENABLE_MULTI_DEVICE because the MPI test calls ncclGetUniqueId for its broadcast case. Keep Torch feature gating and libraries, making their test linkage PRIVATE. Preserve sanitizer instrumentation supplied by the project. Add runtime-tests ownership, host/GPU labels and resource locks for suites with device operations. Validation: compile and link all five leaves with CUDA 13.4/SM80, MPI and Torch. Their graphs exclude the monolith, residual object targets and batch-manager/executor backends; only torchTest retains required Torch libraries. Verify aggregate membership and GPU scheduling metadata. All four locality configuration cases and eight single-rank MPI cases pass; three MPI cases skip because they require multiple ranks. GPU and instrumented sanitizer execution are not available in this environment. Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com> --- cpp/tests/unit_tests/multi_gpu/CMakeLists.txt | 16 +++++++- cpp/tests/unit_tests/runtime/CMakeLists.txt | 40 +++++++++++++++---- 2 files changed, 47 insertions(+), 9 deletions(-) diff --git a/cpp/tests/unit_tests/multi_gpu/CMakeLists.txt b/cpp/tests/unit_tests/multi_gpu/CMakeLists.txt index b8e250df10cb..a34f5149d682 100644 --- a/cpp/tests/unit_tests/multi_gpu/CMakeLists.txt +++ b/cpp/tests/unit_tests/multi_gpu/CMakeLists.txt @@ -37,8 +37,20 @@ target_include_directories( # Queries libnuma and get_mempolicy directly to see where pages landed. target_link_libraries(kvCacheManagerV2HostMemNumaTest PRIVATE numa) -add_tllm_gtest(mpiUtilsTest SOURCES mpiUtilsTest.cpp FULL_STACK LABELS - "unit;full-stack") +add_tllm_gtest( + mpiUtilsTest + OWNER + runtime + SOURCES + mpiUtilsTest.cpp + LINK_LIBRARIES + tllm::runtime_distributed + tllm::runtime_buffers + LABELS + "unit;runtime;host") +if(ENABLE_MULTI_DEVICE) + target_link_libraries(mpiUtilsTest PRIVATE ${NCCL_LIB}) +endif() add_tllm_gtest(userBufferTest SOURCES userBufferTest.cpp FULL_STACK LABELS "unit;full-stack") add_tllm_gtest(ncclUtilsTest SOURCES ncclUtilsTest.cpp FULL_STACK LABELS diff --git a/cpp/tests/unit_tests/runtime/CMakeLists.txt b/cpp/tests/unit_tests/runtime/CMakeLists.txt index f26ce93f4ddc..918d8a5a358c 100644 --- a/cpp/tests/unit_tests/runtime/CMakeLists.txt +++ b/cpp/tests/unit_tests/runtime/CMakeLists.txt @@ -81,10 +81,27 @@ add_tllm_gtest( add_tllm_gtest(localizationTest SOURCES localizationTest.cu FULL_STACK LABELS "unit;full-stack") add_tllm_gtest( - localityDomainPublicConfigTest SOURCES localityDomainPublicConfigTest.cpp - FULL_STACK LABELS "unit;full-stack") -add_tllm_gtest(sanitizerTest SOURCES sanitizerTest.cpp FULL_STACK LABELS - "unit;full-stack") + localityDomainPublicConfigTest + OWNER + runtime + SOURCES + localityDomainPublicConfigTest.cpp + LINK_LIBRARIES + tllm::common_headers + CUDA::toolkit + LABELS + "unit;runtime;host") +add_tllm_gtest( + sanitizerTest + OWNER + runtime + SOURCES + sanitizerTest.cpp + LINK_LIBRARIES + tllm::runtime_buffers + LABELS + "unit;runtime;gpu" + REQUIRES_GPU) add_tllm_gtest( tllmBuffersTest OWNER @@ -125,7 +142,16 @@ add_tllm_gtest( "unit;runtime;host") if(${BUILD_PYT}) - add_tllm_gtest(torchTest SOURCES torchTest.cpp FULL_STACK LABELS - "unit;full-stack") - target_link_libraries(torchTest PUBLIC ${TORCH_LIBRARIES}) + add_tllm_gtest( + torchTest + OWNER + runtime + SOURCES + torchTest.cpp + LINK_LIBRARIES + tllm::runtime_buffers + LABELS + "unit;runtime;gpu" + REQUIRES_GPU) + target_link_libraries(torchTest PRIVATE ${TORCH_LIBRARIES}) endif() From 152d17c3ee16b40038e17bd06ed67571d3c71540 Mon Sep 17 00:00:00 2001 From: Robin Kobus <19427718+Funatiq@users.noreply.github.com> Date: Tue, 6 Oct 2026 11:30:40 +0000 Subject: [PATCH 06/16] build: extract reusable bounce host logic and migrate its unit tests Create tllm::executor_bounce_core for BuddyAllocator, CreditScheduler, BounceTransferPlan and BounceMessage, with explicit common logging and thread dependencies. Make the component available without NIXL and exclude it from the default build unless a consumer needs it. Remove these sources from the NIXL wrapper and retain their existing exports through whole-archive component linkage. Normal reactor tests reuse the same component. Preserve the optional TSan variant's directly compiled, separately instrumented source set through an explicit INSTRUMENTED reactor-helper argument. Migrate creditSchedulerTest, bounceTransferPlanTest, bounceMessageCodecTest and buddyAllocatorTest to the core component, with executor aggregate ownership and host/bounce labels. Remove their repeated production-source compilation and FULL_STACK linkage; retain their existing test sources. Validation: compile and link the four leaves with CUDA 13.4/SM80; all 74 existing host cases pass. Their generated graphs exclude the monolith, Torch, NIXL, ZeroMQ and residual common/runtime/kernel objects. The real project configures successfully with NIXL enabled. Runtime transport and TSan execution require separate environments and were not run. Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com> --- .../nixl_utils/CMakeLists.txt | 15 ++-- .../nixl_utils/bounce/CMakeLists.txt | 26 +++++++ .../unit_tests/executor/bounce/CMakeLists.txt | 77 +++++++++++++------ 3 files changed, 87 insertions(+), 31 deletions(-) create mode 100644 cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/bounce/CMakeLists.txt diff --git a/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/CMakeLists.txt b/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/CMakeLists.txt index 360e6f1a2205..b71c6b1351bc 100644 --- a/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/CMakeLists.txt +++ b/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/CMakeLists.txt @@ -13,6 +13,8 @@ # License for the specific language governing permissions and limitations under # the License. +add_subdirectory(bounce) + # ============================================================================ # NIXL Wrapper Library # ============================================================================ @@ -62,15 +64,12 @@ if(NIXL_ROOT) if(ZMQ_FOUND) target_sources( ${NIXL_WRAPPER_TARGET} - PRIVATE bounce/BounceTransferPlan.cpp - bounce/BuddyAllocator.cpp - bounce/CreditScheduler.cpp - bounce/BounceMessage.cpp - bounce/BounceArena.cpp - bounce/ExecPool.cpp - bounce/GatherScatterKernel.cu - bounce/ZmqControlChannel.cpp + PRIVATE bounce/BounceArena.cpp bounce/ExecPool.cpp + bounce/GatherScatterKernel.cu bounce/ZmqControlChannel.cpp bounce/BounceTransport.cpp) + target_link_libraries( + ${NIXL_WRAPPER_TARGET} + PRIVATE $) target_include_directories( ${NIXL_WRAPPER_TARGET} PRIVATE ${CMAKE_BINARY_DIR}/_deps/cppzmq-src ${ZMQ_INCLUDE_DIRS}) diff --git a/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/bounce/CMakeLists.txt b/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/bounce/CMakeLists.txt new file mode 100644 index 000000000000..9c3e94bfd026 --- /dev/null +++ b/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/bounce/CMakeLists.txt @@ -0,0 +1,26 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. +# All rights reserved. SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +add_library( + tllm_executor_bounce_core STATIC EXCLUDE_FROM_ALL + BuddyAllocator.cpp CreditScheduler.cpp BounceTransferPlan.cpp + BounceMessage.cpp) +add_library(tllm::executor_bounce_core ALIAS tllm_executor_bounce_core) +target_link_libraries(tllm_executor_bounce_core PUBLIC tllm::common_logging + Threads::Threads) +target_compile_features(tllm_executor_bounce_core PUBLIC cxx_std_20) +target_compile_options(tllm_executor_bounce_core PRIVATE -Wno-error) +set_target_properties(tllm_executor_bounce_core + PROPERTIES POSITION_INDEPENDENT_CODE ON) diff --git a/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt b/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt index 562455b3ab6a..5c1c330b6d12 100644 --- a/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt +++ b/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt @@ -13,29 +13,43 @@ # License for the specific language governing permissions and limitations under # the License. -# Unit tests for the NIXL bounce-buffer v2 KV-cache transfer. The code under -# test lives in tensorrt_llm/executor/cache_transmission/nixl_utils/bounce/; the -# bounce core .cpp files are compiled directly into each test (they are also -# built into the NIXL wrapper for production). Three tiers, each independently -# gated: - pure-logic / GPU tests (no NIXL, no zmq, no network) - control-plane -# tests (need zmq + the fetched cppzmq header) - real-NIXL e2e tests (need -# NIXL_ROOT + zmq; two real agents, real RDMA) +# Bounce tests cover host logic, CUDA execution, ZeroMQ control channels and +# real NIXL transport. Transport tests require NIXL_ROOT and ZeroMQ. set(BOUNCE_DIR ${PROJECT_SOURCE_DIR}/tensorrt_llm/executor/cache_transmission/nixl_utils/bounce ) # ---- Pure-logic + GPU unit tests (no NIXL / zmq / network) ---- -add_tllm_gtest(creditSchedulerTest SOURCES creditSchedulerTest.cpp FULL_STACK - LABELS "unit;full-stack") -target_sources(creditSchedulerTest PRIVATE ${BOUNCE_DIR}/CreditScheduler.cpp - ${BOUNCE_DIR}/BuddyAllocator.cpp) -add_tllm_gtest(bounceTransferPlanTest SOURCES bounceTransferPlanTest.cpp - FULL_STACK LABELS "unit;full-stack") -target_sources(bounceTransferPlanTest - PRIVATE ${BOUNCE_DIR}/BounceTransferPlan.cpp) -add_tllm_gtest(bounceMessageCodecTest SOURCES bounceMessageCodecTest.cpp - FULL_STACK LABELS "unit;full-stack") -target_sources(bounceMessageCodecTest PRIVATE ${BOUNCE_DIR}/BounceMessage.cpp) +add_tllm_gtest( + creditSchedulerTest + OWNER + executor + SOURCES + creditSchedulerTest.cpp + LINK_LIBRARIES + tllm::executor_bounce_core + LABELS + "unit;executor;bounce;host") +add_tllm_gtest( + bounceTransferPlanTest + OWNER + executor + SOURCES + bounceTransferPlanTest.cpp + LINK_LIBRARIES + tllm::executor_bounce_core + LABELS + "unit;executor;bounce;host") +add_tllm_gtest( + bounceMessageCodecTest + OWNER + executor + SOURCES + bounceMessageCodecTest.cpp + LINK_LIBRARIES + tllm::executor_bounce_core + LABELS + "unit;executor;bounce;host") # Header-only: knob resolution (agent_bounce_params dict > TRTLLM_NIXL_BOUNCE_* # env > default), byte-size suffixes, garbage fallback, derived-timeout # invariants. @@ -49,9 +63,16 @@ add_tllm_gtest( tllm::common_logging LABELS "unit;executor;host") -add_tllm_gtest(buddyAllocatorTest SOURCES buddyAllocatorTest.cpp FULL_STACK - LABELS "unit;full-stack") -target_sources(buddyAllocatorTest PRIVATE ${BOUNCE_DIR}/BuddyAllocator.cpp) +add_tllm_gtest( + buddyAllocatorTest + OWNER + executor + SOURCES + buddyAllocatorTest.cpp + LINK_LIBRARIES + tllm::executor_bounce_core + LABELS + "unit;executor;bounce;host") # GPU test: execution-context pool (stream/event/scratch/hostPinned) # acquire/release. add_tllm_gtest(execPoolTest SOURCES execPoolTest.cpp FULL_STACK LABELS @@ -102,6 +123,10 @@ if(NIXL_ROOT) # Same gate as the zmq-only tier above. if(BOUNCE_CPPZMQ_AVAILABLE) set(BOUNCE_REACTOR_SRCS + ${BOUNCE_DIR}/BounceTransport.cpp ${BOUNCE_DIR}/BounceArena.cpp + ${BOUNCE_DIR}/ExecPool.cpp ${BOUNCE_DIR}/GatherScatterKernel.cu + ${BOUNCE_DIR}/ZmqControlChannel.cpp) + set(BOUNCE_TSAN_SRCS ${BOUNCE_DIR}/BounceTransport.cpp ${BOUNCE_DIR}/BounceTransferPlan.cpp ${BOUNCE_DIR}/BuddyAllocator.cpp @@ -119,8 +144,14 @@ if(NIXL_ROOT) # One reactor test target: the bounce sources compiled in, plus the shared # include/link sets. function(add_bounce_reactor_test name src) + cmake_parse_arguments(ARG "INSTRUMENTED" "" "" ${ARGN}) add_tllm_gtest(${name} SOURCES ${src} FULL_STACK LABELS "unit;full-stack") - target_sources(${name} PRIVATE ${BOUNCE_REACTOR_SRCS}) + if(ARG_INSTRUMENTED) + target_sources(${name} PRIVATE ${BOUNCE_TSAN_SRCS}) + else() + target_sources(${name} PRIVATE ${BOUNCE_REACTOR_SRCS}) + target_link_libraries(${name} PRIVATE tllm::executor_bounce_core) + endif() target_include_directories(${name} PRIVATE ${BOUNCE_TEST_INCS}) target_link_libraries(${name} PRIVATE ${BOUNCE_TEST_LIBS}) endfunction() @@ -142,7 +173,7 @@ if(NIXL_ROOT) "Build a ThreadSanitizer variant of the bounce reactor test" OFF) if(BOUNCE_TSAN) add_bounce_reactor_test(bounceTransportTsanTest - bounceTransportFailureTest.cpp) + bounceTransportFailureTest.cpp INSTRUMENTED) target_compile_options( bounceTransportTsanTest PRIVATE $<$:-fsanitize=thread -g> From 2b6d8ab43c867421685d993c90d360b40b6ae835 Mon Sep 17 00:00:00 2001 From: Robin Kobus <19427718+Funatiq@users.noreply.github.com> Date: Tue, 6 Oct 2026 11:33:46 +0000 Subject: [PATCH 07/16] build: extract bounce CUDA execution and fabric arena components Create tllm::executor_bounce_cuda for ExecPool and GatherScatterKernel, and tllm::executor_bounce_arena for BounceArena. Declare core/common CUDA and KV-cache fabric-memory dependencies explicitly. Keep the arena separate so pool and gather/scatter leaves do not build KV-cache code. Preserve PIC, CUDA C++20 and device-symbol resolution settings. Move these three implementation sources out of the NIXL wrapper and retain their symbols through whole-archive component linkage. Normal reactor tests reuse the components; their separately instrumented TSan variant continues compiling its complete production source set directly. Migrate execPoolTest, gatherScatterKernelTest and bounceArenaTest to focused libraries with executor ownership and GPU labels/resource locks. Remove repeated production-source compilation and FULL_STACK linkage. Validation: all three leaves compile and link with CUDA 13.4/SM80. Their graphs exclude the monolith, Torch, NIXL wrappers and residual objects; pool/gather leaves also exclude the legacy KV-cache component. Verify aggregate membership and discovered GPU locking. GPU execution and architecture-specific fabric-memory behavior are not tested here. Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com> --- .../nixl_utils/CMakeLists.txt | 11 ++-- .../nixl_utils/bounce/CMakeLists.txt | 24 +++++++++ .../unit_tests/executor/bounce/CMakeLists.txt | 53 +++++++++++++------ 3 files changed, 67 insertions(+), 21 deletions(-) diff --git a/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/CMakeLists.txt b/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/CMakeLists.txt index b71c6b1351bc..ae26ddce4602 100644 --- a/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/CMakeLists.txt +++ b/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/CMakeLists.txt @@ -62,14 +62,13 @@ if(NIXL_ROOT) # absent endif() if(ZMQ_FOUND) - target_sources( - ${NIXL_WRAPPER_TARGET} - PRIVATE bounce/BounceArena.cpp bounce/ExecPool.cpp - bounce/GatherScatterKernel.cu bounce/ZmqControlChannel.cpp - bounce/BounceTransport.cpp) + target_sources(${NIXL_WRAPPER_TARGET} PRIVATE bounce/ZmqControlChannel.cpp + bounce/BounceTransport.cpp) target_link_libraries( ${NIXL_WRAPPER_TARGET} - PRIVATE $) + PRIVATE + $ + ) target_include_directories( ${NIXL_WRAPPER_TARGET} PRIVATE ${CMAKE_BINARY_DIR}/_deps/cppzmq-src ${ZMQ_INCLUDE_DIRS}) diff --git a/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/bounce/CMakeLists.txt b/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/bounce/CMakeLists.txt index 9c3e94bfd026..df3d73f80fb8 100644 --- a/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/bounce/CMakeLists.txt +++ b/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/bounce/CMakeLists.txt @@ -24,3 +24,27 @@ target_compile_features(tllm_executor_bounce_core PUBLIC cxx_std_20) target_compile_options(tllm_executor_bounce_core PRIVATE -Wno-error) set_target_properties(tllm_executor_bounce_core PROPERTIES POSITION_INDEPENDENT_CODE ON) + +add_library(tllm_executor_bounce_cuda STATIC EXCLUDE_FROM_ALL + ExecPool.cpp GatherScatterKernel.cu) +add_library(tllm::executor_bounce_cuda ALIAS tllm_executor_bounce_cuda) +target_link_libraries(tllm_executor_bounce_cuda + PUBLIC tllm::executor_bounce_core tllm::common_cuda) +target_compile_features(tllm_executor_bounce_cuda PUBLIC cxx_std_20) +target_compile_options(tllm_executor_bounce_cuda + PRIVATE $<$:-Wno-error>) +set_target_properties( + tllm_executor_bounce_cuda + PROPERTIES POSITION_INDEPENDENT_CODE ON CUDA_STANDARD 20 + CUDA_STANDARD_REQUIRED ON CUDA_RESOLVE_DEVICE_SYMBOLS ON) + +add_library(tllm_executor_bounce_arena STATIC EXCLUDE_FROM_ALL BounceArena.cpp) +add_library(tllm::executor_bounce_arena ALIAS tllm_executor_bounce_arena) +target_link_libraries( + tllm_executor_bounce_arena + PUBLIC tllm::common_cuda + PRIVATE tllm::kv_cache_legacy) +target_compile_features(tllm_executor_bounce_arena PUBLIC cxx_std_20) +target_compile_options(tllm_executor_bounce_arena PRIVATE -Wno-error) +set_target_properties(tllm_executor_bounce_arena + PROPERTIES POSITION_INDEPENDENT_CODE ON) diff --git a/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt b/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt index 5c1c330b6d12..3686a985b285 100644 --- a/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt +++ b/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt @@ -75,18 +75,41 @@ add_tllm_gtest( "unit;executor;bounce;host") # GPU test: execution-context pool (stream/event/scratch/hostPinned) # acquire/release. -add_tllm_gtest(execPoolTest SOURCES execPoolTest.cpp FULL_STACK LABELS - "unit;full-stack") -target_sources(execPoolTest PRIVATE ${BOUNCE_DIR}/ExecPool.cpp) +add_tllm_gtest( + execPoolTest + OWNER + executor + SOURCES + execPoolTest.cpp + LINK_LIBRARIES + tllm::executor_bounce_cuda + LABELS + "unit;executor;bounce;gpu" + REQUIRES_GPU) # GPU test: gather/scatter CUDA kernel round-trip (needs a CUDA device to run). -add_tllm_gtest(gatherScatterKernelTest SOURCES gatherScatterKernelTest.cpp - FULL_STACK LABELS "unit;full-stack") -target_sources(gatherScatterKernelTest - PRIVATE ${BOUNCE_DIR}/GatherScatterKernel.cu) +add_tllm_gtest( + gatherScatterKernelTest + OWNER + executor + SOURCES + gatherScatterKernelTest.cpp + LINK_LIBRARIES + tllm::executor_bounce_cuda + LABELS + "unit;executor;bounce;gpu" + REQUIRES_GPU) # GPU test: shared data-arena alloc / address mapping / shutdown. -add_tllm_gtest(bounceArenaTest SOURCES bounceArenaTest.cpp FULL_STACK LABELS - "unit;full-stack") -target_sources(bounceArenaTest PRIVATE ${BOUNCE_DIR}/BounceArena.cpp) +add_tllm_gtest( + bounceArenaTest + OWNER + executor + SOURCES + bounceArenaTest.cpp + LINK_LIBRARIES + tllm::executor_bounce_arena + LABELS + "unit;executor;bounce;gpu" + REQUIRES_GPU) # ---- Control-plane unit test — needs only zmq (+ the fetched cppzmq header), # no NIXL. ZMQ_FOUND is reused by the real-NIXL block below. ---- @@ -122,10 +145,8 @@ if(NIXL_ROOT) # when NIXL is on); all of them share this source set + include/link sets. # Same gate as the zmq-only tier above. if(BOUNCE_CPPZMQ_AVAILABLE) - set(BOUNCE_REACTOR_SRCS - ${BOUNCE_DIR}/BounceTransport.cpp ${BOUNCE_DIR}/BounceArena.cpp - ${BOUNCE_DIR}/ExecPool.cpp ${BOUNCE_DIR}/GatherScatterKernel.cu - ${BOUNCE_DIR}/ZmqControlChannel.cpp) + set(BOUNCE_REACTOR_SRCS ${BOUNCE_DIR}/BounceTransport.cpp + ${BOUNCE_DIR}/ZmqControlChannel.cpp) set(BOUNCE_TSAN_SRCS ${BOUNCE_DIR}/BounceTransport.cpp ${BOUNCE_DIR}/BounceTransferPlan.cpp @@ -150,7 +171,9 @@ if(NIXL_ROOT) target_sources(${name} PRIVATE ${BOUNCE_TSAN_SRCS}) else() target_sources(${name} PRIVATE ${BOUNCE_REACTOR_SRCS}) - target_link_libraries(${name} PRIVATE tllm::executor_bounce_core) + target_link_libraries( + ${name} PRIVATE tllm::executor_bounce_core tllm::executor_bounce_cuda + tllm::executor_bounce_arena) endif() target_include_directories(${name} PRIVATE ${BOUNCE_TEST_INCS}) target_link_libraries(${name} PRIVATE ${BOUNCE_TEST_LIBS}) From c2efa15d3cb6ac8f98591642fae3dc526f62027f Mon Sep 17 00:00:00 2001 From: Robin Kobus <19427718+Funatiq@users.noreply.github.com> Date: Tue, 6 Oct 2026 11:38:46 +0000 Subject: [PATCH 08/16] build: extract the bounce ZeroMQ control-plane component Create optional tllm::executor_bounce_control for ZmqControlChannel, with public bounce-core and imported pkg-config ZeroMQ dependencies and cppzmq headers. Enable it only when both libzmq and cppzmq are available. Keep the core/CUDA unit-test components independent of NIXL availability. Move the control source out of the NIXL wrapper and preserve its exports through whole-archive linkage. The wrapper and normal reactor tests now compile only BounceTransport and reuse all extracted bounce components. Keep all nine implementation sources in the separately instrumented TSan reactor build. Migrate zmqControlChannelTest to the control component with executor/host/bounce labels; remove its repeated production sources. Validation: all eight migrated leaves compile/link with CUDA 13.4/SM80, and their graphs exclude the monolith, Torch, NIXL wrappers and residual objects. All 80 existing host/control cases pass, including six ZeroMQ cases. Each of the eight extracted implementation files has exactly one normal compile owner. All eight leaves also build in the independent full-project tree with NIXL disabled, without producing libtensorrt_llm.so. Configure the optional TSan variant with NIXL enabled and verify its full source set and per-source instrumentation. GPU, real RDMA transport and TSan runtime execution are unavailable here. Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com> --- .../nixl_utils/CMakeLists.txt | 23 +++-------- .../nixl_utils/bounce/CMakeLists.txt | 19 +++++++++ .../unit_tests/executor/bounce/CMakeLists.txt | 40 +++++++------------ 3 files changed, 40 insertions(+), 42 deletions(-) diff --git a/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/CMakeLists.txt b/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/CMakeLists.txt index ae26ddce4602..19c7a4050fad 100644 --- a/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/CMakeLists.txt +++ b/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/CMakeLists.txt @@ -56,33 +56,22 @@ if(NIXL_ROOT) # CacheTransceiverConfig (agent_bounce_buffer_enable + # kv_cache_bounce_size_mb, Python (v2) transceiver only). # ------------------------------------------------------------------------ - find_package(PkgConfig) - if(PKG_CONFIG_FOUND) - pkg_check_modules(ZMQ libzmq) # optional: bounce is skipped if libzmq is - # absent - endif() - if(ZMQ_FOUND) - target_sources(${NIXL_WRAPPER_TARGET} PRIVATE bounce/ZmqControlChannel.cpp - bounce/BounceTransport.cpp) + if(TARGET tllm_executor_bounce_control) + target_sources(${NIXL_WRAPPER_TARGET} PRIVATE bounce/BounceTransport.cpp) target_link_libraries( ${NIXL_WRAPPER_TARGET} PRIVATE - $ - ) - target_include_directories( - ${NIXL_WRAPPER_TARGET} PRIVATE ${CMAKE_BINARY_DIR}/_deps/cppzmq-src - ${ZMQ_INCLUDE_DIRS}) - target_link_libraries(${NIXL_WRAPPER_TARGET} PRIVATE ${ZMQ_LIBRARIES} - ${NIXL_BUILD_LIBRARY}) + $ + ${NIXL_BUILD_LIBRARY}) target_compile_definitions(${NIXL_WRAPPER_TARGET} PRIVATE TLLM_BOUNCE_V2=1) # The .cu device symbols must resolve into this shared lib. set_target_properties(${NIXL_WRAPPER_TARGET} PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON) - message(STATUS "NIXL bounce v2: enabled (libzmq found)") + message(STATUS "NIXL bounce v2: enabled (libzmq and cppzmq found)") else() message( STATUS - "NIXL bounce v2: disabled - libzmq/pkg-config not found; an explicit agent_bounce_buffer_enable opt-in fails at agent construction (on a bounce build, runtime setup failures degrade to standard NIXL with a WARNING)" + "NIXL bounce v2: disabled - libzmq or cppzmq unavailable; an explicit agent_bounce_buffer_enable opt-in fails at agent construction (on a bounce build, runtime setup failures degrade to standard NIXL with a WARNING)" ) endif() diff --git a/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/bounce/CMakeLists.txt b/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/bounce/CMakeLists.txt index df3d73f80fb8..3c48d9d5f470 100644 --- a/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/bounce/CMakeLists.txt +++ b/cpp/tensorrt_llm/executor/cache_transmission/nixl_utils/bounce/CMakeLists.txt @@ -48,3 +48,22 @@ target_compile_features(tllm_executor_bounce_arena PUBLIC cxx_std_20) target_compile_options(tllm_executor_bounce_arena PRIVATE -Wno-error) set_target_properties(tllm_executor_bounce_arena PROPERTIES POSITION_INDEPENDENT_CODE ON) + +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(TLLM_BOUNCE_ZMQ QUIET IMPORTED_TARGET GLOBAL libzmq) +endif() +if(TLLM_BOUNCE_ZMQ_FOUND AND EXISTS ${CMAKE_BINARY_DIR}/_deps/cppzmq-src) + add_library(tllm_executor_bounce_control STATIC EXCLUDE_FROM_ALL + ZmqControlChannel.cpp) + add_library(tllm::executor_bounce_control ALIAS tllm_executor_bounce_control) + target_link_libraries( + tllm_executor_bounce_control PUBLIC tllm::executor_bounce_core + PkgConfig::TLLM_BOUNCE_ZMQ) + target_include_directories(tllm_executor_bounce_control SYSTEM + PUBLIC ${CMAKE_BINARY_DIR}/_deps/cppzmq-src) + target_compile_features(tllm_executor_bounce_control PUBLIC cxx_std_20) + target_compile_options(tllm_executor_bounce_control PRIVATE -Wno-error) + set_target_properties(tllm_executor_bounce_control + PROPERTIES POSITION_INDEPENDENT_CODE ON) +endif() diff --git a/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt b/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt index 3686a985b285..5a7627bfbd45 100644 --- a/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt +++ b/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt @@ -111,30 +111,22 @@ add_tllm_gtest( "unit;executor;bounce;gpu" REQUIRES_GPU) -# ---- Control-plane unit test — needs only zmq (+ the fetched cppzmq header), -# no NIXL. ZMQ_FOUND is reused by the real-NIXL block below. ---- -find_package(PkgConfig) -if(PKG_CONFIG_FOUND) - pkg_check_modules(ZMQ libzmq) -endif() -# Both zmq tiers need libzmq AND the fetched cppzmq header: without the latter -# the sources compile-fail on zmq.hpp even though libzmq itself was found. -if(ZMQ_FOUND AND EXISTS ${CMAKE_BINARY_DIR}/_deps/cppzmq-src) +# ---- Control-plane unit test: ZeroMQ and cppzmq, without NIXL. ---- +if(TARGET tllm_executor_bounce_control) set(BOUNCE_CPPZMQ_AVAILABLE TRUE) + add_tllm_gtest( + zmqControlChannelTest + OWNER + executor + SOURCES + zmqControlChannelTest.cpp + LINK_LIBRARIES + tllm::executor_bounce_control + LABELS + "unit;executor;bounce;host") else() set(BOUNCE_CPPZMQ_AVAILABLE FALSE) endif() -if(BOUNCE_CPPZMQ_AVAILABLE) - add_tllm_gtest(zmqControlChannelTest SOURCES zmqControlChannelTest.cpp - FULL_STACK LABELS "unit;full-stack") - target_sources( - zmqControlChannelTest PRIVATE ${BOUNCE_DIR}/ZmqControlChannel.cpp - ${BOUNCE_DIR}/BounceMessage.cpp) - target_include_directories( - zmqControlChannelTest PRIVATE ${CMAKE_BINARY_DIR}/_deps/cppzmq-src - ${ZMQ_INCLUDE_DIRS}) - target_link_libraries(zmqControlChannelTest PRIVATE ${ZMQ_LIBRARIES}) -endif() # ---- Real-NIXL tests (need NIXL_ROOT). The bounce DATA PLANE is always real # NIXL — there is no loopback fake — so every test that drives the reactor @@ -145,8 +137,7 @@ if(NIXL_ROOT) # when NIXL is on); all of them share this source set + include/link sets. # Same gate as the zmq-only tier above. if(BOUNCE_CPPZMQ_AVAILABLE) - set(BOUNCE_REACTOR_SRCS ${BOUNCE_DIR}/BounceTransport.cpp - ${BOUNCE_DIR}/ZmqControlChannel.cpp) + set(BOUNCE_REACTOR_SRCS ${BOUNCE_DIR}/BounceTransport.cpp) set(BOUNCE_TSAN_SRCS ${BOUNCE_DIR}/BounceTransport.cpp ${BOUNCE_DIR}/BounceTransferPlan.cpp @@ -157,10 +148,9 @@ if(NIXL_ROOT) ${BOUNCE_DIR}/ExecPool.cpp ${BOUNCE_DIR}/GatherScatterKernel.cu ${BOUNCE_DIR}/ZmqControlChannel.cpp) - set(BOUNCE_TEST_INCS ${CMAKE_BINARY_DIR}/_deps/cppzmq-src - ${ZMQ_INCLUDE_DIRS}) + set(BOUNCE_TEST_INCS ${CMAKE_BINARY_DIR}/_deps/cppzmq-src) set(BOUNCE_TEST_LIBS tensorrt_llm_nixl_wrapper NIXL::nixl - ${NIXL_BUILD_LIBRARY} ${ZMQ_LIBRARIES}) + ${NIXL_BUILD_LIBRARY} PkgConfig::TLLM_BOUNCE_ZMQ) # One reactor test target: the bounce sources compiled in, plus the shared # include/link sets. From 102c0e413a8b10cbe82d8153b954cad5b6bcceb6 Mon Sep 17 00:00:00 2001 From: Robin Kobus <19427718+Funatiq@users.noreply.github.com> Date: Sat, 24 Oct 2026 12:04:42 +0000 Subject: [PATCH 09/16] fix: initialize CUDA before querying eager MoE test allocator quotas The two EagerMoeWorkspace memory-pressure tests query the native CUDA caching allocator memory fraction before making their first tensor allocation. Reading the current CUDA device does not initialize the PyTorch allocator, so either test can fail in a fresh process with an "Allocator not initialized for device" internal assertion. Running the complete Google Test suite in one process masks this ordering dependency because earlier tests allocate CUDA tensors. CTest executes the registered cases in separate processes and exposes the missing setup. Explicitly initialize the CUDA device through ATen's global context in both memory-pressure tests before reading or changing allocator quotas. Include ATen/Context.h directly for the initialization API. Keep the quota restoration and OOM assertions unchanged. Validation: - Reproduced ConservativeReservationOomStillAllowsSmallerActualDemand failing in isolation before the fix. - Rebuilt thUtilsTest in the project devcontainer. - All 13 EagerMoeWorkspace and EagerMoeWorkspaceScope tests passed through CTest on an A100, with each test running in a fresh process. - clang-format --dry-run --Werror and git diff --check passed. Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com> --- cpp/tests/unit_tests/thop/eagerMoeWorkspaceTest.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cpp/tests/unit_tests/thop/eagerMoeWorkspaceTest.cpp b/cpp/tests/unit_tests/thop/eagerMoeWorkspaceTest.cpp index 36dbb43fe362..0e2e354ff1f1 100644 --- a/cpp/tests/unit_tests/thop/eagerMoeWorkspaceTest.cpp +++ b/cpp/tests/unit_tests/thop/eagerMoeWorkspaceTest.cpp @@ -16,6 +16,7 @@ #include "tensorrt_llm/thop/moe/cutlass/eagerMoeWorkspace.h" #include "tensorrt_llm/thop/moe/cutlass/eagerMoeWorkspaceScope.h" +#include #include #include #include @@ -153,6 +154,8 @@ TEST(EagerMoeWorkspace, ReclamationRetriesAfterReleasingScratchUnderMemoryPressu GTEST_SKIP() << "Uses native allocator quota and OOM counters"; } constexpr int64_t kMiB = 1024 * 1024; + // Allocator quota queries require PyTorch's CUDA initialization. + at::globalContext().lazyInitDevice(c10::DeviceType::CUDA); auto const device = c10::cuda::current_device(); auto const previousLimit = c10::cuda::CUDACachingAllocator::getMemoryFraction(device); auto restoreLimit @@ -205,6 +208,8 @@ TEST(EagerMoeWorkspace, ConservativeReservationOomStillAllowsSmallerActualDemand GTEST_SKIP() << "Uses native allocator quota and OOM counters"; } constexpr int64_t kMiB = 1024 * 1024; + // Allocator quota queries require PyTorch's CUDA initialization. + at::globalContext().lazyInitDevice(c10::DeviceType::CUDA); auto const device = c10::cuda::current_device(); auto const previousLimit = c10::cuda::CUDACachingAllocator::getMemoryFraction(device); auto restoreLimit From 2d953b69b639b39b8a9d5227aa03e907651cd51a Mon Sep 17 00:00:00 2001 From: Robin Kobus <19427718+Funatiq@users.noreply.github.com> Date: Sat, 24 Oct 2026 19:49:44 +0000 Subject: [PATCH 10/16] fix: declare GPU scheduling requirements for migrated C++ tests Mark the PEFT cache, UCX and transfer-agent tests, bounce reactor and agent tests, all-reduce kernel tests, and host-accessible device allocator test as GPU consumers. Preserve their full-stack labels and UCX timeout while enabling GPU label selection and CTest resource locking. Forward GPU requirements through the bounce reactor helper and link its normal variants directly to the control component. Keep the instrumented variant compiling its own control sources. Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com> --- .../unit_tests/batch_manager/CMakeLists.txt | 10 ++++- cpp/tests/unit_tests/executor/CMakeLists.txt | 23 +++++++--- .../unit_tests/executor/bounce/CMakeLists.txt | 42 ++++++++++++++----- .../multi_gpu/kernels/CMakeLists.txt | 30 ++++++++++--- cpp/tests/unit_tests/runtime/CMakeLists.txt | 9 +++- 5 files changed, 89 insertions(+), 25 deletions(-) diff --git a/cpp/tests/unit_tests/batch_manager/CMakeLists.txt b/cpp/tests/unit_tests/batch_manager/CMakeLists.txt index c7bd2933f7ff..ac62314f9c5d 100644 --- a/cpp/tests/unit_tests/batch_manager/CMakeLists.txt +++ b/cpp/tests/unit_tests/batch_manager/CMakeLists.txt @@ -350,8 +350,14 @@ add_tllm_gtest( "unit;batch-manager;gpu" REQUIRES_GPU) -add_tllm_gtest(peftCacheManagerTest SOURCES peftCacheManagerTest.cpp FULL_STACK - LABELS "unit;full-stack") +add_tllm_gtest( + peftCacheManagerTest + SOURCES + peftCacheManagerTest.cpp + FULL_STACK + REQUIRES_GPU + LABELS + "unit;full-stack;gpu") add_tllm_gtest(rnnCacheFormatterTest SOURCES rnnCacheFormatterTest.cpp FULL_STACK LABELS "unit;full-stack") diff --git a/cpp/tests/unit_tests/executor/CMakeLists.txt b/cpp/tests/unit_tests/executor/CMakeLists.txt index cdfae9c1e0cb..70a7b9c0e6d6 100644 --- a/cpp/tests/unit_tests/executor/CMakeLists.txt +++ b/cpp/tests/unit_tests/executor/CMakeLists.txt @@ -106,8 +106,9 @@ add_tllm_gtest( SOURCES ucxCommTest.cpp FULL_STACK + REQUIRES_GPU LABELS - "unit;full-stack" + "unit;full-stack;gpu" TIMEOUT 60) target_link_libraries(ucxCommTest PRIVATE ${Python3_LIBRARIES}) @@ -125,10 +126,22 @@ if(EXISTS "/etc/redhat-release") endif() if(NIXL_ROOT OR (MOONCAKE_ROOT AND NOT IS_ROCKY8)) - add_tllm_gtest(agentCommTest SOURCES agentCommTest.cpp FULL_STACK LABELS - "unit;full-stack") - add_tllm_gtest(transferAgentTest SOURCES transferAgentTest.cpp FULL_STACK - LABELS "unit;full-stack") + add_tllm_gtest( + agentCommTest + SOURCES + agentCommTest.cpp + FULL_STACK + REQUIRES_GPU + LABELS + "unit;full-stack;gpu") + add_tllm_gtest( + transferAgentTest + SOURCES + transferAgentTest.cpp + FULL_STACK + REQUIRES_GPU + LABELS + "unit;full-stack;gpu") if(NIXL_ROOT) target_link_libraries(transferAgentTest PRIVATE tensorrt_llm_nixl_wrapper) diff --git a/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt b/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt index 5a7627bfbd45..19cd6ee74f8a 100644 --- a/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt +++ b/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt @@ -155,15 +155,29 @@ if(NIXL_ROOT) # One reactor test target: the bounce sources compiled in, plus the shared # include/link sets. function(add_bounce_reactor_test name src) - cmake_parse_arguments(ARG "INSTRUMENTED" "" "" ${ARGN}) - add_tllm_gtest(${name} SOURCES ${src} FULL_STACK LABELS "unit;full-stack") + cmake_parse_arguments(ARG "INSTRUMENTED;REQUIRES_GPU" "" "" ${ARGN}) + set(gpu_option "") + set(test_labels "unit;full-stack") + if(ARG_REQUIRES_GPU) + set(gpu_option REQUIRES_GPU) + list(APPEND test_labels gpu) + endif() + add_tllm_gtest( + ${name} + SOURCES + ${src} + FULL_STACK + ${gpu_option} + LABELS + "${test_labels}") if(ARG_INSTRUMENTED) target_sources(${name} PRIVATE ${BOUNCE_TSAN_SRCS}) else() target_sources(${name} PRIVATE ${BOUNCE_REACTOR_SRCS}) target_link_libraries( - ${name} PRIVATE tllm::executor_bounce_core tllm::executor_bounce_cuda - tllm::executor_bounce_arena) + ${name} + PRIVATE tllm::executor_bounce_core tllm::executor_bounce_cuda + tllm::executor_bounce_arena tllm::executor_bounce_control) endif() target_include_directories(${name} PRIVATE ${BOUNCE_TEST_INCS}) target_link_libraries(${name} PRIVATE ${BOUNCE_TEST_LIBS}) @@ -171,11 +185,12 @@ if(NIXL_ROOT) # End-to-end transport over real RDMA (gather -> RDMA write -> scatter + # credit recycling), byte-exact. - add_bounce_reactor_test(bounceTransportTest bounceTransportTest.cpp) + add_bounce_reactor_test(bounceTransportTest bounceTransportTest.cpp + REQUIRES_GPU) # Boundary, failure-path, and concurrency tests. add_bounce_reactor_test(bounceTransportFailureTest - bounceTransportFailureTest.cpp) + bounceTransportFailureTest.cpp REQUIRES_GPU) # Optional ThreadSanitizer variant of the reactor concurrency test. The # bounce sources + the test are instrumented; the shared libtensorrt_llm @@ -185,8 +200,9 @@ if(NIXL_ROOT) option(BOUNCE_TSAN "Build a ThreadSanitizer variant of the bounce reactor test" OFF) if(BOUNCE_TSAN) - add_bounce_reactor_test(bounceTransportTsanTest - bounceTransportFailureTest.cpp INSTRUMENTED) + add_bounce_reactor_test( + bounceTransportTsanTest bounceTransportFailureTest.cpp INSTRUMENTED + REQUIRES_GPU) target_compile_options( bounceTransportTsanTest PRIVATE $<$:-fsanitize=thread -g> @@ -199,8 +215,14 @@ if(NIXL_ROOT) # wrapper; this test only uses the public agent API (the zmq include is # needed only because the shared bounceTestNixlNode.h helpers pull in # ZmqControlChannel.h at compile time). - add_tllm_gtest(bounceAgentE2ETest SOURCES bounceAgentE2ETest.cpp FULL_STACK - LABELS "unit;full-stack") + add_tllm_gtest( + bounceAgentE2ETest + SOURCES + bounceAgentE2ETest.cpp + FULL_STACK + REQUIRES_GPU + LABELS + "unit;full-stack;gpu") target_include_directories(bounceAgentE2ETest PRIVATE ${BOUNCE_TEST_INCS}) target_link_libraries( bounceAgentE2ETest PRIVATE tensorrt_llm_nixl_wrapper NIXL::nixl diff --git a/cpp/tests/unit_tests/multi_gpu/kernels/CMakeLists.txt b/cpp/tests/unit_tests/multi_gpu/kernels/CMakeLists.txt index 66a1e9fd9ecd..eb1258a371ae 100644 --- a/cpp/tests/unit_tests/multi_gpu/kernels/CMakeLists.txt +++ b/cpp/tests/unit_tests/multi_gpu/kernels/CMakeLists.txt @@ -14,12 +14,30 @@ # the License. if(NOT ENABLE_MULTI_DEVICE EQUAL 0) - add_tllm_gtest(allReduceKernelTest SOURCES allReduce/allReduceKernelTest.cu - FULL_STACK LABELS "unit;full-stack") - add_tllm_gtest(allReduceFusionTest SOURCES allReduce/allReduceFusionTest.cu - FULL_STACK LABELS "unit;full-stack") - add_tllm_gtest(gemmAllReduceTest SOURCES allReduce/gemmAllReduceTest.cu - FULL_STACK LABELS "unit;full-stack") + add_tllm_gtest( + allReduceKernelTest + SOURCES + allReduce/allReduceKernelTest.cu + FULL_STACK + REQUIRES_GPU + LABELS + "unit;full-stack;gpu") + add_tllm_gtest( + allReduceFusionTest + SOURCES + allReduce/allReduceFusionTest.cu + FULL_STACK + REQUIRES_GPU + LABELS + "unit;full-stack;gpu") + add_tllm_gtest( + gemmAllReduceTest + SOURCES + allReduce/gemmAllReduceTest.cu + FULL_STACK + REQUIRES_GPU + LABELS + "unit;full-stack;gpu") if(USING_OSS_CUTLASS_ALLREDUCE_GEMM) target_link_libraries(gemmAllReduceTest PRIVATE ar_gemm_src) target_compile_definitions(gemmAllReduceTest diff --git a/cpp/tests/unit_tests/runtime/CMakeLists.txt b/cpp/tests/unit_tests/runtime/CMakeLists.txt index 918d8a5a358c..ba2f1ed76f89 100644 --- a/cpp/tests/unit_tests/runtime/CMakeLists.txt +++ b/cpp/tests/unit_tests/runtime/CMakeLists.txt @@ -38,8 +38,13 @@ add_tllm_gtest( add_tllm_gtest(gdrcopyTest SOURCES gdrcopyTest.cpp FULL_STACK LABELS "unit;full-stack") add_tllm_gtest( - hostAccessibleDeviceAllocatorTest SOURCES - hostAccessibleDeviceAllocatorTest.cu FULL_STACK LABELS "unit;full-stack") + hostAccessibleDeviceAllocatorTest + SOURCES + hostAccessibleDeviceAllocatorTest.cu + FULL_STACK + REQUIRES_GPU + LABELS + "unit;full-stack;gpu") add_tllm_gtest( iBufferTest OWNER From b9384576c54cf6ba6d941993883f4269f4295490 Mon Sep 17 00:00:00 2001 From: Robin Kobus <19427718+Funatiq@users.noreply.github.com> Date: Sat, 24 Oct 2026 20:18:34 +0000 Subject: [PATCH 11/16] fix: classify memoryUtilsTest as a host test The memory utility tests check constexpr indexing with static assertions and do not use a GPU at runtime. Use the common host label and remove REQUIRES_GPU so host test selection includes them without taking the GPU resource lock. Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com> --- cpp/tests/unit_tests/common/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cpp/tests/unit_tests/common/CMakeLists.txt b/cpp/tests/unit_tests/common/CMakeLists.txt index 06973426c766..4e8341b702dd 100644 --- a/cpp/tests/unit_tests/common/CMakeLists.txt +++ b/cpp/tests/unit_tests/common/CMakeLists.txt @@ -37,8 +37,7 @@ add_tllm_gtest( LINK_LIBRARIES tllm::common_cuda LABELS - "unit;common;gpu" - REQUIRES_GPU) + "unit;common;host") add_tllm_gtest( optionalRefTest OWNER From 8b89e27dc9dc28012681e59729be0831bb941433 Mon Sep 17 00:00:00 2001 From: Robin Kobus <19427718+Funatiq@users.noreply.github.com> Date: Sat, 24 Oct 2026 20:21:00 +0000 Subject: [PATCH 12/16] fix: declare GPU requirements for runtime integration tests Add the gpu label and REQUIRES_GPU to the GDRCopy, IPC NVLS memory, LoRA cache, LoRA utilities, MoE load balancer, localization, KV transpose, and runtime utilities tests. These tests use CUDA streams, device memory, or device queries and need GPU resource locking during parallel CTest runs. Preserve test names, sources, full-stack linkage, and existing labels while allowing selection with the gpu label. Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com> --- cpp/tests/unit_tests/runtime/CMakeLists.txt | 80 ++++++++++++++++----- 1 file changed, 64 insertions(+), 16 deletions(-) diff --git a/cpp/tests/unit_tests/runtime/CMakeLists.txt b/cpp/tests/unit_tests/runtime/CMakeLists.txt index ba2f1ed76f89..3b3eabe17e65 100644 --- a/cpp/tests/unit_tests/runtime/CMakeLists.txt +++ b/cpp/tests/unit_tests/runtime/CMakeLists.txt @@ -35,8 +35,14 @@ add_tllm_gtest( LABELS "unit;runtime;gpu" REQUIRES_GPU) -add_tllm_gtest(gdrcopyTest SOURCES gdrcopyTest.cpp FULL_STACK LABELS - "unit;full-stack") +add_tllm_gtest( + gdrcopyTest + SOURCES + gdrcopyTest.cpp + FULL_STACK + REQUIRES_GPU + LABELS + "unit;full-stack;gpu") add_tllm_gtest( hostAccessibleDeviceAllocatorTest SOURCES @@ -55,8 +61,14 @@ add_tllm_gtest( tllm::runtime_buffers LABELS "unit;runtime;host") -add_tllm_gtest(ipcNvlsMemoryTest SOURCES ipcNvlsMemoryTest.cpp FULL_STACK - LABELS "unit;full-stack") +add_tllm_gtest( + ipcNvlsMemoryTest + SOURCES + ipcNvlsMemoryTest.cpp + FULL_STACK + REQUIRES_GPU + LABELS + "unit;full-stack;gpu") add_tllm_gtest( iTensorTest OWNER @@ -67,12 +79,30 @@ add_tllm_gtest( tllm::runtime_buffers LABELS "unit;runtime;host") -add_tllm_gtest(loraCacheTest SOURCES loraCacheTest.cpp FULL_STACK LABELS - "unit;full-stack") -add_tllm_gtest(loraUtilsTest SOURCES loraUtilsTest.cpp FULL_STACK LABELS - "unit;full-stack") -add_tllm_gtest(moeLoadBalancerTest SOURCES moeLoadBalancerTest.cpp FULL_STACK - LABELS "unit;full-stack") +add_tllm_gtest( + loraCacheTest + SOURCES + loraCacheTest.cpp + FULL_STACK + REQUIRES_GPU + LABELS + "unit;full-stack;gpu") +add_tllm_gtest( + loraUtilsTest + SOURCES + loraUtilsTest.cpp + FULL_STACK + REQUIRES_GPU + LABELS + "unit;full-stack;gpu") +add_tllm_gtest( + moeLoadBalancerTest + SOURCES + moeLoadBalancerTest.cpp + FULL_STACK + REQUIRES_GPU + LABELS + "unit;full-stack;gpu") add_tllm_gtest( runtimeMpiUtilsTest OWNER @@ -83,8 +113,14 @@ add_tllm_gtest( tllm::runtime_distributed LABELS "unit;runtime;host") -add_tllm_gtest(localizationTest SOURCES localizationTest.cu FULL_STACK LABELS - "unit;full-stack") +add_tllm_gtest( + localizationTest + SOURCES + localizationTest.cu + FULL_STACK + REQUIRES_GPU + LABELS + "unit;full-stack;gpu") add_tllm_gtest( localityDomainPublicConfigTest OWNER @@ -118,10 +154,22 @@ add_tllm_gtest( LABELS "unit;runtime;gpu" REQUIRES_GPU) -add_tllm_gtest(transposeKVKernelTest SOURCES transposeKVKernelTest.cpp - FULL_STACK LABELS "unit;full-stack") -add_tllm_gtest(utilsTest SOURCES utilsTest.cpp FULL_STACK LABELS - "unit;full-stack") +add_tllm_gtest( + transposeKVKernelTest + SOURCES + transposeKVKernelTest.cpp + FULL_STACK + REQUIRES_GPU + LABELS + "unit;full-stack;gpu") +add_tllm_gtest( + utilsTest + SOURCES + utilsTest.cpp + FULL_STACK + REQUIRES_GPU + LABELS + "unit;full-stack;gpu") add_tllm_gtest( virtualMemoryTest OWNER From 7de32bdf8724a4fff89d795dd688f4ef074af238 Mon Sep 17 00:00:00 2001 From: Robin Kobus <19427718+Funatiq@users.noreply.github.com> Date: Sat, 24 Oct 2026 20:25:20 +0000 Subject: [PATCH 13/16] fix: classify remaining full-stack C++ tests by runtime device use Label the context-transfer vote reducer, RNN cache formatter, profiler environment parser, serialization, agent-name generation, and worker-pool tests as host tests. Their exercised paths do not require CUDA devices. Label attention workspace, cache transceiver, user-buffer, NCCL utilities, and THOP tests as GPU tests, adding missing GPU resource locks. AttentionOp construction queries device properties even when its tests only calculate workspace layouts. Validate all explicit full-stack registrations have consistent labels and GPU flags. Run the six existing host binaries with CUDA_VISIBLE_DEVICES empty: all 149 test cases pass. Focused CMake configuration checks verify discovery properties and resource locks. Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com> --- .../unit_tests/batch_manager/CMakeLists.txt | 4 +-- cpp/tests/unit_tests/common/CMakeLists.txt | 12 ++++++-- cpp/tests/unit_tests/executor/CMakeLists.txt | 4 +-- cpp/tests/unit_tests/multi_gpu/CMakeLists.txt | 30 +++++++++++++++---- cpp/tests/unit_tests/runtime/CMakeLists.txt | 2 +- cpp/tests/unit_tests/thop/CMakeLists.txt | 2 +- 6 files changed, 39 insertions(+), 15 deletions(-) diff --git a/cpp/tests/unit_tests/batch_manager/CMakeLists.txt b/cpp/tests/unit_tests/batch_manager/CMakeLists.txt index ac62314f9c5d..4fc1f20b8397 100644 --- a/cpp/tests/unit_tests/batch_manager/CMakeLists.txt +++ b/cpp/tests/unit_tests/batch_manager/CMakeLists.txt @@ -105,7 +105,7 @@ add_tllm_gtest( add_tllm_gtest( contextTransferCoordinatorTest SOURCES contextTransferCoordinatorTest.cpp - FULL_STACK LABELS "unit;full-stack") + FULL_STACK LABELS "unit;full-stack;host") add_tllm_gtest( evictionPolicyTest @@ -360,7 +360,7 @@ add_tllm_gtest( "unit;full-stack;gpu") add_tllm_gtest(rnnCacheFormatterTest SOURCES rnnCacheFormatterTest.cpp - FULL_STACK LABELS "unit;full-stack") + FULL_STACK LABELS "unit;full-stack;host") add_tllm_gtest( agentTreeTest diff --git a/cpp/tests/unit_tests/common/CMakeLists.txt b/cpp/tests/unit_tests/common/CMakeLists.txt index 4e8341b702dd..b7f0ffab2b70 100644 --- a/cpp/tests/unit_tests/common/CMakeLists.txt +++ b/cpp/tests/unit_tests/common/CMakeLists.txt @@ -14,7 +14,7 @@ # the License. add_tllm_gtest(cudaProfilerUtilsTest SOURCES cudaProfilerUtilsTest.cpp - FULL_STACK LABELS "unit;full-stack") + FULL_STACK LABELS "unit;full-stack;host") add_tllm_gtest( cudaUtilsTest OWNER @@ -26,8 +26,14 @@ add_tllm_gtest( LABELS "unit;common;gpu" REQUIRES_GPU) -add_tllm_gtest(attentionWorkspaceTest SOURCES attentionWorkspaceTest.cpp - FULL_STACK LABELS "unit;full-stack") +add_tllm_gtest( + attentionWorkspaceTest + SOURCES + attentionWorkspaceTest.cpp + FULL_STACK + REQUIRES_GPU + LABELS + "unit;full-stack;gpu") add_tllm_gtest( memoryUtilsTest OWNER diff --git a/cpp/tests/unit_tests/executor/CMakeLists.txt b/cpp/tests/unit_tests/executor/CMakeLists.txt index 70a7b9c0e6d6..c10117b3a426 100644 --- a/cpp/tests/unit_tests/executor/CMakeLists.txt +++ b/cpp/tests/unit_tests/executor/CMakeLists.txt @@ -76,7 +76,7 @@ add_tllm_gtest( "unit;executor;gpu" REQUIRES_GPU) add_tllm_gtest(serializeUtilsTest SOURCES serializeUtilsTest.cpp FULL_STACK - LABELS "unit;full-stack") + LABELS "unit;full-stack;host") add_tllm_gtest( loraConfigTest OWNER @@ -99,7 +99,7 @@ add_tllm_gtest( LABELS "unit;executor;host") add_tllm_gtest(genUniqueAgentNameTest SOURCES genUniqueAgentNameTest.cpp - FULL_STACK LABELS "unit;full-stack") + FULL_STACK LABELS "unit;full-stack;host") target_link_libraries(genUniqueAgentNameTest PRIVATE ${Python3_LIBRARIES}) add_tllm_gtest( ucxCommTest diff --git a/cpp/tests/unit_tests/multi_gpu/CMakeLists.txt b/cpp/tests/unit_tests/multi_gpu/CMakeLists.txt index a34f5149d682..800bc31b4743 100644 --- a/cpp/tests/unit_tests/multi_gpu/CMakeLists.txt +++ b/cpp/tests/unit_tests/multi_gpu/CMakeLists.txt @@ -15,8 +15,14 @@ add_subdirectory(kernels) -add_tllm_gtest(cacheTransceiverTest SOURCES cacheTransceiverTest.cpp FULL_STACK - LABELS "unit;full-stack") +add_tllm_gtest( + cacheTransceiverTest + SOURCES + cacheTransceiverTest.cpp + FULL_STACK + REQUIRES_GPU + LABELS + "unit;full-stack;gpu") target_link_libraries(cacheTransceiverTest PRIVATE ${Python3_LIBRARIES}) add_tllm_gtest( @@ -51,10 +57,22 @@ add_tllm_gtest( if(ENABLE_MULTI_DEVICE) target_link_libraries(mpiUtilsTest PRIVATE ${NCCL_LIB}) endif() -add_tllm_gtest(userBufferTest SOURCES userBufferTest.cpp FULL_STACK LABELS - "unit;full-stack") -add_tllm_gtest(ncclUtilsTest SOURCES ncclUtilsTest.cpp FULL_STACK LABELS - "unit;full-stack") +add_tllm_gtest( + userBufferTest + SOURCES + userBufferTest.cpp + FULL_STACK + REQUIRES_GPU + LABELS + "unit;full-stack;gpu") +add_tllm_gtest( + ncclUtilsTest + SOURCES + ncclUtilsTest.cpp + FULL_STACK + REQUIRES_GPU + LABELS + "unit;full-stack;gpu") target_link_libraries(ncclUtilsTest PRIVATE ${Python3_LIBRARIES}) if(BUILD_PYT) target_compile_definitions(cacheTransceiverTest PUBLIC BUILD_PYT) diff --git a/cpp/tests/unit_tests/runtime/CMakeLists.txt b/cpp/tests/unit_tests/runtime/CMakeLists.txt index 3b3eabe17e65..96aadfa69f56 100644 --- a/cpp/tests/unit_tests/runtime/CMakeLists.txt +++ b/cpp/tests/unit_tests/runtime/CMakeLists.txt @@ -182,7 +182,7 @@ add_tllm_gtest( "unit;runtime;gpu" REQUIRES_GPU) add_tllm_gtest(workerPoolTest SOURCES workerPoolTest.cpp FULL_STACK LABELS - "unit;full-stack") + "unit;full-stack;host") add_tllm_gtest( worldConfigTest OWNER diff --git a/cpp/tests/unit_tests/thop/CMakeLists.txt b/cpp/tests/unit_tests/thop/CMakeLists.txt index 2286f0a4966c..fafdbd5fdfa7 100644 --- a/cpp/tests/unit_tests/thop/CMakeLists.txt +++ b/cpp/tests/unit_tests/thop/CMakeLists.txt @@ -21,7 +21,7 @@ if(${BUILD_PYT}) eagerMoeWorkspaceTest.cpp FULL_STACK LABELS - "unit;full-stack" + "unit;full-stack;gpu" REQUIRES_GPU) target_link_libraries(thUtilsTest PUBLIC th_utils ${Python3_LIBRARIES} ${TORCH_LIBRARIES}) From c7a9f29c42fbecfd481e131c269e657cc5dd606b Mon Sep 17 00:00:00 2001 From: Robin Kobus <19427718+Funatiq@users.noreply.github.com> Date: Sat, 24 Oct 2026 20:33:23 +0000 Subject: [PATCH 14/16] fix: preserve parallel execution of GPU C++ tests parallel_run_ctest sets CTEST_PARALLEL_LEVEL to run multiple tests concurrently and retries failures serially. A shared implicit RESOURCE_LOCK gpu bypasses that policy by serializing every test marked REQUIRES_GPU. Make REQUIRES_GPU add the gpu label instead of a resource lock, deduplicating labels already supplied by callers. Document that the CI runner controls GPU test concurrency. Explicit test resource locks remain available for tests that need exclusive access. Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com> --- AGENTS.md | 6 ++++-- cpp/tests/CMakeLists.txt | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index cfa566852cbf..bb5a2d03fa0c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -192,8 +192,10 @@ See [CI overview](docs/source/developer-guide/ci-overview.md) for full details. New C++ unit tests should use `add_tllm_gtest` with explicit `SOURCES`, `LINK_LIBRARIES`, `OWNER`, and scheduling `LABELS`. Request `FULL_STACK` explicitly -for integration tests and `REQUIRES_GPU` for tests that need a GPU. `google-tests` -continues to build all C++ tests; component aggregate targets build migrated tests. +for integration tests and `REQUIRES_GPU` for tests that need a GPU. `REQUIRES_GPU` +adds the `gpu` label without serializing GPU tests; CI controls concurrency through +`parallel_run_ctest`. `google-tests` continues to build all C++ tests; component +aggregate targets build migrated tests. ### Advisory semantic review diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index e0e9029da15c..c0226cb4e0ca 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -115,7 +115,8 @@ function(add_tllm_gtest test_name) set(test_properties ENVIRONMENT "CUDA_MODULE_LOADING=LAZY") if(ARG_REQUIRES_GPU) - list(APPEND test_properties RESOURCE_LOCK gpu) + list(APPEND ARG_LABELS gpu) + list(REMOVE_DUPLICATES ARG_LABELS) endif() if(ARG_TIMEOUT) list(APPEND test_properties TIMEOUT "${ARG_TIMEOUT}") From f2cca59238d5a1976237cc607784981fdc3853aa Mon Sep 17 00:00:00 2001 From: Robin Kobus <19427718+Funatiq@users.noreply.github.com> Date: Sat, 24 Oct 2026 20:35:48 +0000 Subject: [PATCH 15/16] fix: remove GPU requirement flags introduced by test migration Remove REQUIRES_GPU from the 35 test registrations that gained it on this branch, preserving flags present at the branch base. Keep explicit host and gpu labels, source lists, linkage, and existing test settings. Simplify the bounce reactor helper to retain its gpu label without parsing or forwarding REQUIRES_GPU. Verify registration arguments against the branch base and configure focused test targets with bounce control enabled and disabled. Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com> --- .../unit_tests/batch_manager/CMakeLists.txt | 10 +- cpp/tests/unit_tests/common/CMakeLists.txt | 16 +--- cpp/tests/unit_tests/executor/CMakeLists.txt | 27 ++---- .../unit_tests/executor/bounce/CMakeLists.txt | 47 +++------ cpp/tests/unit_tests/multi_gpu/CMakeLists.txt | 33 ++----- .../multi_gpu/kernels/CMakeLists.txt | 30 ++---- cpp/tests/unit_tests/runtime/CMakeLists.txt | 95 ++++--------------- cpp/tests/unit_tests/thop/CMakeLists.txt | 3 +- 8 files changed, 58 insertions(+), 203 deletions(-) diff --git a/cpp/tests/unit_tests/batch_manager/CMakeLists.txt b/cpp/tests/unit_tests/batch_manager/CMakeLists.txt index 4fc1f20b8397..11624d4822e0 100644 --- a/cpp/tests/unit_tests/batch_manager/CMakeLists.txt +++ b/cpp/tests/unit_tests/batch_manager/CMakeLists.txt @@ -350,14 +350,8 @@ add_tllm_gtest( "unit;batch-manager;gpu" REQUIRES_GPU) -add_tllm_gtest( - peftCacheManagerTest - SOURCES - peftCacheManagerTest.cpp - FULL_STACK - REQUIRES_GPU - LABELS - "unit;full-stack;gpu") +add_tllm_gtest(peftCacheManagerTest SOURCES peftCacheManagerTest.cpp FULL_STACK + LABELS "unit;full-stack;gpu") add_tllm_gtest(rnnCacheFormatterTest SOURCES rnnCacheFormatterTest.cpp FULL_STACK LABELS "unit;full-stack;host") diff --git a/cpp/tests/unit_tests/common/CMakeLists.txt b/cpp/tests/unit_tests/common/CMakeLists.txt index b7f0ffab2b70..4174665d7284 100644 --- a/cpp/tests/unit_tests/common/CMakeLists.txt +++ b/cpp/tests/unit_tests/common/CMakeLists.txt @@ -24,16 +24,9 @@ add_tllm_gtest( LINK_LIBRARIES tllm::runtime_buffers LABELS - "unit;common;gpu" - REQUIRES_GPU) -add_tllm_gtest( - attentionWorkspaceTest - SOURCES - attentionWorkspaceTest.cpp - FULL_STACK - REQUIRES_GPU - LABELS - "unit;full-stack;gpu") + "unit;common;gpu") +add_tllm_gtest(attentionWorkspaceTest SOURCES attentionWorkspaceTest.cpp + FULL_STACK LABELS "unit;full-stack;gpu") add_tllm_gtest( memoryUtilsTest OWNER @@ -115,8 +108,7 @@ add_tllm_gtest( tllm::common_cuda CUDA::cuda_driver LABELS - "unit;common;gpu" - REQUIRES_GPU) + "unit;common;gpu") add_tllm_gtest( loggerTest OWNER diff --git a/cpp/tests/unit_tests/executor/CMakeLists.txt b/cpp/tests/unit_tests/executor/CMakeLists.txt index c10117b3a426..53fd9da6ded3 100644 --- a/cpp/tests/unit_tests/executor/CMakeLists.txt +++ b/cpp/tests/unit_tests/executor/CMakeLists.txt @@ -73,8 +73,7 @@ add_tllm_gtest( LINK_LIBRARIES tllm::executor_values LABELS - "unit;executor;gpu" - REQUIRES_GPU) + "unit;executor;gpu") add_tllm_gtest(serializeUtilsTest SOURCES serializeUtilsTest.cpp FULL_STACK LABELS "unit;full-stack;host") add_tllm_gtest( @@ -86,8 +85,7 @@ add_tllm_gtest( LINK_LIBRARIES tllm::executor_values LABELS - "unit;executor;gpu" - REQUIRES_GPU) + "unit;executor;gpu") add_tllm_gtest( coalesceTest OWNER @@ -106,7 +104,6 @@ add_tllm_gtest( SOURCES ucxCommTest.cpp FULL_STACK - REQUIRES_GPU LABELS "unit;full-stack;gpu" TIMEOUT @@ -126,22 +123,10 @@ if(EXISTS "/etc/redhat-release") endif() if(NIXL_ROOT OR (MOONCAKE_ROOT AND NOT IS_ROCKY8)) - add_tllm_gtest( - agentCommTest - SOURCES - agentCommTest.cpp - FULL_STACK - REQUIRES_GPU - LABELS - "unit;full-stack;gpu") - add_tllm_gtest( - transferAgentTest - SOURCES - transferAgentTest.cpp - FULL_STACK - REQUIRES_GPU - LABELS - "unit;full-stack;gpu") + add_tllm_gtest(agentCommTest SOURCES agentCommTest.cpp FULL_STACK LABELS + "unit;full-stack;gpu") + add_tllm_gtest(transferAgentTest SOURCES transferAgentTest.cpp FULL_STACK + LABELS "unit;full-stack;gpu") if(NIXL_ROOT) target_link_libraries(transferAgentTest PRIVATE tensorrt_llm_nixl_wrapper) diff --git a/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt b/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt index 19cd6ee74f8a..ceaa55d53818 100644 --- a/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt +++ b/cpp/tests/unit_tests/executor/bounce/CMakeLists.txt @@ -84,8 +84,7 @@ add_tllm_gtest( LINK_LIBRARIES tllm::executor_bounce_cuda LABELS - "unit;executor;bounce;gpu" - REQUIRES_GPU) + "unit;executor;bounce;gpu") # GPU test: gather/scatter CUDA kernel round-trip (needs a CUDA device to run). add_tllm_gtest( gatherScatterKernelTest @@ -96,8 +95,7 @@ add_tllm_gtest( LINK_LIBRARIES tllm::executor_bounce_cuda LABELS - "unit;executor;bounce;gpu" - REQUIRES_GPU) + "unit;executor;bounce;gpu") # GPU test: shared data-arena alloc / address mapping / shutdown. add_tllm_gtest( bounceArenaTest @@ -108,8 +106,7 @@ add_tllm_gtest( LINK_LIBRARIES tllm::executor_bounce_arena LABELS - "unit;executor;bounce;gpu" - REQUIRES_GPU) + "unit;executor;bounce;gpu") # ---- Control-plane unit test: ZeroMQ and cppzmq, without NIXL. ---- if(TARGET tllm_executor_bounce_control) @@ -155,21 +152,9 @@ if(NIXL_ROOT) # One reactor test target: the bounce sources compiled in, plus the shared # include/link sets. function(add_bounce_reactor_test name src) - cmake_parse_arguments(ARG "INSTRUMENTED;REQUIRES_GPU" "" "" ${ARGN}) - set(gpu_option "") - set(test_labels "unit;full-stack") - if(ARG_REQUIRES_GPU) - set(gpu_option REQUIRES_GPU) - list(APPEND test_labels gpu) - endif() - add_tllm_gtest( - ${name} - SOURCES - ${src} - FULL_STACK - ${gpu_option} - LABELS - "${test_labels}") + cmake_parse_arguments(ARG "INSTRUMENTED" "" "" ${ARGN}) + add_tllm_gtest(${name} SOURCES ${src} FULL_STACK LABELS + "unit;full-stack;gpu") if(ARG_INSTRUMENTED) target_sources(${name} PRIVATE ${BOUNCE_TSAN_SRCS}) else() @@ -185,12 +170,11 @@ if(NIXL_ROOT) # End-to-end transport over real RDMA (gather -> RDMA write -> scatter + # credit recycling), byte-exact. - add_bounce_reactor_test(bounceTransportTest bounceTransportTest.cpp - REQUIRES_GPU) + add_bounce_reactor_test(bounceTransportTest bounceTransportTest.cpp) # Boundary, failure-path, and concurrency tests. add_bounce_reactor_test(bounceTransportFailureTest - bounceTransportFailureTest.cpp REQUIRES_GPU) + bounceTransportFailureTest.cpp) # Optional ThreadSanitizer variant of the reactor concurrency test. The # bounce sources + the test are instrumented; the shared libtensorrt_llm @@ -200,9 +184,8 @@ if(NIXL_ROOT) option(BOUNCE_TSAN "Build a ThreadSanitizer variant of the bounce reactor test" OFF) if(BOUNCE_TSAN) - add_bounce_reactor_test( - bounceTransportTsanTest bounceTransportFailureTest.cpp INSTRUMENTED - REQUIRES_GPU) + add_bounce_reactor_test(bounceTransportTsanTest + bounceTransportFailureTest.cpp INSTRUMENTED) target_compile_options( bounceTransportTsanTest PRIVATE $<$:-fsanitize=thread -g> @@ -215,14 +198,8 @@ if(NIXL_ROOT) # wrapper; this test only uses the public agent API (the zmq include is # needed only because the shared bounceTestNixlNode.h helpers pull in # ZmqControlChannel.h at compile time). - add_tllm_gtest( - bounceAgentE2ETest - SOURCES - bounceAgentE2ETest.cpp - FULL_STACK - REQUIRES_GPU - LABELS - "unit;full-stack;gpu") + add_tllm_gtest(bounceAgentE2ETest SOURCES bounceAgentE2ETest.cpp FULL_STACK + LABELS "unit;full-stack;gpu") target_include_directories(bounceAgentE2ETest PRIVATE ${BOUNCE_TEST_INCS}) target_link_libraries( bounceAgentE2ETest PRIVATE tensorrt_llm_nixl_wrapper NIXL::nixl diff --git a/cpp/tests/unit_tests/multi_gpu/CMakeLists.txt b/cpp/tests/unit_tests/multi_gpu/CMakeLists.txt index 800bc31b4743..76af1a5550c7 100644 --- a/cpp/tests/unit_tests/multi_gpu/CMakeLists.txt +++ b/cpp/tests/unit_tests/multi_gpu/CMakeLists.txt @@ -15,14 +15,8 @@ add_subdirectory(kernels) -add_tllm_gtest( - cacheTransceiverTest - SOURCES - cacheTransceiverTest.cpp - FULL_STACK - REQUIRES_GPU - LABELS - "unit;full-stack;gpu") +add_tllm_gtest(cacheTransceiverTest SOURCES cacheTransceiverTest.cpp FULL_STACK + LABELS "unit;full-stack;gpu") target_link_libraries(cacheTransceiverTest PRIVATE ${Python3_LIBRARIES}) add_tllm_gtest( @@ -35,8 +29,7 @@ add_tllm_gtest( $ FULL_STACK LABELS - "unit;full-stack;batch-manager;gpu" - REQUIRES_GPU) + "unit;full-stack;batch-manager;gpu") target_include_directories( kvCacheManagerV2HostMemNumaTest PRIVATE ${PROJECT_SOURCE_DIR}/tensorrt_llm/batch_manager) @@ -57,22 +50,10 @@ add_tllm_gtest( if(ENABLE_MULTI_DEVICE) target_link_libraries(mpiUtilsTest PRIVATE ${NCCL_LIB}) endif() -add_tllm_gtest( - userBufferTest - SOURCES - userBufferTest.cpp - FULL_STACK - REQUIRES_GPU - LABELS - "unit;full-stack;gpu") -add_tllm_gtest( - ncclUtilsTest - SOURCES - ncclUtilsTest.cpp - FULL_STACK - REQUIRES_GPU - LABELS - "unit;full-stack;gpu") +add_tllm_gtest(userBufferTest SOURCES userBufferTest.cpp FULL_STACK LABELS + "unit;full-stack;gpu") +add_tllm_gtest(ncclUtilsTest SOURCES ncclUtilsTest.cpp FULL_STACK LABELS + "unit;full-stack;gpu") target_link_libraries(ncclUtilsTest PRIVATE ${Python3_LIBRARIES}) if(BUILD_PYT) target_compile_definitions(cacheTransceiverTest PUBLIC BUILD_PYT) diff --git a/cpp/tests/unit_tests/multi_gpu/kernels/CMakeLists.txt b/cpp/tests/unit_tests/multi_gpu/kernels/CMakeLists.txt index eb1258a371ae..c883cd35c5aa 100644 --- a/cpp/tests/unit_tests/multi_gpu/kernels/CMakeLists.txt +++ b/cpp/tests/unit_tests/multi_gpu/kernels/CMakeLists.txt @@ -14,30 +14,12 @@ # the License. if(NOT ENABLE_MULTI_DEVICE EQUAL 0) - add_tllm_gtest( - allReduceKernelTest - SOURCES - allReduce/allReduceKernelTest.cu - FULL_STACK - REQUIRES_GPU - LABELS - "unit;full-stack;gpu") - add_tllm_gtest( - allReduceFusionTest - SOURCES - allReduce/allReduceFusionTest.cu - FULL_STACK - REQUIRES_GPU - LABELS - "unit;full-stack;gpu") - add_tllm_gtest( - gemmAllReduceTest - SOURCES - allReduce/gemmAllReduceTest.cu - FULL_STACK - REQUIRES_GPU - LABELS - "unit;full-stack;gpu") + add_tllm_gtest(allReduceKernelTest SOURCES allReduce/allReduceKernelTest.cu + FULL_STACK LABELS "unit;full-stack;gpu") + add_tllm_gtest(allReduceFusionTest SOURCES allReduce/allReduceFusionTest.cu + FULL_STACK LABELS "unit;full-stack;gpu") + add_tllm_gtest(gemmAllReduceTest SOURCES allReduce/gemmAllReduceTest.cu + FULL_STACK LABELS "unit;full-stack;gpu") if(USING_OSS_CUTLASS_ALLREDUCE_GEMM) target_link_libraries(gemmAllReduceTest PRIVATE ar_gemm_src) target_compile_definitions(gemmAllReduceTest diff --git a/cpp/tests/unit_tests/runtime/CMakeLists.txt b/cpp/tests/unit_tests/runtime/CMakeLists.txt index 96aadfa69f56..47255068f2cd 100644 --- a/cpp/tests/unit_tests/runtime/CMakeLists.txt +++ b/cpp/tests/unit_tests/runtime/CMakeLists.txt @@ -35,22 +35,11 @@ add_tllm_gtest( LABELS "unit;runtime;gpu" REQUIRES_GPU) +add_tllm_gtest(gdrcopyTest SOURCES gdrcopyTest.cpp FULL_STACK LABELS + "unit;full-stack;gpu") add_tllm_gtest( - gdrcopyTest - SOURCES - gdrcopyTest.cpp - FULL_STACK - REQUIRES_GPU - LABELS - "unit;full-stack;gpu") -add_tllm_gtest( - hostAccessibleDeviceAllocatorTest - SOURCES - hostAccessibleDeviceAllocatorTest.cu - FULL_STACK - REQUIRES_GPU - LABELS - "unit;full-stack;gpu") + hostAccessibleDeviceAllocatorTest SOURCES + hostAccessibleDeviceAllocatorTest.cu FULL_STACK LABELS "unit;full-stack;gpu") add_tllm_gtest( iBufferTest OWNER @@ -61,14 +50,8 @@ add_tllm_gtest( tllm::runtime_buffers LABELS "unit;runtime;host") -add_tllm_gtest( - ipcNvlsMemoryTest - SOURCES - ipcNvlsMemoryTest.cpp - FULL_STACK - REQUIRES_GPU - LABELS - "unit;full-stack;gpu") +add_tllm_gtest(ipcNvlsMemoryTest SOURCES ipcNvlsMemoryTest.cpp FULL_STACK + LABELS "unit;full-stack;gpu") add_tllm_gtest( iTensorTest OWNER @@ -79,30 +62,12 @@ add_tllm_gtest( tllm::runtime_buffers LABELS "unit;runtime;host") -add_tllm_gtest( - loraCacheTest - SOURCES - loraCacheTest.cpp - FULL_STACK - REQUIRES_GPU - LABELS - "unit;full-stack;gpu") -add_tllm_gtest( - loraUtilsTest - SOURCES - loraUtilsTest.cpp - FULL_STACK - REQUIRES_GPU - LABELS - "unit;full-stack;gpu") -add_tllm_gtest( - moeLoadBalancerTest - SOURCES - moeLoadBalancerTest.cpp - FULL_STACK - REQUIRES_GPU - LABELS - "unit;full-stack;gpu") +add_tllm_gtest(loraCacheTest SOURCES loraCacheTest.cpp FULL_STACK LABELS + "unit;full-stack;gpu") +add_tllm_gtest(loraUtilsTest SOURCES loraUtilsTest.cpp FULL_STACK LABELS + "unit;full-stack;gpu") +add_tllm_gtest(moeLoadBalancerTest SOURCES moeLoadBalancerTest.cpp FULL_STACK + LABELS "unit;full-stack;gpu") add_tllm_gtest( runtimeMpiUtilsTest OWNER @@ -113,14 +78,8 @@ add_tllm_gtest( tllm::runtime_distributed LABELS "unit;runtime;host") -add_tllm_gtest( - localizationTest - SOURCES - localizationTest.cu - FULL_STACK - REQUIRES_GPU - LABELS - "unit;full-stack;gpu") +add_tllm_gtest(localizationTest SOURCES localizationTest.cu FULL_STACK LABELS + "unit;full-stack;gpu") add_tllm_gtest( localityDomainPublicConfigTest OWNER @@ -141,8 +100,7 @@ add_tllm_gtest( LINK_LIBRARIES tllm::runtime_buffers LABELS - "unit;runtime;gpu" - REQUIRES_GPU) + "unit;runtime;gpu") add_tllm_gtest( tllmBuffersTest OWNER @@ -154,22 +112,10 @@ add_tllm_gtest( LABELS "unit;runtime;gpu" REQUIRES_GPU) -add_tllm_gtest( - transposeKVKernelTest - SOURCES - transposeKVKernelTest.cpp - FULL_STACK - REQUIRES_GPU - LABELS - "unit;full-stack;gpu") -add_tllm_gtest( - utilsTest - SOURCES - utilsTest.cpp - FULL_STACK - REQUIRES_GPU - LABELS - "unit;full-stack;gpu") +add_tllm_gtest(transposeKVKernelTest SOURCES transposeKVKernelTest.cpp + FULL_STACK LABELS "unit;full-stack;gpu") +add_tllm_gtest(utilsTest SOURCES utilsTest.cpp FULL_STACK LABELS + "unit;full-stack;gpu") add_tllm_gtest( virtualMemoryTest OWNER @@ -204,7 +150,6 @@ if(${BUILD_PYT}) LINK_LIBRARIES tllm::runtime_buffers LABELS - "unit;runtime;gpu" - REQUIRES_GPU) + "unit;runtime;gpu") target_link_libraries(torchTest PRIVATE ${TORCH_LIBRARIES}) endif() diff --git a/cpp/tests/unit_tests/thop/CMakeLists.txt b/cpp/tests/unit_tests/thop/CMakeLists.txt index fafdbd5fdfa7..70733afed359 100644 --- a/cpp/tests/unit_tests/thop/CMakeLists.txt +++ b/cpp/tests/unit_tests/thop/CMakeLists.txt @@ -21,8 +21,7 @@ if(${BUILD_PYT}) eagerMoeWorkspaceTest.cpp FULL_STACK LABELS - "unit;full-stack;gpu" - REQUIRES_GPU) + "unit;full-stack;gpu") target_link_libraries(thUtilsTest PUBLIC th_utils ${Python3_LIBRARIES} ${TORCH_LIBRARIES}) endif() From c4a3dc3330d3a5a1f1ad1276877f8027790bcc59 Mon Sep 17 00:00:00 2001 From: Robin Kobus <19427718+Funatiq@users.noreply.github.com> Date: Sat, 24 Oct 2026 20:37:50 +0000 Subject: [PATCH 16/16] refactor: remove REQUIRES_GPU from C++ test registration Remove the remaining 22 test arguments and delete the option parsing and automatic label handling from add_tllm_gtest. GPU classification is expressed directly through LABELS, while parallel_run_ctest controls concurrency. Update contributor guidance to use explicit gpu labels. Verify existing registration arguments and labels are preserved, no tracked references remain, and focused CMake configurations succeed with bounce control enabled and disabled. Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com> --- AGENTS.md | 7 ++- cpp/tests/CMakeLists.txt | 6 +-- .../unit_tests/batch_manager/CMakeLists.txt | 54 +++++++------------ cpp/tests/unit_tests/runtime/CMakeLists.txt | 12 ++--- 4 files changed, 26 insertions(+), 53 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index bb5a2d03fa0c..3d23a2313753 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -192,10 +192,9 @@ See [CI overview](docs/source/developer-guide/ci-overview.md) for full details. New C++ unit tests should use `add_tllm_gtest` with explicit `SOURCES`, `LINK_LIBRARIES`, `OWNER`, and scheduling `LABELS`. Request `FULL_STACK` explicitly -for integration tests and `REQUIRES_GPU` for tests that need a GPU. `REQUIRES_GPU` -adds the `gpu` label without serializing GPU tests; CI controls concurrency through -`parallel_run_ctest`. `google-tests` continues to build all C++ tests; component -aggregate targets build migrated tests. +for integration tests and include `gpu` in `LABELS` for tests that need a GPU. +CI controls test concurrency through `parallel_run_ctest`. `google-tests` +continues to build all C++ tests; component aggregate targets build migrated tests. ### Advisory semantic review diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index c0226cb4e0ca..4973c3cd8097 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -66,7 +66,7 @@ function(tllm_assert_test_is_component_local target) endfunction() function(add_tllm_gtest test_name) - set(options FULL_STACK NO_GTEST_MAIN REQUIRES_GPU) + set(options FULL_STACK NO_GTEST_MAIN) set(one_value_args TIMEOUT OWNER TEST_PREFIX) set(multi_value_args SOURCES LINK_LIBRARIES LABELS) cmake_parse_arguments(PARSE_ARGV 1 ARG "${options}" "${one_value_args}" @@ -114,10 +114,6 @@ function(add_tllm_gtest test_name) PRIVATE TOP_LEVEL_DIR="${TOP_LEVEL_DIR}") set(test_properties ENVIRONMENT "CUDA_MODULE_LOADING=LAZY") - if(ARG_REQUIRES_GPU) - list(APPEND ARG_LABELS gpu) - list(REMOVE_DUPLICATES ARG_LABELS) - endif() if(ARG_TIMEOUT) list(APPEND test_properties TIMEOUT "${ARG_TIMEOUT}") endif() diff --git a/cpp/tests/unit_tests/batch_manager/CMakeLists.txt b/cpp/tests/unit_tests/batch_manager/CMakeLists.txt index 11624d4822e0..0f2879b1dd77 100644 --- a/cpp/tests/unit_tests/batch_manager/CMakeLists.txt +++ b/cpp/tests/unit_tests/batch_manager/CMakeLists.txt @@ -64,8 +64,7 @@ add_tllm_gtest( LINK_LIBRARIES tllm::kv_cache_legacy LABELS - "unit;batch-manager;gpu" - REQUIRES_GPU) + "unit;batch-manager;gpu") add_tllm_gtest( bufferIndexHolderTest @@ -76,8 +75,7 @@ add_tllm_gtest( LINK_LIBRARIES tllm::kv_cache_legacy LABELS - "unit;batch-manager;gpu" - REQUIRES_GPU) + "unit;batch-manager;gpu") add_tllm_gtest( capacitySchedulerTest @@ -88,8 +86,7 @@ add_tllm_gtest( LINK_LIBRARIES tllm::batch_scheduler LABELS - "unit;batch-manager;gpu" - REQUIRES_GPU) + "unit;batch-manager;gpu") add_tllm_gtest( contextProgressTest @@ -100,8 +97,7 @@ add_tllm_gtest( LINK_LIBRARIES tllm::batch_scheduler LABELS - "unit;batch-manager;gpu" - REQUIRES_GPU) + "unit;batch-manager;gpu") add_tllm_gtest( contextTransferCoordinatorTest SOURCES contextTransferCoordinatorTest.cpp @@ -127,8 +123,7 @@ add_tllm_gtest( LINK_LIBRARIES tllm::kv_cache_legacy LABELS - "unit;batch-manager;gpu" - REQUIRES_GPU) + "unit;batch-manager;gpu") # GDS partial-copy cases load the NIXL wrapper at runtime. if(TARGET tensorrt_llm_nixl_wrapper) @@ -148,8 +143,7 @@ add_tllm_gtest( LINK_LIBRARIES tllm::kv_cache_legacy LABELS - "unit;batch-manager;gpu" - REQUIRES_GPU) + "unit;batch-manager;gpu") add_tllm_gtest( kvCacheManagerV2ConfigTest @@ -173,8 +167,7 @@ add_tllm_gtest( tllm::kv_cache $ LABELS - "unit;batch-manager;gpu" - REQUIRES_GPU) + "unit;batch-manager;gpu") add_tllm_gtest( kvCacheManagerV2ColdPageTest @@ -186,8 +179,7 @@ add_tllm_gtest( tllm::kv_cache $ LABELS - "unit;batch-manager;gpu" - REQUIRES_GPU) + "unit;batch-manager;gpu") add_tllm_gtest( coldPageCodecTest @@ -198,8 +190,7 @@ add_tllm_gtest( LINK_LIBRARIES tllm::kv_cache LABELS - "unit;batch-manager;gpu" - REQUIRES_GPU) + "unit;batch-manager;gpu") add_tllm_gtest( kvCacheManagerV2TypedIndexTest @@ -223,8 +214,7 @@ add_tllm_gtest( tllm::kv_cache $ LABELS - "unit;batch-manager;gpu" - REQUIRES_GPU) + "unit;batch-manager;gpu") add_tllm_gtest( kvCacheManagerV2HostMemBackingTest @@ -236,8 +226,7 @@ add_tllm_gtest( tllm::kv_cache $ LABELS - "unit;batch-manager;gpu" - REQUIRES_GPU) + "unit;batch-manager;gpu") add_tllm_gtest( kvCacheManagerV2StagingBufferTest @@ -249,8 +238,7 @@ add_tllm_gtest( tllm::kv_cache $ LABELS - "unit;batch-manager;gpu" - REQUIRES_GPU) + "unit;batch-manager;gpu") add_tllm_gtest( kvCacheManagerV2StatsTest @@ -262,8 +250,7 @@ add_tllm_gtest( tllm::kv_cache $ LABELS - "unit;batch-manager;gpu" - REQUIRES_GPU) + "unit;batch-manager;gpu") add_tllm_gtest( kvCacheManagerV2SlotAllocatorTest @@ -299,8 +286,7 @@ add_tllm_gtest( tllm::kv_cache $ LABELS - "unit;batch-manager;gpu" - REQUIRES_GPU) + "unit;batch-manager;gpu") add_tllm_gtest( kvCacheManagerV2DigestPoolTest @@ -323,8 +309,7 @@ add_tllm_gtest( LINK_LIBRARIES tllm::kv_cache_legacy LABELS - "unit;batch-manager;gpu" - REQUIRES_GPU) + "unit;batch-manager;gpu") add_tllm_gtest( llmRequestTest @@ -335,8 +320,7 @@ add_tllm_gtest( LINK_LIBRARIES tllm::kv_cache_legacy LABELS - "unit;batch-manager;gpu" - REQUIRES_GPU) + "unit;batch-manager;gpu") add_tllm_gtest( microBatchSchedulerTest @@ -347,8 +331,7 @@ add_tllm_gtest( LINK_LIBRARIES tllm::batch_scheduler LABELS - "unit;batch-manager;gpu" - REQUIRES_GPU) + "unit;batch-manager;gpu") add_tllm_gtest(peftCacheManagerTest SOURCES peftCacheManagerTest.cpp FULL_STACK LABELS "unit;full-stack;gpu") @@ -376,5 +359,4 @@ add_tllm_gtest( LINK_LIBRARIES tllm::kv_cache_legacy LABELS - "unit;batch-manager;gpu" - REQUIRES_GPU) + "unit;batch-manager;gpu") diff --git a/cpp/tests/unit_tests/runtime/CMakeLists.txt b/cpp/tests/unit_tests/runtime/CMakeLists.txt index 47255068f2cd..1cea71176a22 100644 --- a/cpp/tests/unit_tests/runtime/CMakeLists.txt +++ b/cpp/tests/unit_tests/runtime/CMakeLists.txt @@ -22,8 +22,7 @@ add_tllm_gtest( LINK_LIBRARIES tllm::runtime_buffers LABELS - "unit;runtime;gpu" - REQUIRES_GPU) + "unit;runtime;gpu") add_tllm_gtest( cudaMemPoolTest OWNER @@ -33,8 +32,7 @@ add_tllm_gtest( LINK_LIBRARIES tllm::runtime_memory LABELS - "unit;runtime;gpu" - REQUIRES_GPU) + "unit;runtime;gpu") add_tllm_gtest(gdrcopyTest SOURCES gdrcopyTest.cpp FULL_STACK LABELS "unit;full-stack;gpu") add_tllm_gtest( @@ -110,8 +108,7 @@ add_tllm_gtest( LINK_LIBRARIES tllm::runtime_buffers LABELS - "unit;runtime;gpu" - REQUIRES_GPU) + "unit;runtime;gpu") add_tllm_gtest(transposeKVKernelTest SOURCES transposeKVKernelTest.cpp FULL_STACK LABELS "unit;full-stack;gpu") add_tllm_gtest(utilsTest SOURCES utilsTest.cpp FULL_STACK LABELS @@ -125,8 +122,7 @@ add_tllm_gtest( LINK_LIBRARIES tllm::runtime_buffers LABELS - "unit;runtime;gpu" - REQUIRES_GPU) + "unit;runtime;gpu") add_tllm_gtest(workerPoolTest SOURCES workerPoolTest.cpp FULL_STACK LABELS "unit;full-stack;host") add_tllm_gtest(