[SYCL 2020] Declare reduction inline to reduce one variable name
This commit is contained in:
parent
4726f3f0f1
commit
b825df0074
@ -156,14 +156,13 @@ T SYCLStream<T>::dot()
|
||||
sycl::accessor ka {*d_a, cgh, sycl::read_only};
|
||||
sycl::accessor kb {*d_b, cgh, sycl::read_only};
|
||||
|
||||
// Reduction object, to perform summation
|
||||
// Initialises the result to zero
|
||||
auto sumReducer = sycl::reduction(*d_sum, cgh, std::plus<T>(), sycl::property::reduction::initialize_to_identity);
|
||||
|
||||
cgh.parallel_for(sycl::range<1>{array_size}, sumReducer, [=](sycl::id<1> idx, auto& sum)
|
||||
{
|
||||
sum += ka[idx] * kb[idx];
|
||||
});
|
||||
cgh.parallel_for(sycl::range<1>{array_size},
|
||||
// Reduction object, to perform summation - initialises the result to zero
|
||||
sycl::reduction(*d_sum, cgh, std::plus<T>(), sycl::property::reduction::initialize_to_identity);
|
||||
[=](sycl::id<1> idx, auto& sum)
|
||||
{
|
||||
sum += ka[idx] * kb[idx];
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user