cuda::experimental::stf::event_impl

Defined in include/cuda/experimental/__stf/internal/async_prereq.cuh

class event_impl

This is the base event type.

It defines an abstract object which represents that an asynchronous event happened.

It is possible to insert a dependency between two events provided the dependency follows the chronological order of creation: an event E2 created after an event E1 cannot depend on E1.

Inserting a dependency between two events is supposed to be a non-blocking operation, but the actual event implementation is allowed to block temporarily.

Subclassed by cuda::experimental::stf::reserved::graph_event_impl, cuda::experimental::stf::stream_and_event

Public Functions

event_impl(const event_impl&) = delete

Deleted copy constructor to prevent copying and ensure unique event identifiers.

event_impl &operator=(const event_impl&) = delete

Deleted copy assignment operator to prevent copying and ensure unique event identifiers.

virtual ~event_impl() = default

Virtual destructor to support polymorphic deletion.

event_impl() = default

Default constructor.

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.

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

s – The symbolic name to associate with this event.

inline virtual bool factorize(reserved::event_vector&)

Optionally simplifies the event vector to remove redundant entries.

Note

This function provides a hook for derived classes to implement optimization strategies.

Parameters

unused – A vector of events potentially containing redundant entries.

Returns

True if redundant entries were removed and further uniqueness processing is unnecessary, false otherwise.

inline virtual void sync_with_stream(backend_ctx_untyped&, event_list&, cudaStream_t) const
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

Protected Attributes

mutable ::std::string symbol

The symbolic name associated with the event, mutable to allow lazy initialization.