21namespace shamalgs::memory::details {
24 T AvoidCopy<T>::extract_element(sycl::queue &q, sycl::buffer<T> &buf,
u32 idx) {
26 if (!(idx < buf.size())) {
28 "you are trying to access out of bounds");
31 sycl::buffer<T> len_value{1};
32 q.submit([&](sycl::handler &cgh) {
33 sycl::accessor global_mem{buf, cgh, sycl::read_only};
34 sycl::accessor acc_rec{len_value, cgh, sycl::write_only, sycl::no_init};
38 cgh.single_task([=]() {
39 acc_rec[0] = global_mem[idx_];
45 sycl::host_accessor acc{len_value, sycl::read_only};
81#define X(_arg_) template struct AvoidCopy<_arg_>;
std::uint32_t u32
32 bit unsigned integer
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.