![]() |
Shamrock 2025.10.0
Astrophysical Code
|
Class that manages the event state of a SYCL USM buffer. More...
#include <shambackends/include/shambackends/details/BufferEventHandler.hpp>
Collaboration diagram for sham::details::BufferEventHandler:Public Types | |
| enum | last_op { READ , WRITE } |
| Enum to represent the last operation performed on the buffer. More... | |
Public Member Functions | |
| void | wait_all (SourceLocation src_loc=SourceLocation{}) |
| Wait for all the buffer accesses to be completed. | |
| bool | is_empty () |
| Check if there if the events lists are empty. | |
| void | read_access (sham::EventList &depends_list, SourceLocation src_loc=SourceLocation{}) |
Adds events conditioning the validity of a buffer for read access to the dependency list. Also sets the event handler to incomplete state (up_to_date_events = false). | |
| void | write_access (sham::EventList &depends_list, SourceLocation src_loc=SourceLocation{}) |
Adds events conditioning the validity of a buffer for write access to the dependency list. Also sets the event handler to incomplete state (up_to_date_events = false). | |
| void | complete_state (sycl::event e, SourceLocation src_loc=SourceLocation{}) |
| Completes the state of the buffer event handler with the event for which the access was queried. | |
| void | complete_state (const std::vector< sycl::event > &events, SourceLocation src_loc=SourceLocation{}) |
| Completes the state of the buffer event handler with the specified events. | |
| void | filter_events () |
| Filter the read and write events so that only pending events are stored. | |
| void | complete_state (sham::EventList &events) |
| Completes the state of the buffer event handler using an EventList. | |
Public Attributes | |
| std::vector< sycl::event > | read_events |
| Vector of events related to read operations on the buffer. | |
| std::vector< sycl::event > | write_events |
| Vector of events related to write operations on the buffer. | |
| enum sham::details::BufferEventHandler::last_op | last_access |
| bool | up_to_date_events = true |
| Flag to indicate if the buffer access events are up to date. | |
| SourceLocation | last_access_loc |
| Source location of the last access to the buffer. | |
Class that manages the event state of a SYCL USM buffer.
This class is used to manage the accesses to a SYCL USM buffer. It keeps track of the events related to read and write operations of the buffer. The class has two states: incomplete and complete.
read_access or write_access) until the event is registered using complete_state.The class is designed to work with SYCL USM buffers.
Definition at line 40 of file BufferEventHandler.hpp.
Enum to represent the last operation performed on the buffer.
This enum is used to represent the last operation on the managed object. It can be either a read operation or a write operation.
Definition at line 88 of file BufferEventHandler.hpp.
| void sham::details::BufferEventHandler::complete_state | ( | const std::vector< sycl::event > & | events, |
| SourceLocation | src_loc = SourceLocation{} |
||
| ) |
Completes the state of the buffer event handler with the specified events.
This function is used to complete the state of the buffer event handler with the given list of events. Once the state is completed, the buffer event handler is marked as up to date.
| events | A vector of events for which the state is completed. |
| src_loc | The source location of the call to this function. |
| std::runtime_error | if the buffer event handler is already up to date. This exception is thrown when the function is called on a buffer event handler that is already up to date (i.e., up_to_date_events is true). |
Definition at line 108 of file BufferEventHandler.cpp.
Here is the call graph for this function:
|
inline |
Completes the state of the buffer event handler using an EventList.
This function completes the state of the buffer event handler with the events contained in the provided EventList. Once the state is completed, the events in the EventList are marked as consumed.
| events | The EventList containing events for which the state is completed. |
Definition at line 197 of file BufferEventHandler.hpp.
Here is the call graph for this function:| void sham::details::BufferEventHandler::complete_state | ( | sycl::event | e, |
| SourceLocation | src_loc = SourceLocation{} |
||
| ) |
Completes the state of the buffer event handler with the event for which the access was queried.
This function is used to complete the state of the buffer event handler with the event for which the access was queried. Once the state is completed, the buffer event handler is marked as up to date.
| e | The event for which the access was queried. |
| src_loc | The source location of the call to this function. |
| std::runtime_error | if the buffer event handler is already up to date. This exception is thrown when the function is called on a buffer event handler that is already up to date (i.e., up_to_date_events is true). |
Definition at line 104 of file BufferEventHandler.cpp.
Here is the call graph for this function:| void sham::details::BufferEventHandler::filter_events | ( | ) |
Filter the read and write events so that only pending events are stored.
Events that are completed are removed from the read and write event lists.
Definition at line 26 of file BufferEventHandler.cpp.
Here is the call graph for this function:
|
inline |
Check if there if the events lists are empty.
true if both buffer events lists are empty, false otherwise Definition at line 80 of file BufferEventHandler.hpp.
| void sham::details::BufferEventHandler::read_access | ( | sham::EventList & | depends_list, |
| SourceLocation | src_loc = SourceLocation{} |
||
| ) |
Adds events conditioning the validity of a buffer for read access to the dependency list. Also sets the event handler to incomplete state (up_to_date_events = false).
This function is used to add events that condition the validity of a buffer for read access to the dependency list. It is typically used when a read operation is about to be performed on the buffer. The function adds the events related to previous write operations on the buffer to the dependency list.
| depends_list | The vector of events that the read access depends on. |
| src_loc | The source location of the call to this function. |
| std::runtime_error | if the buffer event handler is in an incomplete state. This exception is thrown when the function is called on a buffer event handler that is in an incomplete state (i.e., up_to_date_events is false). |
Definition at line 51 of file BufferEventHandler.cpp.
Here is the call graph for this function:
|
inline |
Wait for all the buffer accesses to be completed.
This function waits for all the buffer accesses to be completed. It waits for both read and write events to be completed.
| src_loc | Source location of the call to this function |
Definition at line 67 of file BufferEventHandler.hpp.
| void sham::details::BufferEventHandler::write_access | ( | sham::EventList & | depends_list, |
| SourceLocation | src_loc = SourceLocation{} |
||
| ) |
Adds events conditioning the validity of a buffer for write access to the dependency list. Also sets the event handler to incomplete state (up_to_date_events = false).
This function is used to add events that condition the validity of a buffer for write access to the dependency list. It is typically used when a write operation is about to be performed on the buffer. The function adds the events related to previous read and write operations on the buffer to the dependency list.
| depends_list | The vector of events that the write access depends on. |
| src_loc | The source location of the call to this function. |
| std::runtime_error | if the buffer event handler is in an incomplete state. This exception is thrown when the function is called on a buffer event handler that is in an incomplete state (i.e., up_to_date_events is false). |
Definition at line 76 of file BufferEventHandler.cpp.
Here is the call graph for this function:| SourceLocation sham::details::BufferEventHandler::last_access_loc |
Source location of the last access to the buffer.
This is the source location of the last access to the buffer. It is used to report an error if the buffer is accessed in an incomplete state.
Definition at line 105 of file BufferEventHandler.hpp.
| std::vector<sycl::event> sham::details::BufferEventHandler::read_events |
Vector of events related to read operations on the buffer.
This vector keeps track of the events that correcpond to read operation on the managed object
Definition at line 49 of file BufferEventHandler.hpp.
| bool sham::details::BufferEventHandler::up_to_date_events = true |
Flag to indicate if the buffer access events are up to date.
If it is true, it means that the buffer access events are up to date. If it is false, it means that the buffer access events are not up to date, the event handler is in a incomplete state.
Definition at line 97 of file BufferEventHandler.hpp.
| std::vector<sycl::event> sham::details::BufferEventHandler::write_events |
Vector of events related to write operations on the buffer.
This vector keeps track of the events that correcpond to wire operation on the managed object
Definition at line 57 of file BufferEventHandler.hpp.