Skip to content

Commit 5410d35

Browse files
[NFC][SYCL][Reduction] Remove dead code after #6646 (#6671)
Variadic version of reduSaveFinalResultToUserMem was only performing work in case of discard-write accessor which isn't created after the removal of ext::oneapi::reduction, the function is empty now. Remove it.
1 parent 1265721 commit 5410d35

File tree

2 files changed

+3
-61
lines changed

2 files changed

+3
-61
lines changed

sycl/include/sycl/handler.hpp

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,34 +1759,9 @@ class __SYCL_EXPORT handler {
17591759
// TODO: this variant is currently enabled for 2+ reductions only as the
17601760
// versions handling 1 reduction variable are more efficient right now.
17611761
//
1762-
// Algorithm:
1763-
// 1) discard_write accessor (DWAcc), InitializeToIdentity = true:
1764-
// a) Create uninitialized buffer and read_write accessor (RWAcc).
1765-
// b) discard-write partial sums to RWAcc.
1766-
// c) Repeat the steps (a) and (b) to get one final sum.
1767-
// d) Copy RWAcc to DWAcc.
1768-
// 2) read_write accessor (RWAcc), InitializeToIdentity = false:
1769-
// a) Create new uninitialized buffer (if #work-groups > 1) and RWAcc or
1770-
// re-use user's RWAcc (if #work-groups is 1).
1771-
// b) discard-write to RWAcc (#WG > 1), or update-write (#WG == 1).
1772-
// c) Repeat the steps (a) and (b) to get one final sum.
1773-
// 3) read_write accessor (RWAcc), InitializeToIdentity = true:
1774-
// a) Create new uninitialized buffer (if #work-groups > 1) and RWAcc or
1775-
// re-use user's RWAcc (if #work-groups is 1).
1776-
// b) discard-write to RWAcc.
1777-
// c) Repeat the steps (a) and (b) to get one final sum.
1778-
// 4) USM pointer, InitializeToIdentity = false:
1779-
// a) Create new uninitialized buffer (if #work-groups > 1) and RWAcc or
1780-
// re-use user's USM pointer (if #work-groups is 1).
1781-
// b) discard-write to RWAcc (#WG > 1) or
1782-
// update-write to USM pointer (#WG == 1).
1783-
// c) Repeat the steps (a) and (b) to get one final sum.
1784-
// 5) USM pointer, InitializeToIdentity = true:
1785-
// a) Create new uninitialized buffer (if #work-groups > 1) and RWAcc or
1786-
// re-use user's USM pointer (if #work-groups is 1).
1787-
// b) discard-write to RWAcc (#WG > 1) or
1788-
// discard-write to USM pointer (#WG == 1).
1789-
// c) Repeat the steps (a) and (b) to get one final sum.
1762+
// This is basically a tree reduction where we re-use user's reduction
1763+
// variable instead of creating temporary storage for the last iteration
1764+
// (#WG == 1).
17901765
template <typename KernelName = detail::auto_name, int Dims,
17911766
typename... RestT>
17921767
std::enable_if_t<(sizeof...(RestT) >= 3 &&
@@ -1823,11 +1798,6 @@ class __SYCL_EXPORT handler {
18231798
AuxHandler, NWorkItems, MaxWGSize, ReduTuple, ReduIndices);
18241799
});
18251800
} // end while (NWorkItems > 1)
1826-
1827-
auto CopyEvent = detail::reduSaveFinalResultToUserMem(
1828-
QueueCopy, MIsHost, ReduTuple, ReduIndices);
1829-
if (CopyEvent)
1830-
MLastEvent = *CopyEvent;
18311801
}
18321802
#endif // __cplusplus >= 201703L
18331803

sycl/include/sycl/reduction.hpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2342,34 +2342,6 @@ size_t reduAuxCGFunc(handler &CGH, size_t NWorkItems, size_t MaxWGSize,
23422342
return NWorkGroups;
23432343
}
23442344

2345-
inline void
2346-
reduSaveFinalResultToUserMemHelper(std::vector<event> &,
2347-
std::shared_ptr<detail::queue_impl>, bool) {}
2348-
2349-
template <typename Reduction, typename... RestT>
2350-
void reduSaveFinalResultToUserMemHelper(
2351-
std::vector<event> &Events, std::shared_ptr<detail::queue_impl> Queue,
2352-
bool IsHost, Reduction &Redu, RestT... Rest) {
2353-
reduSaveFinalResultToUserMemHelper(Events, Queue, IsHost, Rest...);
2354-
}
2355-
2356-
/// Creates additional kernels that copy the accumulated/final results from
2357-
/// reductions accessors to either user's accessor or user's USM memory.
2358-
/// Returns the event to the last kernel copying data or nullptr if no
2359-
/// additional kernels created.
2360-
template <typename... Reduction, size_t... Is>
2361-
std::shared_ptr<event>
2362-
reduSaveFinalResultToUserMem(std::shared_ptr<detail::queue_impl> Queue,
2363-
bool IsHost, std::tuple<Reduction...> &ReduTuple,
2364-
std::index_sequence<Is...>) {
2365-
std::vector<event> Events;
2366-
reduSaveFinalResultToUserMemHelper(Events, Queue, IsHost,
2367-
std::get<Is>(ReduTuple)...);
2368-
if (!Events.empty())
2369-
return std::make_shared<event>(Events.back());
2370-
return std::shared_ptr<event>();
2371-
}
2372-
23732345
template <typename Reduction> size_t reduGetMemPerWorkItemHelper(Reduction &) {
23742346
return sizeof(typename Reduction::result_type);
23752347
}

0 commit comments

Comments
 (0)