Skip to content

[TRTLLM-17005][refactor] Component-local C++ Tests (Part 3) - #20886

Draft
Funatiq wants to merge 37 commits into
NVIDIA:mainfrom
Funatiq:dev/refactor/component-local-tests-3
Draft

Funatiq wants to merge 37 commits into
NVIDIA:mainfrom
Funatiq:dev/refactor/component-local-tests-3

Conversation

@Funatiq

@Funatiq Funatiq commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

@coderabbitai summary

Description

Follow-up to #20222.

Implement component-local tests as real CMake target dependencies. This PR migrates kernel tests. See commit messages for details.

Test Coverage

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

@Funatiq

Funatiq commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80139 [ run ] triggered by Bot. Commit: 19a0896 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80139 [ run ] completed with state FAILURE. Commit: 19a0896
/LLM/main/L0_MergeRequest_PR pipeline #65950 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@Funatiq
Funatiq force-pushed the dev/refactor/component-local-tests-3 branch from d2d8308 to 613a7bc Compare October 23, 2026 21:56
@Funatiq

Funatiq commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80272 [ run ] triggered by Bot. Commit: 613a7bc Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80272 [ run ] completed with state FAILURE. Commit: 613a7bc
/LLM/main/L0_MergeRequest_PR pipeline #66064 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@Funatiq

Funatiq commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80361 [ run ] triggered by Bot. Commit: 538043e Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80361 [ run ] completed with state FAILURE. Commit: 538043e
/LLM/main/L0_MergeRequest_PR pipeline #66140 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@Funatiq

Funatiq commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80381 [ run ] triggered by Bot. Commit: 2293642 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80381 [ run ] completed with state SUCCESS. Commit: 2293642
/LLM/main/L0_MergeRequest_PR pipeline #66157 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@Funatiq
Funatiq force-pushed the dev/refactor/component-local-tests-3 branch from 2293642 to 34a7b1f Compare October 24, 2026 19:28
@Funatiq

Funatiq commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80394 [ run ] triggered by Bot. Commit: 34a7b1f Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80394 [ run ] completed with state SUCCESS. Commit: 34a7b1f
/LLM/main/L0_MergeRequest_PR pipeline #66170 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@Funatiq

Funatiq commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80406 [ run ] triggered by Bot. Commit: 073b28f Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80406 [ run ] completed with state FAILURE. Commit: 073b28f
/LLM/main/L0_MergeRequest_PR pipeline #66182 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

Add TEST_PREFIX to the arguments accepted by add_tllm_gtest and forward a nonempty prefix to gtest_discover_tests. This lets component tests customize their discovered CTest names through the shared helper.

Build optional discovery arguments in both add_tllm_gtest and the legacy add_gtest helper. Omit the TEST_PREFIX keyword when no prefix is supplied, and use each helper’s matching parsed argument variable to preserve explicit prefixes.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Add tllm_assert_test_is_component_local and invoke it after establishing
link dependencies for each non-FULL_STACK add_tllm_gtest target. Inspect
the target's direct LINK_LIBRARIES and fail configuration if it contains
the TensorRT-LLM shared-library target, with an actionable instruction to
use FULL_STACK explicitly.

This closes the bypass where LINK_LIBRARIES could name the monolith while
the test omitted FULL_STACK. Explicit full-stack tests and normal
component dependencies retain their existing behavior. The guard covers
direct target linkage, as specified in the component-local test proposal;
transitive dependency checks remain a separate build-graph concern.

Validation: configure-only probes using the actual assertion and helper
reject direct monolithic linkage, accept focused component linkage and
accept FULL_STACK with supplemental libraries. Reconfigure the real
CUDA 13.4/SM80, MPI, Torch and NIXL project, build stringUtilsTest and run
its four existing host cases. Formatting and commit hooks pass.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Extend tllm_assert_test_is_component_local to inspect the link interface
of each target linked directly by a component test. Previously, the guard
only rejected the full TensorRT-LLM shared target in the test's own
LINK_LIBRARIES, allowing a dependency to introduce that library through
its interface without requiring FULL_STACK.

