Skip to content

[None][fix] Avoid TP collective deadlock in ADP disagg error path - #13900

Merged
Shixiaowei02 merged 2 commits into
NVIDIA:feat/deepseek_v4from
Shixiaowei02:user/xiaoweis/dsv4-adp-fix
May 9, 2026
Merged

[None][fix] Avoid TP collective deadlock in ADP disagg error path#13900
Shixiaowei02 merged 2 commits into
NVIDIA:feat/deepseek_v4from
Shixiaowei02:user/xiaoweis/dsv4-adp-fix

Conversation

@Shixiaowei02

@Shixiaowei02 Shixiaowei02 commented May 8, 2026

Copy link
Copy Markdown
Collaborator

@coderabbitai summary

Description

Stabilizes disaggregated serving when ADP is enabled.

  • ADP dummy request type tracking: Dummy requests now mirror the most recent real request's CTX/GEN type instead of being hardcoded to GEN, and CTX dummies are padded to max_num_tokens so the MoE all-to-all sees aligned token counts across ranks.
  • TP collective deadlock fix: Moves disagg KV cache transfer error handling to the top of the executor loop behind a TP allgather, ensuring all ranks enter the error path together so the downstream tp_gather in response enqueue no longer deadlocks. Includes matching transceiver/NIXL plumbing and a disagg+ADP accuracy test.

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)

  • 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.

@Shixiaowei02

Copy link
Copy Markdown
Collaborator Author

/bot run --add-multi-gpu-test --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #47381 [ run ] triggered by Bot. Commit: 60c9d81 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #47381 [ run ] completed with state SUCCESS. Commit: 60c9d81
/LLM/main/L0_MergeRequest_PR pipeline #37312 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

Link to invocation

@Shixiaowei02
Shixiaowei02 force-pushed the user/xiaoweis/dsv4-adp-fix branch from b06d7af to 57977cd Compare May 9, 2026 01:30
@Shixiaowei02

Copy link
Copy Markdown
Collaborator Author

/bot run --add-multi-gpu-test --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #47460 [ run ] triggered by Bot. Commit: 57977cd Link to invocation

@Shixiaowei02
Shixiaowei02 marked this pull request as ready for review May 9, 2026 04:53
@Shixiaowei02
Shixiaowei02 requested review from a team as code owners May 9, 2026 04:53
@Shixiaowei02
Shixiaowei02 requested review from StanleySun639, bo-nv, byshiue, chuangz0, dongxuy04, lfr-0531, pcastonguay and reasonsolo and removed request for a team May 9, 2026 04:53
@Shixiaowei02 Shixiaowei02 changed the title [None][fix] Fix dis-agg with ADP and avoid TP collective deadlock [None][fix] Avoid TP collective deadlock in ADP disagg error path May 9, 2026
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #47460 [ run ] completed with state SUCCESS. Commit: 57977cd
/LLM/main/L0_MergeRequest_PR pipeline #37381 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

Link to invocation

Squashed from:
  - fix: dis-agg with ADP (77bce45)
  - update (0f50a39)
  - remove the single request type restriction (d4146f0)
  - fix: avoid TP collective deadlock (287c6f6)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
@Shixiaowei02
Shixiaowei02 force-pushed the user/xiaoweis/dsv4-adp-fix branch from 57977cd to 803c68b Compare May 9, 2026 06:15
@Shixiaowei02

Copy link
Copy Markdown
Collaborator Author

/bot run --add-multi-gpu-test --disable-fail-fast

lfr-0531 pushed a commit that referenced this pull request May 14, 2026
…3900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
lfr-0531 pushed a commit to lfr-0531/TensorRT-LLM that referenced this pull request Jun 10, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 10, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 10, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 10, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 11, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 11, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 11, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 11, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
lfr-0531 pushed a commit to lfr-0531/TensorRT-LLM that referenced this pull request Jun 11, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 12, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
lfr-0531 pushed a commit to lfr-0531/TensorRT-LLM that referenced this pull request Jun 12, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 12, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 14, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 16, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 17, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 21, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 22, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 23, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 23, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 23, 2026
…regation

