24namespace sham::details {
28 auto is_event_complete = [](
const sycl::event &event) ->
bool {
30 event.get_info<sycl::info::event::command_execution_status>()
31 == sycl::info::event_command_status::complete);
34 auto filter_events = [&](std::vector<sycl::event> &events) -> std::vector<sycl::event> {
35 std::vector<sycl::event> ret;
36 for (
auto &e : events) {
37 if (!is_event_complete(e)) {
38 ret.emplace_back(std::move(e));
54 std::string err_msg = shambase::format(
55 "you have requested a read access on a buffer in an incomplete state\n"
56 " read_access call location : {}\n"
57 " last access location : {}\n",
79 std::string err_msg = shambase::format(
80 "you have requested a write access on a buffer in an incomplete state\n"
81 " write_access call location : {}\n"
82 " last access location : {}\n",
115 "the event state of that buffer is already complete"
116 "complete_state call location : "
122 if (last_access == READ) {
124 for (
const auto &e : events) {
130 }
else if (last_access == WRITE) {
136 for (
const auto &e : events) {
Class to manage a list of SYCL events.
void add_event(sycl::event e)
Add an event to the list of events.
std::vector< sycl::event > read_events
Vector of events related to read operations on the buffer.
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....
SourceLocation last_access_loc
Source location of the last access to the buffer.
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 filter_events()
Filter the read and write events so that only pending events are stored.
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....
bool up_to_date_events
Flag to indicate if the buffer access events are up to date.
std::vector< sycl::event > write_events
Vector of events related to write operations on the buffer.
This header file contains utility functions related to exception handling in the code.
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
This file contains the class definition for BufferEventHandler.
provide information about the source location
std::string format_one_line() const
format the location in a one liner