@@ -970,28 +970,11 @@ class __SYCL_EXPORT handler {
970
970
}
971
971
}
972
972
973
- // / Process kernel properties.
973
+ // / Process runtime kernel properties.
974
974
// /
975
975
// / Stores information about kernel properties into the handler.
976
- template <
977
- typename KernelName,
978
- typename PropertiesT = ext::oneapi::experimental::empty_properties_t >
979
- void processProperties (PropertiesT Props) {
980
- using KI = detail::KernelInfo<KernelName>;
981
- static_assert (
982
- ext::oneapi::experimental::is_property_list<PropertiesT>::value,
983
- " Template type is not a property list." );
984
- static_assert (
985
- !PropertiesT::template has_property<
986
- sycl::ext::intel::experimental::fp_control_key>() ||
987
- (PropertiesT::template has_property<
988
- sycl::ext::intel::experimental::fp_control_key>() &&
989
- KI::isESIMD ()),
990
- " Floating point control property is supported for ESIMD kernels only." );
991
- static_assert (
992
- !PropertiesT::template has_property<
993
- sycl::ext::oneapi::experimental::indirectly_callable_key>(),
994
- " indirectly_callable property cannot be applied to SYCL kernels" );
976
+ template <typename PropertiesT>
977
+ void processLaunchProperties (PropertiesT Props) {
995
978
if constexpr (PropertiesT::template has_property<
996
979
sycl::ext::intel::experimental::cache_config_key>()) {
997
980
auto Config = Props.template get_property <
@@ -1042,6 +1025,32 @@ class __SYCL_EXPORT handler {
1042
1025
checkAndSetClusterRange (Props);
1043
1026
}
1044
1027
1028
+ // / Process kernel properties.
1029
+ // /
1030
+ // / Stores information about kernel properties into the handler.
1031
+ template <
1032
+ typename KernelName,
1033
+ typename PropertiesT = ext::oneapi::experimental::empty_properties_t >
1034
+ void processProperties (PropertiesT Props) {
1035
+ using KI = detail::KernelInfo<KernelName>;
1036
+ static_assert (
1037
+ ext::oneapi::experimental::is_property_list<PropertiesT>::value,
1038
+ " Template type is not a property list." );
1039
+ static_assert (
1040
+ !PropertiesT::template has_property<
1041
+ sycl::ext::intel::experimental::fp_control_key>() ||
1042
+ (PropertiesT::template has_property<
1043
+ sycl::ext::intel::experimental::fp_control_key>() &&
1044
+ KI::isESIMD ()),
1045
+ " Floating point control property is supported for ESIMD kernels only." );
1046
+ static_assert (
1047
+ !PropertiesT::template has_property<
1048
+ sycl::ext::oneapi::experimental::indirectly_callable_key>(),
1049
+ " indirectly_callable property cannot be applied to SYCL kernels" );
1050
+
1051
+ processLaunchProperties (Props);
1052
+ }
1053
+
1045
1054
// / Checks whether it is possible to copy the source shape to the destination
1046
1055
// / shape(the shapes are described by the accessor ranges) by using
1047
1056
// / copying by regions of memory and not copying element by element
@@ -1440,18 +1449,44 @@ class __SYCL_EXPORT handler {
1440
1449
// /
1441
1450
// / \param NumWorkItems is a range defining indexing space.
1442
1451
// / \param Kernel is a SYCL kernel function.
1443
- template <int Dims>
1444
- void parallel_for_impl (range<Dims> NumWorkItems, kernel Kernel) {
1452
+ // / \param Properties is the properties.
1453
+ template <int Dims, typename PropertiesT>
1454
+ void parallel_for_impl (range<Dims> NumWorkItems, PropertiesT Props,
1455
+ kernel Kernel) {
1445
1456
throwIfActionIsCreated ();
1446
1457
MKernel = detail::getSyclObjImpl (std::move (Kernel));
1447
1458
detail::checkValueRange<Dims>(NumWorkItems);
1448
1459
setNDRangeDescriptor (std::move (NumWorkItems));
1460
+ processLaunchProperties<PropertiesT>(Props);
1449
1461
setType (detail::CGType::Kernel);
1450
1462
setNDRangeUsed (false );
1451
1463
extractArgsAndReqs ();
1452
1464
MKernelName = getKernelName ();
1453
1465
}
1454
1466
1467
+ // / Defines and invokes a SYCL kernel function for the specified range and
1468
+ // / offsets.
1469
+ // /
1470
+ // / The SYCL kernel function is defined as SYCL kernel object.
1471
+ // /
1472
+ // / \param NDRange is a ND-range defining global and local sizes as
1473
+ // / well as offset.
1474
+ // / \param Properties is the properties.
1475
+ // / \param Kernel is a SYCL kernel function.
1476
+ template <int Dims, typename PropertiesT>
1477
+ void parallel_for_impl (nd_range<Dims> NDRange, PropertiesT Props,
1478
+ kernel Kernel) {
1479
+ throwIfActionIsCreated ();
1480
+ MKernel = detail::getSyclObjImpl (std::move (Kernel));
1481
+ detail::checkValueRange<Dims>(NDRange);
1482
+ setNDRangeDescriptor (std::move (NDRange));
1483
+ processLaunchProperties (Props);
1484
+ setType (detail::CGType::Kernel);
1485
+ setNDRangeUsed (true );
1486
+ extractArgsAndReqs ();
1487
+ MKernelName = getKernelName ();
1488
+ }
1489
+
1455
1490
// / Hierarchical kernel invocation method of a kernel defined as a lambda
1456
1491
// / encoding the body of each work-group to launch.
1457
1492
// /
@@ -2163,15 +2198,18 @@ class __SYCL_EXPORT handler {
2163
2198
}
2164
2199
2165
2200
void parallel_for (range<1 > NumWorkItems, kernel Kernel) {
2166
- parallel_for_impl (NumWorkItems, Kernel);
2201
+ parallel_for_impl (NumWorkItems,
2202
+ ext::oneapi::experimental::empty_properties_t {}, Kernel);
2167
2203
}
2168
2204
2169
2205
void parallel_for (range<2 > NumWorkItems, kernel Kernel) {
2170
- parallel_for_impl (NumWorkItems, Kernel);
2206
+ parallel_for_impl (NumWorkItems,
2207
+ ext::oneapi::experimental::empty_properties_t {}, Kernel);
2171
2208
}
2172
2209
2173
2210
void parallel_for (range<3 > NumWorkItems, kernel Kernel) {
2174
- parallel_for_impl (NumWorkItems, Kernel);
2211
+ parallel_for_impl (NumWorkItems,
2212
+ ext::oneapi::experimental::empty_properties_t {}, Kernel);
2175
2213
}
2176
2214
2177
2215
// / Defines and invokes a SYCL kernel function for the specified range and
@@ -2205,14 +2243,8 @@ class __SYCL_EXPORT handler {
2205
2243
// / well as offset.
2206
2244
// / \param Kernel is a SYCL kernel function.
2207
2245
template <int Dims> void parallel_for (nd_range<Dims> NDRange, kernel Kernel) {
2208
- throwIfActionIsCreated ();
2209
- MKernel = detail::getSyclObjImpl (std::move (Kernel));
2210
- detail::checkValueRange<Dims>(NDRange);
2211
- setNDRangeDescriptor (std::move (NDRange));
2212
- setType (detail::CGType::Kernel);
2213
- setNDRangeUsed (true );
2214
- extractArgsAndReqs ();
2215
- MKernelName = getKernelName ();
2246
+ parallel_for_impl (NDRange, ext::oneapi::experimental::empty_properties_t {},
2247
+ Kernel);
2216
2248
}
2217
2249
2218
2250
// / Defines and invokes a SYCL kernel function.
@@ -3741,6 +3773,12 @@ class HandlerAccess {
3741
3773
static void internalProfilingTagImpl (handler &Handler) {
3742
3774
Handler.internalProfilingTagImpl ();
3743
3775
}
3776
+
3777
+ template <typename RangeT, typename PropertiesT>
3778
+ static void parallelForImpl (handler &Handler, RangeT Range, PropertiesT Props,
3779
+ kernel Kernel) {
3780
+ Handler.parallel_for_impl (Range, Props, Kernel);
3781
+ }
3744
3782
};
3745
3783
} // namespace detail
3746
3784
0 commit comments