Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions jenkins/L0_Test.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,7 @@ def getPytestBaseCommandLine(
if (stageName.contains("-Ray-")) {
testCmdLine += ["--run-ray"]
}
def unittestMarkExpr = (stageName.startsWith("CPU-")) ? "cpu_only and not disabled" : "not cpu_only"
def unittestMarkExpr = (stageName.startsWith("CPU-")) ? "cpu_only" : "not cpu_only"
testCmdLine += ["--unittest-markexpr='${unittestMarkExpr}'"]
if (ENABLE_UPLOAD_TEST_RESULTS) {
testCmdLine += ["-o console_output_style=progress-even-when-capture-no"]
Expand Down Expand Up @@ -5075,7 +5075,7 @@ def launchTestJobs(pipeline, testFilter)
// may break the mapping functionality.

x86TestConfigs = [
"CPU-Generic-x86-1": ["cpu", "l0_cpu_x86", 1, 1],
"CPU-Generic-x86-1": ["cpu", "l0_cpu", 1, 1],
"DGX_H100-4_GPUs-CPP-1": ["dgx-h100-x4", "l0_dgx_h100", 1, 1, 4],
"A10-PyTorch-1": ["a10", "l0_a10", 1, 3],
"A10-PyTorch-2": ["a10", "l0_a10", 2, 3],
Expand Down Expand Up @@ -5257,7 +5257,7 @@ def launchTestJobs(pipeline, testFilter)

// SBSA machines from the Blossom machine pool
SBSATestConfigs = [
"CPU-Generic-arm-1": ["cpu", "l0_cpu_arm", 1, 1],
"CPU-Generic-arm-1": ["cpu", "l0_cpu", 1, 1],
"GH200-PyTorch-Post-Merge-1": ["gh200", "l0_gh200", 1, 1],
// DGX Spark is also named as GB10 Grace Blackwell Superchip.
"GB10-PyTorch-1": ["gb10x", "l0_gb10", 1, 1],
Expand Down
13 changes: 1 addition & 12 deletions tensorrt_llm/llmapi/llm_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -4368,8 +4368,7 @@ class BaseLlmArgs(StrictBaseModel):
"(default), it is read from the HF config.json ('dtype', or the "
"deprecated 'torch_dtype'); for composite/VLM configs it falls "
"back to the nested text_config.dtype. Defaults to bfloat16 if "
"none is found, and is overridden to float16 on GPUs with compute "
"capability < 8.0 (pre-Ampere).",
"none is found.",
telemetry=TelemetryField.categorical("auto", "float16", "bfloat16",
"float32"))

Expand Down Expand Up @@ -4679,16 +4678,6 @@ def from_yaml(cls, yaml_path: Union[str, Path]):
raise ValueError("Configuration file root must be a mapping.")
return cls(**config_dict)

@field_validator("dtype")
@classmethod
def validate_dtype(cls, v, info):
if torch.cuda.get_device_properties(0).major < 8:
if v == 'auto':
v = 'float16'
if v == 'bfloat16':
raise RuntimeError("Pre SM 80 GPUs do not support bfloat16")
return v

@field_validator("gpus_per_node", mode='before')
@classmethod
def validate_gpus_per_node(cls, v, info):
Expand Down
14 changes: 9 additions & 5 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,13 @@ In file `jenkins/L0_Test.groovy`, the variables `x86TestConfigs`, `SBSATestConfi

Currently the yml files are manually maintained, which requires developer to update them when new test cases are added.

### How to choose GPU type
### How to choose whether a GPU is needed and which GPU type

The CI resource of each GPU type is different. Usually you should choose the cheapest GPU that fulfills test requirements. In most cases, an integration test case should only run on one GPU type, unless it's very important or has different behaviours on different GPUs.
While TensorRT LLM is GPU-centric, the specific feature covered by a unit test may not need to interact with a GPU on its own. For unit tests that do not intrinsically require a GPU, prefer the CPU-only stages to avoid reserving unnecessary GPU resources. The CPU-only option applies only to unit tests.

The priority is A10 > A30 > L40s > A100 > H100 > B200.
When a test requires a GPU, choose the cheapest GPU that fulfills its requirements. In most cases, an integration test case should run on only one GPU type, unless it is especially important or behaves differently on different GPUs.

The priority is A10 > A30 > L40S > A100 > H100 > B200.

## 2. Add an integration test

Expand All @@ -141,6 +143,8 @@ Once a new integration test case is added, the yml files must be updated to cont

A unit test are used to test a standalone feature or building block, and only runs partial workflow.

Mark a unit test that does not require a GPU to run with `@pytest.mark.cpu_only` or file-level `pytestmark = pytest.mark.cpu_only`. Only these tests run in the CPU-only stages. You can define CPU and GPU cases in the same test file.

For legacy and case management reason, the CI doesn't run unit tests directly. It uses a bridge to map multiple unit test cases into one integration test case, and manages these bridged cases.
The bridge is implemented in `integration/defs/test_unittests.py` and `pytest_generate_tests` function in `tests/integration/defs/conftest.py`.

Expand All @@ -161,9 +165,9 @@ pytest unittest/an_existing_file.py -m "part0 and gpu2" # run some cases in a fi
```

2. Check existing bridge cases and make sure your cases are not covered by an existing one.
For example, you may want to add `pytest unittest/an_existing_file.py -k "some_keyword or another_keyword"`, but there is already `pytest unittest/an_existing_file.py -k "not thrid_keyword"` which covers your filter.
For example, you may want to add `pytest unittest/an_existing_file.py -k "some_keyword or another_keyword"`, but there is already `pytest unittest/an_existing_file.py -k "not third_keyword"` which covers your filter.

3. Choose a suitable GPU and add a line of your cases. For example, adding `unittest/an_existing_file.py -k "some_keyword or another_keyword"` to `tests/integration/test_lists/test-db/l0_a10.yml`.
3. Choose a suitable CI stage and add a line to the corresponding test list config. For example, adding `unittest/an_existing_file.py -k "some_keyword or another_keyword"` to `tests/integration/test_lists/test-db/l0_a10.yml`.

## 4. Run a CI stage locally

Expand Down
11 changes: 8 additions & 3 deletions tests/integration/defs/test_unittests.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ def test_unittests_v2(llm_root, llm_venv, case: str, output_dir, request):

import shlex
arg_list = shlex.split(case)
if unittest_markexpr:
if "-m" in arg_list:
markexpr_index = arg_list.index("-m") + 1
case_markexpr = arg_list[markexpr_index]
arg_list[markexpr_index] = (
f"({case_markexpr}) and ({unittest_markexpr})")
else:
arg_list += ["-m", unittest_markexpr]
case_fn = re.sub(r'[/\s"\']+', '-', case)
if len(case_fn) > 80:
case_fn = case_fn[:80]
Expand Down Expand Up @@ -171,9 +179,6 @@ def test_unittests_v2(llm_root, llm_venv, case: str, output_dir, request):
if run_ray:
command += ["--run-ray"]

if unittest_markexpr:
command += ["-m", unittest_markexpr]

s3_secret_key = None
s3_upload_path = request.config.getoption("--s3-upload-path", default=None)
if s3_upload_path:
Expand Down
22 changes: 0 additions & 22 deletions tests/integration/test_lists/test-db/l0_a10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ l0_a10:
- unittest/_torch/modeling/test_multimodal_encoder_mixin.py
- unittest/_torch/sampler/test_trtllm_sampler.py
- unittest/_torch/sampler/test_token_ban.py
- unittest/_torch/executor/test_async_transfer_manager.py
- unittest/_torch/executor/test_scheduler_serializable_output.py
- unittest/_torch/executor/test_kv_cache_estimation.py
- unittest/_torch/executor/test_kv_cache_budget_split.py
- unittest/_torch/executor/test_kv_pool_rebalance.py
Expand All @@ -44,21 +42,13 @@ l0_a10:
- unittest/_torch/executor/test_kv_cache_v2_capacity_only.py
- unittest/_torch/executor/test_error_classification.py
- unittest/_torch/modules/dwdp/test_dwdp_fixup_moe_backends.py
- unittest/_torch/modules/dwdp/test_dwdp_manager.py
- unittest/_torch/modules/dwdp/test_dwdp_mapping.py
- unittest/_torch/modules/dwdp/test_dwdp_peer_ranges.py
- unittest/_torch/modules/moe/test_communication_factory.py
# NOTE: this is a CPU-only test, but we do not have a dedicated job for this (and therefore no
# test list either).
- unittest/_torch/models/checkpoints
- unittest/_torch/models/test_qwen3_next_moe_quant.py
- unittest/_torch/weight_sharing
- unittest/inputs/test_chat_template_dispatch.py
- unittest/inputs/test_content_format.py
- unittest/inputs/test_url_validation.py
- unittest/inputs/test_multimodal.py
- unittest/inputs/test_multimodal_input_processor.py
- unittest/inputs/test_video_decode.py
- unittest/others/test_cache_transceiver_precheck_config.py
- unittest/others/test_cache_transceiver_precheck_run.py
- unittest/others/test_convert_utils.py
Expand Down Expand Up @@ -145,26 +135,14 @@ l0_a10:
- unittest/_torch/visual_gen/test_qwen_image_infer.py
- unittest/_torch/visual_gen/test_qwen_image_pipeline.py
# llmapi
- unittest/llmapi/test_llm_utils.py
- unittest/llmapi/test_gc_utils.py
- unittest/llmapi/test_reasoning_parser.py
- unittest/llmapi/test_serialization.py
- unittest/llmapi/test_utils.py
- unittest/llmapi/test_rlhf_utils.py
- unittest/llmapi/test_llm_args.py
- unittest/llmapi/test_kv_cache_dtype_override.py
- unittest/llmapi/test_additional_model_outputs.py -m "gpu1"
- unittest/llmapi/test_request_priority.py
# executor
- unittest/executor/test_ipc.py
- unittest/executor/test_fatal_error_health_check.py
- unittest/executor/test_postprocessor_hook.py
- unittest/executor/test_proxy_postproc_terminate.py
- unittest/executor/test_proxy_fast_death.py
# trtllm-serve CPU-only
- unittest/llmapi/apps/test_chat_utils.py
- unittest/llmapi/apps/test_tool_parsers.py
- unittest/llmapi/apps/test_harmony_channel_validation.py
- unittest/llmapi/apps/test_encode_batcher.py
- unittest/llmapi/test_embedding_arch_routing.py
# usage telemetry
Expand Down
1 change: 0 additions & 1 deletion tests/integration/test_lists/test-db/l0_a100.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ l0_a100:
tests:
- unittest/llmapi/test_llm.py -m "part0"
- unittest/llmapi/test_llm.py -m "not part0" TIMEOUT (90)
- unittest/llmapi/test_executor.py
- condition:
ranges:
system_gpu_count:
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/test_lists/test-db/l0_b200.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ l0_b200:
- kv_cache/test_kv_cache_v2_scheduler.py::TestKVCacheV2LoRA::test_lora_chunked_prefill
- kv_cache/test_kv_cache_v2_scheduler.py::TestKVCacheV2LoRA::test_lora_eviction
# ------------- KV Cache Iteration Stats ---------------
- unittest/executor/test_stats_serializer.py
- unittest/metrics/test_collector.py
- kv_cache/test_kv_cache_iteration_stats.py::TestKvCacheIterationStats::test_cold_start
- kv_cache/test_kv_cache_iteration_stats.py::TestKvCacheIterationStats::test_partial_block_reuse
Expand Down Expand Up @@ -269,7 +268,6 @@ l0_b200:
stage: post_merge
backend: pytorch
tests:
- unittest/llmapi/test_llm_quant.py # 3.5 mins on B200
- unittest/disaggregated/test_openai_server_info.py
- examples/visual_gen/test_visual_gen.py::test_cosmos3_t2i_4step_example TIMEOUT (30)
- examples/visual_gen/test_visual_gen.py::test_cosmos3_i2v_4step_example TIMEOUT (45)
Expand Down
46 changes: 46 additions & 0 deletions tests/integration/test_lists/test-db/l0_cpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: 0.0.1
l0_cpu:
- condition:
ranges:
system_gpu_count:
gte: 0
lte: 0
wildcards:
linux_distribution_name: ubuntu*
terms:
stage: pre_merge
backend: generic
orchestrator: mpi
tests:
- unittest/_torch/distributed
- unittest/_torch/executor
- unittest/_torch/lora
- unittest/_torch/modules
- unittest/_torch/ray_orchestrator/single_gpu/test_cache_transceiver_comm.py
- unittest/_torch/speculative/hw_agnostic
- unittest/executor/test_base_worker.py ISOLATION
- unittest/executor/test_fatal_error_health_check.py
- unittest/executor/test_ipc.py
- unittest/executor/test_rpc.py
- unittest/executor/test_multi_frontend_routing.py
- unittest/executor/test_event_loop_error_broadcast.py
- unittest/executor/test_stats_serializer.py
- unittest/inputs
- unittest/llmapi/apps/test_chat_utils.py
- unittest/llmapi/apps/test_harmony_channel_validation.py
- unittest/llmapi/apps/test_tool_parsers.py
- unittest/llmapi/test_bench_async.py
- unittest/llmapi/test_additional_model_outputs.py -m "gpu1"
- unittest/llmapi/test_executor.py
- unittest/llmapi/test_gc_utils.py
- unittest/llmapi/test_kv_cache_dtype_override.py
- unittest/llmapi/test_llm_args.py
- unittest/llmapi/test_llm_quant.py
- unittest/llmapi/test_llm_telemetry.py
- unittest/llmapi/test_llm_utils.py
- unittest/llmapi/test_mpi_session.py ISOLATION
- unittest/llmapi/test_reasoning_parser.py
- unittest/llmapi/test_request_priority.py
- unittest/llmapi/test_serialization.py
- unittest/llmapi/test_utils.py
- unittest/others/test_http_utils_fail_fast.py
19 changes: 0 additions & 19 deletions tests/integration/test_lists/test-db/l0_cpu_arm.yml

This file was deleted.

20 changes: 0 additions & 20 deletions tests/integration/test_lists/test-db/l0_cpu_x86.yml

This file was deleted.

2 changes: 0 additions & 2 deletions tests/integration/test_lists/test-db/l0_dgx_h100.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ l0_dgx_h100:
- unittest/llmapi/test_llm_multi_gpu_pytorch.py -m "gpu2"
- unittest/llmapi/test_additional_model_outputs.py -m "gpu2"
- unittest/_torch/multi_gpu -m "not post_merge" TIMEOUT (90)
- unittest/_torch/distributed
- unittest/_torch/modeling/test_modeling_pixtral.py::test_tensor_parallelism
- kv_cache/test_final_single_token_context_cuda_graph.py::test_final_token_reuse_cuda_graph_tp2[v1]
- kv_cache/test_final_single_token_context_cuda_graph.py::test_final_token_reuse_cuda_graph_tp2[v2]
Expand Down Expand Up @@ -63,7 +62,6 @@ l0_dgx_h100:
- unittest/llmapi/apps/test_disagg_serving_perf_metrics.py
- disaggregated/test_disaggregated.py::test_disaggregated_cancel_large_context_requests[DeepSeek-V3-Lite-bf16]
# llmapi
- unittest/llmapi/test_mpi_session.py::test_llmapi_launch_multiple_tasks
- accuracy/test_disaggregated_serving.py::TestLlama3_1_8BInstruct::test_gen_only_spec_dec
- condition:
ranges:
Expand Down
1 change: 0 additions & 1 deletion tests/integration/test_lists/test-db/l0_gh200.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ l0_gh200:
backend: pytorch
tests:
- unittest/bindings
- unittest/llmapi/test_llm_quant.py
- llmapi/test_llm_examples.py::test_llmapi_quickstart_atexit
- examples/visual_gen/test_visual_gen.py::test_visual_gen_quickstart
- examples/visual_gen/test_visual_gen.py::test_visual_gen_api_walkthrough
3 changes: 0 additions & 3 deletions tests/integration/test_lists/test-db/l0_h100.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ l0_h100:
- disaggregated/test_disaggregated_single_gpu.py::test_disaggregated_logprobs[False-TinyLlama-1.1B-Chat-v1.0]
- disaggregated/test_disaggregated_single_gpu.py::test_disaggregated_logprobs[True-TinyLlama-1.1B-Chat-v1.0]
- unittest/_torch/executor/test_overlap_scheduler.py
- unittest/_torch/ray_orchestrator/single_gpu/test_cache_transceiver_comm.py
- unittest/_torch/ray_orchestrator/single_gpu/test_llm_sleep.py
- unittest/_torch/ray_orchestrator/single_gpu/test_llm_update_weights.py -m "part0"
- unittest/_torch/ray_orchestrator/single_gpu/test_llm_update_weights.py -m "part1"
Expand Down Expand Up @@ -310,7 +309,6 @@ l0_h100:
stage: pre_merge
backend: pytorch
tests:
- unittest/llmapi/test_llm_quant.py # 5.5 mins on H100
- examples/visual_gen/test_visual_gen.py::test_visual_gen_quickstart
- examples/visual_gen/test_visual_gen.py::test_visual_gen_api_walkthrough
- condition:
Expand Down Expand Up @@ -364,7 +362,6 @@ l0_h100:
- unittest/bindings # 8 mins on H100
- unittest/kv_cache_manager_v2_tests # 4 min
# ------------- KV Cache Iteration Stats ---------------
- unittest/executor/test_stats_serializer.py
- unittest/metrics/test_collector.py
- kv_cache/test_kv_cache_iteration_stats.py::TestKvCacheIterationStats::test_cold_start
- kv_cache/test_kv_cache_iteration_stats.py::TestKvCacheIterationStats::test_partial_block_reuse
Expand Down
2 changes: 2 additions & 0 deletions tests/unittest/_torch/distributed/test_cp_broadcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from tensorrt_llm._torch.distributed import MPIDist
from tensorrt_llm.mapping import Mapping

pytestmark = pytest.mark.cpu_only


def get_mpi_info():
"""Get MPI rank and world size, returns (0, 1) if MPI is not available."""
Expand Down
2 changes: 2 additions & 0 deletions tests/unittest/_torch/distributed/test_safe_mpi_comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
from tensorrt_llm._torch.distributed import communicator
from tensorrt_llm.bindings import BuildInfo

pytestmark = pytest.mark.cpu_only


def get_mpi_info():
"""Get MPI rank and world size, returns (0, 1) if MPI is not available."""
Expand Down
2 changes: 2 additions & 0 deletions tests/unittest/_torch/executor/test_adp_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
from tensorrt_llm.conversation_params import ConversationParams
from tensorrt_llm.scheduling_params import SchedulingParams

pytestmark = pytest.mark.cpu_only


class _MockRequest(MagicMock):
"""Mock executor Request whose ``num_input_tokens`` mirrors the real binding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@

from unittest.mock import MagicMock

import pytest

from tensorrt_llm._torch.pyexecutor.py_executor import AsyncTransferManager
from tensorrt_llm._torch.pyexecutor.resource_manager import ResourceManagerType
from tensorrt_llm.bindings import LlmRequestState

pytestmark = pytest.mark.cpu_only


def create_mock_request(request_id: int):
"""Create a mock LlmRequest with the given request ID."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
from tensorrt_llm._torch.pyexecutor.executor_request_queue import (
SHUTDOWN_REQUEST_ID, ExecutorRequestQueue, RequestQueueItem)

pytestmark = pytest.mark.cpu_only


@pytest.fixture
def mock_dist():
Expand Down
Loading
Loading