Reject dependencies whose INTERFACE_LINK_LIBRARIES directly contains
SHARED_TARGET and report both the test and the dependency responsible.
Skip entries that are not CMake targets. This checks one level of target
interfaces; it does not recursively traverse the dependency graph or
evaluate generator expressions.

Validation: isolated CMake configurations accept component-only links and
dependencies with no link interface, and reject a dependency whose
interface directly links the full library. Staged whitespace checks pass.
Full project configuration and build were not run.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Run tllm_assert_test_is_component_local through cmake_language(DEFER)
for tests registered without FULL_STACK. The immediate check only saw
links established inside add_tllm_gtest, so subsequent commands could add
the full TensorRT-LLM library directly or through a dependency interface
without being rejected. Deferring the assertion lets it inspect the link
properties after the current directory finishes processing.

Use cmake_language(EVAL CODE) to expand the function-local test_name when
scheduling the call, and pass the captured name as a bracket argument.
DEFER alone would evaluate the variable after the function scope ends,
losing the target name and causing a configuration error.

Validation:
- Isolated CMake configuration accepts multiple component tests, verifying
  that each deferred call retains its own target name.
- Isolated CMake configuration rejects a direct full-library link added
  after test registration.
- Isolated CMake configuration rejects a dependency interface link to the
  full library added after test registration.
- Repository cmake-format hook and staged whitespace checks pass.

Full project configuration and build were not run.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Move logitsBitmask.cu out of kernels_src into the explicit tllm::kernel_logits static library. Link logitsBitmaskTest only to that family and runtime buffers, and register it with kernel-tests and GPU scheduling labels/resource locking.

Add a reusable kernel-library helper that requires explicit sources, removes them from the residual source lists, and preserves PIC, CUDA device linking, C++/CUDA 20, and the existing architecture selection. Export the extracted families from the product with whole-archive and matching link overrides, while keeping test links ordinary.

Validation: logitsBitmaskTest builds in both the product configuration and a fresh component-only project. Its dependency graph excludes libtensorrt_llm.so, kernels_src, residual common/runtime libraries, batch manager, executor, and Torch. Six GPU cases are discovered with the GPU resource lock. GPU execution is unavailable on this host. Source-ownership checks preserve the existing compilation counts.
Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Create tllm::kernel_nvfp4_cold_page with explicit ownership of nvfp4ColdPageKernels.cu and its environment/CUDA dependencies. Preserve the existing architecture selection and export the family through the shared-library component loop.

Replace the cold-page test's manually assembled production source list with ordinary links to the kernel family and tllm::kv_cache_host_memory. The error, logging, environment, host-memory, and poison implementations now have their production owners instead of being recompiled inside the test. Register the executable with kernel-tests and GPU resource locking.

Validation: nvfp4ColdPageKernelsTest compiles and links independently. Its generated graph excludes the full shared library, kernels_src, residual common/runtime libraries, batch manager, executor, and Torch. Test discovery succeeds and the original production-source compilation counts are preserved. GPU execution is unavailable on this host.
Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Give attention mask construction, decoder metadata, unfused attention and
all eleven QKV type instantiations one explicit static-library owner,
tllm::kernel_rope. Remove these sources from kernels_src while preserving
the shared library's whole-archive exports, CUDA architecture policy and
FP16/BF16/FP32, INT8, FP8 and FP4 instantiations.

Migrate ropeTest, shiftKCacheKernelTest and sparseKvCacheTest to explicit
RoPE and runtime-buffer dependencies. Register them with kernel-tests,
GPU labels and the GPU resource lock; sparse cache updates use the same
QKV instantiations rather than introducing another production owner.

Validation: build and link all three leaf tests in the CUDA 13.4 SM80
configuration; inspect their Ninja graphs to exclude the monolithic
library, residual object libraries and Torch. Check that original source
compilation counts are preserved and discovered GPU cases retain their
resource lock. GPU execution requires hardware unavailable here.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Move sparseAttentionKernels.cu from kernels_src into the explicitly sourced
tllm::kernel_sparse_attention static library. Keep production exports
through the shared-library component list and inherit only common CUDA
utilities, preserving the existing architecture policy.

