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 // To be included in <sycl/handler.hpp>. Note that reductions implementation
12 // need complete sycl::handler type so we cannot include whole
13 // <sycl/reduction.hpp> there.
14 
15 #include <sycl/detail/common.hpp>
16 
17 namespace sycl {
19 namespace detail {
20 template <typename T, class BinaryOperation, int Dims, size_t Extent,
21  typename RedOutVar>
22 class reduction_impl_algo;
23 
24 namespace reduction {
25 enum class strategy : int {
27 
28  // These three are only auto-selected for sycl::range entry point.
32 
36  basic,
37 
38  multi,
39 };
40 
41 // Reductions implementation need access to private members of handler. Those
42 // are limited to those below.
43 inline void finalizeHandler(handler &CGH);
44 template <class FunctorTy> void withAuxHandler(handler &CGH, FunctorTy Func);
45 
46 template <int Dims>
48  return {Range, Id};
49 }
50 } // namespace reduction
51 
52 template <typename KernelName,
53  reduction::strategy Strategy = reduction::strategy::auto_select,
54  int Dims, typename PropertiesT, typename... RestT>
55 void reduction_parallel_for(handler &CGH, range<Dims> NDRange,
56  PropertiesT Properties, RestT... Rest);
57 
58 template <typename KernelName,
59  reduction::strategy Strategy = reduction::strategy::auto_select,
60  int Dims, typename PropertiesT, typename... RestT>
62  PropertiesT Properties, RestT... Rest);
63 
64 template <typename T> struct IsReduction;
65 template <typename FirstT, typename... RestT> struct AreAllButLastReductions;
66 
67 } // namespace detail
68 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
69 } // namespace sycl
Command group handler class.
Definition: handler.hpp:312
Identifies an instance of the function object executing at each point in a range.
Definition: item.hpp:39
Defines the iteration domain of both the work-groups and the overall dispatch.
Definition: nd_range.hpp:23
#define __SYCL_INLINE_VER_NAMESPACE(X)
item< Dims, false > getDelinearizedItem(range< Dims > Range, id< Dims > Id)
void withAuxHandler(handler &CGH, FunctorTy Func)
Definition: reduction.hpp:809
void finalizeHandler(handler &CGH)
Definition: reduction.hpp:808
void reduction_parallel_for(handler &CGH, nd_range< Dims > NDRange, PropertiesT Properties, RestT... Rest)
Definition: reduction.hpp:2203
auto reduction(buffer< T, 1, AllocatorT > Var, handler &CGH, BinaryOperation, const property_list &PropList={})
Constructs a reduction object using the given buffer Var, handler CGH, reduction operation Combiner,...
Definition: reduction.hpp:2333
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:14