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
18 changes: 18 additions & 0 deletions tensorrt_llm/_torch/pyexecutor/model_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -5699,6 +5699,7 @@ def append_cross_attention_state(request: LlmRequest,
input_ids.append(
request.get_tokens(0)[request.context_current_position])
past_seen_token_num = request.context_current_position
request_has_previous_tensor = False
# The request has no previous tensor:
# (1) new_tokens_device is None, which means overlap scheduler is disabled; or
# (2) a dummy request; or
Expand All @@ -5720,17 +5721,34 @@ def append_cross_attention_state(request: LlmRequest,
else:
input_ids.append(request.get_last_tokens(beam))
past_seen_token_num = request.max_beam_num_tokens - 1
request_has_previous_tensor = False
else:
# the request has previous tensor
# previous_batch_indices is per-request, not per-beam
previous_batch_indices.append(request.py_batch_idx)
past_seen_token_num = request.max_beam_num_tokens
request_has_previous_tensor = True

position_id = past_seen_token_num
if _has_cp_helix:
# We compute a global position_id because each helix rank has only a subset of
# tokens for a sequence.
position_id = request.total_input_len_cp + request.py_decoding_iter - 1
if request_has_previous_tensor:
# With the overlap scheduler this batch is prepared
# before the previous iteration's _update_requests has
# advanced py_decoding_iter, so the counter is one
# behind. Compensate exactly like the non-helix path
# above, which uses max_beam_num_tokens *without* the
# -1 in this case. Without this, the position repeats
# once (L, L, L+1, ...) and the new token's K is roped
# at the wrong position before being written to the KV
# cache, corrupting every later step.
# TODO: revisit for helix x speculative decoding -
Comment thread
lancelly marked this conversation as resolved.
# the base formula and this +1 both assume exactly
# one new token per step (draft-token modes are
# currently rejected under helix).
position_id += 1
Comment thread
lancelly marked this conversation as resolved.
if request.py_helix_is_inactive_rank:
past_seen_token_num = request.seqlen_this_rank_cp
else:
Expand Down
62 changes: 42 additions & 20 deletions tests/integration/defs/accuracy/test_disaggregated_serving.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,8 @@ def test_gen_only_spec_dec(self):

@skip_pre_blackwell
@pytest.mark.skip_less_device(8)
@pytest.mark.parametrize("disable_overlap_scheduler", [True, False],
ids=["overlap_off", "overlap_on"])
@pytest.mark.parametrize("gen_pp,gen_tp,gen_cp,enable_attention_dp", [
(1, 2, 2, False),
(1, 2, 2, True),
Expand All @@ -1119,7 +1121,8 @@ def test_gen_only_spec_dec(self):
ids=["cudagraph:with_padding"])
@pytest.mark.parametrize("comms_medium", ["fifo_v2"])
def test_auto_dtype_with_helix(self, comms_medium, cuda_graph_config,
gen_pp, gen_tp, gen_cp, enable_attention_dp):
gen_pp, gen_tp, gen_cp, enable_attention_dp,
disable_overlap_scheduler):
# Parse comms_medium to get use_nccl_for_alltoall and fifo_version.
if comms_medium == "nccl":
use_nccl_for_alltoall = True
Expand Down Expand Up @@ -1166,7 +1169,7 @@ def test_auto_dtype_with_helix(self, comms_medium, cuda_graph_config,
"use_nccl_for_alltoall": use_nccl_for_alltoall,
"fifo_version": fifo_version,
},
"disable_overlap_scheduler": True,
"disable_overlap_scheduler": disable_overlap_scheduler,
"kv_cache_config": kv_cache_config,
"enable_chunked_prefill": False,
"cuda_graph_config": cuda_graph_config,
Expand Down Expand Up @@ -1780,23 +1783,8 @@ def _test_chunked_prefill_helper(self, *, ctx_pp: int):
def test_chunked_prefill(self):
self._test_chunked_prefill_helper(ctx_pp=1)

@skip_pre_blackwell
@pytest.mark.skip_less_device(8)
@pytest.mark.parametrize("gen_pp,gen_tp,gen_cp,enable_attention_dp", [
(1, 2, 2, False),
(1, 2, 2, True),
],
ids=["pp1tp2cp2", "pp1dp2cp2"])
@pytest.mark.parametrize("cuda_graph_config", [
{
"enable_padding": True,
"batch_sizes": [1, 2, 4, 8, 16, 32, 64]
},
],
ids=["cudagraph:with_padding"])
@pytest.mark.parametrize("comms_medium", ["fifo_v2"])
def test_auto_dtype_with_helix(self, comms_medium, cuda_graph_config,
gen_pp, gen_tp, gen_cp, enable_attention_dp):
def _run_helix_test(self, comms_medium, cuda_graph_config, gen_pp, gen_tp,
Comment thread
lancelly marked this conversation as resolved.
gen_cp, enable_attention_dp, disable_overlap_scheduler):
# Parse comms_medium to get use_nccl_for_alltoall and fifo_version.
if comms_medium == "nccl":
use_nccl_for_alltoall = True
Expand Down Expand Up @@ -1841,12 +1829,12 @@ def test_auto_dtype_with_helix(self, comms_medium, cuda_graph_config,
"use_nccl_for_alltoall": use_nccl_for_alltoall,
"fifo_version": fifo_version,
},
"disable_overlap_scheduler": True,
"kv_cache_config": kv_cache_config,
"enable_chunked_prefill": False,
"cuda_graph_config": cuda_graph_config,
"cache_transceiver_config": cache_transceiver_config.copy(),
"enable_attention_dp": enable_attention_dp,
"disable_overlap_scheduler": disable_overlap_scheduler,
}
disaggregated_server_config = {
"hostname": "localhost",
Expand All @@ -1866,6 +1854,40 @@ def test_auto_dtype_with_helix(self, comms_medium, cuda_graph_config,
self.MODEL_PATH) as llm:
run_accuracy_test(llm, self.MODEL_NAME, ["GSM8K"])

@skip_pre_blackwell
@pytest.mark.skip_less_device(8)
# overlap_on is the regression guard for the helix x overlap-scheduler
# position_id off-by-one: generation batches are prepared one iteration
# ahead of py_decoding_iter, and an uncompensated helix position repeats
# once and corrupts the KV cache from the second decode step on. GSM8K
# fails hard without the compensation.
@pytest.mark.parametrize("disable_overlap_scheduler", [True, False],
ids=["overlap_off", "overlap_on"])
@pytest.mark.parametrize("gen_pp,gen_tp,gen_cp,enable_attention_dp", [
(1, 2, 2, False),
(1, 2, 2, True),
],
ids=["pp1tp2cp2", "pp1dp2cp2"])
@pytest.mark.parametrize("cuda_graph_config", [
{
"enable_padding": True,
"batch_sizes": [1, 2, 4, 8, 16, 32, 64]
},
],
ids=["cudagraph:with_padding"])
@pytest.mark.parametrize("comms_medium", ["fifo_v2"])
def test_auto_dtype_with_helix(self, comms_medium, cuda_graph_config,
gen_pp, gen_tp, gen_cp, enable_attention_dp,
disable_overlap_scheduler):
self._run_helix_test(
comms_medium,
cuda_graph_config,
gen_pp,
gen_tp,
gen_cp,
enable_attention_dp,
disable_overlap_scheduler=disable_overlap_scheduler)

@pytest.mark.skip_less_device(2)
def test_gen_first(self):
"""Gen-first dense-model smoke test on KVCacheManagerV2 + NIXL python."""
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/test_lists/qa/llm_function_core.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype[mtp_
accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype[mtp_nextn=0-overlap_scheduler=True]
accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype[mtp_nextn=2-overlap_scheduler=False]
accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype[mtp_nextn=2-overlap_scheduler=True]
accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helix[fifo_v2-cudagraph:with_padding-pp1dp2cp2]
accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helix[fifo_v2-cudagraph:with_padding-pp1tp2cp2]
accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helix[fifo_v2-cudagraph:with_padding-pp1dp2cp2-overlap_off]
accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helix[fifo_v2-cudagraph:with_padding-pp1tp2cp2-overlap_off]
accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_gen_first[adp-mtp2]
accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_gen_first[noadp-mtp0]
accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_gen_only_sync
Expand Down Expand Up @@ -61,8 +61,8 @@ accuracy/test_disaggregated_serving.py::TestQwen3_30B_A3B::test_mixed_ctx_gen_mo
accuracy/test_disaggregated_serving.py::TestQwen3_8B::test_auto_dtype[False-False]
accuracy/test_disaggregated_serving.py::TestQwen3_8B::test_auto_dtype[False-True]
accuracy/test_disaggregated_serving.py::TestQwen3_8B::test_auto_dtype[True-True]
accuracy/test_disaggregated_serving.py::TestQwen3_8B::test_auto_dtype_with_helix[fifo_v2-cudagraph:with_padding-pp1dp2cp2]
accuracy/test_disaggregated_serving.py::TestQwen3_8B::test_auto_dtype_with_helix[fifo_v2-cudagraph:with_padding-pp1tp2cp2]
accuracy/test_disaggregated_serving.py::TestQwen3_8B::test_auto_dtype_with_helix[fifo_v2-cudagraph:with_padding-pp1dp2cp2-overlap_off]
accuracy/test_disaggregated_serving.py::TestQwen3_8B::test_auto_dtype_with_helix[fifo_v2-cudagraph:with_padding-pp1tp2cp2-overlap_off]
accuracy/test_disaggregated_serving.py::TestQwen3_8B::test_chunked_prefill
accuracy/test_disaggregated_serving.py::TestQwen3_8B::test_gen_first
accuracy/test_disaggregated_serving.py::TestQwen3_8B::test_gen_first_kv_cache_v1
Expand Down
6 changes: 4 additions & 2 deletions tests/integration/test_lists/test-db/l0_dgx_b200.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ l0_dgx_b200:
backend: pytorch
orchestrator: mpi
tests:
- accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helix[fifo_v2-cudagraph:with_padding-pp1dp2cp2] TIMEOUT (60)
- accuracy/test_disaggregated_serving.py::TestQwen3_8B::test_auto_dtype_with_helix[fifo_v2-cudagraph:with_padding-pp1tp2cp2] TIMEOUT (60)
- accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helix[fifo_v2-cudagraph:with_padding-pp1dp2cp2-overlap_on] TIMEOUT (60)
- accuracy/test_disaggregated_serving.py::TestQwen3_8B::test_auto_dtype_with_helix[fifo_v2-cudagraph:with_padding-pp1tp2cp2-overlap_on] TIMEOUT (60)
- accuracy/test_llm_api_pytorch.py::TestDeepSeekR1::test_nvfp4_multi_gpus[throughput] TIMEOUT (60)
- accuracy/test_llm_api_pytorch.py::TestDeepSeekR1::test_nvfp4_multi_gpus[throughput_mtp] TIMEOUT (60)
- accuracy/test_llm_api_pytorch.py::TestDeepSeekR1::test_nvfp4_multi_gpus[throughput_bs8_mtp] TIMEOUT (60)
Expand Down Expand Up @@ -241,6 +241,8 @@ l0_dgx_b200:
orchestrator: mpi
tests:
- disaggregated/test_disaggregated.py::test_disaggregated_deepseek_v3_lite_bf16_tllm_gen_helix[DeepSeek-V3-Lite-bf16-short_prompt] TIMEOUT (60)
- accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helix[fifo_v2-cudagraph:with_padding-pp1dp2cp2-overlap_off] TIMEOUT (60)
Comment thread
lancelly marked this conversation as resolved.
- accuracy/test_disaggregated_serving.py::TestQwen3_8B::test_auto_dtype_with_helix[fifo_v2-cudagraph:with_padding-pp1tp2cp2-overlap_off] TIMEOUT (60)
- accuracy/test_llm_api_pytorch.py::TestDeepSeekR1::test_nvfp4_multi_gpus_corner_case TIMEOUT (60)
- accuracy/test_llm_api_pytorch.py::TestDeepSeekV32::test_fp8_blockscale[baseline_fp8kv] TIMEOUT (60)
- accuracy/test_llm_api_pytorch.py::TestDeepSeekV32::test_fp8_blockscale[latency] TIMEOUT (60)
Expand Down
5 changes: 3 additions & 2 deletions tests/integration/test_lists/waives.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helix[fifo_v2-cudagraph:with_padding-pp1dp2cp2] SKIP (https://nvbugs/6567057)
accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helix[fifo_v2-cudagraph:with_padding-pp1dp2cp2-overlap_off] SKIP (https://nvbugs/6567057)
accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helix[fifo_v2-cudagraph:with_padding-pp1dp2cp2-overlap_on] SKIP (https://nvbugs/6567057)
Comment thread
lancelly marked this conversation as resolved.
accuracy/test_disaggregated_serving.py::TestGLM52NVFP4::test_nvfp4_nixl[cache_mgr_v1] SKIP (https://nvbugs/6619883)
accuracy/test_disaggregated_serving.py::TestLlama3_1_8BInstruct::test_ctx_pp_gen_tp_asymmetric[GSM8K-gen_tp=1-ctx_pp=4] SKIP (https://nvbugs/6428069)
accuracy/test_disaggregated_serving.py::TestLlama3_1_8BInstruct::test_ctx_pp_gen_tp_asymmetric[GSM8K-gen_tp=2-ctx_pp=4] SKIP (https://nvbugs/6428069)
Expand Down Expand Up @@ -143,7 +144,7 @@ full:B200/disaggregated/test_disaggregated.py::test_disaggregated_stress_test[in
full:B200/llmapi/test_llm_api_pytorch_moe_lora.py::test_qwen_moe_routed_expert_multi_lora_varying_ranks[cudagraph] SKIP (https://nvbugs/6475623)
full:B200/test_e2e.py::test_multi_nodes_eval[Qwen3/Qwen3-235B-A22B-tp16-mmlu] SKIP (https://nvbugs/6424188)
full:B200/test_e2e.py::test_multi_nodes_eval[Qwen3/saved_models_Qwen3-235B-A22B_nvfp4_hf-tp16-mmlu] SKIP (https://nvbugs/6424188)
full:B300/accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helix[fifo_v2-cudagraph:with_padding-pp1tp2cp2] SKIP (https://nvbugs/6410881)
full:B300/accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helix[fifo_v2-cudagraph:with_padding-pp1tp2cp2-overlap_off] SKIP (https://nvbugs/6410881)
full:B300/accuracy/test_llm_api_autodeploy.py::TestNemotronNanoV3::test_accuracy[bf16-4-attn_dp_off-trtllm] SKIP (https://nvbugs/6539942)
full:B300/accuracy/test_llm_api_pytorch.py::TestDeepSeekV32::test_nvfp4_multi_gpus[latency] SKIP (https://nvbugs/6423866)
full:B300/accuracy/test_llm_api_pytorch.py::TestDeepSeekV32::test_nvfp4_multi_gpus_chunked_prefill[latency] SKIP (https://nvbugs/6483369)
Expand Down
Loading