Initial stats cleanup#1009
Open
nirandaperera wants to merge 5 commits intorapidsai:mainfrom
Open
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
wence-
reviewed
May 1, 2026
| RmmResourceAdaptor mr, | ||
| std::optional<PinnedMemoryResource> pinned_mr = PinnedMemoryResource::Disabled | ||
| ); | ||
| static std::shared_ptr<Statistics> create(bool enabled = true); |
Contributor
There was a problem hiding this comment.
question: What does having a create static method buy us over a constructor?
Contributor
Author
There was a problem hiding this comment.
factory methods allows us to safely use std::enable_shared_from_this, where we can pass a shared_ptr to memory recorder rather than a ptr
Contributor
There was a problem hiding this comment.
While we're doing this, let's return a const & reference to the shared ptr?
Contributor
Author
2889f62 to
8236c70
Compare
Signed-off-by: niranda perera <niranda.perera@gmail.com> remove stats from allgather Signed-off-by: niranda perera <niranda.perera@gmail.com> stats provider concept Signed-off-by: niranda perera <niranda.perera@gmail.com> WIP Signed-off-by: niranda perera <niranda.perera@gmail.com>
8236c70 to
0c6cc9c
Compare
Signed-off-by: niranda perera <niranda.perera@gmail.com>
Signed-off-by: niranda perera <niranda.perera@gmail.com>
Contributor
Author
|
@wence- this is ready for review now |
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.
Statisticswas constructible directly (make_shared<Statistics>(false)was not equal toStatistics::disabled()),MemoryRecorderheld a rawStatistics*(lifetime hazard noted by an existing TODO), providerstatistics()accessors returnedshared_ptrby value (atomic refcount bumps on hot paths), and secondary objects likeAllGatherredundantly carried their ownstatistics_member already reachable through the buffer resource / context.In this PR, following changes were made
Statisticsconstructible only through factory methods (create(),from_options(),disabled()); the public ctor is removed anddisabled()is now the canonical singleton for the disabled case.Statisticsfromstd::enable_shared_from_thissoMemoryRecorderowns ashared_ptr<Statistics>instead of a raw pointer; recorder no-ops when stats are disabled.StatisticsProviderconcept and have providers (BufferResource,ProgressThread,streaming::Context) returnstd::shared_ptr<Statistics> const&fromstatistics(); each providerstatic_asserts the concept.statisticsparameter andstatistics_member fromcoll::AllGather(and its Python binding); secondary classes now derive theirStatisticsfrom the provider they already receive.Related to #1008
Depends on #1003