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

[WIP] continue f16 and f128 impl #120645

Closed
wants to merge 11 commits into from
Closed

Conversation

jendrikw
Copy link
Contributor

@jendrikw jendrikw commented Feb 4, 2024

continuing #114607

tgross35 and others added 10 commits December 28, 2023 01:21
…_ir`

Compilation of `rustc_middle` is successful at this stage

Add `f16` and `f128` to `rustc_smir` and `rustc_trait_selection`

These two crates check successfully at this point

Add `f16` and `f128` to `rustc_abi` and `rustc_target`

Next stage of `f16` and `f128`

Add `f16` and `f128` support to `rustc_codegen_llvm`

Compiler checks correctly

Working on figuring out intrinsics

Add todos to clippy and miri so check passes

Apply CraftSpider's fixes

Finish match for `check_intrinsic_type`

Trade compiler errors for ICEs, progress

Increase precision of f128 constants

Apply Nil's lint_literal fix

Change parsing fallbacks

clif build override

Enable required features for mir_build

Fix parsing modules for new float types

Improve wording on different result message

Correct some f16/f128 constants

Bless UI tests

Work on getting tests to pass

Get a few more tests passing

Bless output with new consts modules

Update bug printing

Bless tests for CI once again (not sure why these are OK on my local but not on CI)

Fix some float tests

Fixup implementations of RawFloat

Some things to help improve tidy

Cover f16 and f128 in more cases

Add f16 and f128 tests

Improve tests results for f16 and f128

Add llvm cg tests for f16

Add f128 tests, both codegen tests passing

Add more to codegen tests

Fix intrinsics and add tests for them

Get a lot more f16 and f128 tests passing

Update a few more f128 tests

Disable rust vs ieee parse checking

parent 518f848
author Trevor Gross <tmgross@umich.edu> 1691638369 -0400
committer Trevor Gross <tmgross@umich.edu> 1701638721 -0500

Add test for f16 parsing and display

Improve 'assert_approx_eq\!' output

Enable all f16 tests

Add meta to macros

Fix rustdoc tests

Update f16 and f128 tests

Update constants

Add inlines to reenable cg_clif on CI

Disable parse checks for f16

Remove a todo

Add missing unused indicators

Change TODO to todo to shut rust-log-analyzer up
Add manual into conversions to fix gc_clif build

Inline call_once for cg_clif

Revert "Add manual into conversions to fix gc_clif build"

This reverts commit 53f8eea5727f366e725306779119d15b518ccbbf.

Throw some more inlines at the wall to see if cg_clif sticks

Even more inlines for cg_clif

Update itanium type ID

Update tests

Update tests

Remove redundancy in gcc

Cleanup note

Clarify integer type for powi primitive

Update clippy to use bootstrap

Fix bootstrapping in miri

Use f16 printing directly

Add mangling for f16 and f128

Update mir_build check for f16
…nd `f128`

Also remove most of `f128_math` because of the LLVM bug

Update clippy to not use f128_math

Update miri to not use f128_math

Remove unneeded feature

Update android log2 intrinsic calls

Temporarily switch demangle to git repo

Fix file mismatch from dropped commit

Fixes after rebase
Update tracking issue

Fix some tests

Fixup clippy

Fixup miri change

Clippy update

Remove spurious smir file

Fix fixme format per review

Fixes for rebase

Update miri shims

Add some broken miri tests

Update parse checks

f32 -> f16 change

Updates to test macros

Updates for clippy

Small cleanup of comments and fixmes

Add inference to feature gate tests

Add feature gate that seems to work, but flag tests don't. Not sure how
that should work...

Update test files
@rustbot
Copy link
Collaborator

rustbot commented Feb 4, 2024

r? @m-ou-se

(rustbot has picked a reviewer for you, use r? to override)

@rustbot
Copy link
Collaborator

rustbot commented Feb 4, 2024

⚠️ Warning ⚠️

  • These commits modify submodules.

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc O-unix Operating system: Unix-like S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative labels Feb 4, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-16 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
GITHUB_ACTION=__run_7
GITHUB_ACTIONS=true
GITHUB_ACTION_REF=
GITHUB_ACTION_REPOSITORY=
GITHUB_ACTOR=jendrikw
GITHUB_API_URL=https://api.github.com
GITHUB_BASE_REF=master
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_a9346f33-e01d-41ce-bb67-1200c5dcbb86
GITHUB_EVENT_NAME=pull_request
GITHUB_EVENT_NAME=pull_request
GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=f16-f128-impl
GITHUB_JOB=pr
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_a9346f33-e01d-41ce-bb67-1200c5dcbb86
GITHUB_REF=refs/pull/120645/merge
GITHUB_REF_NAME=120645/merge
GITHUB_REF_PROTECTED=false
---
GITHUB_SERVER_URL=https://github.com
GITHUB_SHA=b3b992ce91d84a272bd0b9de819e31ecb793eeb4
GITHUB_STATE=/home/runner/work/_temp/_runner_file_commands/save_state_a9346f33-e01d-41ce-bb67-1200c5dcbb86
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_a9346f33-e01d-41ce-bb67-1200c5dcbb86
GITHUB_TRIGGERING_ACTOR=jendrikw
GITHUB_WORKFLOW_REF=rust-lang/rust/.github/workflows/ci.yml@refs/pull/120645/merge
GITHUB_WORKFLOW_SHA=b3b992ce91d84a272bd0b9de819e31ecb793eeb4
GITHUB_WORKSPACE=/home/runner/work/rust/rust
GOROOT_1_19_X64=/opt/hostedtoolcache/go/1.19.13/x64
---
#12 writing image sha256:39d2079b0ada1acda7342fb9ff3bbfd4b9b1f524a686562a0e3cbbdce9f6a83e done
#12 naming to docker.io/library/rust-ci done
#12 DONE 10.2s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-16]
##[group]Clock drift check
  local time: Sun Feb  4 16:04:37 UTC 2024
  network time: Sun, 04 Feb 2024 16:04:37 GMT
  network time: Sun, 04 Feb 2024 16:04:37 GMT
##[endgroup]
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-16', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'build.optimized-compiler-builtins', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-16/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id            := 99999999
---
##[endgroup]
Skipping Set({test::src/tools/tidy}) because it is excluded
##[group]Building stage0 library artifacts (x86_64-unknown-linux-gnu)
    Updating crates.io index
    Updating git repository `https://github.com/tgross35/rustc-demangle.git`