Squash of the post-cherry-pick work layered on top of the 8 DeepSeek-V4
disaggregation cherry-picks.

Fixes:
- ADP disagg error path: restore per-request hang signal (_event_loop_error),
  scan all candidates + prefer CTX role for mixed-batch dummy padding, and
  keep charge_budget=False on KV-transfer timeouts so they don't exhaust the
  global error budget and shut down the executor.
- _count_schedulable_active_requests: revert the GENERATION_TO_COMPLETE
  exclusion that NVIDIA#13900 added (upstream has no such exclusion). Under V1 ADP
  it undercounted -> a spurious ADP dummy was inserted on top of a real
  request -> the batch exceeded max_batch_size=1 and tripped the mamba
  dummy-mask assert / "No free slots". Restores upstream's exact method
  (fixes test_ptp_quickstart_advanced_deepseek_v3_lite_4gpus_adp_balance).
- transceiver: only short-circuit the tp_allgather skip when pp_size==1
  (_ctx_need_pp_sync) -- the PP>1 path asymmetrically flips send/recv markers
  across pipeline stages and deadlocks the _ctx_consensus pp_allgather.
- py_executor: restore main's immediate benchmark fail-fast guard.
- resource_manager: do NOT narrow trim_to_history's except (resize() can raise
  non-ValueError under v2 SWA + uneven-PP; narrowing leaked KV blocks).

Tests (added to existing files):
- test_py_executor.py: disagg cache-error sync + ADP no-op paths; ADP dummy-role
  behavior; GENERATION_TO_COMPLETE counts as active (adp_balance regression).
- test_kv_cache_v2_scheduler.py: trim_to_history.
- test_cache_reuse_adapter.py: trim-to-prompt-history + transceiver ctx mgr.
- test_router.py: finish_request explicit-session forwarding.
- test_agent.py: BindingsNixlTransferStatus + shutdown idempotency (NVIDIA#14137).
- transferAgentTest.cpp: status-outlives-agent (weak_ptr UAF safety) +
  concurrent submitTransferRequests.

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 23, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 23, 2026
…regation

Squash of the post-cherry-pick work layered on top of the 8 DeepSeek-V4
disaggregation cherry-picks.

Fixes:
- ADP disagg error path: restore per-request hang signal (_event_loop_error),
  scan all candidates + prefer CTX role for mixed-batch dummy padding, and
  keep charge_budget=False on KV-transfer timeouts so they don't exhaust the
  global error budget and shut down the executor.
- _count_schedulable_active_requests: revert the GENERATION_TO_COMPLETE
  exclusion that NVIDIA#13900 added (upstream has no such exclusion). Under V1 ADP
  it undercounted -> a spurious ADP dummy was inserted on top of a real
  request -> the batch exceeded max_batch_size=1 and tripped the mamba
  dummy-mask assert / "No free slots". Restores upstream's exact method
  (fixes test_ptp_quickstart_advanced_deepseek_v3_lite_4gpus_adp_balance).
- transceiver: only short-circuit the tp_allgather skip when pp_size==1
  (_ctx_need_pp_sync) -- the PP>1 path asymmetrically flips send/recv markers
  across pipeline stages and deadlocks the _ctx_consensus pp_allgather.
- py_executor: restore main's immediate benchmark fail-fast guard.
- resource_manager: do NOT narrow trim_to_history's except (resize() can raise
  non-ValueError under v2 SWA + uneven-PP; narrowing leaked KV blocks).

Tests (added to existing files):
- test_py_executor.py: disagg cache-error sync + ADP no-op paths; ADP dummy-role
  behavior; GENERATION_TO_COMPLETE counts as active (adp_balance regression).
