Skip to content

[TRTLLM-13696][test] Part2.2: Migrate CPU only tests - generic, models, disagg - #17290

Merged
tongyuantongyu merged 4 commits into
NVIDIA:mainfrom
tongyuantongyu:ytong/host-only-test-cases-v2
Aug 5, 2026
Merged

[TRTLLM-13696][test] Part2.2: Migrate CPU only tests - generic, models, disagg#17290
tongyuantongyu merged 4 commits into
NVIDIA:mainfrom
tongyuantongyu:ytong/host-only-test-cases-v2

Conversation

@tongyuantongyu

@tongyuantongyu tongyuantongyu commented Aug 5, 2026

Copy link
Copy Markdown
Member

Dev Engineer Review

  • Migrates CPU-capable generic, model, multimodal, checkpoint, binding, disaggregated, utility, and tool tests to the CPU-only stage.
  • Applies pytest.mark.cpu_only at module, class, and function scope.
  • Separates the multimodal tensor-encoder test into CPU and CUDA wrappers.
  • Makes the transfer-agent binding import optional for CPU test collection.
  • Updates profiler assertions and CPU test setup.
  • Removes migrated tests from GPU test lists and adds CPU coverage.
  • No public API changes are introduced.
  • Test-list paths and formatting should pass existing validation checks.

QA Engineer Review

Test-list changes

  • l0_cpu.yml: Adds memory, modeling, checkpoint, multimodal, configuration, binding, disaggregated, metrics, quantization, script, tool, and logger coverage.
  • l0_a10.yml: Removes migrated tests and updates retained modeling coverage.
  • l0_b200.yml: Removes unittest/metrics/test_collector.py.
  • l0_h100.yml: Removes migrated memory and disaggregated tests while retaining selected disaggregated tests.
  • l0_l40s.yml: Removes test_llava_next_expand_prompt_token_ids_for_mm.

Test-code changes

  • Adds CPU-only markers across the affected test modules, classes, and functions.
  • Modifies test_prepare_multimodal_inputs_accepts_tensor_encoder_output by adding separate CPU and CUDA wrappers.
  • Modifies transfer-agent import handling in test_kv_transfer.py.
  • Modifies host-profiler tests by removing a skip and tightening call-count assertions.
  • Modifies mapping and pretrained-configuration test setup.
  • The migrated tests are covered by l0_cpu.yml directory or file entries.

Verdict: sufficient.

Description

Move generic, models, disagg test cases don't need GPU to CPU stage.

Test Coverage

These tests pass on CPU.

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.

Signed-off-by: Yuan Tong <13075180+tongyuantongyu@users.noreply.github.com>
Signed-off-by: Yuan Tong <13075180+tongyuantongyu@users.noreply.github.com>
Signed-off-by: Yuan Tong <13075180+tongyuantongyu@users.noreply.github.com>
@tongyuantongyu

Copy link
Copy Markdown
Member Author

/bot run --stage-list "CPU-Generic-x86-1, CPU-Generic-arm-1" --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63969 [ run ] triggered by Bot. Commit: 4464a08 Link to invocation

@tongyuantongyu

Copy link
Copy Markdown
Member Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #63969 [ run ] completed with state SUCCESS. Commit: 4464a08
/LLM/main/L0_MergeRequest_PR pipeline #51904 (Partly Tested) completed with status: 'SUCCESS'

CI Report

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #64004 [ run ] triggered by Bot. Commit: 4464a08 Link to invocation

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The pull request marks unit tests as CPU-only, updates hardware-specific integration test lists, and adjusts selected tests for optional imports, profiler assertions, MPI mapping, and runtime configuration.

Changes

CPU test scheduling