---
   Compiling derivative v2.2.0
   Compiling lazy_static v1.4.0
   Compiling rustc_llvm v0.0.0 (/checkout/compiler/rustc_llvm)
   Compiling unicode-script v0.5.5
   Compiling rustc-demangle v0.1.23 (https://github.com/tgross35/rustc-demangle.git?branch=f16-f128#07968cb1)
   Compiling punycode v0.4.1
   Compiling indexmap v2.0.0
   Compiling pulldown-cmark v0.9.6
   Compiling overload v0.1.1
---
   Compiling overload v0.1.1
   Compiling unicode-script v0.5.5
   Compiling pulldown-cmark v0.9.6
   Compiling punycode v0.4.1
   Compiling rustc-demangle v0.1.23 (https://github.com/tgross35/rustc-demangle.git?branch=f16-f128#07968cb1)
   Compiling nu-ansi-term v0.46.0
   Compiling sharded-slab v0.1.4
   Compiling thread_local v1.1.7
   Compiling pathdiff v0.2.1
---
........................................................................................  4664/16064
..............................i.i.......................................................  4752/16064
.........................................................i..........i............i......  4840/16064
........................................................................................  4928/16064
........................F.F.............................................................  5016/16064
........................................................................................  5192/16064
........................................................................................  5280/16064
........................................................................................  5368/16064
.................................................................................i......  5456/16064
---
failures:

---- [ui] tests/ui/feature-gates/feature-gate-f16.rs stdout ----

error: /checkout/tests/ui/feature-gates/feature-gate-f16.rs:1: unexpected error: '1:10: 1:13: the f16 primitive type is experimental [E0658]'

error: /checkout/tests/ui/feature-gates/feature-gate-f16.rs:4: unexpected error: '4:12: 4:15: the f16 primitive type is experimental [E0658]'

error: /checkout/tests/ui/feature-gates/feature-gate-f16.rs:9: unexpected error: '9:11: 9:14: the f16 primitive type is experimental [E0658]'

error: /checkout/tests/ui/feature-gates/feature-gate-f16.rs:12: unexpected error: '12:8: 12:11: the f16 primitive type is experimental [E0658]'
error: 4 unexpected errors found, 0 expected errors not found
status: exit status: 1
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/feature-gates/feature-gate-f16.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/feature-gates/feature-gate-f16" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/feature-gates/feature-gate-f16/auxiliary"
    Error {
        line_num: 1,
        kind: Some(
            Error,
            Error,
        ),
        msg: "1:10: 1:13: the f16 primitive type is experimental [E0658]",
    Error {
        line_num: 4,
        kind: Some(
            Error,
            Error,
        ),
        msg: "4:12: 4:15: the f16 primitive type is experimental [E0658]",
    Error {
        line_num: 9,
        kind: Some(
            Error,
            Error,
        ),
        msg: "9:11: 9:14: the f16 primitive type is experimental [E0658]",
    Error {
        line_num: 12,
        kind: Some(
            Error,
            Error,
        ),
        msg: "12:8: 12:11: the f16 primitive type is experimental [E0658]",
]

thread '[ui] tests/ui/feature-gates/feature-gate-f16.rs' panicked at src/tools/compiletest/src/runtest.rs:1845:13:
explicit panic
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- [ui] tests/ui/feature-gates/feature-gate-f128.rs stdout ----

error: /checkout/tests/ui/feature-gates/feature-gate-f128.rs:1: unexpected error: '1:10: 1:14: the f128 primitive type is experimental [E0658]'

error: /checkout/tests/ui/feature-gates/feature-gate-f128.rs:4: unexpected error: '4:12: 4:16: the f128 primitive type is experimental [E0658]'

error: /checkout/tests/ui/feature-gates/feature-gate-f128.rs:9: unexpected error: '9:11: 9:15: the f128 primitive type is experimental [E0658]'

error: /checkout/tests/ui/feature-gates/feature-gate-f128.rs:12: unexpected error: '12:8: 12:12: the f128 primitive type is experimental [E0658]'
error: 4 unexpected errors found, 0 expected errors not found
status: exit status: 1
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/feature-gates/feature-gate-f128.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/feature-gates/feature-gate-f128" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/feature-gates/feature-gate-f128/auxiliary"
    Error {
        line_num: 1,
        kind: Some(
            Error,
            Error,
        ),
        msg: "1:10: 1:14: the f128 primitive type is experimental [E0658]",
    Error {
        line_num: 4,
        kind: Some(
            Error,
            Error,
        ),
        msg: "4:12: 4:16: the f128 primitive type is experimental [E0658]",
    Error {
        line_num: 9,
        kind: Some(
            Error,
            Error,
        ),
        msg: "9:11: 9:15: the f128 primitive type is experimental [E0658]",
    Error {
        line_num: 12,
        kind: Some(
            Error,
            Error,
        ),
        msg: "12:8: 12:12: the f128 primitive type is experimental [E0658]",
]

thread '[ui] tests/ui/feature-gates/feature-gate-f128.rs' panicked at src/tools/compiletest/src/runtest.rs:1845:13:
explicit panic

@jendrikw
Copy link
Contributor Author

jendrikw commented Feb 4, 2024

Help, I've run ./x test --bless, but there's no change and I don't quite understand what the difference between actual and expected is.

@fmease fmease added the has-merge-commits PR has merge commits, merge with caution. label Feb 4, 2024
@Nilstrieb
Copy link
Member

This PR is extremely large, making it very hard to review properly. I would strongly recommend splitting it up.
From a quick peek at the diff, here's how I would split it:

  • add the variants to ty::FloatTy/PrimTy and lower them correctly. no changes to library
  • add the intrinsics without using them
  • add f16.rs/f128.rs in the library (with all the docs)
  • implement the changes to float parsing/printing in the library
  • 🎉

This will allow you to simplify the steps and make it easier to review them. It also means that individual teams can review it on their own. The compiler team can review the first and second PR on its own, the libs team can then review the third PR on their own. It also means that concerns will be split, for example issues with the documentation don't have to hold up the intrinsics.

As for your question, the failing tests cannot just be --blessed, you also need to add //~ERROR annotations like in the other files.

@tgross35
Copy link
Contributor

tgross35 commented Feb 4, 2024

This PR is extremely large, making it very hard to review properly. I would strongly recommend splitting it up. From a quick peek at the diff, here's how I would split it:

* add the variants to `ty::FloatTy`/`PrimTy` and lower them correctly. no changes to `library`

* add the intrinsics without using them

* add `f16.rs`/`f128.rs` in the library (with all the docs)

* implement the changes to float parsing/printing in the library

* 🎉

I can handle the first two items since that is complete or near complete in my original PR. @jendrikw are you planning to do the parsing / formatting changes, and/or compiler-builtins?

@bors
Copy link
Contributor

bors commented Feb 4, 2024

☔ The latest upstream changes (presumably #120620) made this pull request unmergeable. Please resolve the merge conflicts.

@jendrikw
Copy link
Contributor Author

jendrikw commented Feb 4, 2024

Sounds good.

@jendrikw
Copy link
Contributor Author

jendrikw commented Feb 5, 2024

Closing as per #114607 (comment).

@jendrikw jendrikw closed this Feb 5, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 1, 2024
…r=compiler-errors

Add stubs in IR and ABI for `f16` and `f128`

This is the very first step toward the changes in rust-lang#114607 and the [`f16` and `f128` RFC](https://rust-lang.github.io/rfcs/3453-f16-and-f128.html). It adds the types to `rustc_type_ir::FloatTy` and `rustc_abi::Primitive`, and just propagates those out as `unimplemented!` stubs where necessary.

These types do not parse yet so there is no feature gate, and it should be okay to use `unimplemented!`.

The next steps will probably be AST support with parsing and the feature gate.

r? `@compiler-errors`
cc `@Nilstrieb` suggested breaking the PR up in rust-lang#120645 (comment)
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Mar 2, 2024
…r-errors

Add stubs in IR and ABI for `f16` and `f128`

This is the very first step toward the changes in rust-lang/rust#114607 and the [`f16` and `f128` RFC](https://rust-lang.github.io/rfcs/3453-f16-and-f128.html). It adds the types to `rustc_type_ir::FloatTy` and `rustc_abi::Primitive`, and just propagates those out as `unimplemented!` stubs where necessary.

These types do not parse yet so there is no feature gate, and it should be okay to use `unimplemented!`.

The next steps will probably be AST support with parsing and the feature gate.

r? `@compiler-errors`
cc `@Nilstrieb` suggested breaking the PR up in rust-lang/rust#120645 (comment)
antoyo pushed a commit to rust-lang/rustc_codegen_gcc that referenced this pull request Mar 5, 2024
…r-errors

Add stubs in IR and ABI for `f16` and `f128`

This is the very first step toward the changes in rust-lang/rust#114607 and the [`f16` and `f128` RFC](https://rust-lang.github.io/rfcs/3453-f16-and-f128.html). It adds the types to `rustc_type_ir::FloatTy` and `rustc_abi::Primitive`, and just propagates those out as `unimplemented!` stubs where necessary.

These types do not parse yet so there is no feature gate, and it should be okay to use `unimplemented!`.

The next steps will probably be AST support with parsing and the feature gate.

r? `@compiler-errors`
cc `@Nilstrieb` suggested breaking the PR up in rust-lang/rust#120645 (comment)
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Mar 7, 2024
…r-errors

Add stubs in IR and ABI for `f16` and `f128`

This is the very first step toward the changes in rust-lang/rust#114607 and the [`f16` and `f128` RFC](https://rust-lang.github.io/rfcs/3453-f16-and-f128.html). It adds the types to `rustc_type_ir::FloatTy` and `rustc_abi::Primitive`, and just propagates those out as `unimplemented!` stubs where necessary.

These types do not parse yet so there is no feature gate, and it should be okay to use `unimplemented!`.

The next steps will probably be AST support with parsing and the feature gate.

r? `@compiler-errors`
cc `@Nilstrieb` suggested breaking the PR up in rust-lang/rust#120645 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc has-merge-commits PR has merge commits, merge with caution. O-unix Operating system: Unix-like S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants