Repository navigation
skip transform_sender's steps when neither transforms the sender - #2550
Merged
Merged
Conversation
`transform_sender(sndr, env)` composes two steps, one for the domain where the sender completes and one for the domain where its operation starts, and each step computes its result with consteval functions and variables of its own, for each sender and environment. For most senders neither step does anything: neither domain has a transformation for the sender, and its tag has none either. In that case `transform_sender` now returns the sender as it is, without composing the steps (`__leaves_alone`, from each step's own test). The result is the same as before: a reference to the sender. The composition was named in a default template argument of the other overload, and default template arguments are substituted before constraints are checked, so it is now named in that overload's return type instead. Clang 22, frontend only, on test_merge_each_threaded.cpp: with STDEXEC_ENABLE_EXTRA_TYPE_CHECKING, peak memory goes from 5.9 GB to 5.3 GB (-11%), with 10% fewer types; without it, from 2.6 GB to 2.4 GB (-9%). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`__leaves_alone` named `__has_tag_transform_sender` in an `&&`, but a concept-id is checked when the initializer is instantiated, even where `&&` skips it. For a sender that a domain transforms, such as exec::ensure_started under nvexec's stream_domain, that checked the tag's default transformation, whose deduced return type instantiates exec's generic, host-only shared receiver. Clang CUDA then reported it referenced from the device. Before, the check ran only on senders that a transformation had returned. `__leaves_alone` is now a consteval function that names the concept only when the domain's transformation isn't taken. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…a test With the transform_sender fast path inlined into connect, GCC 12 at -O3 warns that connect's copy of the receiver's std::stop_token (in the environment it passes to transform_sender) can free the shared stop state before the receiver is moved. The receiver's own reference keeps the state alive, so it is a false positive. Scope the suppression to the two std::stop_token tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
transform_sender(sndr, env)composes a step for the completing domain and a step for the starting domain, and each step computes its result with consteval functions and variables of its own, for every sender and environment that gets connected. usually neither step does anything: neither domain has a transformation for the sender, and its tag has none either. thentransform_sendernow returns the sender as it is, without composing the steps (__leaves_alone, from each step's own test). the result is unchanged: a reference to the sender,noexcept.the composition was named in a default template argument of the other overload, and default template arguments are substituted before constraints are checked, so it's now named in that overload's return type. (clang 16 substitutes the return type first anyway, so it doesn't save anything there.)
clang 22, frontend only, on
test_merge_each_threaded.cpp: withSTDEXEC_ENABLE_EXTRA_TYPE_CHECKING, peak memory 5.9 GB → 5.3 GB (-11%) and 10% fewer types; without, 2.6 GB → 2.4 GB (-9%).🤖 Generated with Claude Code