Skip to content

Commit 7c45672

Browse files
committed
Change to properties on submit
Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 9110431 commit 7c45672

File tree

3 files changed

+36
-47
lines changed

3 files changed

+36
-47
lines changed

sycl/doc/extensions/experimental/sycl_ext_oneapi_enqueue_functions.asciidoc

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ a!
230230
----
231231
namespace sycl::ext::oneapi::experimental {
232232
233-
template <typename CommandGroupFunc>
234-
void submit(sycl::queue q, CommandGroupFunc&& cgf);
233+
template <typename CommandGroupFunc, typename Properties = empty_properties_t>
234+
void submit(sycl::queue q, CommandGroupFunc&& cgf, Properties properties = {});
235235
236236
}
237237
----
@@ -247,8 +247,9 @@ a!
247247
----
248248
namespace sycl::ext::oneapi::experimental {
249249
250-
template <typename CommandGroupFunc>
251-
sycl::event submit_with_event(sycl::queue q, CommandGroupFunc&& cgf);
250+
template <typename CommandGroupFunc, typename Properties = empty_properties_t>
251+
sycl::event submit_with_event(sycl::queue q, CommandGroupFunc&& cgf,
252+
Properties properties = {});
252253
253254
}
254255
----
@@ -670,11 +671,9 @@ a!
670671
----
671672
namespace sycl::ext::oneapi::experimental {
672673
673-
template <typename Properties = empty_properties_t>
674-
void barrier(sycl::queue q, Properties properties = {});
674+
void barrier(sycl::queue q);
675675
676-
template <typename Properties = empty_properties_t>
677-
void barrier(sycl::handler h, Properties properties = {});
676+
void barrier(sycl::handler h);
678677
679678
}
680679
----
@@ -692,13 +691,9 @@ a!
692691
----
693692
namespace sycl::ext::oneapi::experimental {
694693
695-
template <typename Properties = empty_properties_t>
696-
void partial_barrier(sycl::queue q, const std::vector<sycl::event>& events,
697-
Properties properties = {});
694+
void partial_barrier(sycl::queue q, const std::vector<sycl::event>& events);
698695
699-
template <typename Properties = empty_properties_t>
700-
void partial_barrier(sycl::handler h, const std::vector<sycl::event>& events,
701-
Properties properties = {});
696+
void partial_barrier(sycl::handler h, const std::vector<sycl::event>& events);
702697
703698
}
704699
----

sycl/doc/extensions/proposed/sycl_ext_intel_low_power_event.asciidoc

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ On some backends, calling `wait()` on a `event` will synchronize using a
6969
busy-waiting implementation. Though this comes at a low latency for the
7070
synchronization of the event, it has the downside of consuming high amounts of
7171
CPU time for no meaningful work. This extension introduces a new property for
72-
`sycl::ext::oneapi::experimental::barrier()` that will produce a "low-power"
73-
event. These new low-power events will, if possible, yield the thread that the
74-
`wait()` member function is called on and only wake up occasionally to check if
75-
the event has finished. This reduces the time the CPU spends checking finish
76-
condition of the wait, at the cost of latency.
72+
SYCL commands that will produce a "low-power" event. These new low-power events
73+
will, if possible, yield the thread that the `wait()` member function is called
74+
on and only wake up occasionally to check if the event has finished. This
75+
reduces the time the CPU spends checking finish condition of the wait, at the
76+
cost of latency.
7777

7878

7979
== Specification
@@ -101,15 +101,20 @@ supports.
101101

102102
=== Low-power event property
103103

104-
This extension also adds a new property which can be used with the `barrier`
105-
and `partial_barrier` enqueue free functions from
104+
This extension adds a new property which can be used with the
105+
`submit_with_event` free function from
106106
link:../experimental/sycl_ext_oneapi_enqueue_functions.asciidoc[sycl_ext_oneapi_enqueue_functions].
107107
Passing this property to either of these functions will act as a hint to the
108108
`event` created from the corresponding commands to do low-power synchronization.
109109
If the backend is able to handle low-power events, calling `event::wait()` or
110110
`event::wait_and_throw()` will cause the thread to yield and only do occasional
111111
wake-ups to check the event progress.
112112

