Skip to content

Commit

Permalink
Turn off pairwise reduction for some op.
Browse files Browse the repository at this point in the history
The accuracy won't be better.
  • Loading branch information
N5N3 committed Jan 6, 2023
1 parent 84e0b89 commit 6077812
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions base/reduce.jl
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ pairwise_blocksize(f, op) = 1024
# This combination appears to show a benefit from a larger block size
pairwise_blocksize(::typeof(abs2), ::typeof(+)) = 4096

# The following operations prefer non-pairwise reduction.
pairwise_blocksize(_, ::Union{typeof(min),typeof(max)}) = typemax(Int)
pairwise_blocksize(_, ::Union{typeof(|),typeof(&)}) = typemax(Int)

# handling empty arrays
_empty_reduce_error() = throw(ArgumentError("reducing over an empty collection is not allowed"))
Expand Down Expand Up @@ -816,6 +819,8 @@ function _extrema_rf(x::NTuple{2,T}, y::NTuple{2,T}) where {T<:IEEEFloat}
z1, z2
end

pairwise_blocksize(::ExtremaMap, ::typeof(_extrema_rf)) = typemax(Int)

## findmax, findmin, argmax & argmin

"""
Expand Down

0 comments on commit 6077812

Please sign in to comment.