Skip to content

Commit a0a4d72

Browse files
[SYCL][Reduction] Fix issue with multiple buffer reductions (#6680)
reduAuxCGFunc has different output target between the case when number of work groups is one or more, while the kernel executed is the same. As such we were re-using the same kernel code trying to adjust its name so that a single one isn't used two times (#WGs check is a run-time one). We used accessors' types for that but that approach only worked for USM case (ptr vs buffer accessor for the output type depending on #WGs). In case when the original reduction variable used a buffer, both type were the same resulting in a "definition with same mangled name" error. Use something that has distinct types to name the kernel.
1 parent 3dc891f commit a0a4d72

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sycl/include/sycl/reduction.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,7 +2272,7 @@ void reduCGFunc(handler &CGH, KernelType KernelFunc,
22722272

22732273
namespace reduction {
22742274
namespace aux_krn {
2275-
template <class KernelName, class Accessor> struct Multi;
2275+
template <class KernelName, class Predicate> struct Multi;
22762276
} // namespace aux_krn
22772277
} // namespace reduction
22782278
template <typename KernelName, typename KernelType, typename... Reductions,
@@ -2312,7 +2312,7 @@ size_t reduAuxCGFunc(handler &CGH, size_t NWorkItems, size_t MaxWGSize,
23122312
auto AccReduIndices = filterSequence<Reductions...>(Predicate, ReduIndices);
23132313
associateReduAccsWithHandler(CGH, ReduTuple, AccReduIndices);
23142314
using Name = __sycl_reduction_kernel<reduction::aux_krn::Multi, KernelName,
2315-
decltype(OutAccsTuple)>;
2315+
decltype(Predicate)>;
23162316
// TODO: Opportunity to parallelize across number of elements
23172317
range<1> GlobalRange = {HasUniformWG ? NWorkItems : NWorkGroups * WGSize};
23182318
nd_range<1> Range{GlobalRange, range<1>(WGSize)};

0 commit comments

Comments
 (0)