-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[https://nvbugs/6428087][fix] Extend the PP send payload with the flag (backward-compatible 2/3-tuple… #16145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3147,10 +3147,15 @@ def _ring_broadcast_sample_state( | |
| if not self.dist.is_last_pp_rank: | ||
| # Receive tokens from previous pp rank (w.r.t model forward direction) | ||
| with nvtx_range("recv_sample_state"): | ||
| sample_state.host, py_result_diffs = self.dist.recv_object( | ||
| # SampleStateTorch carries a ``use_host_stop_criteria`` flag | ||
| # decided on the last PP rank; propagate it so ``update_requests`` | ||
| # picks the same branch on all ranks. Other samplers ship None. | ||
| sample_state.host, py_result_diffs, use_host_stop_criteria = self.dist.recv_object( | ||
| src=self.dist.prev_pp_rank, | ||
| tag=tag, | ||
| ) | ||
| if use_host_stop_criteria is not None: | ||
| sample_state.use_host_stop_criteria = use_host_stop_criteria | ||
|
|
||
| for request, py_result_diff in zip(requests, py_result_diffs): | ||
| request.py_result.apply_diff(py_result_diff) | ||
|
|
@@ -3168,7 +3173,8 @@ def _ring_broadcast_sample_state( | |
| self.wait_on_pp_send_handles(self.send_handles, microbatch_id) | ||
| with nvtx_range("send_sample_state"): | ||
| self.send_handles[microbatch_id] = self.dist.isend_object( | ||
| (sample_state.host, py_result_diffs), | ||
| (sample_state.host, py_result_diffs, | ||
| getattr(sample_state, "use_host_stop_criteria", None)), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The flag you want is |
||
| dest=self.dist.next_pp_rank, | ||
| tag=tag, | ||
| ) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two problems here beyond the missing attribute:
ValueError. (Fine in practice since all ranks run the same build, but the description and the code disagree.)Noneas an in-band "field absent" sentinel and usinggetattr(..., None)on the send side hides exactly the bug this PR has: a typo'd or nonexistent attribute name silently degrades to the old behavior instead of failing. Reference the dataclass field directly (sample_state.single_step_greedy) so an attribute mismatch is anAttributeError, and branch onisinstance(sample_state, SampleStateTorch)if other sampler state types need to skip it.