Add async AR_COL for 2d sync (#4530) - #4530
Open
axeisghost wants to merge 1 commit into
Open
Conversation
Contributor
|
@axeisghost has exported this pull request. If you are a Meta employee, you can view the originating Diff in D114156292. |
axeisghost
force-pushed
the
export-D114156292
branch
from
August 18, 2026 18:09
fd16311 to
fd42894
Compare
axeisghost
added a commit
to axeisghost/torchrec
that referenced
this pull request
Aug 18, 2026
Summary: - Extends `DMPCollection.set_all_reduce_hook` so custom hooks receive the active replication process group, while preserving the existing constructor-provided hook behavior. - Adds the default-off `async_two_dim_sparse_parallelism_sync` pipeline option. The option is accepted only when both `two_dim_sparse_parallelism_sync` and `pipeline_embedding_lookup_fwd` are enabled and the model is a `DMPCollection`. - Registers an async hook from `TrainPipelineCustomizedOrderSparseDist` that runs `all_reduce_coalesced` with `ReduceOp.AVG` and `async_op=True`, retaining every returned future across parameter dtypes, optimizer state, and DMP contexts. - Waits for all pending 2D synchronization futures immediately after model forward and before post-forward hooks or backward, then clears the completed handles. The existing blocking synchronization path remains unchanged when the new option is disabled. - Adds focused coverage for process-group forwarding, legacy-hook override behavior, option validation, async collective arguments, future ownership and cleanup, and `forward -> wait -> post-forward` ordering. Differential Revision: D114156292
axeisghost
added a commit
to axeisghost/torchrec
that referenced
this pull request
Aug 18, 2026
Summary: - Extends `DMPCollection.set_all_reduce_hook` so custom hooks receive the active replication process group, while preserving the existing constructor-provided hook behavior. - Adds the default-off `async_two_dim_sparse_parallelism_sync` pipeline option. The option is accepted only when both `two_dim_sparse_parallelism_sync` and `pipeline_embedding_lookup_fwd` are enabled and the model is a `DMPCollection`. - Registers an async hook from `TrainPipelineCustomizedOrderSparseDist` that runs `all_reduce_coalesced` with `ReduceOp.AVG` and `async_op=True`, retaining every returned future across parameter dtypes, optimizer state, and DMP contexts. - Waits for all pending 2D synchronization futures immediately after model forward and before post-forward hooks or backward, then clears the completed handles. The existing blocking synchronization path remains unchanged when the new option is disabled. - Adds focused coverage for process-group forwarding, legacy-hook override behavior, option validation, async collective arguments, future ownership and cleanup, and `forward -> wait -> post-forward` ordering. Differential Revision: D114156292
axeisghost
force-pushed
the
export-D114156292
branch
from
August 18, 2026 19:03
fd42894 to
a37cbac
Compare
Summary: - Extends `DMPCollection.set_all_reduce_hook` so custom hooks receive the active replication process group, while preserving the existing constructor-provided hook behavior. - Adds the default-off `async_two_dim_sparse_parallelism_sync` pipeline option. The option is accepted only when both `two_dim_sparse_parallelism_sync` and `pipeline_embedding_lookup_fwd` are enabled and the model is a `DMPCollection`. - Registers an async hook from `TrainPipelineCustomizedOrderSparseDist` that runs `all_reduce_coalesced` with `ReduceOp.AVG` and `async_op=True`, retaining every returned future across parameter dtypes, optimizer state, and DMP contexts. - Waits for all pending 2D synchronization futures immediately after model forward and before post-forward hooks or backward, then clears the completed handles. The existing blocking synchronization path remains unchanged when the new option is disabled. - Adds focused coverage for process-group forwarding, legacy-hook override behavior, option validation, async collective arguments, future ownership and cleanup, and `forward -> wait -> post-forward` ordering. Differential Revision: D114156292
axeisghost
force-pushed
the
export-D114156292
branch
from
August 18, 2026 20:08
a37cbac to
761f82d
Compare
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.
Summary:
DMPCollection.set_all_reduce_hookso custom hooks receive the active replication process group, while preserving the existing constructor-provided hook behavior.async_two_dim_sparse_parallelism_syncpipeline option. The option is accepted only when bothtwo_dim_sparse_parallelism_syncandpipeline_embedding_lookup_fwdare enabled and the model is aDMPCollection.TrainPipelineCustomizedOrderSparseDistthat runsall_reduce_coalescedwithReduceOp.AVGandasync_op=True, retaining every returned future across parameter dtypes, optimizer state, and DMP contexts.forward -> wait -> post-forwardordering.Differential Revision: D114156292