@@ -135,7 +135,7 @@ class pipe;
135135
136136namespace ext ::oneapi::experimental::detail {
137137class graph_impl ;
138- }
138+ } // namespace ext::oneapi::experimental::detail
139139namespace detail {
140140
141141class handler_impl ;
@@ -1578,6 +1578,10 @@ class __SYCL_EXPORT handler {
15781578 void set_specialization_constant (
15791579 typename std::remove_reference_t <decltype (SpecName)>::value_type Value) {
15801580
1581+ throwIfGraphAssociated<
1582+ ext::oneapi::experimental::detail::UnsupportedGraphFeatures::
1583+ sycl_specialization_constants>();
1584+
15811585 setStateSpecConstSet ();
15821586
15831587 std::shared_ptr<detail::kernel_bundle_impl> KernelBundleImplPtr =
@@ -1592,6 +1596,10 @@ class __SYCL_EXPORT handler {
15921596 typename std::remove_reference_t <decltype (SpecName)>::value_type
15931597 get_specialization_constant() const {
15941598
1599+ throwIfGraphAssociated<
1600+ ext::oneapi::experimental::detail::UnsupportedGraphFeatures::
1601+ sycl_specialization_constants>();
1602+
15951603 if (isStateExplicitKernelBundle ())
15961604 throw sycl::exception (make_error_code (errc::invalid),
15971605 " Specialization constants cannot be read after "
@@ -2107,6 +2115,7 @@ class __SYCL_EXPORT handler {
21072115 std::enable_if_t <
21082116 ext::oneapi::experimental::is_property_list<PropertiesT>::value>
21092117 single_task (PropertiesT Props, _KERNELFUNCPARAM(KernelFunc)) {
2118+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
21102119 single_task_lambda_impl<KernelName, KernelType, PropertiesT>(Props,
21112120 KernelFunc);
21122121 }
@@ -2117,6 +2126,7 @@ class __SYCL_EXPORT handler {
21172126 ext::oneapi::experimental::is_property_list<PropertiesT>::value>
21182127 parallel_for (range<1 > NumWorkItems, PropertiesT Props,
21192128 _KERNELFUNCPARAM (KernelFunc)) {
2129+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
21202130 parallel_for_lambda_impl<KernelName, KernelType, 1 , PropertiesT>(
21212131 NumWorkItems, Props, std::move (KernelFunc));
21222132 }
@@ -2127,6 +2137,7 @@ class __SYCL_EXPORT handler {
21272137 ext::oneapi::experimental::is_property_list<PropertiesT>::value>
21282138 parallel_for (range<2 > NumWorkItems, PropertiesT Props,
21292139 _KERNELFUNCPARAM (KernelFunc)) {
2140+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
21302141 parallel_for_lambda_impl<KernelName, KernelType, 2 , PropertiesT>(
21312142 NumWorkItems, Props, std::move (KernelFunc));
21322143 }
@@ -2137,6 +2148,7 @@ class __SYCL_EXPORT handler {
21372148 ext::oneapi::experimental::is_property_list<PropertiesT>::value>
21382149 parallel_for (range<3 > NumWorkItems, PropertiesT Props,
21392150 _KERNELFUNCPARAM (KernelFunc)) {
2151+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
21402152 parallel_for_lambda_impl<KernelName, KernelType, 3 , PropertiesT>(
21412153 NumWorkItems, Props, std::move (KernelFunc));
21422154 }
@@ -2147,6 +2159,7 @@ class __SYCL_EXPORT handler {
21472159 ext::oneapi::experimental::is_property_list<PropertiesT>::value>
21482160 parallel_for (nd_range<Dims> Range, PropertiesT Properties,
21492161 _KERNELFUNCPARAM (KernelFunc)) {
2162+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
21502163 parallel_for_impl<KernelName>(Range, Properties, std::move (KernelFunc));
21512164 }
21522165
@@ -2159,6 +2172,9 @@ class __SYCL_EXPORT handler {
21592172 detail::AreAllButLastReductions<RestT...>::value &&
21602173 ext::oneapi::experimental::is_property_list<PropertiesT>::value>
21612174 parallel_for(range<1 > Range, PropertiesT Properties, RestT &&...Rest) {
2175+ throwIfGraphAssociated<ext::oneapi::experimental::detail::
2176+ UnsupportedGraphFeatures::sycl_reductions>();
2177+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
21622178 detail::reduction_parallel_for<KernelName>(*this , Range, Properties,
21632179 std::forward<RestT>(Rest)...);
21642180 }
@@ -2170,6 +2186,9 @@ class __SYCL_EXPORT handler {
21702186 detail::AreAllButLastReductions<RestT...>::value &&
21712187 ext::oneapi::experimental::is_property_list<PropertiesT>::value>
21722188 parallel_for(range<2 > Range, PropertiesT Properties, RestT &&...Rest) {
2189+ throwIfGraphAssociated<ext::oneapi::experimental::detail::
2190+ UnsupportedGraphFeatures::sycl_reductions>();
2191+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
21732192 detail::reduction_parallel_for<KernelName>(*this , Range, Properties,
21742193 std::forward<RestT>(Rest)...);
21752194 }
@@ -2181,6 +2200,9 @@ class __SYCL_EXPORT handler {
21812200 detail::AreAllButLastReductions<RestT...>::value &&
21822201 ext::oneapi::experimental::is_property_list<PropertiesT>::value>
21832202 parallel_for(range<3 > Range, PropertiesT Properties, RestT &&...Rest) {
2203+ throwIfGraphAssociated<ext::oneapi::experimental::detail::
2204+ UnsupportedGraphFeatures::sycl_reductions>();
2205+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
21842206 detail::reduction_parallel_for<KernelName>(*this , Range, Properties,
21852207 std::forward<RestT>(Rest)...);
21862208 }
@@ -2216,6 +2238,8 @@ class __SYCL_EXPORT handler {
22162238 detail::AreAllButLastReductions<RestT...>::value &&
22172239 ext::oneapi::experimental::is_property_list<PropertiesT>::value>
22182240 parallel_for(nd_range<Dims> Range, PropertiesT Properties, RestT &&...Rest) {
2241+ throwIfGraphAssociated<ext::oneapi::experimental::detail::
2242+ UnsupportedGraphFeatures::sycl_reductions>();
22192243 detail::reduction_parallel_for<KernelName>(*this , Range, Properties,
22202244 std::forward<RestT>(Rest)...);
22212245 }
@@ -2235,6 +2259,7 @@ class __SYCL_EXPORT handler {
22352259 int Dims, typename PropertiesT>
22362260 void parallel_for_work_group (range<Dims> NumWorkGroups, PropertiesT Props,
22372261 _KERNELFUNCPARAM (KernelFunc)) {
2262+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
22382263 parallel_for_work_group_lambda_impl<KernelName, KernelType, Dims,
22392264 PropertiesT>(NumWorkGroups, Props,
22402265 KernelFunc);
@@ -2245,6 +2270,7 @@ class __SYCL_EXPORT handler {
22452270 void parallel_for_work_group (range<Dims> NumWorkGroups,
22462271 range<Dims> WorkGroupSize, PropertiesT Props,
22472272 _KERNELFUNCPARAM (KernelFunc)) {
2273+ throwIfGraphAssociatedAndKernelProperties<PropertiesT>();
22482274 parallel_for_work_group_lambda_impl<KernelName, KernelType, Dims,
22492275 PropertiesT>(
22502276 NumWorkGroups, WorkGroupSize, Props, KernelFunc);
@@ -2552,6 +2578,9 @@ class __SYCL_EXPORT handler {
25522578 // / until all commands previously submitted to this queue have entered the
25532579 // / complete state.
25542580 void ext_oneapi_barrier () {
2581+ throwIfGraphAssociated<
2582+ ext::oneapi::experimental::detail::UnsupportedGraphFeatures::
2583+ sycl_ext_oneapi_enqueue_barrier>();
25552584 throwIfActionIsCreated ();
25562585 setType (detail::CG::Barrier);
25572586 }
@@ -2637,6 +2666,9 @@ class __SYCL_EXPORT handler {
26372666 typename = std::enable_if_t <std::is_same_v<T, unsigned char >>>
26382667 void ext_oneapi_memcpy2d (void *Dest, size_t DestPitch, const void *Src,
26392668 size_t SrcPitch, size_t Width, size_t Height) {
2669+ throwIfGraphAssociated<
2670+ ext::oneapi::experimental::detail::UnsupportedGraphFeatures::
2671+ sycl_ext_oneapi_memcpy2d>();
26402672 throwIfActionIsCreated ();
26412673 if (Width > DestPitch)
26422674 throw sycl::exception (sycl::make_error_code (errc::invalid),
@@ -2815,6 +2847,9 @@ class __SYCL_EXPORT handler {
28152847 void memcpy (ext::oneapi::experimental::device_global<T, PropertyListT> &Dest,
28162848 const void *Src, size_t NumBytes = sizeof (T),
28172849 size_t DestOffset = 0) {
2850+ throwIfGraphAssociated<
2851+ ext::oneapi::experimental::detail::UnsupportedGraphFeatures::
2852+ sycl_ext_oneapi_device_global>();
28182853 if (sizeof (T) < DestOffset + NumBytes)
28192854 throw sycl::exception (make_error_code (errc::invalid),
28202855 " Copy to device_global is out of bounds." );
@@ -2847,6 +2882,9 @@ class __SYCL_EXPORT handler {
28472882 memcpy (void *Dest,
28482883 const ext::oneapi::experimental::device_global<T, PropertyListT> &Src,
28492884 size_t NumBytes = sizeof (T), size_t SrcOffset = 0) {
2885+ throwIfGraphAssociated<
2886+ ext::oneapi::experimental::detail::UnsupportedGraphFeatures::
2887+ sycl_ext_oneapi_device_global>();
28502888 if (sizeof (T) < SrcOffset + NumBytes)
28512889 throw sycl::exception (make_error_code (errc::invalid),
28522890 " Copy from device_global is out of bounds." );
@@ -3368,8 +3406,34 @@ class __SYCL_EXPORT handler {
33683406 " handler::require() before it can be used." );
33693407 }
33703408
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+
33713420 // Set value of the gpu cache configuration for the kernel.
33723421 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+ }
33733437};
33743438} // namespace _V1
33753439} // namespace sycl
0 commit comments