30
30
#include < sycl/exception_list.hpp> // for defaultAsyncHa...
31
31
#include < sycl/ext/oneapi/device_global/device_global.hpp> // for device_global
32
32
#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
42
43
43
44
#include < cstddef> // for size_t
44
45
#include < functional> // for function
@@ -99,6 +100,9 @@ class __SYCL_EXPORT SubmissionInfo {
99
100
std::shared_ptr<detail::queue_impl> &SecondaryQueue ();
100
101
const std::shared_ptr<detail::queue_impl> &SecondaryQueue () const ;
101
102
103
+ ext::oneapi::experimental::event_mode_enum &EventMode ();
104
+ const ext::oneapi::experimental::event_mode_enum &EventMode () const ;
105
+
102
106
private:
103
107
std::shared_ptr<SubmissionInfoImpl> impl = nullptr ;
104
108
};
@@ -111,9 +115,14 @@ enum class queue_state { executing, recording };
111
115
struct image_descriptor ;
112
116
113
117
namespace 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,
116
120
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);
117
126
} // namespace detail
118
127
} // namespace ext::oneapi::experimental
119
128
@@ -366,7 +375,9 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
366
375
std::enable_if_t <std::is_invocable_r_v<void , T, handler &>, event> submit (
367
376
T CGF,
368
377
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);
370
381
}
371
382
372
383
// / 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> {
384
395
std::enable_if_t <std::is_invocable_r_v<void , T, handler &>, event> submit (
385
396
T CGF, queue &SecondaryQueue,
386
397
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);
388
401
}
389
402
390
403
// / Prevents any commands submitted afterward to this queue from executing
@@ -2747,11 +2760,28 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
2747
2760
const detail::code_location &);
2748
2761
#endif
2749
2762
2750
- template <typename CommandGroupFunc>
2763
+ template <typename CommandGroupFunc, typename PropertiesT >
2751
2764
friend void ext::oneapi::experimental::detail::submit_impl (
2752
- queue &Q, CommandGroupFunc &&CGF,
2765
+ queue &Q, PropertiesT Props, CommandGroupFunc &&CGF,
2753
2766
const sycl::detail::code_location &CodeLoc);
2754
2767
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
+
2755
2785
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
2756
2786
// / TODO: Unused. Remove these when ABI-break window is open.
2757
2787
event submit_impl (std::function<void (handler &)> CGH,
@@ -2800,16 +2830,18 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
2800
2830
// / Submits a command group function object to the queue, in order to be
2801
2831
// / scheduled for execution on the device.
2802
2832
// /
2833
+ // / \param Props is a property list with submission properties.
2803
2834
// / \param CGF is a function object containing command group.
2804
2835
// / \param CodeLoc is the code location of the submit call (default argument)
2805
2836
// / \return a SYCL event object for the submitted command group.
2806
- template <typename T>
2837
+ template <typename T, typename PropertiesT >
2807
2838
std::enable_if_t <std::is_invocable_r_v<void , T, handler &>, event>
2808
2839
submit_with_event (
2809
- T CGF, queue *SecondaryQueuePtr,
2840
+ PropertiesT Props, T CGF, queue *SecondaryQueuePtr,
2810
2841
const detail::code_location &CodeLoc = detail::code_location::current()) {
2811
2842
detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
2812
2843
detail::SubmissionInfo SI{};
2844
+ ProcessSubmitProperties (Props, SI);
2813
2845
if (SecondaryQueuePtr)
2814
2846
SI.SecondaryQueue () = detail::getSyclObjImpl (*SecondaryQueuePtr);
2815
2847
#if __SYCL_USE_FALLBACK_ASSERT
@@ -2834,18 +2866,21 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
2834
2866
// / Submits a command group function object to the queue, in order to be
2835
2867
// / scheduled for execution on the device.
2836
2868
// /
2869
+ // / \param Props is a property list with submission properties.
2837
2870
// / \param CGF is a function object containing command group.
2838
2871
// / \param CodeLoc is the code location of the submit call (default argument)
2839
- template <typename T>
2872
+ template <typename T, typename PropertiesT >
2840
2873
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) {
2842
2876
#if __SYCL_USE_FALLBACK_ASSERT
2843
2877
// If post-processing is needed, fall back to the regular submit.
2844
2878
// TODO: Revisit whether we can avoid this.
2845
- submit_with_event (CGF, nullptr , CodeLoc);
2879
+ submit_with_event (Props, CGF, nullptr , CodeLoc);
2846
2880
#else
2847
2881
detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
2848
2882
detail::SubmissionInfo SI{};
2883
+ ProcessSubmitProperties (Props, SI);
2849
2884
submit_without_event_impl (CGF, SI, TlsCodeLocCapture.query (),
2850
2885
TlsCodeLocCapture.isToplevel ());
2851
2886
#endif // __SYCL_USE_FALLBACK_ASSERT
@@ -3072,8 +3107,12 @@ event submitAssertCapture(queue &Self, event &Event, queue *SecondaryQueue,
3072
3107
});
3073
3108
};
3074
3109
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);
3077
3116
3078
3117
return CheckerEv;
3079
3118
}
0 commit comments