- test_kv_cache_v2_scheduler.py: trim_to_history.
- test_cache_reuse_adapter.py: trim-to-prompt-history + transceiver ctx mgr.
- test_router.py: finish_request explicit-session forwarding.
- test_agent.py: BindingsNixlTransferStatus + shutdown idempotency (NVIDIA#14137).
- transferAgentTest.cpp: status-outlives-agent (weak_ptr UAF safety) +
  concurrent submitTransferRequests.

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 24, 2026
…regation

Squash of the post-cherry-pick work layered on top of the 8 DeepSeek-V4
disaggregation cherry-picks.

Fixes:
- ADP disagg error path: restore per-request hang signal (_event_loop_error),
  scan all candidates + prefer CTX role for mixed-batch dummy padding, and
  keep charge_budget=False on KV-transfer timeouts so they don't exhaust the
  global error budget and shut down the executor.
- _count_schedulable_active_requests: revert the GENERATION_TO_COMPLETE
  exclusion that NVIDIA#13900 added (upstream has no such exclusion). Under V1 ADP
  it undercounted -> a spurious ADP dummy was inserted on top of a real
  request -> the batch exceeded max_batch_size=1 and tripped the mamba
  dummy-mask assert / "No free slots". Restores upstream's exact method
  (fixes test_ptp_quickstart_advanced_deepseek_v3_lite_4gpus_adp_balance).
- _handle_responses KV-timeout: gate the tp_allgather on disagg
  (kv_cache_transceiver is not None), not just enable_attention_dp.
  py_kv_transfer_timed_out is disagg-only, so in non-disagg ADP this added a
  spurious per-iteration collective that desynced adp_router's tp_allgather
  (gather_all_rank_states received a bool -> TypeError). Verified by 4-GPU
  DeepSeek-V3-Lite adp_balance e2e A/B (buggy: timeout hang; fixed: completes).
- transceiver: only short-circuit the tp_allgather skip when pp_size==1
  (_ctx_need_pp_sync) -- the PP>1 path asymmetrically flips send/recv markers
  across pipeline stages and deadlocks the _ctx_consensus pp_allgather.
- py_executor: restore main's immediate benchmark fail-fast guard.
- resource_manager: do NOT narrow trim_to_history's except (resize() can raise
  non-ValueError under v2 SWA + uneven-PP; narrowing leaked KV blocks).

Tests (added to existing files):
- test_py_executor.py: disagg cache-error sync + ADP no-op paths; ADP dummy-role
  behavior; GENERATION_TO_COMPLETE counts as active (adp_balance regression);
  CTX dummy padding for disagg idle ranks (incl. awaiting-KV-transfer-only).