Migrate sparseAttentionKernelsTest to this library and runtime buffers,
register it under kernel-tests and assign sparse-attention/GPU labels
with a GPU resource lock. A page-gather leaf build no longer pulls in
RoPE instantiations, attention backends or the full product library.

Validation: build and link sparseAttentionKernelsTest with CUDA 13.4
and SM80 in both the product configuration and a separate clean
component-only build (no libtensorrt_llm.so produced); check its Ninja dependency graph, original production-source
compilation counts and discovered GPU scheduling properties. GPU cases
are discoverable but cannot execute without GPU hardware.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Assign mlaKernels.cu to the explicitly sourced tllm::kernel_mla static
library instead of kernels_src. Declare the environment and common CUDA
dependencies used by MLA launchers, retain existing type instantiations
and architecture settings, and preserve all shared-library exports.

Make mlaPreprocessTest a component-local kernel test linking only MLA
preprocessing and runtime buffers. Register GPU labels and resource
locking through add_tllm_gtest and include it in kernel-tests. Building
this paged-KV preprocessing test no longer builds generated FMHA,
FlashMLA, CUTLASS GEMM or the TensorRT-LLM shared library.

Validation: build and link the leaf with CUDA 13.4/SM80; verify its Ninja
graph excludes residual component objects, Torch and the monolith,
production source ownership is unchanged, and discovery retains GPU
scheduling properties. GPU execution is unavailable on this host.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Give fusedMoeCommKernels.cu an explicit static-library owner,
tllm::kernel_moe_communication. Remove it from the residual MoE source
list and preserve shared-library exports and CUDA architecture settings.
Declare common CUDA and environment dependencies for its PDL launchers
and CUDA::cuda_driver for workspace initialization via cuMemsetD32.

Migrate fusedMoeCommKernelTest to explicit fused-communication and thread
dependencies without runtime buffers, GEMM backends or full-stack linkage.
Register the test under kernel-tests with MoE communication and GPU labels
and a GPU resource lock. Other communication implementations remain in
their existing owners until their own callers need extraction.

Validation: compile and link the leaf with CUDA 13.4/SM80, verify its
component-local Ninja graph and preserved source ownership, and inspect
discovered GPU resource locks. GPU execution is unavailable on this host.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Assign moe/loadBalance/moeLoadBalanceKernels.cu to the focused static
library tllm::kernel_moe_load_balance, removing it from residual MoE
sources while retaining shared-library exports and CUDA architectures.
Declare common CUDA and environment utilities used by its cooperative
and PDL launchers.

Migrate moeLoadBalanceKernelTest to the load-balancing component and
Threads::Threads. Its signal and expert-load tests allocate through CUDA
directly and do not need runtime-buffer, communication or GEMM libraries.
Register kernel aggregate ownership, GPU labels and a GPU resource lock.

Validation: build and link with CUDA 13.4/SM80; verify the leaf Ninja
graph, unchanged production-source ownership and discovered GPU resource
locks. GPU execution requires hardware unavailable on this host.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Create tllm::kernel_moe_lora with explicit pointer-expansion, problem-builder
and slot-expansion CUDA sources. Remove those sources from the CUTLASS
MoE launcher object library and link the existing MoE GEMM backend to the
new owner. Preserve OSS-MoE gating, CUDA architectures and shared-library
exports; expose only CUTLASS headers needed by problem-size declarations.

Migrate moeLoraPointerExpandTest, moeLoraProblemBuilderTest and
moeLoraSlotExpandTest to the focused component. Their direct CUDA
allocations need neither runtime buffers nor the full MoE GEMM backend.
Register all three with kernel-tests, MoE LoRA/GPU labels and GPU locks.

