diff --git a/sycl/include/sycl/handler.hpp b/sycl/include/sycl/handler.hpp index 971c91de9c5a8..4fffc31a60306 100644 --- a/sycl/include/sycl/handler.hpp +++ b/sycl/include/sycl/handler.hpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -268,43 +269,9 @@ class RoundedRangeKernelWithKH { KernelType KernelFunc; }; -template -class reduction_impl_algo; - using sycl::detail::enable_if_t; using sycl::detail::queue_impl; -// Reductions implementation need access to private members of handler. Those -// are limited to those below. -namespace reduction { -inline void finalizeHandler(handler &CGH); -template void withAuxHandler(handler &CGH, FunctorTy Func); -} // namespace reduction - -template -void reduction_parallel_for(handler &CGH, - std::shared_ptr Queue, - range Range, PropertiesT Properties, - Reduction Redu, KernelType KernelFunc); - -template -void reduction_parallel_for(handler &CGH, - std::shared_ptr Queue, - nd_range Range, PropertiesT Properties, - Reduction Redu, KernelType KernelFunc); - -template -void reduction_parallel_for(handler &CGH, - std::shared_ptr Queue, - nd_range Range, PropertiesT Properties, - RestT... Rest); - -template struct IsReduction; -template struct AreAllButLastReductions; } // namespace detail /// Command group handler class. diff --git a/sycl/include/sycl/reduction.hpp b/sycl/include/sycl/reduction.hpp index 6eeb263aa0ca1..bc84422033fbe 100644 --- a/sycl/include/sycl/reduction.hpp +++ b/sycl/include/sycl/reduction.hpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -317,7 +318,7 @@ template class combiner { ReduVarPtr, [](auto Ref, auto Val) { return Ref.fetch_max(Val); }); } }; -} +} // namespace detail /// Specialization of the generic class 'reducer'. It is used for reductions /// of those types and operations for which the identity value is not known. @@ -571,8 +572,7 @@ class reduction_impl_algo : public reduction_impl_common { } } - template - auto &getTempBuffer(size_t Size, handler &CGH) { + template auto &getTempBuffer(size_t Size, handler &CGH) { auto Buffer = std::make_shared>(range<1>(Size)); CGH.addReduction(Buffer); return *Buffer; @@ -830,711 +830,785 @@ reduSaveFinalResultToUserMem(handler &CGH, Reduction &Redu) { }); } +namespace reduction { +template struct MainKrn; +template struct AuxKrn; +} // namespace reduction + /// A helper to pass undefined (sycl::detail::auto_name) names unmodified. We /// must do that to avoid name collisions. -template