Skip to content

Commit 9e1bfc6

Browse files
committed
[SYCL] Deprecate parallel_for and single_task overloads in the sycl_ext_oneapi_kernel_properties extension
Signed-off-by: Hu, Peisen <[email protected]>
1 parent 5e61f8f commit 9e1bfc6

File tree

2 files changed

+76
-38
lines changed

2 files changed

+76
-38
lines changed

sycl/include/sycl/handler.hpp

Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2314,9 +2314,12 @@ class __SYCL_EXPORT handler {
23142314

23152315
template <typename KernelName = detail::auto_name, typename KernelType,
23162316
typename PropertiesT>
2317-
std::enable_if_t<
2318-
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2319-
single_task(PropertiesT Props, _KERNELFUNCPARAM(KernelFunc)) {
2317+
__SYCL2020_DEPRECATED(
2318+
"Use sycl::ext::oneapi::experimental::single_task (provided in the "
2319+
"sycl_ext_oneapi_enqueue_functions extension) instead.")
2320+
std::enable_if_t<ext::oneapi::experimental::is_property_list<
2321+
PropertiesT>::value> single_task(PropertiesT Props,
2322+
_KERNELFUNCPARAM(KernelFunc)) {
23202323
single_task_lambda_impl<KernelName, KernelType, PropertiesT>(Props,
23212324
KernelFunc);
23222325
}
@@ -2364,11 +2367,15 @@ class __SYCL_EXPORT handler {
23642367

23652368
template <typename KernelName = detail::auto_name, typename PropertiesT,
23662369
typename... RestT>
2367-
std::enable_if_t<
2368-
(sizeof...(RestT) > 1) &&
2369-
detail::AreAllButLastReductions<RestT...>::value &&
2370-
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2371-
parallel_for(range<1> Range, PropertiesT Properties, RestT &&...Rest) {
2370+
__SYCL2020_DEPRECATED(
2371+
"Use sycl::ext::oneapi::experimental::parallel_for (provided in the "
2372+
"sycl_ext_oneapi_enqueue_functions extension) instead.")
2373+
std::enable_if_t<(sizeof...(RestT) > 1) &&
2374+
detail::AreAllButLastReductions<RestT...>::value &&
2375+
ext::oneapi::experimental::is_property_list<
2376+
PropertiesT>::value> parallel_for(range<1> Range,
2377+
PropertiesT Properties,
2378+
RestT &&...Rest) {
23722379
#ifndef __SYCL_DEVICE_ONLY__
23732380
throwIfGraphAssociated<ext::oneapi::experimental::detail::
23742381
UnsupportedGraphFeatures::sycl_reductions>();
@@ -2379,11 +2386,15 @@ class __SYCL_EXPORT handler {
23792386

23802387
template <typename KernelName = detail::auto_name, typename PropertiesT,
23812388
typename... RestT>
2382-
std::enable_if_t<
2383-
(sizeof...(RestT) > 1) &&
2384-
detail::AreAllButLastReductions<RestT...>::value &&
2385-
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2386-
parallel_for(range<2> Range, PropertiesT Properties, RestT &&...Rest) {
2389+
__SYCL2020_DEPRECATED(
2390+
"Use sycl::ext::oneapi::experimental::parallel_for (provided in the "
2391+
"sycl_ext_oneapi_enqueue_functions extension) instead.")
2392+
std::enable_if_t<(sizeof...(RestT) > 1) &&
2393+
detail::AreAllButLastReductions<RestT...>::value &&
2394+
ext::oneapi::experimental::is_property_list<
2395+
PropertiesT>::value> parallel_for(range<2> Range,
2396+
PropertiesT Properties,
2397+
RestT &&...Rest) {
23872398
#ifndef __SYCL_DEVICE_ONLY__
23882399
throwIfGraphAssociated<ext::oneapi::experimental::detail::
23892400
UnsupportedGraphFeatures::sycl_reductions>();
@@ -2394,11 +2405,15 @@ class __SYCL_EXPORT handler {
23942405

23952406
template <typename KernelName = detail::auto_name, typename PropertiesT,
23962407
typename... RestT>
2397-
std::enable_if_t<
2398-
(sizeof...(RestT) > 1) &&
2399-
detail::AreAllButLastReductions<RestT...>::value &&
2400-
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2401-
parallel_for(range<3> Range, PropertiesT Properties, RestT &&...Rest) {
2408+
__SYCL2020_DEPRECATED(
2409+
"Use sycl::ext::oneapi::experimental::parallel_for (provided in the "
2410+
"sycl_ext_oneapi_enqueue_functions extension) instead.")
2411+
std::enable_if_t<(sizeof...(RestT) > 1) &&
2412+
detail::AreAllButLastReductions<RestT...>::value &&
2413+
ext::oneapi::experimental::is_property_list<
2414+
PropertiesT>::value> parallel_for(range<3> Range,
2415+
PropertiesT Properties,
2416+
RestT &&...Rest) {
24022417
#ifndef __SYCL_DEVICE_ONLY__
24032418
throwIfGraphAssociated<ext::oneapi::experimental::detail::
24042419
UnsupportedGraphFeatures::sycl_reductions>();
@@ -2433,11 +2448,15 @@ class __SYCL_EXPORT handler {
24332448

24342449
template <typename KernelName = detail::auto_name, int Dims,
24352450
typename PropertiesT, typename... RestT>
2436-
std::enable_if_t<
2437-
(sizeof...(RestT) > 1) &&
2438-
detail::AreAllButLastReductions<RestT...>::value &&
2439-
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2440-
parallel_for(nd_range<Dims> Range, PropertiesT Properties, RestT &&...Rest) {
2451+
__SYCL2020_DEPRECATED(
2452+
"Use sycl::ext::oneapi::experimental::parallel_for (provided in the "
2453+
"sycl_ext_oneapi_enqueue_functions extension) instead.")
2454+
std::enable_if_t<(sizeof...(RestT) > 1) &&
2455+
detail::AreAllButLastReductions<RestT...>::value &&
2456+
ext::oneapi::experimental::is_property_list<
2457+
PropertiesT>::value> parallel_for(nd_range<Dims> Range,
2458+
PropertiesT Properties,
2459+
RestT &&...Rest) {
24412460
#ifndef __SYCL_DEVICE_ONLY__
24422461
throwIfGraphAssociated<ext::oneapi::experimental::detail::
24432462
UnsupportedGraphFeatures::sycl_reductions>();
@@ -2459,6 +2478,9 @@ class __SYCL_EXPORT handler {
24592478

24602479
template <typename KernelName = detail::auto_name, typename KernelType,
24612480
int Dims, typename PropertiesT>
2481+
__SYCL2020_DEPRECATED(
2482+
"Use sycl::ext::oneapi::experimental::parallel_for (provided in the "
2483+
"sycl_ext_oneapi_enqueue_functions extension) instead.")
24622484
void parallel_for_work_group(range<Dims> NumWorkGroups, PropertiesT Props,
24632485
_KERNELFUNCPARAM(KernelFunc)) {
24642486
parallel_for_work_group_lambda_impl<KernelName, KernelType, Dims,
@@ -2468,6 +2490,9 @@ class __SYCL_EXPORT handler {
24682490

24692491
template <typename KernelName = detail::auto_name, typename KernelType,
24702492
int Dims, typename PropertiesT>
2493+
__SYCL2020_DEPRECATED(
2494+
"Use sycl::ext::oneapi::experimental::parallel_for (provided in the "
2495+
"sycl_ext_oneapi_enqueue_functions extension) instead.")
24712496
void parallel_for_work_group(range<Dims> NumWorkGroups,
24722497
range<Dims> WorkGroupSize, PropertiesT Props,
24732498
_KERNELFUNCPARAM(KernelFunc)) {

sycl/include/sycl/queue.hpp

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2089,11 +2089,14 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
20892089
/// \param CodeLoc contains the code location of user code
20902090
template <typename KernelName = detail::auto_name, typename KernelType,
20912091
typename PropertiesT>
2092+
__SYCL2020_DEPRECATED(
2093+
"Use sycl::ext::oneapi::experimental::single_task (provided in the "
2094+
"sycl_ext_oneapi_enqueue_functions extension) instead.")
20922095
std::enable_if_t<
2093-
ext::oneapi::experimental::is_property_list<PropertiesT>::value, event>
2094-
single_task(
2095-
PropertiesT Properties, _KERNELFUNCPARAM(KernelFunc),
2096-
const detail::code_location &CodeLoc = detail::code_location::current()) {
2096+
ext::oneapi::experimental::is_property_list<PropertiesT>::value,
2097+
event> single_task(PropertiesT Properties, _KERNELFUNCPARAM(KernelFunc),
2098+
const detail::code_location &CodeLoc =
2099+
detail::code_location::current()) {
20972100
static_assert(
20982101
(detail::check_fn_signature<std::remove_reference_t<KernelType>,
20992102
void()>::value ||
@@ -2131,11 +2134,15 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
21312134
/// \param CodeLoc contains the code location of user code
21322135
template <typename KernelName = detail::auto_name, typename KernelType,
21332136
typename PropertiesT>
2137+
__SYCL2020_DEPRECATED(
2138+
"Use sycl::ext::oneapi::experimental::single_task (provided in the "
2139+
"sycl_ext_oneapi_enqueue_functions extension) instead.")
21342140
std::enable_if_t<
2135-
ext::oneapi::experimental::is_property_list<PropertiesT>::value, event>
2136-
single_task(
2137-
event DepEvent, PropertiesT Properties, _KERNELFUNCPARAM(KernelFunc),
2138-
const detail::code_location &CodeLoc = detail::code_location::current()) {
2141+
ext::oneapi::experimental::is_property_list<PropertiesT>::value,
2142+
event> single_task(event DepEvent, PropertiesT Properties,
2143+
_KERNELFUNCPARAM(KernelFunc),
2144+
const detail::code_location &CodeLoc =
2145+
detail::code_location::current()) {
21392146
static_assert(
21402147
(detail::check_fn_signature<std::remove_reference_t<KernelType>,
21412148
void()>::value ||
@@ -2177,12 +2184,15 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
21772184
/// \param CodeLoc contains the code location of user code
21782185
template <typename KernelName = detail::auto_name, typename KernelType,
21792186
typename PropertiesT>
2187+
__SYCL2020_DEPRECATED(
2188+
"Use sycl::ext::oneapi::experimental::single_task (provided in the "
2189+
"sycl_ext_oneapi_enqueue_functions extension) instead.")
21802190
std::enable_if_t<
2181-
ext::oneapi::experimental::is_property_list<PropertiesT>::value, event>
2182-
single_task(
2183-
const std::vector<event> &DepEvents, PropertiesT Properties,
2184-
_KERNELFUNCPARAM(KernelFunc),
2185-
const detail::code_location &CodeLoc = detail::code_location::current()) {
2191+
ext::oneapi::experimental::is_property_list<PropertiesT>::value,
2192+
event> single_task(const std::vector<event> &DepEvents,
2193+
PropertiesT Properties, _KERNELFUNCPARAM(KernelFunc),
2194+
const detail::code_location &CodeLoc =
2195+
detail::code_location::current()) {
21862196
static_assert(
21872197
(detail::check_fn_signature<std::remove_reference_t<KernelType>,
21882198
void()>::value ||
@@ -2428,11 +2438,14 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
24282438
/// const KernelType &KernelFunc".
24292439
template <typename KernelName = detail::auto_name, int Dims,
24302440
typename PropertiesT, typename... RestT>
2441+
__SYCL2020_DEPRECATED(
2442+
"Use sycl::ext::oneapi::experimental::parallel_for (provided in the "
2443+
"sycl_ext_oneapi_enqueue_functions extension) instead.")
24312444
std::enable_if_t<
24322445
detail::AreAllButLastReductions<RestT...>::value &&
24332446
ext::oneapi::experimental::is_property_list<PropertiesT>::value,
2434-
event>
2435-
parallel_for(nd_range<Dims> Range, PropertiesT Properties, RestT &&...Rest) {
2447+
event> parallel_for(nd_range<Dims> Range, PropertiesT Properties,
2448+
RestT &&...Rest) {
24362449
constexpr detail::code_location CodeLoc = getCodeLocation<KernelName>();
24372450
detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc);
24382451
return submit(

0 commit comments

Comments
 (0)