Skip to content

Commit 1c97a16

Browse files
committed
[SYCL] Disable span reductions before C++17
Necessary because span.hpp is only available >= C++17. Signed-off-by: John Pennycook <[email protected]>
1 parent c0e0cec commit 1c97a16

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

sycl/include/CL/sycl/reduction.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ reduction(T *Var, const T &Identity, BinaryOperation Combiner,
100100
return {Var, Identity, Combiner, InitializeToIdentity};
101101
}
102102

103+
#if __cplusplus >= 201703L
103104
/// Constructs a reduction object using the reduction variable referenced by
104105
/// the given sycl::span \p Span, reduction operation \p Combiner, and
105106
/// optional reduction properties.
@@ -149,6 +150,7 @@ reduction(span<T, Extent> Span, const T &Identity, BinaryOperation Combiner,
149150
PropList.has_property<property::reduction::initialize_to_identity>();
150151
return {Span, Identity, Combiner, InitializeToIdentity};
151152
}
153+
#endif
152154

153155
} // namespace sycl
154156
} // __SYCL_INLINE_NAMESPACE(cl)

sycl/include/sycl/ext/oneapi/reduction.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ template <typename T, class BinaryOperation> class reducer_element {
413413
/// Specialization of 'reducer' class for array reductions accepting a span
414414
/// in cases where the identity value is not known.
415415
// TODO: Support alternative algorithms for different values of Extent
416+
#if __cplusplus >= 201703L
416417
template <typename T, size_t Extent, class BinaryOperation>
417418
class reducer<span<T, Extent>, BinaryOperation,
418419
enable_if_t<!IsKnownIdentityOp<T, BinaryOperation>::value>> {
@@ -571,6 +572,7 @@ class reducer<span<T, Extent>, BinaryOperation,
571572
private:
572573
marray<T, Extent> MValue;
573574
};
575+
#endif
574576

575577
/// Base non-template class which is a base class for all reduction
576578
/// implementation classes. It is needed to detect the reduction classes.
@@ -1026,6 +1028,7 @@ class reduction_impl : private reduction_impl_base {
10261028
/// Specialization of reduction_impl for spans
10271029
// TODO: Consider hoisting some functionality into reduction_impl_base
10281030
// TODO: Refactor to remove IsUSM and IsPlaceholder arguments?
1031+
#if __cplusplus >= 201703L
10291032
template <typename T, size_t Extent, class BinaryOperation, int Dims,
10301033
bool IsUSM, access::placeholder IsPlaceholder>
10311034
class reduction_impl<span<T, Extent>, BinaryOperation, Dims, IsUSM,
@@ -1273,6 +1276,7 @@ class reduction_impl<span<T, Extent>, BinaryOperation, Dims, IsUSM,
12731276

12741277
bool InitializeToIdentity;
12751278
};
1279+
#endif
12761280

12771281
/// These are the forward declaration for the classes that help to create
12781282
/// names for additional kernels. It is used only when there are

0 commit comments

Comments
 (0)