Skip to content

Commit c64f88e

Browse files
[SYCL][Reduction] Fix return type of identityless reduction (#8130)
Identityless reduction uses an unexpected value for the deprecated placeholder template parameter in accessor, so using it causes a failure during compilation. This commit fixes the compilation failures. Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 55b8aa7 commit c64f88e

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

sycl/include/sycl/reduction.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2347,9 +2347,7 @@ template <
23472347
typename = std::enable_if_t<!has_known_identity<BinaryOperation, T>::value>>
23482348
detail::reduction_impl<
23492349
T, BinaryOperation, 0, 1,
2350-
accessor<T, 1, access::mode::read_write, access::target::device,
2351-
access::placeholder::true_t,
2352-
ext::oneapi::accessor_property_list<>>>
2350+
accessor<T, 1, access::mode::read_write, access::target::device>>
23532351
reduction(buffer<T, 1, AllocatorT>, handler &, BinaryOperation,
23542352
const property_list &PropList = {}) {
23552353
// TODO: implement reduction that works even when identity is not known.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// RUN: %clangxx -fsycl -fsyntax-only -sycl-std=2020 %s
2+
3+
// Regression test for ensuring that identityless reductions with accessors
4+
// compile without error.
5+
6+
#include <sycl/sycl.hpp>
7+
8+
int main() {
9+
auto IdentitylessPlus = [](int a, int b) { return a + b; };
10+
11+
sycl::queue Q;
12+
sycl::buffer<int, 1> ReduBuff{1};
13+
Q.submit([&](sycl::handler &CGH) {
14+
auto Reduction = sycl::reduction(ReduBuff, CGH, IdentitylessPlus);
15+
CGH.parallel_for(sycl::range<1>(10), Reduction,
16+
[=](sycl::id<1>, auto &Redu) { Redu.combine(1); });
17+
}).wait();
18+
19+
return 0;
20+
}

0 commit comments

Comments
 (0)