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
4 changes: 4 additions & 0 deletions tests/integration/test_lists/test-db/l0_cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ l0_cpu:
backend: generic
orchestrator: mpi
tests:
- unittest/_torch/auto_deploy
- unittest/_torch/cute_dsl/test_kimi_k3_kda_ptx_patch.py
- unittest/_torch/distributed
- unittest/_torch/executor
Expand All @@ -25,6 +26,9 @@ l0_cpu:
- unittest/_torch/speculative/hw_agnostic
- unittest/_torch/test_model_config.py
- unittest/_torch/thop/parallel_hw_agnostic/test_custom_ops.py
- unittest/auto_deploy/multigpu
- unittest/auto_deploy/singlegpu
- unittest/auto_deploy/standalone
- unittest/bindings
- unittest/disaggregated
- unittest/executor/test_base_worker.py ISOLATION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ def test_full_model_equivalence():


@_GPT_OSS_MODELING_NVBUG
@pytest.mark.cpu_only
def test_export():
"""Model can be exported with torch.export and produces correct output."""
device = "cpu"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"SYMM_MEM",
],
)
@pytest.mark.cpu_only
def test_allreduce_strategy_propagation(strategy):
"""Test that allreduce_strategy is correctly propagated to graph nodes.

Expand Down Expand Up @@ -151,6 +152,7 @@ def forward(self, x):
"SYMM_MEM",
],
)
@pytest.mark.cpu_only
def test_allgather_strategy_propagation(strategy):
"""Test that allgather_strategy is correctly propagated to graph nodes.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def forward(self, x):
pytest.param(576, 4, 128, id="non_aligned_uneven_n-N576-ws4"),
],
)
@pytest.mark.cpu_only
def test_finegrained_fp8_get_sharded_scale(weight_original_n, world_size, block_n):
"""Tests FineGrained FP8 scale sharding for all shard boundary cases.

Expand Down Expand Up @@ -481,6 +482,7 @@ def forward(self, x):
return torch.ops.aten.view.default(x, (b, s, 32, 128))


@pytest.mark.cpu_only
def test_update_node_args_preserves_nested_symbolic_shape_nodes():
gm = torch.fx.symbolic_trace(SymbolicShapeView())
view_node = next(node for node in gm.graph.nodes if is_op(node, [torch.ops.aten.view]))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def _find_dynamic_op_node(gm):
)


@pytest.mark.cpu_only
def test_inject_out_param_reuses_positional_out_schema_slot():
graph = Graph()
q = graph.placeholder("q")
Expand Down Expand Up @@ -180,6 +181,7 @@ def test_inject_out_param_reuses_positional_out_schema_slot():
assert "out" not in dynamic_node.kwargs


@pytest.mark.cpu_only
def test_inject_out_param_uses_kwarg_when_out_slot_not_materialized():
graph = Graph()
q = graph.placeholder("q")
Expand Down Expand Up @@ -237,6 +239,7 @@ def test_inject_out_param_uses_kwarg_when_out_slot_not_materialized():
([], 15, None), # Case 8: empty list should return None
],
)
@pytest.mark.cpu_only
def test_round_up_to_closest(lst, value, expected):
assert _round_up_to_closest(lst, value) == expected

Expand Down Expand Up @@ -392,6 +395,7 @@ def get_args_kwargs(batch_size):
class TestCapturedGraphCapture:
"""Tests for capture-time input truncation in CapturedGraph."""

@pytest.mark.cpu_only
def test_capture_graph_uses_per_input_extents_for_truncation(self, monkeypatch):
class ModelWithDifferentDynamicDims(nn.Module):
def forward(self, x, y):
Expand Down Expand Up @@ -426,6 +430,7 @@ def get_args_kwargs(bs):
(3, 2, 2, 4),
}

@pytest.mark.cpu_only
def test_capture_graph_refetches_max_batch_after_probe(self, monkeypatch):
class ModelWithStatefulMetadata(nn.Module):
def __init__(self):
Expand Down Expand Up @@ -457,6 +462,7 @@ def get_args_kwargs(bs):

assert compiled_model.model.seen == [(2, 2)]

@pytest.mark.cpu_only
def test_capture_graph_skips_static_arg_mismatched_batch_size(self, monkeypatch):
class ModelWithStaticMetadata(nn.Module):
def forward(self, x, meta):
Expand Down Expand Up @@ -486,6 +492,7 @@ def get_args_kwargs(bs):
assert captured_shapes == [torch.Size([4, 1])]
assert set(compiled_model.cudagraphs) == {(4, 1)}

@pytest.mark.cpu_only
def test_auto_batched_inputs_keep_explicit_resources_static(self, monkeypatch):
class ModelWithInterleavedKwargs(nn.Module):
def forward(self, runtime_a, explicit_cache, runtime_b):
Expand Down Expand Up @@ -520,6 +527,7 @@ def get_args_kwargs(bs):
assert [tuple(buf.shape) for buf in compiled_model._input_buffers] == [(4, 2), (4, 2)]
assert captured_kwarg_orders == [("runtime_a", "runtime_b", "explicit_cache")]

@pytest.mark.cpu_only
def test_auto_batched_inputs_keep_cache_seq_interface_static(self, monkeypatch):
class Interface:
pass
Expand Down Expand Up @@ -556,6 +564,7 @@ def get_args_kwargs(bs):
assert [tuple(buf.shape) for buf in compiled_model._input_buffers] == [(4, 2)]
assert captured_kwarg_orders == [("runtime_a", "cache_seq_interface")]

@pytest.mark.cpu_only
def test_auto_batched_inputs_do_not_guess_legacy_cache_names(self, monkeypatch):
class ModelWithLegacyCacheName(nn.Module):
def forward(self, runtime_a, r0_cache, runtime_b):
Expand Down Expand Up @@ -626,6 +635,7 @@ def get_args_kwargs(batch_size):
assert out.shape == (bs - 1, hidden_size)
torch.testing.assert_close(out, replay_input[:-1] + 1)

@pytest.mark.cpu_only
def test_forward_uses_captured_output_extent_when_input_extent_is_larger(self, monkeypatch):
class GatherLikeModel(nn.Module):
def __init__(self):
Expand Down Expand Up @@ -676,6 +686,7 @@ def get_args_kwargs(bs):
assert out.shape == (4, 2)
torch.testing.assert_close(out, torch.full((4, 2), 4.0))

@pytest.mark.cpu_only
def test_forward_falls_back_when_captured_output_extent_exceeds_buffer(self, monkeypatch):
class EchoModel(nn.Module):
def __init__(self):
Expand Down Expand Up @@ -720,6 +731,7 @@ def get_args_kwargs(bs):
((2, 2), "output extent metadata does not match captured outputs"),
],
)
@pytest.mark.cpu_only
def test_forward_raises_for_inconsistent_output_extent_metadata(
self, monkeypatch, output_extents, error_match
):
Expand Down Expand Up @@ -787,6 +799,7 @@ def forward(self, x):
# ============================================================================


@pytest.mark.cpu_only
class TestSubmodHasCudaOps:
"""Tests for submod_has_cuda_ops."""

Expand Down Expand Up @@ -837,6 +850,7 @@ def test_graphmodule_with_only_trivial_methods(self):
# ============================================================================


@pytest.mark.cpu_only
class TestDualModeCapturedGraphRouting:
"""Tests for DualModeCapturedGraph routing logic (no actual graph capture)."""

Expand Down Expand Up @@ -950,6 +964,7 @@ def test_find_nearest_bucket_empty(self):
# ============================================================================


@pytest.mark.cpu_only
class TestPiecewiseCapturedGraphPrepare:
"""Tests for PiecewiseCapturedGraph.prepare."""

Expand All @@ -976,6 +991,7 @@ def test_prepare_is_idempotent(self):
# ============================================================================


@pytest.mark.cpu_only
class TestPiecewiseCapturedGraphOutputHandling:
"""Tests for output reconstruction and forward-state cleanup."""

Expand Down Expand Up @@ -1030,6 +1046,7 @@ def test_forward_synchronizes_and_reconstructs_output(self, monkeypatch):
# ============================================================================


@pytest.mark.cpu_only
class TestPiecewiseCapturedGraphStaticInputBuffers:
"""Tests for static kwarg buffers used by piecewise capture."""

Expand Down Expand Up @@ -1126,6 +1143,7 @@ def get_args_kwargs(num_tokens):
# ============================================================================


@pytest.mark.cpu_only
class TestADPiecewiseRunnerCapture:
"""Tests for dynamic output buffers allocated during runner capture."""

Expand Down Expand Up @@ -1181,6 +1199,7 @@ def fake_make_weak_ref(value):
# ============================================================================


@pytest.mark.cpu_only
class TestGenerateDefaultPiecewiseNumTokens:
"""Tests for _generate_default_piecewise_num_tokens."""

Expand Down Expand Up @@ -1233,6 +1252,7 @@ def test_no_duplicates_when_max_is_power_of_two(self):
# ============================================================================


@pytest.mark.cpu_only
class TestCompileModelGraphModuleTargetCollection:
"""Tests for selecting GraphModule compile targets."""

Expand Down Expand Up @@ -1509,6 +1529,7 @@ def _build_plain_static_submod():
return torch.fx.GraphModule(root, g)


@pytest.mark.cpu_only
class TestPiecewiseCapturedGraphMultiStreamWiring:
def _build_split_gm(self, ms_submod, plain_submod):
parent = nn.Module()
Expand Down Expand Up @@ -1547,6 +1568,7 @@ def test_prepare_keeps_stream_switch_partition_as_static_runner(self, monkeypatc
assert isinstance(pcg.split_gm.submod_1, ADPiecewiseRunner)


@pytest.mark.cpu_only
class TestSetupPiecewiseMixedBatch:
"""Coverage for piecewise warmup synthetic mixed-batch setup.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
# ============================================================================


