3030#include < sycl/exception_list.hpp> // for defaultAsyncHa...
3131#include < sycl/ext/oneapi/device_global/device_global.hpp> // for device_global
3232#include < sycl/ext/oneapi/device_global/properties.hpp> // for device_image_s...
33- #include < sycl/ext/oneapi/experimental/graph.hpp> // for command_graph...
34- #include < sycl/ext/oneapi/properties/properties.hpp> // for empty_properti...
35- #include < sycl/handler.hpp> // for handler, isDev...
36- #include < sycl/id.hpp> // for id
37- #include < sycl/kernel.hpp> // for auto_name
38- #include < sycl/kernel_handler.hpp> // for kernel_handler
39- #include < sycl/nd_range.hpp> // for nd_range
40- #include < sycl/property_list.hpp> // for property_list
41- #include < sycl/range.hpp> // for range
33+ #include < sycl/ext/oneapi/experimental/event_mode_property.hpp>
34+ #include < sycl/ext/oneapi/experimental/graph.hpp> // for command_graph...
35+ #include < sycl/ext/oneapi/properties/properties.hpp> // for empty_properti...
36+ #include < sycl/handler.hpp> // for handler, isDev...
37+ #include < sycl/id.hpp> // for id
38+ #include < sycl/kernel.hpp> // for auto_name
39+ #include < sycl/kernel_handler.hpp> // for kernel_handler
40+ #include < sycl/nd_range.hpp> // for nd_range
41+ #include < sycl/property_list.hpp> // for property_list
42+ #include < sycl/range.hpp> // for range
4243
4344#include < cstddef> // for size_t
4445#include < functional> // for function
@@ -99,6 +100,9 @@ class __SYCL_EXPORT SubmissionInfo {
99100 std::shared_ptr<detail::queue_impl> &SecondaryQueue ();
100101 const std::shared_ptr<detail::queue_impl> &SecondaryQueue () const ;
101102
103+ ext::oneapi::experimental::event_mode_enum &EventMode ();
104+ const ext::oneapi::experimental::event_mode_enum &EventMode () const ;
105+
102106private:
103107 std::shared_ptr<SubmissionInfoImpl> impl = nullptr ;
104108};
@@ -111,9 +115,14 @@ enum class queue_state { executing, recording };
111115struct image_descriptor ;
112116
113117namespace detail {
114- template <typename CommandGroupFunc>
115- void submit_impl (queue &Q, CommandGroupFunc &&CGF,
118+ template <typename CommandGroupFunc, typename PropertiesT >
119+ void submit_impl (queue &Q, PropertiesT Props, CommandGroupFunc &&CGF,
116120 const sycl::detail::code_location &CodeLoc);
121+
122+ template <typename CommandGroupFunc, typename PropertiesT>
123+ event submit_with_event_impl (queue &Q, PropertiesT Props,
124+ CommandGroupFunc &&CGF,
125+ const sycl::detail::code_location &CodeLoc);
117126} // namespace detail
118127} // namespace ext::oneapi::experimental
119128
@@ -366,7 +375,9 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
366375 std::enable_if_t <std::is_invocable_r_v<void , T, handler &>, event> submit (
367376 T CGF,
368377 const detail::code_location &CodeLoc = detail::code_location::current()) {
369- return submit_with_event (CGF, /* SecondaryQueuePtr=*/ nullptr , CodeLoc);
378+ return submit_with_event (
379+ sycl::ext::oneapi::experimental::empty_properties_t {}, CGF,
380+ /* SecondaryQueuePtr=*/ nullptr , CodeLoc);
370381 }
371382
372383 // / Submits a command group function object to the queue, in order to be
@@ -384,7 +395,9 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
384395 std::enable_if_t <std::is_invocable_r_v<void , T, handler &>, event> submit (
385396 T CGF, queue &SecondaryQueue,
386397 const detail::code_location &CodeLoc = detail::code_location::current()) {
387- return submit_with_event (CGF, &SecondaryQueue, CodeLoc);
398+ return submit_with_event (
399+ sycl::ext::oneapi::experimental::empty_properties_t {}, CGF,
400+ &SecondaryQueue, CodeLoc);
388401 }
389402
390403 // / Prevents any commands submitted afterward to this queue from executing
@@ -2747,11 +2760,28 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
27472760 const detail::code_location &);
27482761#endif
27492762
2750- template <typename CommandGroupFunc>
2763+ template <typename CommandGroupFunc, typename PropertiesT >
27512764 friend void ext::oneapi::experimental::detail::submit_impl (
2752- queue &Q, CommandGroupFunc &&CGF,
2765+ queue &Q, PropertiesT Props, CommandGroupFunc &&CGF,
27532766 const sycl::detail::code_location &CodeLoc);
27542767
2768+ template <typename CommandGroupFunc, typename PropertiesT>
2769+ friend event ext::oneapi::experimental::detail::submit_with_event_impl (
2770+ queue &Q, PropertiesT Props, CommandGroupFunc &&CGF,
2771+ const sycl::detail::code_location &CodeLoc);
2772+
2773+ template <typename PropertiesT>
2774+ void ProcessSubmitProperties (PropertiesT Props, detail::SubmissionInfo &SI) {
2775+ if constexpr (Props.template has_property <
2776+ ext::oneapi::experimental::event_mode_key>()) {
2777+ ext::oneapi::experimental::event_mode EventModeProp =
2778+ Props.template get_property <ext::oneapi::experimental::event_mode>();
2779+ if (EventModeProp.value !=
2780+ ext::oneapi::experimental::event_mode_enum::none)
2781+ SI.EventMode () = EventModeProp.value ;
2782+ }
2783+ }
2784+
27552785#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
27562786 // / TODO: Unused. Remove these when ABI-break window is open.
27572787 event submit_impl (std::function<void (handler &)> CGH,
@@ -2800,16 +2830,18 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
28002830 // / Submits a command group function object to the queue, in order to be
28012831 // / scheduled for execution on the device.
28022832 // /
2833+ // / \param Props is a property list with submission properties.
28032834 // / \param CGF is a function object containing command group.
28042835 // / \param CodeLoc is the code location of the submit call (default argument)
28052836 // / \return a SYCL event object for the submitted command group.
2806- template <typename T>
2837+ template <typename T, typename PropertiesT >
28072838 std::enable_if_t <std::is_invocable_r_v<void , T, handler &>, event>
28082839 submit_with_event (
2809- T CGF, queue *SecondaryQueuePtr,
2840+ PropertiesT Props, T CGF, queue *SecondaryQueuePtr,
28102841 const detail::code_location &CodeLoc = detail::code_location::current()) {
28112842 detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
28122843 detail::SubmissionInfo SI{};
2844+ ProcessSubmitProperties (Props, SI);
28132845 if (SecondaryQueuePtr)
28142846 SI.SecondaryQueue () = detail::getSyclObjImpl (*SecondaryQueuePtr);
28152847#if __SYCL_USE_FALLBACK_ASSERT
@@ -2834,18 +2866,21 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
28342866 // / Submits a command group function object to the queue, in order to be
28352867 // / scheduled for execution on the device.
28362868 // /
2869+ // / \param Props is a property list with submission properties.
28372870 // / \param CGF is a function object containing command group.
28382871 // / \param CodeLoc is the code location of the submit call (default argument)
2839- template <typename T>
2872+ template <typename T, typename PropertiesT >
28402873 std::enable_if_t <std::is_invocable_r_v<void , T, handler &>, void >
2841- submit_without_event (T CGF, const detail::code_location &CodeLoc) {
2874+ submit_without_event (PropertiesT Props, T CGF,
2875+ const detail::code_location &CodeLoc) {
28422876#if __SYCL_USE_FALLBACK_ASSERT
28432877 // If post-processing is needed, fall back to the regular submit.
28442878 // TODO: Revisit whether we can avoid this.
2845- submit_with_event (CGF, nullptr , CodeLoc);
2879+ submit_with_event (Props, CGF, nullptr , CodeLoc);
28462880#else
28472881 detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
28482882 detail::SubmissionInfo SI{};
2883+ ProcessSubmitProperties (Props, SI);
28492884 submit_without_event_impl (CGF, SI, TlsCodeLocCapture.query (),
28502885 TlsCodeLocCapture.isToplevel ());
28512886#endif // __SYCL_USE_FALLBACK_ASSERT
@@ -3072,8 +3107,12 @@ event submitAssertCapture(queue &Self, event &Event, queue *SecondaryQueue,
30723107 });
30733108 };
30743109
3075- CopierEv = Self.submit_with_event (CopierCGF, SecondaryQueue, CodeLoc);
3076- CheckerEv = Self.submit_with_event (CheckerCGF, SecondaryQueue, CodeLoc);
3110+ CopierEv = Self.submit_with_event (
3111+ sycl::ext::oneapi::experimental::empty_properties_t {}, CopierCGF,
3112+ SecondaryQueue, CodeLoc);
3113+ CheckerEv = Self.submit_with_event (
3114+ sycl::ext::oneapi::experimental::empty_properties_t {}, CheckerCGF,
3115+ SecondaryQueue, CodeLoc);
30773116
30783117 return CheckerEv;
30793118}
0 commit comments