DPC++ Runtime
Runtime libraries for oneAPI DPC++
reduction_forward.hpp
Go to the documentation of this file.
1 //==---- reduction_forward.hpp - SYCL reduction forward decl ---*- C++ -*---==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 // ===--------------------------------------------------------------------=== //
8 
9 #pragma once
10 
11 #include <sycl/detail/helpers.hpp> // for Builder
12 #include <sycl/detail/item_base.hpp> // for range
13 #include <sycl/id.hpp> // for id
14 #include <sycl/item.hpp> // for item
15 #include <sycl/nd_range.hpp> // for nd_range
16 #include <sycl/range.hpp> // for range
17 
18 #include <stddef.h> // for size_t
19 
20 // To be included in <sycl/handler.hpp>. Note that reductions implementation
21 // need complete sycl::handler type so we cannot include whole
22 // <sycl/reduction.hpp> there.
23 
24 namespace sycl {
25 inline namespace _V1 {
26 namespace detail {
27 template <typename T, class BinaryOperation, int Dims, size_t Extent,
28  bool ExplicitIdentity, typename RedOutVar>
29 class reduction_impl_algo;
30 
31 namespace reduction {
32 enum class strategy : int {
34 
35  // These three are only auto-selected for sycl::range entry point.
39 
43  basic,
44 
45  multi,
46 };
47 
48 // Reductions implementation need access to private members of handler. Those
49 // are limited to those below.
50 inline void finalizeHandler(handler &CGH);
51 template <class FunctorTy> void withAuxHandler(handler &CGH, FunctorTy Func);
52 
53 template <int Dims>
55  return Builder::createItem<Dims, false>(Range, Id);
56 }
57 } // namespace reduction
58 
59 template <typename KernelName,
61  int Dims, typename PropertiesT, typename... RestT>
62 void reduction_parallel_for(handler &CGH, range<Dims> NDRange,
63  PropertiesT Properties, RestT... Rest);
64 
65 template <typename KernelName,
67  int Dims, typename PropertiesT, typename... RestT>
69  PropertiesT Properties, RestT... Rest);
70 
71 template <typename T> struct IsReduction;
72 template <typename FirstT, typename... RestT> struct AreAllButLastReductions;
73 
74 } // namespace detail
75 } // namespace _V1
76 } // namespace sycl
Command group handler class.
Definition: handler.hpp:462
Identifies an instance of the function object executing at each point in a range.
Definition: item.hpp:37
Defines the iteration domain of both the work-groups and the overall dispatch.
Definition: nd_range.hpp:22
item< Dims, false > getDelinearizedItem(range< Dims > Range, id< Dims > Id)
void withAuxHandler(handler &CGH, FunctorTy Func)
Definition: reduction.hpp:1192
void finalizeHandler(handler &CGH)
Definition: reduction.hpp:1191
void reduction_parallel_for(handler &CGH, range< Dims > NDRange, PropertiesT Properties, RestT... Rest)
Definition: reduction.hpp:2737
auto reduction(buffer< T, 1, AllocatorT > Var, handler &CGH, BinaryOperation Combiner, const property_list &PropList={})
Constructs a reduction object using the given buffer Var, handler CGH, reduction operation Combiner,...
Definition: reduction.hpp:2863
Definition: access.hpp:18