Repository navigation
Add inplace_stoppable_base to reduce operation state sizes - #2413
Merged
Merged
Conversation
vasama
force-pushed
the
inplace_stoppable_base
branch
from
November 5, 2026 10:02
af95622 to
a874904
Compare
When Clang checks that the callback type is invocable, the `__local_state` type is still incomplete and thus not considered invocable.
vasama
force-pushed
the
inplace_stoppable_base
branch
2 times, most recently
from
November 5, 2026 10:05
8f8b63b to
c4965c6
Compare
vasama
force-pushed
the
inplace_stoppable_base
branch
from
November 5, 2026 11:52
c4965c6 to
6688192
Compare
ericniebler
approved these changes
Nov 5, 2026
ericniebler
left a comment
Collaborator
There was a problem hiding this comment.
this is great! thanks!
Collaborator
|
/ok to test 6688192 |
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.
Introduction
This PR introduces a CRTP alternative to stop callbacks. This allows reducing the sizes of many operation states for two reasons:
__optionalwrappers can be eliminated, because the stoppable base tracks its own state.See also P3301: inplace_stoppable_base.
Changes in this PR
inplace_stop_token:inplace_stoppable_basestoppable_base_for_talias template, analogous tostop_callback_for_t.Measurements
This table shows sizes of operation state objects, using three different stop token types, before and after the changes. Measured on x86-64 Ubuntu 26.04 using Clang 22.
inplace_stop_tokenstd::stop_tokennever_stop_tokenNote
Similar changes were made to a few Windows or CUDA specific components, but changes in the relevant operation state sizes were not measured.