Validation: build and link all three leaves with CUDA 13.4/SM80; inspect
their graphs to exclude the monolith, residual objects and Torch; verify
original kernel/backend compilation counts and discovered GPU scheduling
properties. GPU execution is unavailable on this host.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Move prepareCustomMask.cu from the generated FMHA object target into
tllm::kernel_attention_mask with explicit source ownership. Link the
FMHA backend to the new component, preserve shared-library exports,
and declare the FMHA header interface and CUTLASS header requirements
without inheriting generated kernels or prebuilt FMHA implementation.

Migrate prepareCustomMaskTest to mask preparation and runtime buffers.
Register it with kernel-tests, attention-mask/GPU labels and a GPU lock.
Mask-format leaf builds now avoid generated FMHA, GEMM backends, Torch
and the monolithic TensorRT-LLM shared library.

Validation: build and link the leaf with CUDA 13.4/SM80; verify its Ninja
graph excludes residual object libraries and the full stack, preserve
production/backend source compilation counts, and inspect discovered
GPU scheduling properties. GPU execution is unavailable on this host.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Move weightOnlyBatchedGemv/cudaCoreGemm.cu from kernels_src into the
explicit static library tllm::kernel_cuda_core_gemm, preserving product
exports, type instantiations and CUDA architectures. Declare the
environment utilities used by PDL dispatch and a reusable CUTLASS header
interface covering vendor headers, utility headers and local extensions.

Migrate cudaCoreGemmKernelTest to this component and CUDA::cublasLt for
its reference implementation. Its direct CUDA allocations do not need
runtime buffers or CUTLASS GEMM binaries. Register kernel aggregate
ownership, CUDA core GEMM/GPU labels and the GPU resource lock.

Validation: build and link with CUDA 13.4/SM80, verify the leaf graph
excludes the full stack and residual objects, check unchanged source
ownership and discovered GPU locks. GPU execution is unavailable here.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Give cutlass_heuristic.cpp and cutlass_preprocessors.cpp one explicit
static-library owner, tllm::kernel_gemm_utilities. These host utilities
provide tactic configuration and weight layout preprocessing shared by
gated, INT8, weight-only and MoE GEMM implementations. Declare their
CUTLASS header/common CUDA requirements without linking GEMM kernels.

Remove both files from cutlass_src and make that compatibility target
link the focused utility component. Preserve all production exports
through the shared-library component list. This prepares independent
GEMM-family migrations without duplicating utility compilation or
forcing their tests through the broad CUTLASS target.

Validation: build the utility library with the CUDA 13.4/SM80 toolchain,
verify its Ninja graph excludes GEMM implementation families, residual
objects, Torch and the monolith, and check that all original production
and generated kernel source compilation counts remain unchanged.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Expose the existing single-source SM90 gated GEMM static library as
tllm::kernel_gated_gemm and declare its shared GEMM utility dependencies.
Preserve its architecture scoping and retain production symbols through
the shared-library component list. Link gemmSwigluRunnerTest explicitly
to that family instead of the product library; remove the obsolete
extra production-source argument ignored by the legacy helper.

Build the header-defined gemmSwigluKernelTestSm90Fp8 executable with
CUTLASS headers, common CUDA utilities and GoogleTest assertions only.
Register its standalone main directly as one CTest case, avoiding
GoogleTest discovery running its CUDA workload during enumeration.
Keep both custom mains, device-symbol resolution, Hopper feature gating
and compiler options, and assign kernel aggregate ownership and GPU locks.

Validation: build and link both targets with CUDA 13.4/SM80, inspect
component-local Ninja graphs and preserved production-source ownership,
and enumerate the runner case and standalone executable without GPU
execution. Both cases carry GPU labels and resource locks.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Create explicitly sourced static libraries for int8SQ.cu and the four
BF16/FP16/FP32/INT32 CUTLASS INT8 GEMM instantiations. Keep the root GEMV
and CUTLASS backend architecture policies separate, declare header and
GEMM utility dependencies, and preserve production exports. Remove the
INT8 sources from cutlass_src, which forwards its extracted components
through an interface when no residual implementation remains.

Migrate smoothQuantKernelTest to tllm::kernel_smooth_quant and
tllm::kernel_int8_gemm, explicitly naming the implementation under test
and its reference backend. Remove unnecessary runtime-buffer and full
product linkage, and register kernel ownership, GPU labels and locking.

