Skip to content

fix(pd): a P/D producer reports its first token from the forward that samples it - #3203

Draft
PerryZhang01 wants to merge 1 commit into
mainfrom
perzhang/pd-producer-first-token
Draft

PerryZhang01 wants to merge 1 commit into
mainfrom
perzhang/pd-producer-first-token

Conversation

@PerryZhang01

Copy link
Copy Markdown
Contributor

Ready for review. No blocking issues.

A P/D producer with paged state (DeepSeek-V4, MLA, MHA) kept deferred output, so it held each request until its rank's next forward that samples, and forwards of middle chunks sample nothing. Every P/D producer now reports its first token from the forward that samples it, as recurrent-state producers already did. Port of jgong5#3165 (fork branch task-2655 at 4ced162) for jgong5#2655, without its simulator parts.

Dev record

  • Found: since [feature] support pp>1 for Kimi-K3 #2365 the scheduler and tokenIDProcessor both take the rule from scheduler.defers_output, and recurrent-state producers and PP already take the non-deferred path, so only the producer branch changes.
  • Decided: defers_output is False for every producer and drops its family argument, with the config lookup and imports only that branch used. Consumers and servers without P/D still defer; PP still does not. A producer schedules no drafts, so ScheduledBatch stages the same ids either way.
  • Decided: a producer's sampling forward now waits on the host for its own ids (prepare_sampled_ids reads them with .tolist()), as recurrent-state producers' already do. Its throughput cost belongs to the served measurement.
  • Surprised: the CPU gate skips tests/test_spec_deferred_status_queue.py, since model_runner imports only with aiter and a device arch. Red and green ran with Triton's target declared gfx950.
  • Left undone: the served measurement.

Named result

The 14 s median hold was measured on Compass records in the fork; the served measurement is pending (jgong5#3173).

Gates

  • acc5dee: tests/test_spec_deferred_status_queue.py 33 passed with gfx950 declared; 5 fail on main's source.
  • acc5dee: tests/ without plugins, 13802 passed; its 125 failed and 99 errors are main's, test for test.
  • acc5dee: P/D, PP, scheduler and runner tests with gfx950 declared: 1218 passed, and the same 30 failures as main.
  • ruff, black clean.
Evidence

Revert-red: atom/model_engine/{scheduler,model_runner}.py and atom/kv_transfer/disaggregation/types.py from main (0189b35), this branch's test file, gfx950 declared:

tree result failing
acc5dee 33 passed
main's source 5 failed, 28 passed test_every_producer_gives_up_deferred_output[v4], [mla], [mha]: assert True is False; test_a_producer_reports_t0_from_the_forward_that_samples_it: the deferred branch's send_to_cpu_async waits on sync_event=None; test_the_scheduler_resolves_the_runners_deferral[1]: main looks up the model's family (no attribute 'hf_config')

Declared target: A fake rocminfo on PATH and a Triton driver whose only answer is GPUTarget("hip", "gfx950", 64), as the fork's capture tooling does. It is a scratch wrapper around pytest.main, not part of this change.

Regression set, gfx950 declared: test_scheduler.py, test_scheduler_mtp_max_tokens.py, test_scheduler_spec_preempt.py, test_pp.py, test_pp_draft_input_ids.py, test_pd_{chunked_transfer,mla_landing,mla_staging,pp,producer_config,source_claim}.py, test_kv_connector_scheduler.py, test_kv_change.py, test_pause_generation.py, test_postprocess_width.py, test_output_transfer_runner.py, test_h2d_runner_publication.py, test_model_runner_staging_fence.py, test_mtp_draft_kv_allocation.py, test_dsv4_state_replay.py, test_deepseek_v4_transfer_regions.py, test_attn_family.py, test_spec_deferred_status_queue.py. The 30 failures are identical on main and here: 22 in test_postprocess_width.py and 8 in test_output_transfer_runner.py, Current atom config is not set or no _served on a stub runner. The CPU gate skips both files. Without the declared target the set gives 1163 passed, 39 skipped.

Full suite: in a container with aiter and no GPU, unlike the CPU gate's runner, main's tree gives 13801 passed and the same 224 failing or erroring tests.

Overlap: No open ROCm/ATOM PR changes defers_output: of 363 open PRs, the 94 touching scheduler.py, model_runner.py or disaggregation/types.py were read for it.

Fork measurement, jgong5#2655: in two DeepSeek-V4-Pro DPA-TP8 1P1D runs at c=256, output prefill to release p50 14.7 s and 14.4 s, and no first token reached the client before its release.

🤖 Generated with Claude Code

… samples it

A paged P/D producer (DeepSeek-V4, MLA, MHA) kept deferred output, so a
request's first token reached the host only at the rank's next forward that
samples, and the producer held the request until then. Forwards of middle
chunks sample nothing, so the request waited while the rank prefilled others.

defers_output now answers False for every producer, as it already did for
recurrent-state ones. Consumers and servers without P/D still defer, and PP
still does not. The family argument and its config lookup go with the old
rule.

Port of jgong5#3165 (task-2655 at 4ced162), without its simulator
parts. The 14 s median hold was measured on Compass records in the fork; the
served measurement is pending (jgong5#3173).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every eligible PR before approval:

  • ✅ Pre Checkin: Black, Ruff, catalog schema validation, non-GPU unit tests

Heavy model tests:

  • ✅ Run after the PR is approved and Pre Checkin passes
  • ✅ Run immediately when an approval review is submitted
  • ✅ Can be requested before approval with labels
Label Tests
ci:full Run all heavy PR model tests: native ATOM, vLLM, and SGLang
ci:atom Run native ATOM model accuracy tests
ci:vllm Run ATOM vLLM OOT model accuracy tests
ci:sglang Run ATOM SGLang model accuracy tests

Heavy jobs are skipped when the PR is not approved and no matching ci:* label is present.
Add labels via the sidebar or gh pr edit 3203 --add-label <label>

This branch has not been deployed

No deployments
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.

2 participants