Invert meaning of operator bool for CUDA stream and event#199
Open
msimberg wants to merge 1 commit intoghex-org:masterfrom
Open
Invert meaning of operator bool for CUDA stream and event#199msimberg wants to merge 1 commit intoghex-org:masterfrom
msimberg wants to merge 1 commit intoghex-org:masterfrom
Conversation
Collaborator
Author
|
I see also that there actually already sort of existed a cudaEvent_t wrapper... just hidden inside the future helper. I'll try to unify the event wrapper added in #190 with the existing one in a separate PR. |
There was a problem hiding this comment.
Pull request overview
This PR aligns the boolean conversion semantics of CUDA stream/event wrappers with typical C++ “valid object == true” expectations (and with the GHEX_C_STRUCT / GHEX_C_MANAGED_STRUCT behavior referenced in the linked #190 discussion), by making moved-from objects evaluate to false.
Changes:
- Invert
operator bool()forghex::device::streamandghex::device::cuda_eventto returntruewhen the wrapper is usable (not moved-from). - Update the
event_poolinternal assertion to match the newcuda_eventboolean semantics.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| include/ghex/device/cuda/stream.hpp | stream::operator bool() now reports validity (!m_moved). |
| include/ghex/device/cuda/event.hpp | cuda_event::operator bool() now reports validity (!m_moved). |
| include/ghex/device/cuda/event_pool.hpp | Adjust assertion in get_event() to reflect the new cuda_event truthiness. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
Author
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.
This was a leftover from #190. See #190 (comment).