|
8 | 8 |
|
9 | 9 | #pragma once
|
10 | 10 |
|
11 |
| -#if __cplusplus >= 201703L |
12 |
| -// Entire feature is dependent on C++17. |
13 |
| - |
14 | 11 | #include <sycl/accessor.hpp>
|
15 | 12 | #include <sycl/atomic.hpp>
|
16 | 13 | #include <sycl/atomic_ref.hpp>
|
|
23 | 20 |
|
24 | 21 | #include <tuple>
|
25 | 22 |
|
| 23 | +__SYCL_INLINE_NAMESPACE(cl) { |
| 24 | +namespace sycl { |
| 25 | +namespace ext { |
| 26 | +namespace oneapi { |
| 27 | +namespace detail { |
| 28 | + |
| 29 | +/// Base non-template class which is a base class for all reduction |
| 30 | +/// implementation classes. It is needed to detect the reduction classes. |
| 31 | +class reduction_impl_base {}; |
| 32 | + |
| 33 | +/// Predicate returning true if all template type parameters except the last one |
| 34 | +/// are reductions. |
| 35 | +template <typename FirstT, typename... RestT> struct AreAllButLastReductions { |
| 36 | + static constexpr bool value = |
| 37 | + std::is_base_of<reduction_impl_base, |
| 38 | + std::remove_reference_t<FirstT>>::value && |
| 39 | + AreAllButLastReductions<RestT...>::value; |
| 40 | +}; |
| 41 | + |
| 42 | +/// Helper specialization of AreAllButLastReductions for one element only. |
| 43 | +/// Returns true if the template parameter is not a reduction. |
| 44 | +template <typename T> struct AreAllButLastReductions<T> { |
| 45 | + static constexpr bool value = |
| 46 | + !std::is_base_of<reduction_impl_base, std::remove_reference_t<T>>::value; |
| 47 | +}; |
| 48 | +} // namespace detail |
| 49 | +} // namespace oneapi |
| 50 | +} // namespace ext |
| 51 | +} // namespace sycl |
| 52 | +} // __SYCL_INLINE_NAMESPACE(cl) |
| 53 | + |
| 54 | +#if __cplusplus >= 201703L |
| 55 | +// Entire feature is dependent on C++17. We still have to make the trait above |
| 56 | +// available as queue shortcuts use them unconditionally, including on |
| 57 | +// non-reduction path. |
26 | 58 | __SYCL_INLINE_NAMESPACE(cl) {
|
27 | 59 | namespace sycl {
|
28 | 60 | namespace ext {
|
@@ -456,10 +488,6 @@ class reducer<
|
456 | 488 | marray<T, Extent> MValue;
|
457 | 489 | };
|
458 | 490 |
|
459 |
| -/// Base non-template class which is a base class for all reduction |
460 |
| -/// implementation classes. It is needed to detect the reduction classes. |
461 |
| -class reduction_impl_base {}; |
462 |
| - |
463 | 491 | /// Templated class for common functionality of all reduction implementation
|
464 | 492 | /// classes.
|
465 | 493 | template <typename T, class BinaryOperation> class reduction_impl_common {
|
@@ -713,22 +741,6 @@ class reduction_impl_algo : public reduction_impl_common<T, BinaryOperation> {
|
713 | 741 | /// User's accessor/USM pointer to where the reduction must be written.
|
714 | 742 | RedOutVar MRedOut;
|
715 | 743 | };
|
716 |
| - |
717 |
| -/// Predicate returning true if all template type parameters except the last one |
718 |
| -/// are reductions. |
719 |
| -template <typename FirstT, typename... RestT> struct AreAllButLastReductions { |
720 |
| - static constexpr bool value = |
721 |
| - std::is_base_of<reduction_impl_base, |
722 |
| - std::remove_reference_t<FirstT>>::value && |
723 |
| - AreAllButLastReductions<RestT...>::value; |
724 |
| -}; |
725 |
| - |
726 |
| -/// Helper specialization of AreAllButLastReductions for one element only. |
727 |
| -/// Returns true if the template parameter is not a reduction. |
728 |
| -template <typename T> struct AreAllButLastReductions<T> { |
729 |
| - static constexpr bool value = |
730 |
| - !std::is_base_of<reduction_impl_base, std::remove_reference_t<T>>::value; |
731 |
| -}; |
732 | 744 | /// This class encapsulates the reduction variable/accessor,
|
733 | 745 | /// the reduction operator and an optional operator identity.
|
734 | 746 | template <typename T, class BinaryOperation, int Dims, size_t Extent,
|
|
0 commit comments