-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
float::min/max: mention the non-determinism around signed 0 #136296
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tgross35
approved these changes
Jan 30, 2025
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 31, 2025
Rollup of 8 pull requests Successful merges: - rust-lang#135414 (Stabilize `const_black_box`) - rust-lang#136150 (ci: use windows 2025 for i686-mingw) - rust-lang#136258 (rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 11)) - rust-lang#136270 (Remove `NamedVarMap`.) - rust-lang#136278 (add constraint graph to polonius MIR dump) - rust-lang#136287 (LLVM changed the nocapture attribute to captures(none)) - rust-lang#136291 (some test suite cleanups) - rust-lang#136296 (float::min/max: mention the non-determinism around signed 0) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 31, 2025
Rollup merge of rust-lang#136296 - RalfJung:float-min-max, r=tgross35 float::min/max: mention the non-determinism around signed 0 Turns out this can actually produce different results on different machines [in practice](rust-lang#83984 (comment)); that seems worth documenting. I assume LLVM will happily const-fold these operations so so there could be different results for the same input even on the same machine, depending on whether things get const-folded or not. `@nikic` I remember there was an LLVM soundness fix regarding scalar evolution for loops that had to recognize certain operations as non-deterministic... it seems to me that pass would also have to avoid predicting the result of `llvm.{min,max}num`, for the same reason? r? `@tgross35` Cc `@rust-lang/libs-api` If this lands we should also make Miri non-deterministic here. Fixes rust-lang#83984
workingjubilee
added a commit
to workingjubilee/rustc
that referenced
this pull request
Jan 31, 2025
…-obk miri: make float min/max non-deterministic This makes Miri match the documentation that landed in rust-lang#136296. r? `@oli-obk`
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Feb 1, 2025
…-obk miri: make float min/max non-deterministic This makes Miri match the documentation that landed in rust-lang#136296. r? ``@oli-obk``
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 1, 2025
Rollup merge of rust-lang#136348 - RalfJung:miri-float-min-max, r=oli-obk miri: make float min/max non-deterministic This makes Miri match the documentation that landed in rust-lang#136296. r? ``@oli-obk``
RalfJung
pushed a commit
to RalfJung/miri
that referenced
this pull request
Feb 2, 2025
miri: make float min/max non-deterministic This makes Miri match the documentation that landed in rust-lang/rust#136296. r? ``@oli-obk``
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Turns out this can actually produce different results on different machines in practice; that seems worth documenting. I assume LLVM will happily const-fold these operations so so there could be different results for the same input even on the same machine, depending on whether things get const-folded or not.
@nikic I remember there was an LLVM soundness fix regarding scalar evolution for loops that had to recognize certain operations as non-deterministic... it seems to me that pass would also have to avoid predicting the result of
llvm.{min,max}num
, for the same reason?r? @tgross35
Cc @rust-lang/libs-api
If this lands we should also make Miri non-deterministic here.
Fixes #83984