diff --git a/sycl/include/sycl/ext/oneapi/experimental/enqueue_functions.hpp b/sycl/include/sycl/ext/oneapi/experimental/enqueue_functions.hpp index 21d383b6fe2c..3201cf94f406 100644 --- a/sycl/include/sycl/ext/oneapi/experimental/enqueue_functions.hpp +++ b/sycl/include/sycl/ext/oneapi/experimental/enqueue_functions.hpp @@ -10,6 +10,7 @@ #include // for std::forward +#include #include #include #include @@ -74,14 +75,18 @@ template struct LaunchConfigAccess { } // namespace detail template -void submit(queue Q, CommandGroupFunc &&CGF) { +void submit(queue Q, CommandGroupFunc &&CGF, + const sycl::detail::code_location &CodeLoc = + sycl::detail::code_location::current()) { // TODO: Use new submit without Events. - Q.submit(std::forward(CGF)); + Q.submit(std::forward(CGF), CodeLoc); } template -event submit_with_event(queue Q, CommandGroupFunc &&CGF) { - return Q.submit(std::forward(CGF)); +event submit_with_event(queue Q, CommandGroupFunc &&CGF, + const sycl::detail::code_location &CodeLoc = + sycl::detail::code_location::current()) { + return Q.submit(std::forward(CGF), CodeLoc); } template @@ -90,8 +95,12 @@ void single_task(handler &CGH, const KernelType &KernelObj) { } template -void single_task(queue Q, const KernelType &KernelObj) { - submit(Q, [&](handler &CGH) { single_task(CGH, KernelObj); }); +void single_task(queue Q, const KernelType &KernelObj, + const sycl::detail::code_location &CodeLoc = + sycl::detail::code_location::current()) { + submit( + Q, [&](handler &CGH) { single_task(CGH, KernelObj); }, + CodeLoc); } template @@ -261,8 +270,10 @@ inline void memcpy(handler &CGH, void *Dest, const void *Src, size_t NumBytes) { CGH.memcpy(Dest, Src, NumBytes); } -inline void memcpy(queue Q, void *Dest, const void *Src, size_t NumBytes) { - submit(Q, [&](handler &CGH) { memcpy(CGH, Dest, Src, NumBytes); }); +inline void memcpy(queue Q, void *Dest, const void *Src, size_t NumBytes, + const sycl::detail::code_location &CodeLoc = + sycl::detail::code_location::current()) { + submit(Q, [&](handler &CGH) { memcpy(CGH, Dest, Src, NumBytes); }, CodeLoc); } template @@ -270,16 +281,21 @@ void copy(handler &CGH, const T *Src, T *Dest, size_t Count) { CGH.copy(Src, Dest, Count); } -template void copy(queue Q, const T *Src, T *Dest, size_t Count) { - submit(Q, [&](handler &CGH) { copy(CGH, Src, Dest, Count); }); +template +void copy(queue Q, const T *Src, T *Dest, size_t Count, + const sycl::detail::code_location &CodeLoc = + sycl::detail::code_location::current()) { + submit(Q, [&](handler &CGH) { copy(CGH, Src, Dest, Count); }, CodeLoc); } inline void memset(handler &CGH, void *Ptr, int Value, size_t NumBytes) { CGH.memset(Ptr, Value, NumBytes); } -inline void memset(queue Q, void *Ptr, int Value, size_t NumBytes) { - submit(Q, [&](handler &CGH) { memset(CGH, Ptr, Value, NumBytes); }); +inline void memset(queue Q, void *Ptr, int Value, size_t NumBytes, + const sycl::detail::code_location &CodeLoc = + sycl::detail::code_location::current()) { + submit(Q, [&](handler &CGH) { memset(CGH, Ptr, Value, NumBytes); }, CodeLoc); } template @@ -288,38 +304,49 @@ void fill(sycl::handler &CGH, T *Ptr, const T &Pattern, size_t Count) { } template -void fill(sycl::queue Q, T *Ptr, const T &Pattern, size_t Count) { - submit(Q, [&](handler &CGH) { fill(CGH, Ptr, Pattern, Count); }); +void fill(sycl::queue Q, T *Ptr, const T &Pattern, size_t Count, + const sycl::detail::code_location &CodeLoc = + sycl::detail::code_location::current()) { + submit(Q, [&](handler &CGH) { fill(CGH, Ptr, Pattern, Count); }, CodeLoc); } inline void prefetch(handler &CGH, void *Ptr, size_t NumBytes) { CGH.prefetch(Ptr, NumBytes); } -inline void prefetch(queue Q, void *Ptr, size_t NumBytes) { - submit(Q, [&](handler &CGH) { prefetch(CGH, Ptr, NumBytes); }); +inline void prefetch(queue Q, void *Ptr, size_t NumBytes, + const sycl::detail::code_location &CodeLoc = + sycl::detail::code_location::current()) { + submit(Q, [&](handler &CGH) { prefetch(CGH, Ptr, NumBytes); }, CodeLoc); } inline void mem_advise(handler &CGH, void *Ptr, size_t NumBytes, int Advice) { CGH.mem_advise(Ptr, NumBytes, Advice); } -inline void mem_advise(queue Q, void *Ptr, size_t NumBytes, int Advice) { - submit(Q, [&](handler &CGH) { mem_advise(CGH, Ptr, NumBytes, Advice); }); +inline void mem_advise(queue Q, void *Ptr, size_t NumBytes, int Advice, + const sycl::detail::code_location &CodeLoc = + sycl::detail::code_location::current()) { + submit( + Q, [&](handler &CGH) { mem_advise(CGH, Ptr, NumBytes, Advice); }, + CodeLoc); } inline void barrier(handler &CGH) { CGH.ext_oneapi_barrier(); } -inline void barrier(queue Q) { - submit(Q, [&](handler &CGH) { barrier(CGH); }); +inline void barrier(queue Q, const sycl::detail::code_location &CodeLoc = + sycl::detail::code_location::current()) { + submit(Q, [&](handler &CGH) { barrier(CGH); }, CodeLoc); } inline void partial_barrier(handler &CGH, const std::vector &Events) { CGH.ext_oneapi_barrier(Events); } -inline void partial_barrier(queue Q, const std::vector &Events) { - submit(Q, [&](handler &CGH) { partial_barrier(CGH, Events); }); +inline void partial_barrier(queue Q, const std::vector &Events, + const sycl::detail::code_location &CodeLoc = + sycl::detail::code_location::current()) { + submit(Q, [&](handler &CGH) { partial_barrier(CGH, Events); }, CodeLoc); } } // namespace ext::oneapi::experimental