- test_kv_cache_v2_scheduler.py: trim_to_history.
- test_cache_reuse_adapter.py: trim-to-prompt-history + transceiver ctx mgr;
  _create_kv_slice TokenRange (stub sets py_beam_width for the NVIDIA#14876 path).
- test_router.py: finish_request explicit-session forwarding.
- test_agent.py: BindingsNixlTransferStatus + shutdown idempotency (NVIDIA#14137).
- transferAgentTest.cpp: status-outlives-agent (weak_ptr UAF safety) +
  concurrent submitTransferRequests.

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 24, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 24, 2026
…regation

Squash of the post-cherry-pick work layered on top of the 8 DeepSeek-V4
disaggregation cherry-picks.

Fixes:
- ADP disagg error path: restore per-request hang signal (_event_loop_error),
  scan all candidates + prefer CTX role for mixed-batch dummy padding, and
  keep charge_budget=False on KV-transfer timeouts so they don't exhaust the
  global error budget and shut down the executor.
- _count_schedulable_active_requests: revert the GENERATION_TO_COMPLETE
  exclusion that NVIDIA#13900 added (upstream has no such exclusion). Under V1 ADP
  it undercounted -> a spurious ADP dummy was inserted on top of a real
  request -> the batch exceeded max_batch_size=1 and tripped the mamba
  dummy-mask assert / "No free slots". Restores upstream's exact method
  (fixes test_ptp_quickstart_advanced_deepseek_v3_lite_4gpus_adp_balance).
- _handle_responses KV-timeout: gate the tp_allgather on disagg
  (kv_cache_transceiver is not None), not just enable_attention_dp.
  py_kv_transfer_timed_out is disagg-only, so in non-disagg ADP this added a
  spurious per-iteration collective that desynced adp_router's tp_allgather
  (gather_all_rank_states received a bool -> TypeError). Verified by 4-GPU
  DeepSeek-V3-Lite adp_balance e2e A/B (buggy: timeout hang; fixed: completes).
- transceiver: only short-circuit the tp_allgather skip when pp_size==1
  (_ctx_need_pp_sync) -- the PP>1 path asymmetrically flips send/recv markers
  across pipeline stages and deadlocks the _ctx_consensus pp_allgather.
- py_executor: restore main's immediate benchmark fail-fast guard.
- resource_manager: do NOT narrow trim_to_history's except (resize() can raise
  non-ValueError under v2 SWA + uneven-PP; narrowing leaked KV blocks).

Tests (added to existing files):
- test_py_executor.py: disagg cache-error sync + ADP no-op paths; ADP dummy-role
  behavior; GENERATION_TO_COMPLETE counts as active (adp_balance regression);
  CTX dummy padding for disagg idle ranks (incl. awaiting-KV-transfer-only).
- test_kv_cache_v2_scheduler.py: trim_to_history.
- test_cache_reuse_adapter.py: trim-to-prompt-history + transceiver ctx mgr;
  _create_kv_slice TokenRange (stub sets py_beam_width for the NVIDIA#14876 path).
- test_router.py: finish_request explicit-session forwarding.
- test_agent.py: BindingsNixlTransferStatus + shutdown idempotency (NVIDIA#14137).
- transferAgentTest.cpp: status-outlives-agent (weak_ptr UAF safety) +
  concurrent submitTransferRequests.

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 24, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 24, 2026
…regation

Squash of the post-cherry-pick work layered on top of the 8 DeepSeek-V4
disaggregation cherry-picks.

Fixes:
- ADP disagg error path: restore per-request hang signal (_event_loop_error),
  scan all candidates + prefer CTX role for mixed-batch dummy padding, and
  keep charge_budget=False on KV-transfer timeouts so they don't exhaust the
  global error budget and shut down the executor.
- _count_schedulable_active_requests: revert the GENERATION_TO_COMPLETE
  exclusion that NVIDIA#13900 added (upstream has no such exclusion). Under V1 ADP
  it undercounted -> a spurious ADP dummy was inserted on top of a real
  request -> the batch exceeded max_batch_size=1 and tripped the mamba
  dummy-mask assert / "No free slots". Restores upstream's exact method
  (fixes test_ptp_quickstart_advanced_deepseek_v3_lite_4gpus_adp_balance).
- _handle_responses KV-timeout: gate the tp_allgather on disagg
  (kv_cache_transceiver is not None), not just enable_attention_dp.
  py_kv_transfer_timed_out is disagg-only, so in non-disagg ADP this added a
  spurious per-iteration collective that desynced adp_router's tp_allgather
  (gather_all_rank_states received a bool -> TypeError). Verified by 4-GPU
  DeepSeek-V3-Lite adp_balance e2e A/B (buggy: timeout hang; fixed: completes).
- transceiver: only short-circuit the tp_allgather skip when pp_size==1
  (_ctx_need_pp_sync) -- the PP>1 path asymmetrically flips send/recv markers
  across pipeline stages and deadlocks the _ctx_consensus pp_allgather.
- py_executor: restore main's immediate benchmark fail-fast guard.
- resource_manager: do NOT narrow trim_to_history's except (resize() can raise
  non-ValueError under v2 SWA + uneven-PP; narrowing leaked KV blocks).

Tests (added to existing files):
- test_py_executor.py: disagg cache-error sync + ADP no-op paths; ADP dummy-role
  behavior; GENERATION_TO_COMPLETE counts as active (adp_balance regression);
  CTX dummy padding for disagg idle ranks (incl. awaiting-KV-transfer-only).
- test_kv_cache_v2_scheduler.py: trim_to_history.
- test_cache_reuse_adapter.py: trim-to-prompt-history + transceiver ctx mgr;
  _create_kv_slice TokenRange (stub sets py_beam_width for the NVIDIA#14876 path).
- test_router.py: finish_request explicit-session forwarding.
- test_agent.py: BindingsNixlTransferStatus + shutdown idempotency (NVIDIA#14137).
- transferAgentTest.cpp: status-outlives-agent (weak_ptr UAF safety) +
  concurrent submitTransferRequests.

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 24, 2026
…IDIA#13900)

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Xiaowei Shi <39303645+Shixiaowei02@users.noreply.github.com>
Signed-off-by: Fanrong Li <lfr-0531@users.noreply.github.com>
Shixiaowei02 added a commit to Shixiaowei02/TensorRT-LLM that referenced this pull request Jun 24, 2026
…regation

Squash of the post-cherry-pick work layered on top of the 8 DeepSeek-V4
disaggregation cherry-picks.

Fixes:
- ADP disagg error path: restore per-request hang signal (_event_loop_error),
  scan all candidates + prefer CTX role for mixed-batch dummy padding, and
  keep charge_budget=False on KV-transfer timeouts so they don't exhaust the
  global error budget and shut down the executor.
- _count_schedulable_active_requests: revert the GENERATION_TO_COMPLETE
  exclusion that NVIDIA#13900 added (upstream has no such exclusion). Under V1 ADP
  it undercounted -> a spurious ADP dummy was inserted on top of a real
  request -> the batch exceeded max_batch_size=1 and tripped the mamba
  dummy-mask assert / "No free slots". Restores upstream's exact method
  (fixes test_ptp_quickstart_advanced_deepseek_v3_lite_4gpus_adp_balance).
- _handle_responses KV-timeout: gate the tp_allgather on disagg
  (kv_cache_transceiver is not None), not just enable_attention_dp.
  py_kv_transfer_timed_out is disagg-only, so in non-disagg ADP this added a
  spurious per-iteration collective that desynced adp_router's tp_allgather
  (gather_all_rank_states received a bool -> TypeError). Verified by 4-GPU
  DeepSeek-V3-Lite adp_balance e2e A/B (buggy: timeout hang; fixed: completes).
- transceiver: only short-circuit the tp_allgather skip when pp_size==1
  (_ctx_need_pp_sync) -- the PP>1 path asymmetrically flips send/recv markers
  across pipeline stages and deadlocks the _ctx_consensus pp_allgather.
- py_executor: restore main's immediate benchmark fail-fast guard.
- resource_manager: do NOT narrow trim_to_history's except (resize() can raise
  non-ValueError under v2 SWA + uneven-PP; narrowing leaked KV blocks).

Tests (added to existing files):
- test_py_executor.py: disagg cache-error sync + ADP no-op paths; ADP dummy-role
  behavior; GENERATION_TO_COMPLETE counts as active (adp_balance regression);
  CTX dummy padding for disagg idle ranks (incl. awaiting-KV-transfer-only).
- test_kv_cache_v2_scheduler.py: trim_to_history.
- test_cache_reuse_adapter.py: trim-to-prompt-history + transceiver ctx mgr;
  _create_kv_slice TokenRange (stub sets py_beam_width for the NVIDIA#14876 path).
- test_router.py: finish_request explicit-session forwarding.
- test_agent.py: BindingsNixlTransferStatus + shutdown idempotency (NVIDIA#14137).
- transferAgentTest.cpp: status-outlives-agent (weak_ptr UAF safety) +
  concurrent submitTransferRequests.

Signed-off-by: Shixiaowei02 <39303645+Shixiaowei02@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants