Skip to content

Commit c0e0cec

Browse files
committed
[SYCL] Enable span reductions
Each of the existing reduction implementations (for a single reduction object) can be extended to support spans by looping over the number of elements in the reduction. If (num_elements == 1), the loop has a single iteration and degenerates to the behavior of the reduction implementation prior to this commit. If (num_elements > 1), the loop iterates over each reduction element in turn. Note that the getElement() function allows the scalar and array reduction implementations to be the same without specializing for either case, and allowing difference in storage (a single T vs an array of Ts). This is especially convenient because a scalar reduction is equivalent to an array reduction with a single element. If (num_elements > 1), the implementation currently reduces each element separately. This allows array reductions to use the same amount of work-group local memory as a scalar reduction using the same T, but at the expense of additional synchronization calls. Signed-off-by: John Pennycook <[email protected]>
1 parent 86e9ef5 commit c0e0cec

File tree

1 file changed

+268
-162
lines changed

1 file changed

+268
-162
lines changed

0 commit comments

Comments
 (0)