Validation: build and link with CUDA 13.4/SM80; inspect the leaf graph
for prohibited monolithic and residual dependencies, check all original
production/generated source compilation counts, and verify discovered
GPU properties. GPU execution is unavailable on this host.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Create tllm::kernel_weight_only with explicit pre-quantization scaling and
all FP16/BF16 INT4/INT8, per-channel/groupwise and layout-specific GEMV
instantiation sources. Remove them from kernels_src, declare CUTLASS
headers and environment utilities, and preserve architectures and shared
library exports without duplicating any production translation unit.

Expose the existing focused mixed-input CUTLASS GEMM backend as
tllm::kernel_weight_only_gemm and declare its host GEMM utility/environment
dependencies. Migrate weightOnlyKernelTest to the GEMV implementation and
this reference backend, with kernel aggregate ownership and GPU locking.
Its direct CUDA allocations do not require runtime-buffer linkage.

Validation: build and link the leaf with CUDA 13.4/SM80, inspect its
component-only graph and preserved source compilation counts, and verify
discovered GPU labels/resource locks. GPU execution is unavailable here.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Convert the custom-routing object target into a focused static library
exposed as tllm::kernel_moe_routing. Give it explicit ownership of all
eight custom, DeepSeek, top-K-input and Llama4 routing CUDA sources,
removing the latter three from the broader block-scale MoE object target.
Preserve CUDA architectures, device-symbol resolution, PIC, split-compile
1 for the five custom TUs and split-compile 0 for the other three.

Declare CUTLASS header/common CUDA requirements and make the existing MoE
runner backend depend on routing. Preserve all production routing exports
with the shared-library component list. Migrate the four-source
routingKernelsTest to routing, runtime buffers and its existing Python
dependency; register kernel ownership, GPU labels and a GPU resource lock.

Validation: build and link the routing leaf with CUDA 13.4/SM80, verify
its graph excludes the product library, residual objects, GEMM backends
and Torch, check original production/generated source ownership and
discovered GPU scheduling properties. GPU execution is unavailable here.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Move moe/trtllmGen/DevKernel.cu into the explicit static library
tllm::kernel_moe_block_scale. Preserve its original CUDA architectures
and split-compile 0 policy, declare CUTLASS header/common CUDA requirements
and retain production exports. Make the existing MoE runner depend on the
new component and name runner.cu explicitly, eliminating this backend's
remaining recursive source globs and duplicate ownership opportunities.

Migrate blockScaleMoeActivationTest and blockScaleMoeFinalizeTest to the
block-scale helper library and runtime buffers. These kernel tests no
longer compile the GEMM runner or generated GEMM backends. Register both
with kernel-tests, block-scale/GPU labels and GPU resource locks.

Validation: build/link both leaves with CUDA 13.4/SM80, verify their
component-only graphs, preserved production/generated source counts and
discovered GPU scheduling properties. Run the three existing host-only
backing/capacity arithmetic cases; GPU execution is unavailable here.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Move cascadeAttentionKernel.cu from the MMHA head library to the explicit
static component tllm::kernel_cascade_attention, preserving its CUDA
architecture policy. Extract the top-level MMHA dispatcher as
tllm::kernel_attention_decode and give the existing Linux MMHA head
libraries explicit cascade/environment dependencies. On Windows, retain
MMHA instantiations in their own static target rather than mixing them
with decoder XQA objects. Preserve product exports and source ownership.

Migrate cascadeAttentionNumericsTest to cascade and the MMHA dispatcher.
It builds the actual MMHA numerical reference without XQA, generated
FMHA or the monolithic library. Link the eligibility suite only to
cascade; its predicate queries GPU capability when enabled, so both
suites receive GPU labels/locking and join kernel-tests explicitly.