@pytest.mark.cpu_only
class TestADPiecewiseRunnerContextManagement:
def setup_method(self):
ADPiecewiseRunner._current_num_tokens = None
Expand Down Expand Up @@ -57,6 +58,7 @@ def test_set_current_phase_invalid_raises(self):
# ============================================================================


@pytest.mark.cpu_only
class TestADPiecewiseRunnerInit:
def test_entries_initially_empty(self):
submod = nn.Linear(4, 4)
Expand All @@ -80,6 +82,7 @@ def test_no_dynamic_out_info_by_default(self):
# ============================================================================


@pytest.mark.cpu_only
class TestOutputInfo:
def test_creation(self):
info = OutputInfo(
Expand All @@ -91,6 +94,7 @@ def test_creation(self):
assert info.dtype == torch.float16


@pytest.mark.cpu_only
class TestSegmentEntry:
def test_default_values(self):
entry = SegmentEntry()
Expand All @@ -116,6 +120,7 @@ def forward(self, chunk_values: torch.Tensor, seq_idx_values: torch.Tensor):
return chunk_values, chunk_values.clone(), seq_idx_values.to(torch.int32).view(1, -1)


@pytest.mark.cpu_only
class TestMetadataWrapper:
def setup_method(self):
ADPiecewiseRunner._current_num_tokens = None
Expand Down Expand Up @@ -185,6 +190,7 @@ def test_mamba_metadata_allows_runtime_growth(self):
# ============================================================================


@pytest.mark.cpu_only
class TestDynamicOutBuf:
def test_set_and_get_returns_none_before_capture(self):
submod = nn.Linear(4, 4)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from types import SimpleNamespace

import pytest
import torch
import torch.nn as nn
from torch.fx import Graph, GraphModule
Expand All @@ -36,6 +37,9 @@
wait_aux_stream_passthrough,
)

