@@ -830,28 +830,16 @@ template <class FunctorTy> void withAuxHandler(handler &CGH, FunctorTy Func) {
830
830
}
831
831
} // namespace reduction
832
832
833
- // This method is used for implementation of parallel_for accepting 1 reduction.
834
- // TODO: remove this method when everything is switched to general algorithm
835
- // implementing arbitrary number of reductions in parallel_for().
836
- // / Copies the final reduction result kept in read-write accessor to user's
837
- // / accessor. This method is not called for user's read-write accessors
838
- // / requiring update-write to it.
839
- template <typename KernelName, class Reduction >
840
- std::enable_if_t <!Reduction::is_usm>
841
- reduSaveFinalResultToUserMem (handler &CGH, Reduction &Redu) {
842
- auto InAcc = Redu.getReadAccToPreviousPartialReds (CGH);
843
- associateWithHandler (CGH, &Redu.getUserRedVar (), access::target::device);
844
- CGH.copy (InAcc, Redu.getUserRedVar ());
845
- }
846
-
847
833
// This method is used for implementation of parallel_for accepting 1 reduction.
848
834
// TODO: remove this method when everything is switched to general algorithm
849
835
// implementing arbitrary number of reductions in parallel_for().
850
836
// / Copies the final reduction result kept in read-write accessor to user's
851
837
// / USM memory.
852
838
template <typename KernelName, class Reduction >
853
- std::enable_if_t <Reduction::is_usm>
854
- reduSaveFinalResultToUserMem (handler &CGH, Reduction &Redu) {
839
+ void reduSaveFinalResultToUserMem (handler &CGH, Reduction &Redu) {
840
+ static_assert (Reduction::is_usm,
841
+ " All implementations using this helper are expected to have "
842
+ " USM reduction, not a buffer-based one." );
855
843
size_t NElements = Reduction::num_elements;
856
844
auto InAcc = Redu.getReadAccToPreviousPartialReds (CGH);
857
845
auto UserVarPtr = Redu.getUserRedVar ();
@@ -1144,7 +1132,7 @@ template <> struct NDRangeReduction<reduction::strategy::range_basic> {
1144
1132
}
1145
1133
});
1146
1134
1147
- if (Reduction::is_usm)
1135
+ if constexpr (Reduction::is_usm)
1148
1136
reduction::withAuxHandler (CGH, [&](handler &CopyHandler) {
1149
1137
reduSaveFinalResultToUserMem<KernelName>(CopyHandler, Redu);
1150
1138
});
@@ -1389,7 +1377,7 @@ struct NDRangeReduction<
1389
1377
});
1390
1378
} // end while (NWorkItems > 1)
1391
1379
1392
- if (Reduction::is_usm) {
1380
+ if constexpr (Reduction::is_usm) {
1393
1381
reduction::withAuxHandler (CGH, [&](handler &CopyHandler) {
1394
1382
reduSaveFinalResultToUserMem<KernelName>(CopyHandler, Redu);
1395
1383
});
@@ -1589,7 +1577,7 @@ template <> struct NDRangeReduction<reduction::strategy::basic> {
1589
1577
});
1590
1578
} // end while (NWorkItems > 1)
1591
1579
1592
- if (Reduction::is_usm) {
1580
+ if constexpr (Reduction::is_usm) {
1593
1581
reduction::withAuxHandler (CGH, [&](handler &CopyHandler) {
1594
1582
reduSaveFinalResultToUserMem<KernelName>(CopyHandler, Redu);
1595
1583
});
0 commit comments