Skip to content

Use fast_step in DPMux for non-current-rank items + add tests#47

Merged
Randomizez merged 2 commits into
stepfun-ai:devfrom
yuruofeifei:test/add-dpmux-nextable-tests
Apr 19, 2026
Merged

Use fast_step in DPMux for non-current-rank items + add tests#47
Randomizez merged 2 commits into
stepfun-ai:devfrom
yuruofeifei:test/add-dpmux-nextable-tests

Conversation

@yuruofeifei

@yuruofeifei yuruofeifei commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • DPMux.__next__ was calling next() for all ranks, loading data that gets discarded for non-current-rank items. Changed to use fast_step() for other ranks — skips N-1 data loads per step.
  • Add 11 unit tests for DPMux and nextable interfaces (previously uncovered).

Discussion

Is fast_step() sufficient to fully advance state? next() may carry side effects beyond what fast_step() / update() captures — if any SlowFastNextable implementation mutates state inside the slow path that fast_step() doesn't replicate, skipping next() for non-current-rank items could cause state divergence. However, if we must call next() to keep state correct, then we're forced to do the expensive work for every rank — which defeats the entire purpose of the SlowFastNextable separation.

Test plan

  • pytest tests/test_nextable.py — 11/11 passed

🤖 Generated with Claude Code

yuruofeifei and others added 2 commits April 18, 2026 15:53
Cover basic rank selection, state save/restore, fast_step parity
with __next__, len delegation, input validation, and iter protocol.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Avoid unnecessary data loading for items belonging to other ranks
by calling fast_step() (state advance only) instead of next()
(state advance + I/O). With dp_size=N, this skips N-1 data loads
per step.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@yuruofeifei yuruofeifei requested a review from a team April 18, 2026 23:51
@Randomizez Randomizez merged commit 2aae961 into stepfun-ai:dev Apr 19, 2026
7 checks passed
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