Skip to content

Commit a580702

Browse files
Stop passing Queue around in reductions
1 parent f59a17b commit a580702

File tree

1 file changed

+15
-37
lines changed

1 file changed

+15
-37
lines changed

sycl/include/sycl/reduction.hpp

Lines changed: 15 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,15 +1238,12 @@ template <>
12381238
struct NDRangeReduction<reduction::strategy::local_atomic_and_atomic_cross_wg> {
12391239
template <typename KernelName, int Dims, typename PropertiesT,
12401240
typename KernelType, typename Reduction>
1241-
static void run(handler &CGH,
1242-
const std::shared_ptr<detail::queue_impl> &Queue,
1243-
nd_range<Dims> NDRange, PropertiesT &Properties,
1241+
static void run(handler &CGH, nd_range<Dims> NDRange, PropertiesT &Properties,
12441242
Reduction &Redu, KernelType &KernelFunc) {
12451243
static_assert(Reduction::has_identity,
12461244
"Identityless reductions are not supported by the "
12471245
"local_atomic_and_atomic_cross_wg strategy.");
12481246

1249-
std::ignore = Queue;
12501247
using Name = __sycl_reduction_kernel<
12511248
reduction::MainKrn, KernelName,
12521249
reduction::strategy::local_atomic_and_atomic_cross_wg>;
@@ -1290,15 +1287,12 @@ struct NDRangeReduction<
12901287
reduction::strategy::group_reduce_and_last_wg_detection> {
12911288
template <typename KernelName, int Dims, typename PropertiesT,
12921289
typename KernelType, typename Reduction>
1293-
static void run(handler &CGH,
1294-
const std::shared_ptr<detail::queue_impl> &Queue,
1295-
nd_range<Dims> NDRange, PropertiesT &Properties,
1290+
static void run(handler &CGH, nd_range<Dims> NDRange, PropertiesT &Properties,
12961291
Reduction &Redu, KernelType &KernelFunc) {
12971292
static_assert(Reduction::has_identity,
12981293
"Identityless reductions are not supported by the "
12991294
"group_reduce_and_last_wg_detection strategy.");
13001295

1301-
std::ignore = Queue;
13021296
size_t NElements = Reduction::num_elements;
13031297
size_t WGSize = NDRange.get_local_range().size();
13041298
size_t NWorkGroups = NDRange.get_group_range().size();
@@ -1490,9 +1484,7 @@ void doTreeReductionOnTuple(size_t WorkSize, size_t LID,
14901484
template <> struct NDRangeReduction<reduction::strategy::range_basic> {
14911485
template <typename KernelName, int Dims, typename PropertiesT,
14921486
typename KernelType, typename Reduction>
1493-
static void run(handler &CGH,
1494-
const std::shared_ptr<detail::queue_impl> &Queue,
1495-
nd_range<Dims> NDRange, PropertiesT &Properties,
1487+
static void run(handler &CGH, nd_range<Dims> NDRange, PropertiesT &Properties,
14961488
Reduction &Redu, KernelType &KernelFunc) {
14971489
using reducer_type = typename Reduction::reducer_type;
14981490
using element_type = typename ReducerTraits<reducer_type>::element_type;
@@ -1504,7 +1496,6 @@ template <> struct NDRangeReduction<reduction::strategy::range_basic> {
15041496
constexpr bool UsePartialSumForOutput =
15051497
!Reduction::is_usm && Reduction::has_identity;
15061498

1507-
std::ignore = Queue;
15081499
size_t NElements = Reduction::num_elements;
15091500
size_t WGSize = NDRange.get_local_range().size();
15101501
size_t NWorkGroups = NDRange.get_group_range().size();
@@ -1602,15 +1593,12 @@ template <>
16021593
struct NDRangeReduction<reduction::strategy::group_reduce_and_atomic_cross_wg> {
16031594
template <typename KernelName, int Dims, typename PropertiesT,
16041595
typename KernelType, typename Reduction>
1605-
static void run(handler &CGH,
1606-
const std::shared_ptr<detail::queue_impl> &Queue,
1607-
nd_range<Dims> NDRange, PropertiesT &Properties,
1596+
static void run(handler &CGH, nd_range<Dims> NDRange, PropertiesT &Properties,
16081597
Reduction &Redu, KernelType &KernelFunc) {
16091598
static_assert(Reduction::has_identity,
16101599
"Identityless reductions are not supported by the "
16111600
"group_reduce_and_atomic_cross_wg strategy.");
16121601

1613-
std::ignore = Queue;
16141602
using Name = __sycl_reduction_kernel<
16151603
reduction::MainKrn, KernelName,
16161604
reduction::strategy::group_reduce_and_atomic_cross_wg>;
@@ -1639,14 +1627,11 @@ struct NDRangeReduction<
16391627
reduction::strategy::local_mem_tree_and_atomic_cross_wg> {
16401628
template <typename KernelName, int Dims, typename PropertiesT,
16411629
typename KernelType, typename Reduction>
1642-
static void run(handler &CGH,
1643-
const std::shared_ptr<detail::queue_impl> &Queue,
1644-
nd_range<Dims> NDRange, PropertiesT &Properties,
1630+
static void run(handler &CGH, nd_range<Dims> NDRange, PropertiesT &Properties,
16451631
Reduction &Redu, KernelType &KernelFunc) {
16461632
using reducer_type = typename Reduction::reducer_type;
16471633
using element_type = typename ReducerTraits<reducer_type>::element_type;
16481634

1649-
std::ignore = Queue;
16501635
using Name = __sycl_reduction_kernel<
16511636
reduction::MainKrn, KernelName,
16521637
reduction::strategy::local_mem_tree_and_atomic_cross_wg>;
@@ -1701,8 +1686,7 @@ struct NDRangeReduction<
17011686
reduction::strategy::group_reduce_and_multiple_kernels> {
17021687
template <typename KernelName, int Dims, typename PropertiesT,
17031688
typename KernelType, typename Reduction>
1704-
static void run(handler &CGH, const std::shared_ptr<detail::queue_impl> &,
1705-
nd_range<Dims> NDRange, PropertiesT &Properties,
1689+
static void run(handler &CGH, nd_range<Dims> NDRange, PropertiesT &Properties,
17061690
Reduction &Redu, KernelType &KernelFunc) {
17071691
static_assert(Reduction::has_identity,
17081692
"Identityless reductions are not supported by the "
@@ -1839,8 +1823,7 @@ struct NDRangeReduction<
18391823
template <> struct NDRangeReduction<reduction::strategy::basic> {
18401824
template <typename KernelName, int Dims, typename PropertiesT,
18411825
typename KernelType, typename Reduction>
1842-
static void run(handler &CGH, const std::shared_ptr<detail::queue_impl> &,
1843-
nd_range<Dims> NDRange, PropertiesT &Properties,
1826+
static void run(handler &CGH, nd_range<Dims> NDRange, PropertiesT &Properties,
18441827
Reduction &Redu, KernelType &KernelFunc) {
18451828
using element_type = typename Reduction::reducer_element_type;
18461829

@@ -2614,8 +2597,7 @@ tuple_select_elements(TupleT Tuple, std::index_sequence<Is...>) {
26142597
template <> struct NDRangeReduction<reduction::strategy::multi> {
26152598
template <typename KernelName, int Dims, typename PropertiesT,
26162599
typename... RestT>
2617-
static void run(handler &CGH, const std::shared_ptr<detail::queue_impl> &,
2618-
nd_range<Dims> NDRange, PropertiesT &Properties,
2600+
static void run(handler &CGH, nd_range<Dims> NDRange, PropertiesT &Properties,
26192601
RestT... Rest) {
26202602
std::tuple<RestT...> ArgsTuple(Rest...);
26212603
constexpr size_t NumArgs = sizeof...(RestT);
@@ -2658,13 +2640,10 @@ template <> struct NDRangeReduction<reduction::strategy::auto_select> {
26582640

26592641
template <typename KernelName, int Dims, typename PropertiesT,
26602642
typename KernelType, typename Reduction>
2661-
static void run(handler &CGH,
2662-
const std::shared_ptr<detail::queue_impl> &Queue,
2663-
nd_range<Dims> NDRange, PropertiesT &Properties,
2643+
static void run(handler &CGH, nd_range<Dims> NDRange, PropertiesT &Properties,
26642644
Reduction &Redu, KernelType &KernelFunc) {
26652645
auto Delegate = [&](auto Impl) {
2666-
Impl.template run<KernelName>(CGH, Queue, NDRange, Properties, Redu,
2667-
KernelFunc);
2646+
Impl.template run<KernelName>(CGH, NDRange, Properties, Redu, KernelFunc);
26682647
};
26692648

26702649
if constexpr (Reduction::has_float64_atomics) {
@@ -2706,10 +2685,9 @@ template <> struct NDRangeReduction<reduction::strategy::auto_select> {
27062685
}
27072686
template <typename KernelName, int Dims, typename PropertiesT,
27082687
typename... RestT>
2709-
static void
2710-
run(handler &CGH, const std::shared_ptr<detail::queue_impl> &Queue,
2711-
nd_range<Dims> NDRange, PropertiesT &Properties, RestT... Rest) {
2712-
return Impl<Strat::multi>::run<KernelName>(CGH, Queue, NDRange, Properties,
2688+
static void run(handler &CGH, nd_range<Dims> NDRange, PropertiesT &Properties,
2689+
RestT... Rest) {
2690+
return Impl<Strat::multi>::run<KernelName>(CGH, NDRange, Properties,
27132691
Rest...);
27142692
}
27152693
};
@@ -2718,8 +2696,8 @@ template <typename KernelName, reduction::strategy Strategy, int Dims,
27182696
typename PropertiesT, typename... RestT>
27192697
void reduction_parallel_for(handler &CGH, nd_range<Dims> NDRange,
27202698
PropertiesT Properties, RestT... Rest) {
2721-
NDRangeReduction<Strategy>::template run<KernelName>(CGH, CGH.MQueue, NDRange,
2722-
Properties, Rest...);
2699+
NDRangeReduction<Strategy>::template run<KernelName>(CGH, NDRange, Properties,
2700+
Rest...);
27232701
}
27242702

27252703
__SYCL_EXPORT uint32_t reduGetMaxNumConcurrentWorkGroups(handler &cgh);

0 commit comments

Comments
 (0)