Validation: compile/link both leaves with CUDA 13.4/SM80, inspect their
graphs and original source counts, verify discovered scheduling metadata
and execute eligibility in one process with cascade initially disabled.
Numerical and enabled-eligibility GPU execution are unavailable here;
the Windows branch requires a Windows toolchain.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Convert trtllm_gen_fmha from an object library to the static component
tllm::kernel_attention. Name fmhaRunner.cpp and fmhaReduction.cu explicitly,
retain generated cubin archive sources and prebuilt FMHA/core libraries,
and declare mask preparation, environment, CUTLASS header and CUDA driver
dependencies. Preserve architecture pruning, Rubin metadata, compile
definitions and device-symbol resolution. Whole-archive the component
only in the product library to retain all exports and cubin registration.

Migrate fmhaDsv4EpilogueFusionTest to this attention family and runtime
buffers, with kernel aggregate ownership, FMHA/GPU labels and locking.
The numerical fusion leaf builds its actual generated attention backend
without decoder XQA, unrelated GEMM implementations, Torch or the monolith.

Validation: build and link with CUDA 13.4/SM80, verify the focused Ninja
graph, original production/generated source ownership and discovered GPU
properties. Numerical execution on supported GPU hardware is unavailable
here; generated/prebuilt backend architecture support remains unchanged.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Move cublasMMWrapper.cpp from common_src into the focused static library
tllm::common_cublas. Declare common CUDA, cuBLAS and cuBLASLt dependencies,
C++20/PIC requirements and the existing optional FP4 compile definition.
Make residual common callers link this owner instead of recompiling it,
and retain all shared-library exports with a whole-archive override.

The CUTLASS MoE runner references LoRA's cuBLAS path even when a test does
not enable LoRA. Giving the matrix wrapper a separate owner lets that
real dependency be satisfied without pulling attention, distributed GPU
utilities and the rest of common_src into a kernel-family leaf.

Validation: build the wrapper with the CUDA 13.4/SM80 toolchain, inspect
its graph to exclude residual object targets, unrelated kernel backends,
Torch and the monolith, and preserve original common/kernel production
source compilation counts. Runtime cuBLAS execution requires a GPU.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Create tllm::kernel_lora with explicit ownership of the LoRA/DoRA adapters,
grouped and split-K grouped GEMM, fused parameter-fill/row-reorder and
DoRA scaling sources. Remove all six files from kernels_src and declare
focused cuBLAS wrapper, CUTLASS header, runtime-buffer and environment
dependencies. Preserve root-kernel architectures, type instantiations
and all shared-library exports.

CUTLASS MoE's runner references these real LoRA paths even when a unit
case disables LoRA. This focused component supplies those symbols without
linking residual kernel/common object libraries or a product-level stub.
Keep the existing adapter implementation and backend dispatch unchanged.

Validation: compile/archive the family with CUDA 13.4/SM80, inspect its
graph for monolithic, Torch and residual object dependencies, and preserve
original common/kernel source compilation counts. The subsequent MoE
leaf link checks the actual host-symbol closure; GPU execution is unavailable.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Assign quantization.cu to the explicit static component
tllm::kernel_quantization and remove it from kernels_src. Declare common
CUDA and environment dependencies, preserve the original architecture
policy and quantization instantiations, and retain all product exports
through the shared-library component list.

The CUTLASS MoE test directly exercises FP4 weight quantization when
preparing its inputs. Giving quantization its own owner lets the MoE
leaf declare that dependency without compiling residual attention,
communication and unrelated kernel sources. Keep numerical kernels and
FP16/BF16/FP8/FP4 feature gating unchanged.

Validation: compile/archive the family with CUDA 13.4/SM80, verify its
Ninja graph excludes residual object targets, Torch and the monolith,
and preserve original common/kernel source compilation counts. The
subsequent MoE leaf link checks quantization symbols; GPU execution is unavailable.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Give preQuantScaleKernel.cu its own explicitly sourced static library,
tllm::kernel_pre_quant_scale, and make weight-only GEMV depend on it.
Preserve CUDA architectures and production exports while keeping exactly
one compilation owner for the shared scaling implementations.

