Initial stats cleanup#1009
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. |
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>
|
@wence- this is ready for review now |
pentschev
left a comment
There was a problem hiding this comment.
At a high-level this looks ok. Left some minor suggestions.
Signed-off-by: niranda perera <niranda.perera@gmail.com>
Signed-off-by: niranda perera <niranda.perera@gmail.com>
pentschev
left a comment
There was a problem hiding this comment.
This looks good to me, thanks Niranda.
Signed-off-by: niranda perera <niranda.perera@gmail.com>
Signed-off-by: niranda perera <niranda.perera@gmail.com>
wence-
left a comment
There was a problem hiding this comment.
I think we need to think through what this design, especially around disabled statistics, looks like. Right now it seems very over-complicated and has, from my reading, somewhat inconsistent semantics.
Before writing some more code, let us figure out what it is we actually want to support (it can be different from what we support today!)
This reverts commit 04a3dae.
Signed-off-by: niranda perera <niranda.perera@gmail.com>
Signed-off-by: niranda perera <niranda.perera@gmail.com>
Signed-off-by: niranda perera <niranda.perera@gmail.com>
Signed-off-by: niranda perera <niranda.perera@gmail.com>
Signed-off-by: niranda perera <niranda.perera@gmail.com>
Signed-off-by: niranda perera <niranda.perera@gmail.com>
wence-
left a comment
There was a problem hiding this comment.
I've had another read over this and I think it is in a good place now.
Minor nits to fix in this round before merging: where you introduce new construction arguments that provide a default value for statistics (e.g. from_options) please just require a statistics object (because of planned followup to remove statistics defaults).
Also, I think it is better to return shared_ptr const& from statistics providers. The consumer can then either get a shared_ptr or just use the method slot directly.
| * @note Returning by value provides clear ownership semantics. Callers that invoke | ||
| * `statistics()` multiple times within the same scope should cache the result | ||
| * in a local variable to avoid repeated atomic refcount operations on hot paths. |
There was a problem hiding this comment.
So I think there was some back and forth here. TBH, I think that the statistics method should return shared_ptr<Statistics> const&.
That way, the following works "as expected" but everything is efficient.
auto br = std::make_shared<BufferResource>(...);
br->statistics()->record(); // doesn't bump refcount
auto stats = br->statistics(); // does bump refcount, because stats is a shared_ptr, not shared_ptr&
There was a problem hiding this comment.
I was thinking on the same lines here, but then decided against it, because IMO returning the value forces callers to be mindful of the lifetime aspects (and at minimum its the safest).
Co-authored-by: Lawrence Mitchell <wence@gmx.li>
…nto stats-refactor
Signed-off-by: niranda perera <niranda.perera@gmail.com>
Signed-off-by: niranda perera <niranda.perera@gmail.com>
Signed-off-by: niranda perera <niranda.perera@gmail.com>
pentschev
left a comment
There was a problem hiding this comment.
One minor docstring issue, otherwise LGTM. Thanks Niranda.
Signed-off-by: niranda perera <niranda.perera@gmail.com>
Signed-off-by: niranda perera <niranda.perera@gmail.com>
|
/merge |
This has several fixes for cudf CI - *temporarily* relax strict xfail for flaky xpass-ing tests in cudf-pandas. Tracked at #22681 - Vendor a couple of `detail` functions from RMM that were changed in rapidsai/rmm#2416 - compatibility with an API change in rapidsmpf's `Statistics` rapidsai/rapidsmpf#1009. Authors: - Tom Augspurger (https://github.com/TomAugspurger) - Niranda Perera (https://github.com/nirandaperera) Approvers: - GALI PREM SAGAR (https://github.com/galipremsagar) - Bradley Dice (https://github.com/bdice) - Yunsong Wang (https://github.com/PointKernel) URL: #22677
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