25#ifdef SYCL2020_FEATURE_GROUP_REDUCTION
37 template<
class T,
class Func,
class... Args>
38 inline T map_vector(
const T &in, Func &&f, Args... args) {
42 if constexpr (dim == 1) {
43 return f(in, std::forward<Args>(args)...);
44 }
else if constexpr (dim == 2) {
45 return {f(in[0], std::forward<Args>(args)...), f(in[1], std::forward<Args>(args)...)};
46 }
else if constexpr (dim == 3) {
48 f(in[0], std::forward<Args>(args)...),
49 f(in[1], std::forward<Args>(args)...),
50 f(in[2], std::forward<Args>(args)...)};
51 }
else if constexpr (dim == 4) {
53 f(in[0], std::forward<Args>(args)...),
54 f(in[1], std::forward<Args>(args)...),
55 f(in[2], std::forward<Args>(args)...),
56 f(in[3], std::forward<Args>(args)...)};
57 }
else if constexpr (dim == 8) {
59 f(in[0], std::forward<Args>(args)...),
60 f(in[1], std::forward<Args>(args)...),
61 f(in[2], std::forward<Args>(args)...),
62 f(in[3], std::forward<Args>(args)...),
63 f(in[4], std::forward<Args>(args)...),
64 f(in[5], std::forward<Args>(args)...),
65 f(in[6], std::forward<Args>(args)...),
66 f(in[7], std::forward<Args>(args)...)};
67 }
else if constexpr (dim == 16) {
69 f(in[0], std::forward<Args>(args)...),
70 f(in[1], std::forward<Args>(args)...),
71 f(in[2], std::forward<Args>(args)...),
72 f(in[3], std::forward<Args>(args)...),
73 f(in[4], std::forward<Args>(args)...),
74 f(in[5], std::forward<Args>(args)...),
75 f(in[6], std::forward<Args>(args)...),
76 f(in[7], std::forward<Args>(args)...),
77 f(in[8], std::forward<Args>(args)...),
78 f(in[9], std::forward<Args>(args)...),
79 f(in[10], std::forward<Args>(args)...),
80 f(in[11], std::forward<Args>(args)...),
81 f(in[12], std::forward<Args>(args)...),
82 f(in[13], std::forward<Args>(args)...),
83 f(in[14], std::forward<Args>(args)...),
84 f(in[15], std::forward<Args>(args)...)};
104 inline T sum_over_group(
const sycl::group<1> &g,
const T &v) {
105 #ifdef SYCL_COMP_INTEL_LLVM
106 return sycl::reduce_over_group(g, v, sycl::plus<>());
108 #ifdef SYCL_COMP_ACPP
111 [](
auto component,
const sycl::group<1> &g) {
112 return sycl::reduce_over_group(g, component, sycl::plus<
decltype(component)>{});
127 inline T min_over_group(
const sycl::group<1> &g,
const T &v) {
128 #ifdef SYCL_COMP_INTEL_LLVM
129 return sycl::reduce_over_group(g, v, sycl::minimum<>());
131 #ifdef SYCL_COMP_ACPP
134 [](
auto component,
const sycl::group<1> &g) {
135 return sycl::reduce_over_group(g, component, sycl::minimum<
decltype(component)>{});
150 inline T max_over_group(
const sycl::group<1> &g,
const T &v) {
151 #ifdef SYCL_COMP_INTEL_LLVM
152 return sycl::reduce_over_group(g, v, sycl::maximum<>());
154 #ifdef SYCL_COMP_ACPP
157 [](
auto component,
const sycl::group<1> &g) {
158 return sycl::reduce_over_group(g, component, sycl::maximum<
decltype(component)>{});
std::uint32_t u32
32 bit unsigned integer
namespace for backends this one is named only sham since shambackends is too long to write
constexpr bool always_false_v
Helper variable template that is always false. Especially useful to perform static asserts based on t...