Skip to content

Unify event implementation#200

Open
msimberg wants to merge 6 commits intoghex-org:masterfrom
msimberg:unify-event-implementation
Open

Unify event implementation#200
msimberg wants to merge 6 commits intoghex-org:masterfrom
msimberg:unify-event-implementation

Conversation

@msimberg
Copy link
Copy Markdown
Collaborator

This is on top of #199.

Uses the explicit implementation of a cudaEvent_t RAII wrapper in include/ghex.device/cuda/event.hpp in the device future implementation.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR unifies CUDA event usage by reusing the explicit cuda_event RAII wrapper (include/ghex/device/cuda/event.hpp) inside the CUDA future implementation, and aligns operator bool() semantics for CUDA stream/event with PR #199.

Changes:

  • Invert operator bool() for ghex::device::stream and ghex::device::cuda_event to return true when the object is valid (not moved-from).
  • Replace future’s internal cudaEvent_t managed-struct wrapper with the shared cuda_event RAII type.
  • Update cuda_event to accept event creation flags and add implicit conversions to cudaEvent_t references; adjust event_pool assertion accordingly.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
include/ghex/device/cuda/stream.hpp Aligns operator bool() validity semantics with the new convention.
include/ghex/device/cuda/future.hpp Switches future’s event storage to cuda_event (but introduces an include-guard issue).
include/ghex/device/cuda/event_pool.hpp Updates assertion to match the inverted cuda_event::operator bool() semantics.
include/ghex/device/cuda/event.hpp Adds flag-configurable ctor and aligns operator bool() validity semantics; adds implicit cudaEvent_t conversions.
Comments suppressed due to low confidence (1)

include/ghex/device/cuda/future.hpp:17

  • future.hpp now includes ghex/device/cuda/event.hpp unconditionally. That header depends on CUDA runtime types/macros and is not guarded by GHEX_CUDACC, so this will break any translation unit that includes future.hpp without GHEX_CUDACC (e.g., generic headers like include/ghex/packer.hpp include this file unconditionally). Consider moving the CUDA-only includes (device/cuda/event.hpp, and any other CUDA-runtime-dependent headers) inside the #ifdef GHEX_CUDACC block, or include the wrapper header ghex/device/event.hpp instead so non-CUDA builds see the stub type.
#include <ghex/config.hpp>
#include <ghex/device/cuda/event.hpp>
#include <ghex/device/cuda/error.hpp>
#ifdef GHEX_CUDACC
#include <ghex/device/cuda/runtime.hpp>
#endif

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Collaborator

@philip-paul-mueller philip-paul-mueller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some comments/questions.

I kind of think that the number of places where we have amended the meaning is a bit low?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants