Skip to content

[PD] Prioritize ready handoffs before prefill submission - #122

Merged
bjf-frz merged 1 commit into
mainfrom
fix/pd-ready-handoff
Oct 14, 2026
Merged

bjf-frz merged 1 commit into
mainfrom
fix/pd-ready-handoff

Conversation

@bjf-frz

@bjf-frz bjf-frz commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

Ready PD transfer chunks can wait behind unrelated prefill submissions. The owner thread sends at most one chunk per request per tick, then submits more GPU work; CUDA launch backpressure can block that thread before it returns to NIXL progress. One observed request waited 2.21 s between prefill completion and the final handoff commit.

This change defers new prefill submission while a queued transfer chunk is ready. The existing event loop continues polling transfers and control messages, preserving transfer limits and allowing cancellation under backpressure. Unready chunks do not prevent other prefill work. Runtime change: 5 added lines, plus two regression tests.

Follow-up to #77, based on merged main 43881d8.

Validation

  • New ordering regression fails on the original implementation; both new tests pass with the patch.
  • Two-GPU PD tests with tiny checkpoints: 14 passed.
  • Official Nanbeige4.2-3B checkpoint mode: 6 passed (five use official weights; the controlled EOS test uses tiny weights).
  • Four-GPU multi-worker/peer-failure test: 1 passed.
  • CPU suite: 620 passed, 7 skipped, 1 failed. The failure, test_run_refuses_the_stored_baseline_at_another_depth, also reproduces on the unmodified baseline: installed Transformers 5.14.1 lacks AutoModelForVision2Seq.
  • Ruff lint/format and git diff --check passed.

Performance scope and tradeoff

Unprofiled diagnostic on 2×B300, official Nanbeige4.2-3B, BF16/Triton, fixed two loops, async scheduling, no graphs/prefix cache. Per run: 12 requests arriving every 0.5 s, alternating 128/4096 input tokens, 64 greedy output tokens with EOS ignored; three warmed repetitions. Values are medians of per-run statistics. This is a short diagnostic workload, not a steady-state capacity benchmark.

Metric Original This patch
p95 prefill-complete → commit 1,994.5 ms 1.39 ms
p95 prefill-complete → D activation 2,294.9 ms 488.8 ms
p95 TTFT 13.35 s 12.75 s
Output throughput 37.75 tok/s 37.78 tok/s
Median E2E 7.59 s 8.37 s

All 36/36 outputs match the original. Commit marks transfer submission, not transfer completion.

Draft for review: the patch removes avoidable handoff submission delay, but does not establish a throughput gain and regresses median E2E in this diagnostic. Scheduling/overlap tradeoffs need further evaluation before merging; the original 60-second Poisson workload matrix has not been rerun with this patch. Separate ops-only/full traces attribute the owner-thread blocking to CUDA Command Buffer Full waits; those profiled timings are excluded from the table.

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.

1 participant