pytestmark = pytest.mark.cpu_only


# ============================================================================
# Helpers
# ============================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from tensorrt_llm._torch.auto_deploy.custom_ops.attention_interface import BatchInfo


@pytest.mark.cpu_only
@torch.inference_mode()
def test_gemma4_multimodal_mask_source_op():
input_ids = torch.tensor([[1, 2, 3, 4, 5]], dtype=torch.int64)
Expand Down Expand Up @@ -55,6 +56,7 @@ def test_gemma4_multimodal_mask_source_op():
torch.testing.assert_close(actual, expected)


@pytest.mark.cpu_only
@torch.inference_mode()
def test_gemma4_prepare_multimodal_mask_chunked_prefill():
batch_info = BatchInfo()
Expand Down Expand Up @@ -90,6 +92,7 @@ def test_gemma4_prepare_multimodal_mask_chunked_prefill():
torch.testing.assert_close(actual, expected)


@pytest.mark.cpu_only
@torch.inference_mode()
def test_torch_attention_explicit_mask_is_authoritative():
torch.manual_seed(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,7 @@ def test_memory_efficiency(self):
assert compression_ratio > 50, f"Expected >50x compression, got {compression_ratio:.1f}x"


@pytest.mark.cpu_only
class TestMLADescriptor:
"""Test MultiHeadLatentAttention descriptor configuration."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ def test_prefill_ragged(
)


@pytest.mark.cpu_only
class TestTritonMLADescriptor:
"""Test TritonMLAAttention descriptor configuration."""

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

import pytest
import torch
from triton_kernels.tensor_details.layout import HopperMXValueLayout, StridedLayout

from tensorrt_llm._torch.auto_deploy.custom_ops.fused_moe import mxfp4_moe

pytestmark = pytest.mark.cpu_only


def test_mxfp4_value_layout_uses_strided_layout_on_blackwell(monkeypatch):
monkeypatch.setattr(mxfp4_moe, "cuda_capability_geq", lambda major, minor=0: major >= 10)
Expand Down
Loading
Loading