diff --git a/sycl/include/sycl/reduction.hpp b/sycl/include/sycl/reduction.hpp index 0e2639ab1cf9f..49eca5d02b110 100644 --- a/sycl/include/sycl/reduction.hpp +++ b/sycl/include/sycl/reduction.hpp @@ -1653,15 +1653,13 @@ void initReduLocalAccs(bool Pow2WG, size_t LID, size_t WGSize, const std::tuple &Reducers, ReduTupleT Identities, std::index_sequence) { - std::tie(std::get(LocalAccs)[LID]...) = - std::make_tuple(std::get(Reducers).MValue...); + ((std::get(LocalAccs)[LID] = std::get(Reducers).MValue), ...); // For work-groups, which size is not power of two, local accessors have // an additional element with index WGSize that is used by the tree-reduction // algorithm. Initialize those additional elements with identity values here. if (!Pow2WG) - std::tie(std::get(LocalAccs)[WGSize]...) = - std::make_tuple(std::get(Identities)...); + ((std::get(LocalAccs)[WGSize] = std::get(Identities)), ...); } template (LocalAccs)[LID]...) = - std::make_tuple(std::get(InputAccs)[GID]...); + ((std::get(LocalAccs)[LID] = std::get(InputAccs)[GID]), ...); else - std::tie(std::get(LocalAccs)[LID]...) = - std::make_tuple(std::get(Identities)...); + ((std::get(LocalAccs)[LID] = std::get(Identities)), ...); // For work-groups, which size is not power of two, local accessors have // an additional element with index WGSize that is used by the tree-reduction // algorithm. Initialize those additional elements with identity values here. if (!UniformPow2WG) - std::tie(std::get(LocalAccs)[WGSize]...) = - std::make_tuple(std::get(Identities)...); + ((std::get(LocalAccs)[WGSize] = std::get(Identities)), ...); } template @@ -1698,9 +1693,10 @@ void reduceReduLocalAccs(size_t IndexA, size_t IndexB, ReduTupleT LocalAccs, ReduTupleT BOPs, std::index_sequence) { - std::tie(std::get(LocalAccs)[IndexA]...) = - std::make_tuple((std::get(BOPs)(std::get(LocalAccs)[IndexA], - std::get(LocalAccs)[IndexB]))...); + auto ProcessOne = [=](auto &LocalAcc, auto &BOp) { + LocalAcc[IndexA] = BOp(LocalAcc[IndexA], LocalAcc[IndexB]); + }; + (ProcessOne(std::get(LocalAccs), std::get(BOPs)), ...); } template ) { // Add the initial value of user's variable to the final result. if (IsOneWG) - std::tie(std::get(LocalAccs)[0]...) = std::make_tuple(std::get( - BOPs)(std::get(LocalAccs)[0], IsInitializeToIdentity[Is] - ? std::get(IdentityVals) - : std::get(OutAccs)[0])...); + ((std::get(LocalAccs)[0] = std::get(BOPs)( + std::get(LocalAccs)[0], IsInitializeToIdentity[Is] + ? std::get(IdentityVals) + : std::get(OutAccs)[0])), + ...); if (Pow2WG) { // The partial sums for the work-group are stored in 0-th elements of local // accessors. Simply write those sums to output accessors. - std::tie(std::get(OutAccs)[OutAccIndex]...) = - std::make_tuple(std::get(LocalAccs)[0]...); + ((std::get(OutAccs)[OutAccIndex] = std::get(LocalAccs)[0]), ...); } else { // Each of local accessors keeps two partial sums: in 0-th and WGsize-th // elements. Combine them into final partial sums and write to output // accessors. - std::tie(std::get(OutAccs)[OutAccIndex]...) = - std::make_tuple(std::get(BOPs)(std::get(LocalAccs)[0], - std::get(LocalAccs)[WGSize])...); + ((std::get(OutAccs)[OutAccIndex] = std::get(BOPs)( + std::get(LocalAccs)[0], std::get(LocalAccs)[WGSize])), + ...); } }