3131#include < sycl/exception_list.hpp> // for defaultAsyncHa...
3232#include < sycl/ext/oneapi/device_global/device_global.hpp> // for device_global
3333#include < sycl/ext/oneapi/device_global/properties.hpp> // for device_image_s...
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
34+ #include < sycl/ext/oneapi/experimental/event_mode_property.hpp>
35+ #include < sycl/ext/oneapi/experimental/graph.hpp> // for command_graph...
36+ #include < sycl/ext/oneapi/properties/properties.hpp> // for empty_properti...
37+ #include < sycl/handler.hpp> // for handler, isDev...
38+ #include < sycl/id.hpp> // for id
39+ #include < sycl/kernel.hpp> // for auto_name
40+ #include < sycl/kernel_handler.hpp> // for kernel_handler
41+ #include < sycl/nd_range.hpp> // for nd_range
42+ #include < sycl/property_list.hpp> // for property_list
43+ #include < sycl/range.hpp> // for range
4344
4445#include < cstddef> // for size_t
4546#include < functional> // for function
@@ -103,6 +104,9 @@ class __SYCL_EXPORT SubmissionInfo {
103104 std::shared_ptr<detail::queue_impl> &SecondaryQueue ();
104105 const std::shared_ptr<detail::queue_impl> &SecondaryQueue () const ;
105106
107+ ext::oneapi::experimental::event_mode_enum &EventMode ();
108+ const ext::oneapi::experimental::event_mode_enum &EventMode () const ;
109+
106110private:
107111 std::shared_ptr<SubmissionInfoImpl> impl = nullptr ;
108112};
@@ -115,9 +119,14 @@ enum class queue_state { executing, recording };
115119struct image_descriptor ;
116120
117121namespace detail {
118- template <typename CommandGroupFunc>
119- void submit_impl (queue &Q, CommandGroupFunc &&CGF,
122+ template <typename CommandGroupFunc, typename PropertiesT >
123+ void submit_impl (queue &Q, PropertiesT Props, CommandGroupFunc &&CGF,
120124 const sycl::detail::code_location &CodeLoc);
125+
126+ template <typename CommandGroupFunc, typename PropertiesT>
127+ event submit_with_event_impl (queue &Q, PropertiesT Props,
128+ CommandGroupFunc &&CGF,
129+ const sycl::detail::code_location &CodeLoc);
121130} // namespace detail
122131} // namespace ext::oneapi::experimental
123132
@@ -365,7 +374,9 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
365374 std::enable_if_t <std::is_invocable_r_v<void , T, handler &>, event> submit (
366375 T CGF,
367376 const detail::code_location &CodeLoc = detail::code_location::current()) {
368- return submit_with_event (CGF, /* SecondaryQueuePtr=*/ nullptr , CodeLoc);
377+ return submit_with_event (
378+ sycl::ext::oneapi::experimental::empty_properties_t {}, CGF,
379+ /* SecondaryQueuePtr=*/ nullptr , CodeLoc);
369380 }
370381
371382 // / Submits a command group function object to the queue, in order to be
@@ -383,7 +394,9 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
383394 std::enable_if_t <std::is_invocable_r_v<void , T, handler &>, event> submit (
384395 T CGF, queue &SecondaryQueue,
385396 const detail::code_location &CodeLoc = detail::code_location::current()) {
386- return submit_with_event (CGF, &SecondaryQueue, CodeLoc);
397+ return submit_with_event (
398+ sycl::ext::oneapi::experimental::empty_properties_t {}, CGF,
399+ &SecondaryQueue, CodeLoc);
387400 }
388401
389402 // / Prevents any commands submitted afterward to this queue from executing
@@ -2746,11 +2759,28 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
27462759 const detail::code_location &);
27472760#endif
27482761
2749- template <typename CommandGroupFunc>
2762+ template <typename CommandGroupFunc, typename PropertiesT >
27502763 friend void ext::oneapi::experimental::detail::submit_impl (
2751- queue &Q, CommandGroupFunc &&CGF,
2764+ queue &Q, PropertiesT Props, CommandGroupFunc &&CGF,
27522765 const sycl::detail::code_location &CodeLoc);
27532766
2767+ template <typename CommandGroupFunc, typename PropertiesT>
2768+ friend event ext::oneapi::experimental::detail::submit_with_event_impl (
2769+ queue &Q, PropertiesT Props, CommandGroupFunc &&CGF,
2770+ const sycl::detail::code_location &CodeLoc);
2771+
2772+ template <typename PropertiesT>
2773+ void ProcessSubmitProperties (PropertiesT Props, detail::SubmissionInfo &SI) {
2774+ if constexpr (Props.template has_property <
2775+ ext::oneapi::experimental::event_mode_key>()) {
2776+ ext::oneapi::experimental::event_mode EventModeProp =
2777+ Props.template get_property <ext::oneapi::experimental::event_mode>();
2778+ if (EventModeProp.value !=
2779+ ext::oneapi::experimental::event_mode_enum::none)
2780+ SI.EventMode () = EventModeProp.value ;
2781+ }
2782+ }
2783+
27542784#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
27552785 // / TODO: Unused. Remove these when ABI-break window is open.
27562786 event submit_impl (std::function<void (handler &)> CGH,
@@ -2799,16 +2829,18 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
27992829 // / Submits a command group function object to the queue, in order to be
28002830 // / scheduled for execution on the device.
28012831 // /
2832+ // / \param Props is a property list with submission properties.
28022833 // / \param CGF is a function object containing command group.
28032834 // / \param CodeLoc is the code location of the submit call (default argument)
28042835 // / \return a SYCL event object for the submitted command group.
2805- template <typename T>
2836+ template <typename T, typename PropertiesT >
28062837 std::enable_if_t <std::is_invocable_r_v<void , T, handler &>, event>
28072838 submit_with_event (
2808- T CGF, queue *SecondaryQueuePtr,
2839+ PropertiesT Props, T CGF, queue *SecondaryQueuePtr,
28092840 const detail::code_location &CodeLoc = detail::code_location::current()) {
28102841 detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
28112842 detail::SubmissionInfo SI{};
2843+ ProcessSubmitProperties (Props, SI);
28122844 if (SecondaryQueuePtr)
28132845 SI.SecondaryQueue () = detail::getSyclObjImpl (*SecondaryQueuePtr);
28142846#if __SYCL_USE_FALLBACK_ASSERT
@@ -2833,18 +2865,21 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
28332865 // / Submits a command group function object to the queue, in order to be
28342866 // / scheduled for execution on the device.
28352867 // /
2868+ // / \param Props is a property list with submission properties.
28362869 // / \param CGF is a function object containing command group.
28372870 // / \param CodeLoc is the code location of the submit call (default argument)
2838- template <typename T>
2871+ template <typename T, typename PropertiesT >
28392872 std::enable_if_t <std::is_invocable_r_v<void , T, handler &>, void >
2840- submit_without_event (T CGF, const detail::code_location &CodeLoc) {
2873+ submit_without_event (PropertiesT Props, T CGF,
2874+ const detail::code_location &CodeLoc) {
28412875#if __SYCL_USE_FALLBACK_ASSERT
28422876 // If post-processing is needed, fall back to the regular submit.
28432877 // TODO: Revisit whether we can avoid this.
2844- submit_with_event (CGF, nullptr , CodeLoc);
2878+ submit_with_event (Props, CGF, nullptr , CodeLoc);
28452879#else
28462880 detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
28472881 detail::SubmissionInfo SI{};
2882+ ProcessSubmitProperties (Props, SI);
28482883 submit_without_event_impl (CGF, SI, TlsCodeLocCapture.query (),
28492884 TlsCodeLocCapture.isToplevel ());
28502885#endif // __SYCL_USE_FALLBACK_ASSERT
@@ -3071,8 +3106,12 @@ event submitAssertCapture(queue &Self, event &Event, queue *SecondaryQueue,
30713106 });
30723107 };
30733108
3074- CopierEv = Self.submit_with_event (CopierCGF, SecondaryQueue, CodeLoc);
3075- CheckerEv = Self.submit_with_event (CheckerCGF, SecondaryQueue, CodeLoc);
3109+ CopierEv = Self.submit_with_event (
3110+ sycl::ext::oneapi::experimental::empty_properties_t {}, CopierCGF,
3111+ SecondaryQueue, CodeLoc);
3112+ CheckerEv = Self.submit_with_event (
3113+ sycl::ext::oneapi::experimental::empty_properties_t {}, CheckerCGF,
3114+ SecondaryQueue, CodeLoc);
30763115
30773116 return CheckerEv;
30783117}
0 commit comments