@@ -110,8 +110,19 @@ class pipe;
110
110
}
111
111
112
112
namespace ext ::oneapi::experimental::detail {
113
+ // List of sycl experimental extensions
114
+ // This enum is used to define the extension from which a function is called.
115
+ // This is used in handler::throwIfGraphAssociated() to specify
116
+ // the message of the thrown expection.
117
+ enum SyclExtensions {
118
+ sycl_ext_oneapi_kernel_properties,
119
+ sycl_ext_oneapi_enqueue_barrier,
120
+ sycl_ext_oneapi_memcpy2d,
121
+ sycl_ext_oneapi_device_global
122
+ };
123
+
113
124
class graph_impl ;
114
- }
125
+ } // namespace ext::oneapi::experimental::detail
115
126
namespace detail {
116
127
117
128
class handler_impl ;
@@ -2085,6 +2096,7 @@ class __SYCL_EXPORT handler {
2085
2096
std::enable_if_t <
2086
2097
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2087
2098
single_task (PropertiesT Props, _KERNELFUNCPARAM(KernelFunc)) {
2099
+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
2088
2100
single_task_lambda_impl<KernelName, KernelType, PropertiesT>(Props,
2089
2101
KernelFunc);
2090
2102
}
@@ -2095,6 +2107,7 @@ class __SYCL_EXPORT handler {
2095
2107
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2096
2108
parallel_for (range<1 > NumWorkItems, PropertiesT Props,
2097
2109
_KERNELFUNCPARAM (KernelFunc)) {
2110
+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
2098
2111
parallel_for_lambda_impl<KernelName, KernelType, 1 , PropertiesT>(
2099
2112
NumWorkItems, Props, std::move (KernelFunc));
2100
2113
}
@@ -2105,6 +2118,7 @@ class __SYCL_EXPORT handler {
2105
2118
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2106
2119
parallel_for (range<2 > NumWorkItems, PropertiesT Props,
2107
2120
_KERNELFUNCPARAM (KernelFunc)) {
2121
+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
2108
2122
parallel_for_lambda_impl<KernelName, KernelType, 2 , PropertiesT>(
2109
2123
NumWorkItems, Props, std::move (KernelFunc));
2110
2124
}
@@ -2115,6 +2129,7 @@ class __SYCL_EXPORT handler {
2115
2129
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2116
2130
parallel_for (range<3 > NumWorkItems, PropertiesT Props,
2117
2131
_KERNELFUNCPARAM (KernelFunc)) {
2132
+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
2118
2133
parallel_for_lambda_impl<KernelName, KernelType, 3 , PropertiesT>(
2119
2134
NumWorkItems, Props, std::move (KernelFunc));
2120
2135
}
@@ -2125,6 +2140,7 @@ class __SYCL_EXPORT handler {
2125
2140
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2126
2141
parallel_for (nd_range<Dims> Range, PropertiesT Properties,
2127
2142
_KERNELFUNCPARAM (KernelFunc)) {
2143
+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
2128
2144
parallel_for_impl<KernelName>(Range, Properties, std::move (KernelFunc));
2129
2145
}
2130
2146
@@ -2137,6 +2153,7 @@ class __SYCL_EXPORT handler {
2137
2153
detail::AreAllButLastReductions<RestT...>::value &&
2138
2154
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2139
2155
parallel_for(range<1 > Range, PropertiesT Properties, RestT &&...Rest) {
2156
+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
2140
2157
detail::reduction_parallel_for<KernelName>(*this , Range, Properties,
2141
2158
std::forward<RestT>(Rest)...);
2142
2159
}
@@ -2148,6 +2165,7 @@ class __SYCL_EXPORT handler {
2148
2165
detail::AreAllButLastReductions<RestT...>::value &&
2149
2166
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2150
2167
parallel_for(range<2 > Range, PropertiesT Properties, RestT &&...Rest) {
2168
+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
2151
2169
detail::reduction_parallel_for<KernelName>(*this , Range, Properties,
2152
2170
std::forward<RestT>(Rest)...);
2153
2171
}
@@ -2159,6 +2177,7 @@ class __SYCL_EXPORT handler {
2159
2177
detail::AreAllButLastReductions<RestT...>::value &&
2160
2178
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2161
2179
parallel_for(range<3 > Range, PropertiesT Properties, RestT &&...Rest) {
2180
+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
2162
2181
detail::reduction_parallel_for<KernelName>(*this , Range, Properties,
2163
2182
std::forward<RestT>(Rest)...);
2164
2183
}
@@ -2213,6 +2232,7 @@ class __SYCL_EXPORT handler {
2213
2232
int Dims, typename PropertiesT>
2214
2233
void parallel_for_work_group (range<Dims> NumWorkGroups, PropertiesT Props,
2215
2234
_KERNELFUNCPARAM (KernelFunc)) {
2235
+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
2216
2236
parallel_for_work_group_lambda_impl<KernelName, KernelType, Dims,
2217
2237
PropertiesT>(NumWorkGroups, Props,
2218
2238
KernelFunc);
@@ -2223,6 +2243,7 @@ class __SYCL_EXPORT handler {
2223
2243
void parallel_for_work_group (range<Dims> NumWorkGroups,
2224
2244
range<Dims> WorkGroupSize, PropertiesT Props,
2225
2245
_KERNELFUNCPARAM (KernelFunc)) {
2246
+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
2226
2247
parallel_for_work_group_lambda_impl<KernelName, KernelType, Dims,
2227
2248
PropertiesT>(
2228
2249
NumWorkGroups, WorkGroupSize, Props, KernelFunc);
@@ -2530,6 +2551,8 @@ class __SYCL_EXPORT handler {
2530
2551
// / until all commands previously submitted to this queue have entered the
2531
2552
// / complete state.
2532
2553
void ext_oneapi_barrier () {
2554
+ throwIfGraphAssociated<ext::oneapi::experimental::detail::SyclExtensions::
2555
+ sycl_ext_oneapi_enqueue_barrier>();
2533
2556
throwIfActionIsCreated ();
2534
2557
setType (detail::CG::Barrier);
2535
2558
}
@@ -2615,6 +2638,8 @@ class __SYCL_EXPORT handler {
2615
2638
typename = std::enable_if_t <std::is_same_v<T, unsigned char >>>
2616
2639
void ext_oneapi_memcpy2d (void *Dest, size_t DestPitch, const void *Src,
2617
2640
size_t SrcPitch, size_t Width, size_t Height) {
2641
+ throwIfGraphAssociated<ext::oneapi::experimental::detail::SyclExtensions::
2642
+ sycl_ext_oneapi_memcpy2d>();
2618
2643
throwIfActionIsCreated ();
2619
2644
if (Width > DestPitch)
2620
2645
throw sycl::exception (sycl::make_error_code (errc::invalid),
@@ -2793,6 +2818,8 @@ class __SYCL_EXPORT handler {
2793
2818
void memcpy (ext::oneapi::experimental::device_global<T, PropertyListT> &Dest,
2794
2819
const void *Src, size_t NumBytes = sizeof (T),
2795
2820
size_t DestOffset = 0) {
2821
+ throwIfGraphAssociated<ext::oneapi::experimental::detail::SyclExtensions::
2822
+ sycl_ext_oneapi_device_global>();
2796
2823
if (sizeof (T) < DestOffset + NumBytes)
2797
2824
throw sycl::exception (make_error_code (errc::invalid),
2798
2825
" Copy to device_global is out of bounds." );
@@ -2825,6 +2852,8 @@ class __SYCL_EXPORT handler {
2825
2852
memcpy (void *Dest,
2826
2853
const ext::oneapi::experimental::device_global<T, PropertyListT> &Src,
2827
2854
size_t NumBytes = sizeof (T), size_t SrcOffset = 0) {
2855
+ throwIfGraphAssociated<ext::oneapi::experimental::detail::SyclExtensions::
2856
+ sycl_ext_oneapi_device_global>();
2828
2857
if (sizeof (T) < SrcOffset + NumBytes)
2829
2858
throw sycl::exception (make_error_code (errc::invalid),
2830
2859
" Copy from device_global is out of bounds." );
@@ -3346,8 +3375,21 @@ class __SYCL_EXPORT handler {
3346
3375
" handler::require() before it can be used." );
3347
3376
}
3348
3377
3378
+ template <typename PropertiesT>
3379
+ std::enable_if_t <
3380
+ ext::oneapi::experimental::is_property_list<PropertiesT>::value>
3381
+ throwIfGraphAssociatedAndKernelProperties () {
3382
+ if (!std::is_same_v<PropertiesT,
3383
+ ext::oneapi::experimental::detail::empty_properties_t >)
3384
+ throwIfGraphAssociated<ext::oneapi::experimental::detail::SyclExtensions::
3385
+ sycl_ext_oneapi_kernel_properties>();
3386
+ }
3387
+
3349
3388
// Set value of the gpu cache configuration for the kernel.
3350
3389
void setKernelCacheConfig (sycl::detail::pi::PiKernelCacheConfig);
3390
+
3391
+ template <ext::oneapi::experimental::detail::SyclExtensions ExtensionT>
3392
+ void throwIfGraphAssociated ();
3351
3393
};
3352
3394
} // namespace _V1
3353
3395
} // namespace sycl
0 commit comments