Layer / File(s) Summary
Hardware test-suite selection
tests/integration/test_lists/test-db/*.yml
Updates A10, CPU, H100, and L40S test coverage.
PyTorch CPU-only markers
tests/unittest/_torch/...
Marks modeling, multimodal, memory, checkpoint, and configuration tests as CPU-only.
Bindings and disaggregated test markers
tests/unittest/bindings/..., tests/unittest/disaggregated/...
Marks binding and disaggregated tests as CPU-only. Handles an optional transfer-agent import.
Supporting test adjustments
tests/unittest/others/..., tests/unittest/tools/..., tests/unittest/metrics/..., tests/unittest/scripts/..., tests/unittest/utils/...
Marks utility tests as CPU-only. Updates profiler assertions, MPI mapping setup, and pretrained configuration setup.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • NVIDIA/TensorRT-LLM#16498: Overlaps in CPU-only test scheduling, shared test-list YAML files, and pytest.mark.cpu_only usage.

Suggested reviewers: qijune, shixiaowei02, chuangz0

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 31.91% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the migration of generic, model, and disaggregated tests to CPU-only execution.
Description check ✅ Passed The description includes the required sections and explains the CPU-only migration and test coverage, with the checklist completed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
tests/unittest/bindings/test_executor_bindings.py (1)

719-719: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a boolean assertion.

config_copy.fast_logits is already the value under test. == True triggers Ruff E712 and obscures the intended check.

Proposed fix
-    assert config_copy.fast_logits == True
+    assert config_copy.fast_logits

As per coding guidelines, keep the boolean assertion PEP 8 compliant. The static-analysis report flags this exact comparison.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unittest/bindings/test_executor_bindings.py` at line 719, Update the
assertion in the test around config_copy.fast_logits to assert the boolean value
directly instead of comparing it with True, preserving the existing expected
truthy behavior and satisfying Ruff E712.

Sources: Coding guidelines, Linters/SAST tools

tests/unittest/others/test_mapping.py (1)

25-29: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add return annotations to the changed functions.

Both changed functions omit return annotations. Apply the repository annotation rule at both sites.

  • tests/unittest/others/test_mapping.py#L25-L29: add a generator annotation such as -> Iterator[None] to _force_mpi_topology_mapping.
  • tests/unittest/others/test_pretrained_config.py#L24-L26: add -> None to test_pretrained_config_parses_runtime_defaults_correctly.

As per coding guidelines, **/*.py requires: “Annotate every function.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unittest/others/test_mapping.py` around lines 25 - 29, Annotate both
changed functions: add a generator return annotation such as Iterator[None] to
_force_mpi_topology_mapping in tests/unittest/others/test_mapping.py (lines
25-29), and add -> None to
test_pretrained_config_parses_runtime_defaults_correctly in
tests/unittest/others/test_pretrained_config.py (lines 24-26).

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/unittest/bindings/test_executor_bindings.py`:
- Line 719: Update the assertion in the test around config_copy.fast_logits to
assert the boolean value directly instead of comparing it with True, preserving
the existing expected truthy behavior and satisfying Ruff E712.

In `@tests/unittest/others/test_mapping.py`:
- Around line 25-29: Annotate both changed functions: add a generator return
annotation such as Iterator[None] to _force_mpi_topology_mapping in
tests/unittest/others/test_mapping.py (lines 25-29), and add -> None to
test_pretrained_config_parses_runtime_defaults_correctly in
tests/unittest/others/test_pretrained_config.py (lines 24-26).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 9e09e699-6238-4d7c-a539-cdf9cf25e298

📥 Commits

Reviewing files that changed from the base of the PR and between 7608520 and 4464a08.

