Skip to content

[Perf] dspark: Make the prefill SWA valid-from update sync-free - #45234

Merged
hnyls2002 merged 2 commits into
mainfrom
lsyin/dspark-prefill-sync-free
Oct 19, 2026
Merged

hnyls2002 merged 2 commits into
mainfrom
lsyin/dspark-prefill-sync-free

Conversation

@hnyls2002

@hnyls2002 hnyls2002 commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator
  • After a target prefill with encoder SWA replay, DSparkWorkerV2._forward_prefill marks each newly placed request's draft SWA ring valid from its cached prefix. It built the slots by indexing a CUDA tensor with a Python list and the prefix lengths with torch.tensor(..., device=...). Both are pageable host-to-device copies that block the host. They run after the target forward is enqueued, so each prefill step stalled the scheduler until the whole target forward finished.
  • Both copies now go through async_h2d (pinned, non-blocking), and the slots come from an index_select on the device. No behavior change: same slots, same values.
  • Verification: DeepSeek-V4.1-Flash on GB300, DP2 attention + MegaMoE (EP2), DSpark, encoder and decoder replay on, a multi-turn agentic prefill trace at concurrency 512, 900 s per run, same-node pairs.
    • Before: py-spy put 50% of the scheduler main thread's samples on the list index line.
    • After: that line is gone from the profile. The step interval went from ~375 to ~312 ms, and throughput rose from 1,459,199 to 1,581,184 tok/s/GPU (+8.4%) on one node and from 1,453,741 to 1,598,164 (+9.9%) on another, with no errors.

CI States

Latest PR Test (Base): 🚫 Run #39327514044
Latest PR Test (Extra): ❌ Run #39327515096
Latest PR Test (AMD ROCm 10): 🚫 Run #39327514105

@hnyls2002

Copy link
Copy Markdown
Collaborator Author

/rerun-test test_deepseek_v41_flash_gb300_encoder_bcg.py test_dsv4_compressed_pools.py test_encoder_swa_replay.py

@hnyls2002

Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🚀 4-gpu-gb300 (1 test): ❌ View workflow run

cd test/ && python3 registered/e2e/models/test_deepseek_v41_flash_gb300_encoder_bcg.py

🚀 ubuntu-latest (2 tests): ✅ View workflow run

cd test/ && python3 registered/unit/mem_cache/test_dsv4_compressed_pools.py
cd test/ && python3 registered/unit/model_executor/test_encoder_swa_replay.py

@github-actions github-actions Bot added the run-ci CI: run the baseline test suite on this PR label Oct 19, 2026
@hnyls2002
hnyls2002 merged commit fdc2dd0 into main Oct 19, 2026
172 of 233 checks passed
@hnyls2002
hnyls2002 deleted the lsyin/dspark-prefill-sync-free branch October 19, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant