From b825df00746a13854cfdfd7265cb797fb57395b2 Mon Sep 17 00:00:00 2001 From: Tom Deakin Date: Thu, 21 Jan 2021 18:18:35 +0000 Subject: [PATCH] [SYCL 2020] Declare reduction inline to reduce one variable name --- SYCLStream.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/SYCLStream.cpp b/SYCLStream.cpp index 1c182cb..d879c4e 100644 --- a/SYCLStream.cpp +++ b/SYCLStream.cpp @@ -156,14 +156,13 @@ T SYCLStream::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(), 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(), sycl::property::reduction::initialize_to_identity); + [=](sycl::id<1> idx, auto& sum) + { + sum += ka[idx] * kb[idx]; + }); });