Skip to content

Update to nightly-2021-09-11 #79

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

Merged
merged 7 commits into from Sep 17, 2021
Merged

Update to nightly-2021-09-11 #79

merged 7 commits into from Sep 17, 2021

Conversation

ghost
Copy link

@ghost ghost commented Sep 11, 2021

There are quite a few changes in rustc I had to address, most notably black_box is now a backend-driven intrinsic. No more hacks for llvm_asm!

I haven't yet looked at the codegen tests: no spare time, sorry. Hopefully, this evening.

Commeownist added 3 commits September 11, 2021 06:37
Responsibility of implementing the black box is now lies on backend
No changes needed, apparently
Copy link
Contributor

@antoyo antoyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ghost
Copy link
Author

ghost commented Sep 15, 2021

(There are not enough hours in the day)

I have good news, bad news, and bad news (it's midnight and I'm a little bit unimaginative at midnights; I'll catch up another day).

Good news: I've been able to verify that the clobber_api is indeed correctly translated to out("reg")_ operands, transparently to the backend (I compiled a simple separate file). Also, turns out that not every register's name as given by rustc is a valid GCC name for the clobber list. I'm sending a separate PR for it.

Bad news: running codegen tests in requires being able to save intermediate artifacts to a file (judging by this). I haven't find a way to save GIMPLE to a separate file, or anywhere but stderr. (I checked your fork as well). Related to #81.

Bad news: clobber_api("C") clobbers k[1-7] AVX-512 registers, which the docs of course do not mention. I'm starting to love open-source world, and it's very weird, kiss-kill kind of love. Unfortunately, GCC does not allow to clobber these registers unless the -mavx512f option is passed, and I see gccjit::context does not support testing for added options. Another patch to libgccjit...

@bjorn3
Copy link
Member

bjorn3 commented Sep 15, 2021

Bad news: clobber_api("C") clobbers k[1-7] AVX-512 registers

I think it should be changed to only do so when AVX-512 is actually enabled for the current function I think. It makes sense that GCC doesn't allow it when AVX-512 isn't enabled. I am slightly suprised that LLVM does allow it. cc @Amanieu.

which the docs of course do not mention.

The actual code for this is https://github.com/rust-lang/rust/blob/3ed6c1d23fd40f4367259a531465e809eb00ec27/compiler/rustc_target/src/asm/mod.rs#L802 which does indeed have k1-k7. Guess the docs need to be updated.

@Amanieu
Copy link
Member

Amanieu commented Sep 15, 2021

Yes, LLVM simply ignores any invalid clobbers. So for GCC you would just have to gate the clobbers based on what target features are enabled.

@Amanieu
Copy link
Member

Amanieu commented Sep 15, 2021

Note that this only applies to clobbers, LLVM still requires outputs (even dummy ones) to be valid registers for the current target.

This is the code that handles this in the LLVM codegen backend: https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_llvm/src/asm.rs#L175

@ghost
Copy link
Author

ghost commented Sep 16, 2021

I see gccjit::context does not support testing for added options. Another patch to libgccjit...

I think this was wrong. We can just check features provided by the frontend as suggested by @Amanieu .

@antoyo
Copy link
Contributor

antoyo commented Sep 17, 2021

@Commeownist: Is it okay for you if I fix the remaining reviews in order to merge this PR? I'd like to merge it soon to update the PR in rustc to move things forward.

@ghost
Copy link
Author

ghost commented Sep 17, 2021

@antoyo Cool.

@ghost
Copy link
Author

ghost commented Sep 17, 2021

@antoyo I've resolved reviews (except I'd like to leave the TODO comment) and updated to nightly-2021-09-17. I think you can just merge it as is.

I'll leave codegen tests for another day.

@antoyo
Copy link
Contributor

antoyo commented Sep 17, 2021

There's an error in the CI which seems unrelated: it's about the bootstrap.

@ghost
Copy link
Author

ghost commented Sep 17, 2021

@antoyo Are you sure that rust-toolchain file is respected? These lines from the log make me somewhat concerned:

downloading https://static.rust-lang.org/dist/2021-09-08/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz
...
extracting /home/runner/work/rustc_codegen_gcc/rustc_codegen_gcc/rust/build/cache/2021-09-08/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz

@ghost
Copy link
Author

ghost commented Sep 17, 2021

I suspect it's related to those wonderful git checkout <hash> commands all over test.sh.

@antoyo
Copy link
Contributor

antoyo commented Sep 17, 2021

Does this work locally? Perhaps the CI is having issue…

@bjorn3
Copy link
Member

bjorn3 commented Sep 17, 2021

@antoyo Are you sure that rust-toolchain file is respected? These lines from the log make me somewhat concerned:

downloading https://static.rust-lang.org/dist/2021-09-08/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz
...
extracting /home/runner/work/rustc_codegen_gcc/rustc_codegen_gcc/rust/build/cache/2021-09-08/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz

Rustc uses a nightly rustfmt instead of the version associated with the bootstrap compiler. I don't quite remember why though.

@bjorn3
Copy link
Member

bjorn3 commented Sep 17, 2021

Bootstrap failed due to a new warning about an unused field that doesn't exist on beta. You could add deny-warnings = false to the [rust] section of config.toml:

[build]

@ghost
Copy link
Author

ghost commented Sep 17, 2021

@antoyo Ready

@antoyo antoyo merged commit 48d60ab into rust-lang:master Sep 17, 2021
@antoyo
Copy link
Contributor

antoyo commented Sep 17, 2021

Thanks!

@ghost ghost deleted the update-to-latest branch September 18, 2021 09:53
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.

3 participants