113+
[_Note:_ The property currently only has an effect on `barrier` and
114+
`partial_barrier` commands enqueued on queues that return
115+
`backend::ext_oneapi_level_zero` from `queue::get_backend()`.
116+
_{endnote}_]
117+
113118
```
114119
namespace sycl::ext::intel::experimental {
115120

@@ -140,10 +145,10 @@ int main() {
140145
// Submit some work to the queue.
141146
oneapiex::submit(Q, [&](sycl::handler &CGH) {...});
142147

143-
// Submit a barrier with the low-power event property.
148+
// Submit a command with the low-power event property.
144149
sycl::event E = oneapiex::submit_with_event(Q, [&](sycl::handler &CGH) {
145-
oneapiex::barrier(CGH, oneapiex::properties{intelex::low_power_event});
146-
});
150+
...
151+
}, oneapiex::properties{intelex::low_power_event});
147152

148153
// Waiting for the resulting event will use low-power waiting if possible.
149154
E.wait();

sycl/include/sycl/ext/oneapi/experimental/enqueue_functions.hpp

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,20 @@ void submit_impl(queue &Q, CommandGroupFunc &&CGF,
9595
}
9696
} // namespace detail
9797

98-
template <typename CommandGroupFunc>
99-
void submit(queue Q, CommandGroupFunc &&CGF,
98+
template <typename CommandGroupFunc, typename PropertiesT = empty_properties_t>
99+
void submit(queue Q, CommandGroupFunc &&CGF, PropertiesT Props = {},
100100
const sycl::detail::code_location &CodeLoc =
101101
sycl::detail::code_location::current()) {
102+
std::ignore = Props;
102103
sycl::ext::oneapi::experimental::detail::submit_impl(
103104
Q, std::forward<CommandGroupFunc>(CGF), CodeLoc);
104105
}
105106

106-
template <typename CommandGroupFunc>
107-
event submit_with_event(queue Q, CommandGroupFunc &&CGF,
107+
template <typename CommandGroupFunc, typename PropertiesT = empty_properties_t>
108+
event submit_with_event(queue Q, CommandGroupFunc &&CGF, PropertiesT Props = {},
108109
const sycl::detail::code_location &CodeLoc =
109110
sycl::detail::code_location::current()) {
111+
std::ignore = Props;
110112
return Q.submit(std::forward<CommandGroupFunc>(CGF), CodeLoc);
111113
}
112114

@@ -349,34 +351,21 @@ __SYCL_EXPORT void mem_advise(queue Q, void *Ptr, size_t NumBytes, int Advice,
349351
const sycl::detail::code_location &CodeLoc =
350352
sycl::detail::code_location::current());
351353

352-
template <typename PropertiesT = empty_properties_t>
353-
inline void barrier(handler &CGH, PropertiesT Properties = {}) {
354-
std::ignore = Properties;
355-
CGH.ext_oneapi_barrier();
356-
}
354+
inline void barrier(handler &CGH) { CGH.ext_oneapi_barrier(); }
357355

358-
template <typename PropertiesT = empty_properties_t>
359-
inline void barrier(queue Q, PropertiesT Properties = {},
360-
const sycl::detail::code_location &CodeLoc =
361-
sycl::detail::code_location::current()) {
362-
submit(Q, [&](handler &CGH) { barrier(CGH, Properties); }, CodeLoc);
356+
inline void barrier(queue Q, const sycl::detail::code_location &CodeLoc =
357+
sycl::detail::code_location::current()) {
358+
submit(Q, [&](handler &CGH) { barrier(CGH); }, CodeLoc);
363359
}
364360

365-
template <typename PropertiesT = empty_properties_t>
366-
inline void partial_barrier(handler &CGH, const std::vector<event> &Events,
367-
PropertiesT Properties = {}) {
368-
std::ignore = Properties;
361+
inline void partial_barrier(handler &CGH, const std::vector<event> &Events) {
369362
CGH.ext_oneapi_barrier(Events);
370363
}
371364

372-
template <typename PropertiesT = empty_properties_t>
373365
inline void partial_barrier(queue Q, const std::vector<event> &Events,
374-
PropertiesT Properties = {},
375366
const sycl::detail::code_location &CodeLoc =
376367
sycl::detail::code_location::current()) {
377-
submit(
378-
Q, [&](handler &CGH) { partial_barrier(CGH, Events, Properties); },
379-
CodeLoc);
368+
submit(Q, [&](handler &CGH) { partial_barrier(CGH, Events); }, CodeLoc);
380369
}
381370

382371
} // namespace ext::oneapi::experimental

0 commit comments

Comments
 (0)