Skip to content

Commit 97725f1

Browse files
[SYCL][Reduction] Prefer fast group reduce over fast atomics (#6890)
#6434 enabled treating "float" as suitable for Reduction::has_fast_atomics implementation but that is slower than the one available under Reduction::has_fast_reduce. Make sure to check for the latter first.
1 parent 8f0960e commit 97725f1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sycl/include/sycl/reduction.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,12 +1133,12 @@ bool reduCGFuncForRange(handler &CGH, KernelType KernelFunc,
11331133
size_t NDRItems = NWorkGroups * WGSize;
11341134
nd_range<1> NDRange{range<1>{NDRItems}, range<1>{WGSize}};
11351135

1136-
if constexpr (Reduction::has_fast_atomics)
1137-
return reduCGFuncForRangeFastAtomics<KernelName>(CGH, KernelFunc, Range,
1138-
NDRange, Redu);
1139-
else if constexpr (Reduction::has_fast_reduce)
1136+
if constexpr (Reduction::has_fast_reduce)
11401137
return reduCGFuncForRangeFastReduce<KernelName>(CGH, KernelFunc, Range,
11411138
NDRange, Redu);
1139+
else if constexpr (Reduction::has_fast_atomics)
1140+
return reduCGFuncForRangeFastAtomics<KernelName>(CGH, KernelFunc, Range,
1141+
NDRange, Redu);
11421142
else
11431143
return reduCGFuncForRangeBasic<KernelName>(CGH, KernelFunc, Range, NDRange,
11441144
Redu);

0 commit comments

Comments
 (0)