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

Documents arithmetic reduction semantics #391

Closed
wants to merge 1 commit into from

Conversation

gnzlbg
Copy link
Contributor

@gnzlbg gnzlbg commented Mar 20, 2018

This PR documents the semantics of the arithmetic reductions sum, product, min, and max for integers in the presence of integer overflow, and for floating point numbers in the presence of round-off errors and NaNs.

It does so by adding test for these semantics for all portable vectors involved.

@alexcrichton
Copy link
Member

Looks good! I think CI is failing though?

@gnzlbg
Copy link
Contributor Author

gnzlbg commented Mar 21, 2018

@alexcrichton they are failing on release mode only because my implementation of these in rustc had a bug. I've fixed it here: rust-lang/rust#49231

I'll close this until that lands, and reopen it again once the tests pass.

@gnzlbg gnzlbg closed this Mar 21, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Mar 21, 2018
fix vector fmin/fmax non-fast/fast intrinsics NaN handling

This bugs shows up in release mode tests of `stdsimd`: rust-lang/stdarch#391 . The intrinsics are thoroughly tested there for roundoff errors, NaN, and overflow behavior.

The problem was that the non-fast intrinsics where specifying `NoNaNs == true`, which meant that they don't support NaNs. This is incorrect, the non-fast intrinsics should handle NaNs properly.

Also, the "fast" intrinsics where specifying `NoNaNs == false` which meant that they support NaNs and then fast-math, which probably disables this support. This was not intended either.

I've added a comment specifying what the boolean flags do.
kennytm added a commit to kennytm/rust that referenced this pull request Mar 22, 2018
fix vector fmin/fmax non-fast/fast intrinsics NaN handling

This bugs shows up in release mode tests of `stdsimd`: rust-lang/stdarch#391 . The intrinsics are thoroughly tested there for roundoff errors, NaN, and overflow behavior.

The problem was that the non-fast intrinsics where specifying `NoNaNs == true`, which meant that they don't support NaNs. This is incorrect, the non-fast intrinsics should handle NaNs properly.

Also, the "fast" intrinsics where specifying `NoNaNs == false` which meant that they support NaNs and then fast-math, which probably disables this support. This was not intended either.

I've added a comment specifying what the boolean flags do.
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.

2 participants