Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't dispatch on VectorizationBase.Vec #20

Merged
merged 2 commits into from
Apr 9, 2022
Merged

Don't dispatch on VectorizationBase.Vec #20

merged 2 commits into from
Apr 9, 2022

Conversation

brenhinkeller
Copy link
Owner

@brenhinkeller brenhinkeller commented Apr 8, 2022

The previous implementation of nanmin and nanmax dispatched on VectorizationBase.Vec{N, <:AbstractFloat} which was a convenient way to avoid unnecessary comparisons on arrays which didn't contain AbstractFloat and couldn't contain NaNs.

However, at some point LoopVectorization.jl / VectorizationBase.jl appears to have started also (?) emitting a more complicated VectorizationBase.VecUnroll which hit the untyped fallback method in nanmin/nanmax which gave incorrect results.

To avoid that problem, this fix for now just treats everything as if it potentially contains NaNs, and makes no assumptions about the internals of LoopVectorzation / VectorizationBase so should be more robust to future changes at the minor cost of being a bit slower for arrays of integers.

Should test and fix #19

@brenhinkeller brenhinkeller merged commit 91f4201 into main Apr 9, 2022
@brenhinkeller brenhinkeller deleted the vec branch April 9, 2022 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nanmaximum and nanminimum yield NaN when too many NaN's are present in Array
1 participant