fix kernel launch failure when sender expressions can throw#6277
Merged
ericniebler merged 3 commits intoNVIDIA:mainfrom Oct 20, 2025
Merged
Conversation
Contributor
|
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. |
Contributor
Author
|
/ok to test d8905b0 |
This comment has been minimized.
This comment has been minimized.
Contributor
Author
|
/ok to test b69591a |
Contributor
Author
|
/ok to test 9f65d45 |
Contributor
🥳 CI Workflow Results🟩 Finished in 31m 19s: Pass: 100%/42 | Total: 5h 15m | Max: 25m 48s | Hits: 95%/21329See results here. |
pciolkosz
approved these changes
Oct 20, 2025
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.
Description
the following code will fail with an "invalid device function" cuda error:
however, the following nearly identical code will work:
the difference is that the lambda passed to
ex::thenisnoexcept. when it is notnoexcept, the sender has aex::set_error_t(std::exception_ptr)completion signature -- but only in host code.this results in host code and device code computing different intermediate types, and instantiating kernels with those different types. since the mangled names of the kernels differ, the kernel launch fails.
Fix
the problem stems from the fact that
cudax::executionuses some nothrow type traits that are unconditionallytruein device code (since device code never throws). the fix is to stop defining the nothrow traits differently for device code.but that is an incomplete fix, because with that change, device code now needs to be aware of
std::exception_ptr. the standardexception_ptrAPIs are host-only and so cannot be called from device code.the fix is to polyfill the
exception_ptrAPIs for device code, and use thestd::APIs on host.Checklist