@@ -135,7 +135,7 @@ class pipe;
135
135
136
136
namespace ext ::oneapi::experimental::detail {
137
137
class graph_impl ;
138
- }
138
+ } // namespace ext::oneapi::experimental::detail
139
139
namespace detail {
140
140
141
141
class handler_impl ;
@@ -1578,6 +1578,10 @@ class __SYCL_EXPORT handler {
1578
1578
void set_specialization_constant (
1579
1579
typename std::remove_reference_t <decltype (SpecName)>::value_type Value) {
1580
1580
1581
+ throwIfGraphAssociated<
1582
+ ext::oneapi::experimental::detail::UnsupportedGraphFeatures::
1583
+ sycl_specialization_constants>();
1584
+
1581
1585
setStateSpecConstSet ();
1582
1586
1583
1587
std::shared_ptr<detail::kernel_bundle_impl> KernelBundleImplPtr =
@@ -1592,6 +1596,10 @@ class __SYCL_EXPORT handler {
1592
1596
typename std::remove_reference_t <decltype (SpecName)>::value_type
1593
1597
get_specialization_constant() const {
1594
1598
1599
+ throwIfGraphAssociated<
1600
+ ext::oneapi::experimental::detail::UnsupportedGraphFeatures::
1601
+ sycl_specialization_constants>();
1602
+
1595
1603
if (isStateExplicitKernelBundle ())
1596
1604
throw sycl::exception (make_error_code (errc::invalid),
1597
1605
" Specialization constants cannot be read after "
@@ -2107,6 +2115,7 @@ class __SYCL_EXPORT handler {
2107
2115
std::enable_if_t <
2108
2116
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2109
2117
single_task (PropertiesT Props, _KERNELFUNCPARAM(KernelFunc)) {
2118
+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
2110
2119
single_task_lambda_impl<KernelName, KernelType, PropertiesT>(Props,
2111
2120
KernelFunc);
2112
2121
}
@@ -2117,6 +2126,7 @@ class __SYCL_EXPORT handler {
2117
2126
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2118
2127
parallel_for (range<1 > NumWorkItems, PropertiesT Props,
2119
2128
_KERNELFUNCPARAM (KernelFunc)) {
2129
+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
2120
2130
parallel_for_lambda_impl<KernelName, KernelType, 1 , PropertiesT>(
2121
2131
NumWorkItems, Props, std::move (KernelFunc));
2122
2132
}
@@ -2127,6 +2137,7 @@ class __SYCL_EXPORT handler {
2127
2137
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2128
2138
parallel_for (range<2 > NumWorkItems, PropertiesT Props,
2129
2139
_KERNELFUNCPARAM (KernelFunc)) {
2140
+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
2130
2141
parallel_for_lambda_impl<KernelName, KernelType, 2 , PropertiesT>(
2131
2142
NumWorkItems, Props, std::move (KernelFunc));
2132
2143
}
@@ -2137,6 +2148,7 @@ class __SYCL_EXPORT handler {
2137
2148
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2138
2149
parallel_for (range<3 > NumWorkItems, PropertiesT Props,
2139
2150
_KERNELFUNCPARAM (KernelFunc)) {
2151
+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
2140
2152
parallel_for_lambda_impl<KernelName, KernelType, 3 , PropertiesT>(
2141
2153
NumWorkItems, Props, std::move (KernelFunc));
2142
2154
}
@@ -2147,6 +2159,7 @@ class __SYCL_EXPORT handler {
2147
2159
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2148
2160
parallel_for (nd_range<Dims> Range, PropertiesT Properties,
2149
2161
_KERNELFUNCPARAM (KernelFunc)) {
2162
+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
2150
2163
parallel_for_impl<KernelName>(Range, Properties, std::move (KernelFunc));
2151
2164
}
2152
2165
@@ -2159,6 +2172,9 @@ class __SYCL_EXPORT handler {
2159
2172
detail::AreAllButLastReductions<RestT...>::value &&
2160
2173
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2161
2174
parallel_for(range<1 > Range, PropertiesT Properties, RestT &&...Rest) {
2175
+ throwIfGraphAssociated<ext::oneapi::experimental::detail::
2176
+ UnsupportedGraphFeatures::sycl_reductions>();
2177
+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
2162
2178
detail::reduction_parallel_for<KernelName>(*this , Range, Properties,
2163
2179
std::forward<RestT>(Rest)...);
2164
2180
}
@@ -2170,6 +2186,9 @@ class __SYCL_EXPORT handler {
2170
2186
detail::AreAllButLastReductions<RestT...>::value &&
2171
2187
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2172
2188
parallel_for(range<2 > Range, PropertiesT Properties, RestT &&...Rest) {
2189
+ throwIfGraphAssociated<ext::oneapi::experimental::detail::
2190
+ UnsupportedGraphFeatures::sycl_reductions>();
2191
+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
2173
2192
detail::reduction_parallel_for<KernelName>(*this , Range, Properties,
2174
2193
std::forward<RestT>(Rest)...);
2175
2194
}
@@ -2181,6 +2200,9 @@ class __SYCL_EXPORT handler {
2181
2200
detail::AreAllButLastReductions<RestT...>::value &&
2182
2201
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2183
2202
parallel_for(range<3 > Range, PropertiesT Properties, RestT &&...Rest) {
2203
+ throwIfGraphAssociated<ext::oneapi::experimental::detail::
2204
+ UnsupportedGraphFeatures::sycl_reductions>();
2205
+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
2184
2206
detail::reduction_parallel_for<KernelName>(*this , Range, Properties,
2185
2207
std::forward<RestT>(Rest)...);
2186
2208
}
@@ -2216,6 +2238,8 @@ class __SYCL_EXPORT handler {
2216
2238
detail::AreAllButLastReductions<RestT...>::value &&
2217
2239
ext::oneapi::experimental::is_property_list<PropertiesT>::value>
2218
2240
parallel_for(nd_range<Dims> Range, PropertiesT Properties, RestT &&...Rest) {
2241
+ throwIfGraphAssociated<ext::oneapi::experimental::detail::
2242
+ UnsupportedGraphFeatures::sycl_reductions>();
2219
2243
detail::reduction_parallel_for<KernelName>(*this , Range, Properties,
2220
2244
std::forward<RestT>(Rest)...);
2221
2245
}
@@ -2235,6 +2259,7 @@ class __SYCL_EXPORT handler {
2235
2259
int Dims, typename PropertiesT>
2236
2260
void parallel_for_work_group (range<Dims> NumWorkGroups, PropertiesT Props,
2237
2261
_KERNELFUNCPARAM (KernelFunc)) {
2262
+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
2238
2263
parallel_for_work_group_lambda_impl<KernelName, KernelType, Dims,
2239
2264
PropertiesT>(NumWorkGroups, Props,
2240
2265
KernelFunc);
@@ -2245,6 +2270,7 @@ class __SYCL_EXPORT handler {
2245
2270
void parallel_for_work_group (range<Dims> NumWorkGroups,
2246
2271
range<Dims> WorkGroupSize, PropertiesT Props,
2247
2272
_KERNELFUNCPARAM (KernelFunc)) {
2273
+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
2248
2274
parallel_for_work_group_lambda_impl<KernelName, KernelType, Dims,
2249
2275
PropertiesT>(
2250
2276
NumWorkGroups, WorkGroupSize, Props, KernelFunc);
@@ -2552,6 +2578,9 @@ class __SYCL_EXPORT handler {
2552
2578
// / until all commands previously submitted to this queue have entered the
2553
2579
// / complete state.
2554
2580
void ext_oneapi_barrier () {
2581
+ throwIfGraphAssociated<
2582
+ ext::oneapi::experimental::detail::UnsupportedGraphFeatures::
2583
+ sycl_ext_oneapi_enqueue_barrier>();
2555
2584
throwIfActionIsCreated ();
2556
2585
setType (detail::CG::Barrier);
2557
2586
}
@@ -2637,6 +2666,9 @@ class __SYCL_EXPORT handler {
2637
2666
typename = std::enable_if_t <std::is_same_v<T, unsigned char >>>
2638
2667
void ext_oneapi_memcpy2d (void *Dest, size_t DestPitch, const void *Src,
2639
2668
size_t SrcPitch, size_t Width, size_t Height) {
2669
+ throwIfGraphAssociated<
2670
+ ext::oneapi::experimental::detail::UnsupportedGraphFeatures::
2671
+ sycl_ext_oneapi_memcpy2d>();
2640
2672
throwIfActionIsCreated ();
2641
2673
if (Width > DestPitch)
2642
2674
throw sycl::exception (sycl::make_error_code (errc::invalid),
@@ -2815,6 +2847,9 @@ class __SYCL_EXPORT handler {
2815
2847
void memcpy (ext::oneapi::experimental::device_global<T, PropertyListT> &Dest,
2816
2848
const void *Src, size_t NumBytes = sizeof (T),
2817
2849
size_t DestOffset = 0) {
2850
+ throwIfGraphAssociated<
2851
+ ext::oneapi::experimental::detail::UnsupportedGraphFeatures::
2852
+ sycl_ext_oneapi_device_global>();
2818
2853
if (sizeof (T) < DestOffset + NumBytes)
2819
2854
throw sycl::exception (make_error_code (errc::invalid),
2820
2855
" Copy to device_global is out of bounds." );
@@ -2847,6 +2882,9 @@ class __SYCL_EXPORT handler {
2847
2882
memcpy (void *Dest,
2848
2883
const ext::oneapi::experimental::device_global<T, PropertyListT> &Src,
2849
2884
size_t NumBytes = sizeof (T), size_t SrcOffset = 0) {
2885
+ throwIfGraphAssociated<
2886
+ ext::oneapi::experimental::detail::UnsupportedGraphFeatures::
2887
+ sycl_ext_oneapi_device_global>();
2850
2888
if (sizeof (T) < SrcOffset + NumBytes)
2851
2889
throw sycl::exception (make_error_code (errc::invalid),
2852
2890
" Copy from device_global is out of bounds." );
@@ -3368,8 +3406,34 @@ class __SYCL_EXPORT handler {
3368
3406
" handler::require() before it can be used." );
3369
3407
}
3370
3408
3409
+ template <typename PropertiesT>
3410
+ std::enable_if_t <
3411
+ ext::oneapi::experimental::is_property_list<PropertiesT>::value>
3412
+ throwIfGraphAssociatedAndKernelProperties () const {
3413
+ if (!std::is_same_v<PropertiesT,
3414
+ ext::oneapi::experimental::detail::empty_properties_t >)
3415
+ throwIfGraphAssociated<
3416
+ ext::oneapi::experimental::detail::UnsupportedGraphFeatures::
3417
+ sycl_ext_oneapi_kernel_properties>();
3418
+ }
3419
+
3371
3420
// Set value of the gpu cache configuration for the kernel.
3372
3421
void setKernelCacheConfig (sycl::detail::pi::PiKernelCacheConfig);
3422
+
3423
+ template <
3424
+ ext::oneapi::experimental::detail::UnsupportedGraphFeatures FeatureT>
3425
+ void throwIfGraphAssociated () const {
3426
+
3427
+ if (getCommandGraph ()) {
3428
+ std::string FeatureString =
3429
+ ext::oneapi::experimental::detail::UnsupportedFeatureToString (
3430
+ FeatureT);
3431
+ throw sycl::exception (sycl::make_error_code (errc::invalid),
3432
+ " The " + FeatureString +
3433
+ " feature is not yet available "
3434
+ " for use with the SYCL Graph extension." );
3435
+ }
3436
+ }
3373
3437
};
3374
3438
} // namespace _V1
3375
3439
} // namespace sycl
0 commit comments