kokkos-execution 0.0.1
Loading...
Searching...
No Matches
Kokkos::Execution::Impl::Event< Exec > Struct Template Reference

An event that can be recorded on an execution space instance. More...

#include <event.hpp>

Public Member Functions

 Event ()=default
 Event (const Event &)=delete
Eventoperator= (const Event &)=delete
 Event (Event &&) noexcept=delete
Eventoperator= (Event &&) noexcept=delete
 ~Event ()=default
void record (const Exec &)
void wait () const

Public Attributes

std::atomic< bool > m_recorded {false}
uint64_t m_event_id = invalid_event_id

Detailed Description

template<Kokkos::ExecutionSpace Exec>
struct Kokkos::Execution::Impl::Event< Exec >

An event that can be recorded on an execution space instance.

This is the default implementation. It assumes the backend has blocking dispatch.

It is assumed that the thread calling record does so after submitting the operation on the execution space instance. Since the backend is assumed blocking, this means that the operation must have completed before the call to record, so that making the effects visible after the call to wait on the waiting thread is all that is needed.

Definition at line 108 of file event.hpp.

Constructor & Destructor Documentation

◆ Event() [1/3]

template<Kokkos::ExecutionSpace Exec>
Kokkos::Execution::Impl::Event< Exec >::Event ( )
default

◆ Event() [2/3]

template<Kokkos::ExecutionSpace Exec>
Kokkos::Execution::Impl::Event< Exec >::Event ( const Event< Exec > & )
delete

References Event().

◆ Event() [3/3]

template<Kokkos::ExecutionSpace Exec>
Kokkos::Execution::Impl::Event< Exec >::Event ( Event< Exec > && )
deletenoexcept

References Event().

◆ ~Event()

template<Kokkos::ExecutionSpace Exec>
Kokkos::Execution::Impl::Event< Exec >::~Event ( )
default

References Event().

Member Function Documentation

◆ operator=() [1/2]

template<Kokkos::ExecutionSpace Exec>
Event & Kokkos::Execution::Impl::Event< Exec >::operator= ( const Event< Exec > & )
delete

References Event().

◆ operator=() [2/2]

template<Kokkos::ExecutionSpace Exec>
Event & Kokkos::Execution::Impl::Event< Exec >::operator= ( Event< Exec > && )
deletenoexcept

References Event().

◆ record()

template<Kokkos::ExecutionSpace Exec>
void Kokkos::Execution::Impl::Event< Exec >::record ( const Exec & )
inline

Definition at line 122 of file event.hpp.

References m_recorded, and record().

◆ wait()

template<Kokkos::ExecutionSpace Exec>
void Kokkos::Execution::Impl::Event< Exec >::wait ( ) const
inline

The while loop is needed because the promise that memory writes that happened before the atomic store from the point of view of the recording thread become visible in the waiting thread only holds if the waiting thread actually reads the value that the recording thread stored. See https://en.cppreference.com/cpp/atomic/memory_order.

Definition at line 126 of file event.hpp.

References m_recorded.

Member Data Documentation

◆ m_event_id

template<Kokkos::ExecutionSpace Exec>
uint64_t Kokkos::Execution::Impl::Event< Exec >::m_event_id = invalid_event_id

Definition at line 113 of file event.hpp.

◆ m_recorded

template<Kokkos::ExecutionSpace Exec>
std::atomic<bool> Kokkos::Execution::Impl::Event< Exec >::m_recorded {false}

Definition at line 111 of file event.hpp.


The documentation for this struct was generated from the following file:
  • /__w/kokkos-execution/kokkos-execution/kokkos-execution/impl/event.hpp