-
Notifications
You must be signed in to change notification settings - Fork 599
RecMetricModule: apply reduction function before gloo all gathers #3593
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
Open
jeffkbkim
wants to merge
2
commits into
meta-pytorch:main
Choose a base branch
from
jeffkbkim:export-D88297404
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Contributor
|
@jeffkbkim has exported this pull request. If you are a Meta employee, you can view the originating Diff in D88297404. |
jeffkbkim
added a commit
to jeffkbkim/torchrec
that referenced
this pull request
Jan 12, 2026
…ta-pytorch#3593) Summary: Pull Request resolved: meta-pytorch#3593 Differential Revision: D88297404
jeffkbkim
added a commit
to jeffkbkim/torchrec
that referenced
this pull request
Jan 13, 2026
…ta-pytorch#3593) Summary: metric_module's get_pre_compute_states() provides an API to perform gloo all gathers instead of the default torchmetric.Metric's sync_dist (nccl). However, the mechanism calls gloo all gathers for each element in a list of tensors. This can be problematic because: - AUC's 3 state tensors hold a list of tensors, not a single tensor. - The size of the tensor list is theoretically unbounded. (In practice, it can grow to orders of 100K) - gloo all gathers are inherently much slower. Instead, this patch aims to: - apply the reduction function prior to the all gather if we're processing a tensor list - enforce that the reduction_fn does not rely on ordering Differential Revision: D88297404
747258a to
4daa523
Compare
jeffkbkim
added a commit
to jeffkbkim/torchrec
that referenced
this pull request
Jan 22, 2026
…ta-pytorch#3593) Summary: metric_module's get_pre_compute_states() provides an API to perform gloo all gathers instead of the default torchmetric.Metric's sync_dist (nccl). However, the mechanism calls gloo all gathers for each element in a list of tensors. This can be problematic because: - AUC's 3 state tensors hold a list of tensors, not a single tensor. - The size of the tensor list is theoretically unbounded. (In practice, it can grow to orders of 100K) - gloo all gathers are inherently much slower. Instead, this patch aims to: - apply the reduction function prior to the all gather if we're processing a tensor list - enforce that the reduction_fn does not rely on ordering Differential Revision: D88297404
4daa523 to
73e575e
Compare
jeffkbkim
added a commit
to jeffkbkim/torchrec
that referenced
this pull request
Jan 22, 2026
…ta-pytorch#3593) Summary: metric_module's get_pre_compute_states() provides an API to perform gloo all gathers instead of the default torchmetric.Metric's sync_dist (nccl). However, the mechanism calls gloo all gathers for each element in a list of tensors. This can be problematic because: - AUC's 3 state tensors hold a list of tensors, not a single tensor. - The size of the tensor list is theoretically unbounded. (In practice, it can grow to orders of 100K) - gloo all gathers are inherently much slower. Instead, this patch aims to: - apply the reduction function prior to the all gather if we're processing a tensor list - enforce that the reduction_fn does not rely on ordering Differential Revision: D88297404
4daa523 to
73e575e
Compare
jeffkbkim
added a commit
to jeffkbkim/torchrec
that referenced
this pull request
Jan 22, 2026
…ta-pytorch#3593) Summary: metric_module's get_pre_compute_states() provides an API to perform gloo all gathers instead of the default torchmetric.Metric's sync_dist (nccl). However, the mechanism calls gloo all gathers for each element in a list of tensors. This can be problematic because: - AUC's 3 state tensors hold a list of tensors, not a single tensor. - The size of the tensor list is theoretically unbounded. (In practice, it can grow to orders of 100K) - gloo all gathers are inherently much slower. Instead, this patch aims to: - apply the reduction function prior to the all gather if we're processing a tensor list - enforce that the reduction_fn does not rely on ordering Differential Revision: D88297404
73e575e to
a2618d7
Compare
Summary: Utilities for CPUOffloadedRecMetricModule and RecMetricModule. Also raise exceptions in the main thread if any of the background threads. Added unit tests. Simplify the core metric types: - MetricsResult = Dict[str, MetricValue]: sync metrics computation - MetricsFuture = concurrent.futures.Future[MetricsResult]: for async computation - MetricsOutput = Union[MetricsResult, MetricsFuture]: Either a MetricsResult, or a MetricsFuture - The PublishableMetrics variants are to loosen the constraints to publish, so that the user can store values other than a Tensor/float. Introduce a metrics_output_util to handle the logic between futures and dicts. Users can schedule callbacks via `get_metrics_async()`. If they want to synchronously perform it, they can use `get_metrics_sync()` Introduce `device` argument to RecMetricModule constructor. It is a noop for the standard metric module, but CPUOffloadedRecMetricModule requires it to determine whether to perform GPU to CPU transfers. Differential Revision: D87110900
…ta-pytorch#3593) Summary: metric_module's get_pre_compute_states() provides an API to perform gloo all gathers instead of the default torchmetric.Metric's sync_dist (nccl). However, the mechanism calls gloo all gathers for each element in a list of tensors. This can be problematic because: - AUC's 3 state tensors hold a list of tensors, not a single tensor. - The size of the tensor list is theoretically unbounded. (In practice, it can grow to orders of 100K) - gloo all gathers are inherently much slower. Instead, this patch aims to: - apply the reduction function prior to the all gather if we're processing a tensor list - enforce that the reduction_fn does not rely on ordering Differential Revision: D88297404
a2618d7 to
f4a2668
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
fb-exported
meta-exported
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.
Differential Revision: D88297404