📒 Files selected for processing (84)
  • tests/integration/test_lists/test-db/l0_a10.yml
  • tests/integration/test_lists/test-db/l0_b200.yml
  • tests/integration/test_lists/test-db/l0_cpu.yml
  • tests/integration/test_lists/test-db/l0_h100.yml
  • tests/integration/test_lists/test-db/l0_l40s.yml
  • tests/unittest/_torch/executor/test_benchmark_disagg.py
  • tests/unittest/_torch/memory/test_gms_backend.py
  • tests/unittest/_torch/modeling/test_gemma4_multimodal.py
  • tests/unittest/_torch/modeling/test_modeling_afmoe.py
  • tests/unittest/_torch/modeling/test_modeling_llava_next.py
  • tests/unittest/_torch/modeling/test_modeling_nemotron_nano_v2_vl.py
  • tests/unittest/_torch/modeling/test_modeling_parakeet.py
  • tests/unittest/_torch/modeling/test_modeling_qwen3vl.py
  • tests/unittest/_torch/modeling/test_modeling_qwen3vl_preprocess.py
  • tests/unittest/_torch/modeling/test_modeling_step3p7.py
  • tests/unittest/_torch/modeling/test_nemotron_nano_preprocessing.py
  • tests/unittest/_torch/models/checkpoints/hf/test_weight_loader.py
  • tests/unittest/_torch/models/checkpoints/laguna/__init__.py
  • tests/unittest/_torch/models/checkpoints/laguna/test_laguna_weight_mapper.py
  • tests/unittest/_torch/models/checkpoints/mistral/__init__.py
  • tests/unittest/_torch/models/checkpoints/mistral/test_config_loader.py
  • tests/unittest/_torch/models/checkpoints/mistral/test_mistral_weight_mapper.py
  • tests/unittest/_torch/models/checkpoints/mx/test_mx_checkpoint_loader.py
  • tests/unittest/_torch/models/test_nemotron_h_puzzle.py
  • tests/unittest/_torch/multimodal/test_external_embedding.py
  • tests/unittest/_torch/multimodal/test_multimodal_mixin.py
  • tests/unittest/_torch/multimodal/test_multimodal_runtime.py
  • tests/unittest/_torch/multimodal/test_qwen3vl_disagg_prompt.py
  • tests/unittest/_torch/multimodal/test_share_multiparams.py
  • tests/unittest/_torch/test_connector.py
  • tests/unittest/_torch/test_custom_config_registration.py
  • tests/unittest/_torch/test_hf_quant_config.py
  • tests/unittest/_torch/test_model_config.py
  • tests/unittest/bindings/test_bindings_ut.py
  • tests/unittest/bindings/test_executor_bindings.py
  • tests/unittest/bindings/test_transfer_agent_bindings.py
  • tests/unittest/disaggregated/region/test_aux.py
  • tests/unittest/disaggregated/region/test_block.py
  • tests/unittest/disaggregated/region/test_page.py
  • tests/unittest/disaggregated/region/test_region.py
  • tests/unittest/disaggregated/test_agent.py
  • tests/unittest/disaggregated/test_agent_multi_backends.py
  • tests/unittest/disaggregated/test_cache_reuse_adapter.py
  • tests/unittest/disaggregated/test_cluster_storage.py
  • tests/unittest/disaggregated/test_disagg_cluster_manager_worker.py
  • tests/unittest/disaggregated/test_disagg_openai_client.py
  • tests/unittest/disaggregated/test_disagg_utils.py
  • tests/unittest/disaggregated/test_disaggregated_params.py
  • tests/unittest/disaggregated/test_extractor.py
  • tests/unittest/disaggregated/test_kv_transfer.py
  • tests/unittest/disaggregated/test_messenger.py
  • tests/unittest/disaggregated/test_openai_disagg_server.py
  • tests/unittest/disaggregated/test_openai_disagg_service.py
  • tests/unittest/disaggregated/test_peer.py
  • tests/unittest/disaggregated/test_perf_logger.py
  • tests/unittest/disaggregated/test_rank_info.py
  • tests/unittest/disaggregated/test_remoteDictionary.py
  • tests/unittest/disaggregated/test_request_id.py
  • tests/unittest/disaggregated/test_router.py
  • tests/unittest/llmapi/test_disagg_telemetry_launcher.py
  • tests/unittest/metrics/test_collector.py
  • tests/unittest/models/test_modeling_utils.py
  • tests/unittest/models/test_quant_config_utils.py
  • tests/unittest/others/test_bench.py
  • tests/unittest/others/test_convert_utils.py
  • tests/unittest/others/test_exception.py
  • tests/unittest/others/test_export.py
  • tests/unittest/others/test_lm_eval.py
  • tests/unittest/others/test_lora_module_count.py
  • tests/unittest/others/test_mapping.py
  • tests/unittest/others/test_multimodal_registry.py
  • tests/unittest/others/test_pretrained_config.py
  • tests/unittest/others/test_time_breakdown.py
  • tests/unittest/others/test_triton_kernels_vendoring.py
  • tests/unittest/quantization/test_mode.py
  • tests/unittest/scripts/test_check_model_registry.py
  • tests/unittest/scripts/test_fetch_cache.py
  • tests/unittest/scripts/test_legacy_utils.py
  • tests/unittest/tools/test_config_database_sync.py
  • tests/unittest/tools/test_host_profiler.py
  • tests/unittest/tools/test_prepare_dataset.py
  • tests/unittest/tools/test_test_to_stage_mapping.py
  • tests/unittest/utils/test_logger.py
  • tests/unittest/utils/test_prebuilt_whl_cpp_extensions.py
