Repository navigation
Make generator actor aware of DP rank layout - #3743
Merged
Merged
Conversation
pzhan9
marked this pull request as draft
June 23, 2026 00:51
tianyu-l
reviewed
Jun 23, 2026
pzhan9
force-pushed
the
generator-dp
branch
3 times, most recently
from
June 23, 2026 19:35
38b235d to
2539076
Compare
pzhan9
marked this pull request as ready for review
June 23, 2026 20:23
Contributor
Author
This was referenced Jun 23, 2026
pzhan9
added a commit
that referenced
this pull request
Jun 23, 2026
We do not need V2 model runner for now. On the other hand, v2 runner has a bug which blocks it from being used with `DP>1` generator setup (see the PR description in #3743). As a result, switch back to V1.
tianyu-l
approved these changes
Jun 24, 2026
saforem2
added a commit
to saforem2/torchtitan
that referenced
this pull request
Jun 24, 2026
Merged upstream/main into ezpz (merge 2c0daba, no conflicts). The single commit (pytorch#3743, generator DP rank layout) touches only experiments/rl/; ezpz/rl doesn't fork upstream rl/actors/generator.py so no replay needed. ezpz imports verified clean post-merge.
pzhan9
added a commit
that referenced
this pull request
Jun 25, 2026
…ighest DP rank (#3765) In #3743, generator was changed so its rank 0 starts to route requests among its DP ranks. In that PR, the routing was hardcoded to DP0. In this PR, we change the hardcoded routing to the highest DP rank. The main difference between the highest DP rank and DP0 is, * rank 0 is on DP0. So when requests are processed by DP0, the results are accessed by rank 0 locally. * But if requests are processed by other DPs, rank 0 no long has local access. Instead, the peer DPs need to send their results back to rank 0, aka. "fan-in", so rank 0 can further process them, and return the final responses back to controller. In summary, this PR does 2 changes: 1. add the fan-in mechanism; 2. change the hardcoding to the highest DP rank, so we can verify the fan-in works.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently when generator's
data_parallel_degree > 1, generator will simply send the same requests to all DP ranks to process, but only use the results from DP rank 0, and discard the results from other DP ranks. This PR changes that.Specifically, it:
LoopDecision, it will assign requests by DP ranks in itsrequests_per_dp_rankfield. And actors will only process requests belong to its own DP rank.When testing this PR, I encountered a vllm bug in its v2 model runner. Specifically,
So we have this disvergence:
To workaround, I switched the MOE model config to v1 runner. This PR also adds a field
use_v2_model_runnertoVLLMGenerator.Configto make the switch possible.What does the bug break
Let us assume we have DP=2, TP=2, EP=4. The change of this PR will route all requests to DP0, which leads to a busy DP0, and idle DP1.
vllm has logic in place to accommodate the idle DP problem. In
def has_unfinished_requests, when DP > 1, it does a all-reduce to check if any rank still has unfinished requests, if yes, the idle rank will execute a dummy batch. Executing the dummy batch means the idle DP rank will enters the collective instep().Normally, the busy rank, i.e. DP0 should also enters the collective in
step(). That is the whole point of the dummy batch. However, when DP0'stotal_num_scheduled_tokens == 0, in v2 runner, DP0 will return early, without entering the collective. That makes DP1'sstep()not having a pair from DP0. Furthermore, DP0 will move to its next iteration, which it will issue a different collective. DP0 and DP1's collective will collide, and we will see error like:Test plan
Note: the trunk is broken for the MOE configs. I had to patch locally with this change to workaround.
Run the
rl_grpo_qwen3_30b_a3b_varlenconfig locally to verify it still works.