- Notifications
You must be signed in to change notification settings - Fork14.1k
[experiment] reliable float experiments#140424
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Closed
Closed
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or 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
Support for `f16` and `f128` is varied across targets, backends, andbackend versions. Eventually we would like to reach a point where allbackends support these approximately equally, but until then we have towork around some of these nuances of support being observable.Introduce the `cfg_target_has_reliable_f16_f128` internal feature, whichprovides the following new configuration gates:* `cfg(target_has_reliable_f16)`* `cfg(target_has_reliable_f16_math)`* `cfg(target_has_reliable_f128)`* `cfg(target_has_reliable_f128_math)``reliable_f16` and `reliable_f128` indicate that basic arithmetic forthe type works correctly. The `_math` versions indicate that anythingrelying on `libm` works correctly, since sometimes this hits a separateclass of codegen bugs.These options match configuration set by the build script at [1]. Thelogic for LLVM support is duplicated as-is from the same script. Thereare a few possible updates that will come as a follow up.The config introduced here is not planned to ever become stable, it isonly intended to replace the build scripts for `std` tests and`compiler-builtins` that don't have any way to configure based on thecodegen backend.MCP:rust-lang/compiler-team#866Closes:rust-lang/compiler-team#866[1]:https://github.com/rust-lang/rust/blob/555e1d0386f024a8359645c3217f4b3eae9be042/library/std/build.rs#L84-L186
New compiler configuration has been introduced that is designed toreplace the build script configuration `reliable_f16`, `reliable_f128`,`reliable_f16_math`, and `reliable_f128_math`. Do this replacement here,which allows us to clean up `std`'s build script.All tests are gated by `#[cfg(bootstrap)]` rather than doing a morecomplicated `cfg(bootstrap)` / `cfg(not(bootstrap))` split since thenext beta split is within two weeks.
Use the existing Lemire (decimal -> float) and Dragon / Grisu algorithms(float -> decimal) to add support for `f16`. This allows updating theimplementation for `Display` to the expected behavior for `Display`(currently it prints the a hex bitwise representation) and adds a`FromStr` implementation.(cherry picked from commit4c57b48)
Extend the existing tests for `f32` and `f64` with versions that include`f16`'s new printing and parsing implementations.Co-authored-by: Speedy_Lex <alex.ciocildau@gmail.com>(cherry picked from commitc4c7d6c)
This requires a fix to the subnormal test to cap the maximum allowedvalue within the maximum mantissa.(cherry picked from commitcb40d2d)
ContributorAuthor
tgross35 commentedApr 29, 2025
@bors try |
bors added a commit to rust-lang-ci/rust that referenced this pull requestApr 29, 2025
[experiment] reliable float experimentsTrying a few blocked things based on top ofrust-lang#140323.r? `@ghost`try-job: aarch64-gnutry-job: i686-gnu-1try-job: i686-msvc-1try-job: test-varioustry-job: x86_64-gnutry-job: x86_64-msvc-ext2
Collaborator
bors commentedApr 29, 2025
ContributorAuthor
tgross35 commentedApr 29, 2025
@bors try |
Collaborator
bors commentedApr 29, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull requestApr 29, 2025
[experiment] reliable float experimentsTrying a few blocked things based on top ofrust-lang#140323.r? `@ghost`try-job: x86_64-gnu-llvm-19-1try-job: x86_64-gnu-llvm-20-1
This comment has been minimized.
This comment has been minimized.
ContributorAuthor
tgross35 commentedApr 29, 2025
@bors try |
Collaborator
bors commentedApr 29, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull requestApr 29, 2025
[experiment] reliable float experimentsTrying a few blocked things based on top ofrust-lang#140323.r? `@ghost`try-job: aarch64-gnutry-job: i686-gnu-1try-job: i686-msvc-1try-job: test-varioustry-job: x86_64-gnutry-job: x86_64-msvc-ext2try-job: x86_64-gnu-llvm-19-1try-job: x86_64-gnu-llvm-20-1
This comment has been minimized.
This comment has been minimized.
ContributorAuthor
tgross35 commentedApr 29, 2025
@bors try |
Collaborator
rust-log-analyzer commentedApr 29, 2025
The job Click to see the possible cause of the failure (guessed by this bot) |
Collaborator
bors commentedApr 29, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull requestApr 29, 2025
[experiment] reliable float experimentsTrying a few blocked things based on top ofrust-lang#140323.r? `@ghost`try-job: aarch64-gnutry-job: i686-gnu-1try-job: i686-msvc-1try-job: test-varioustry-job: x86_64-gnutry-job: x86_64-msvc-ext2try-job: x86_64-gnu-llvm-19-1try-job: x86_64-gnu-llvm-20-1
Collaborator
rust-log-analyzer commentedApr 29, 2025
The job Click to see the possible cause of the failure (guessed by this bot) |
Collaborator
rust-log-analyzer commentedApr 29, 2025
The job Click to see the possible cause of the failure (guessed by this bot) |
Collaborator
rust-log-analyzer commentedApr 29, 2025
The job Click to see the possible cause of the failure (guessed by this bot) |
Collaborator
rust-log-analyzer commentedApr 29, 2025
The job Click to see the possible cause of the failure (guessed by this bot) |
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Labels
A-testsuiteArea: The testsuite used to check the correctness of rustc S-waiting-on-reviewStatus: Awaiting review from the assignee but also interested parties. T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compilerRelevant to the compiler team, which will review and decide on the PR/issue. T-libsRelevant 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.
Uh oh!
There was an error while loading.Please reload this page.
Trying a few blocked things based on top of#140323.
r?@ghost
try-job: aarch64-gnu
try-job: i686-gnu-1
try-job: i686-msvc-1
try-job: test-various
try-job: x86_64-gnu
try-job: x86_64-msvc-ext2
try-job: x86_64-gnu-llvm-19-1
try-job: x86_64-gnu-llvm-20-1