💤 Files with no reviewable changes (4)
  • tests/integration/test_lists/test-db/l0_l40s.yml
  • tests/integration/test_lists/test-db/l0_b200.yml
  • tests/integration/test_lists/test-db/l0_h100.yml
  • tests/integration/test_lists/test-db/l0_a10.yml

@QiJune QiJune left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Yuan Tong <13075180+tongyuantongyu@users.noreply.github.com>
@tongyuantongyu

Copy link
Copy Markdown
Member Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #64016 [ run ] triggered by Bot. Commit: 450c239 Link to invocation

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/unittest/tools/test_test_to_stage_mapping.py (1)

328-329: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Do not skip tests with no stage mapping.

When tests_to_stages([test_name]) returns no stages, continue bypasses the consistency checks. A missing or broken test-to-stage mapping can therefore pass this test. Assert that stages is non-empty and report the affected test and backend.

Proposed fix
             stages = stage_query.tests_to_stages([test_name])

             if not stages:
-                continue  # Skip tests that don't map to any stages
+                assert stages, (
+                    f"Test '{test_name}' with backend '{backend}' "
+                    "does not map to any stage"
+                )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unittest/tools/test_test_to_stage_mapping.py` around lines 328 - 329,
Replace the `if not stages: continue` behavior in the test-to-stage consistency
loop with an assertion that `stages` is non-empty, including the affected
`test_name` and backend in the failure message. Keep the subsequent consistency
checks running for mapped tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@tests/unittest/tools/test_test_to_stage_mapping.py`:
- Around line 328-329: Replace the `if not stages: continue` behavior in the
test-to-stage consistency loop with an assertion that `stages` is non-empty,
including the affected `test_name` and backend in the failure message. Keep the
subsequent consistency checks running for mapped tests.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 83a2705d-26d9-42c5-bb46-1ede38288121

📥 Commits

Reviewing files that changed from the base of the PR and between 4464a08 and 450c239.

📒 Files selected for processing (2)
  • tests/unittest/disaggregated/test_disagg_cluster_manager_worker.py
  • tests/unittest/tools/test_test_to_stage_mapping.py
💤 Files with no reviewable changes (1)
  • tests/unittest/disaggregated/test_disagg_cluster_manager_worker.py

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #64004 [ run ] completed with state ABORTED. Commit: 4464a08

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #64016 [ run ] completed with state SUCCESS. Commit: 450c239
/LLM/main/L0_MergeRequest_PR pipeline #51948 completed with status: 'SUCCESS'

CI Report

Link to invocation

@tongyuantongyu
tongyuantongyu merged commit a6aeaff into NVIDIA:main Aug 5, 2026
10 checks passed
@tongyuantongyu
tongyuantongyu deleted the ytong/host-only-test-cases-v2 branch August 6, 2026 03:25
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.

4 participants