CUTLASS MoE also calls the per-channel and per-expert scaling entrypoints.
A separate component lets it link that actual dependency without building
the 24 weight-only GEMV dispatch translation units. Existing weight-only
callers keep the scaling symbols through their declared dependency.

Validation: rebuild/link weightOnlyKernelTest with CUDA 13.4/SM80, verify
its focused graph and unchanged source compilation counts, and inspect
discovered GPU labels/resource locks. GPU execution is unavailable here.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
List the GEMM runner and packed quantization CUDA sources explicitly and
expose the existing static backend as tllm::kernel_fp8_block_scale_gemm.
Declare common environment, GEMM utility, CUDA driver and configured
NVRTC dependencies so clients
can link the real runner without the monolithic library. Preserve the
existing CUTLASS architecture and compile policies and product linkage.

The CUTLASS MoE launcher instantiates this runner even when a test uses
other weight formats; this component supplies that production dependency.

Validation: build the static component with CUDA 13.4/SM80 and verify
original source ownership counts. GPU execution is unavailable here.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Expose the existing CUTLASS MoE static backend as tllm::kernel_moe and
name its CUDA implementation files explicitly. Preserve datatype/feature
selection, generated GEMM instantiations, per-architecture object targets
and compile policies. Declare GEMM utilities, FP8 block-scale GEMM, LoRA,
pre-quantization scaling and environment dependencies. Retain product
exports through the shared-library component list.

Migrate mixtureOfExpertsTest to the actual MoE backend, CUDA quantization
and runtime buffers, with kernel ownership, GPU labels and resource
locking. Provide an interface for the real internal CUTLASS archive and
use it for the optional internal test and non-OSS configuration. Preserve
the internal-source availability check and OSS macro removal. No stub
implementations or residual kernel/common objects satisfy backend symbols.

Validation: kernel-tests builds with CUDA 13.4/SM80. All 26 configured
kernel leaf graphs exclude Torch, the monolith and residual object
libraries. Original common/kernel/backend source counts are preserved;
discovered GPU tests retain scheduling locks. Four representative leaves
also build in a fresh full-project tree without producing the monolith. GPU execution and the optional internal-source
variant require environments unavailable here.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
The bundled CUTLASS MoE archive references CutlassFp8BlockScaleGemmRunner, but the internal MoE component did not propagate its provider library. Component-local tests therefore failed to link after losing the shared library link graph. Declare the FP8 block-scale GEMM dependency on tllm_kernel_moe_internal so both explicit internal tests and non-OSS MoE consumers inherit it.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
List each TensorRT-LLM component separately and apply the whole-archive link expression in a foreach loop. Preserve the existing component order and private link visibility.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
The component-library split links additional kernel archives into
libtensorrt_llm.so with WHOLE_ARCHIVE. With the SBSA multi-architecture
build, the embedded CUDA payloads separate host text from its unwind
tables far enough to overflow signed 32-bit R_AARCH64_PREL32 relocations
in .eh_frame and prevent the shared-library link from completing.

Add a supplemental ELF linker script that places .nv_fatbin and
__nv_relfatbin after .bss, keeping host code, unwind tables, and host data
close together. Leave .nvFatBinSegment registration wrappers near host
data. INSERT AFTER augments the default linker layout rather than
replacing the platform's complete linker script.

Apply the script privately to the tensorrt_llm shared target on Linux
AArch64 and register it in LINK_DEPENDS so changes trigger relinking.
Preserve the component-library structure, WHOLE_ARCHIVE exports, and
exception-unwinding support without changing other platform links.

Validation in the running AArch64 container using build_sbsa, originally
configured by run_build_wheel_arm.sh:
- Reproduced the original R_AARCH64_PREL32 relocation overflow.
- Regenerated CMake and verified the Ninja link rule includes the script
  as both a linker option and an input dependency.
- Successfully linked libtensorrt_llm.so with the generated command.
- Inspected the resulting ELF section layout with readelf.
- Passed library-loading, exception-unwinding through the shared library,
  and backtrace smoke checks.
- Passed git diff --check.

