cuda::experimental::stf::stream_and_event#

class stream_and_event : public cuda::experimental::stf::event_impl#

Public Functions

inline void insert_event() noexcept#

Record the event that marks this stream position.

Never throws.

Every failure here is unrecoverable in practice. The CUDA calls fail either because we are out of resources or — far more often — because a sticky error from earlier asynchronous work is only now surfacing, since this is the next place we touch CUDA. Neither leaves a usable context, and callers run this from task teardown where there is nothing to fall back on. Report and abort rather than propagate.

The wrap covers the whole body on purpose: get_device_from_stream and the device switch in exec_place::operator->* throw too (cuda_try, plus bad_alloc from constructing the exec_place), so converting only the two event calls would leave those uncovered.

inline void insert_dep(
async_resources_handle &async_resources,
const stream_and_event &from
)#
inline virtual bool factorize(
const backend_ctx_untyped&,
reserved::event_vector &events
) override#

Remove implicit dependencies already induced by more recent events using the same stream.

inline virtual void sync_with_stream(
const backend_ctx_untyped &bctx,
event_list &prereqs,
cudaStream_t stream
) const override#
inline cudaStream_t get_stream() const#
inline augmented_stream get_augmented_stream() const#
inline unsigned long long get_stream_id() const#
inline cudaEvent_t get_cuda_event() const#
inline bool operator==(const event_impl &e) const#

Compares this event with another event for equality based on their unique identifiers.

Parameters:

e – The event to compare with.

Returns:

True if the events have the same unique identifier, false otherwise.

inline bool operator<(const event_impl &e) const#

Compares this event with another event for ordering based on their unique identifiers.

Parameters:

e – The event to compare with.

Returns:

True if this event’s unique identifier is less than the other event’s identifier, false otherwise.

inline void set_symbol_with_dot(
reserved::per_ctx_dot &dot,
::std::string s
)#

Sets a symbolic name for the event, useful for debugging or tracing.

Parameters:
  • dot – The per-context DOT graph helper used for tracing.

  • s – The symbolic name to associate with this event.

template<typename context_t>
inline void set_symbol(
context_t &ctx,
::std::string s
)#

Sets a symbolic name for the event, useful for debugging or tracing.

Parameters:
  • ctx – The context providing access to the DOT graph helper.

  • s – The symbolic name to associate with this event.

inline virtual event_list from_stream(
backend_ctx_untyped&,
cudaStream_t
) const#
inline const ::std::string &get_symbol() const#

Retrieves the symbolic name of the event.

Returns:

The symbolic name of the event. Generates a default name if none was set.

Public Members

mutable reserved::unique_id_t unique_prereq_id#

A unique identifier for the event, used to ensure proper event ordering.

::std::atomic<int> outbound_deps = 0#

Public Static Functions

static inline void insert_dependency(
cudaStream_t s1,
cudaStream_t s2
)#