Full wheel packaging was not rerun.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Extend the existing Linux CUDA fatbin linker layout from AArch64 to x86-64. Multi-architecture payloads can push the GOT and other host sections beyond the signed 32-bit PC-relative range, causing GOTPCRELX truncation and PLT offset overflow when linking libtensorrt_llm.so.

Reuse cuda_fatbin.ld to place .nv_fatbin and __nv_relfatbin after .bss while retaining CUDA registration wrappers near host data. Keep the current code model and BOLT settings.

Validation: a sparse 2 GiB PROGBITS CUDA-payload reproducer fails with the default layout and links successfully with this script. A minimal CMake project using the changed block verifies Linux x86-64 and AArch64 receive the script while Windows does not. Full wheel rebuild is not validated because the failed build's intermediate objects have been removed.
Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Apply the existing Linux CUDA fatbin linker script to decoder_attention_0 and decoder_attention_1 alongside the main TensorRT-LLM shared library. The second decoder library contains more than 2 GiB of CUDA payloads in multi-architecture builds, which otherwise separate host code from the GOT and data and cause GOTPCRELX, PC32, and PLT relocation overflows.

Reuse the existing target configuration block and track the script in LINK_DEPENDS for all three libraries so script changes trigger relinking.

Validation: checked generated linker commands and script dependencies for all three targets on Linux x86-64, Linux AArch64, and Windows. Both real decoder libraries relink successfully with the script using the retained build objects, including the previously failing decoder_attention_1 target.
Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Remove the CMAKE_SYSTEM_PROCESSOR matcher from the CUDA payload linker-script condition. Earlier architecture validation already limits supported Linux targets to x86-64 and AArch64, and both use the same layout policy.

Keep the Linux guard and apply the script to the main shared library and both decoder libraries as before.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
BOLT normally appends rewritten code and unwind information after the
last loadable segment. Placing large CUDA payloads after .bss therefore
leaves BOLT's relocated .eh_frame too far from the original host code for
signed 32-bit PC-relative references.

Build-SBSA run 11350 failed while consuming the main AArch64 profile with
LLVM BOLT 21.1.5. Its failing reference required a displacement of
-2,181,430,481 bytes, exceeding the signed 32-bit range by 32.37 MiB. The
same failure reproduces without a stale profile, so refreshing profiles
alone does not address the underlying layout constraint.

Move .nv_fatbin and __nv_relfatbin before .dynsym instead of after .bss.
This keeps the original host code, unwind tables, GOT, and appended BOLT
output together after the CUDA payloads. Keep .nvFatBinSegment registration
wrappers near host data. Use .dynsym as the insertion anchor because both
GNU ld and LLD place it before host code and unwind sections; their .init
ordering differs. Update the CMake comment to describe this layout.

Validation performed in the running AArch64 build container:
- Reproduced the Delta32 overflow with LLVM BOLT 21.1.5 and the CI
  optimization flags using a minimal binary with a 3 GiB mapped payload.
- Applied the promoted profile to an isolated relink of the existing local
  TensorRT-LLM library: the trailing-payload layout failed with the same
  .relocated.eh_frame error, while a leading-payload layout passed BOLT.
- Successfully loaded the rewritten TensorRT-LLM shared library.
- Tested the final linker script with GNU ld and Clang/LLD using a 3 GiB
  CUDA-like payload; BOLT, dlopen, normal calls, and C++ exception
  unwinding all passed.
- git diff --check passed.

The real-library comparison used the existing local GCC build. A complete
Clang-built CI wheel rebuild remains to be validated.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
Remove REQUIRES_GPU from the 26 migrated kernel test registrations and the explicit GPU resource lock from gemmSwigluKernelTestSm90Fp8. These tests do not need CTest to serialize execution through a shared GPU lock.

Signed-off-by: Robin Kobus <19427718+Funatiq@users.noreply.github.com>
@Funatiq
Funatiq force-pushed the dev/refactor/component-local-tests-3 branch from 073b28f to 6d84133 Compare October 25, 2026 06:04
@Funatiq

Funatiq commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #80438 [ run ] triggered by Bot. Commit: 6d84133 Link to invocation

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants