rustc_codegen_gcc: Progress Report #14
What is rustc_codegen_gcc?
rustc_codegen_gcc is a GCC ahead-of-time codegen for rustc, meaning that it can be loaded by the existing rustc frontend, but benefits from GCC by having more architectures supported and having access to GCC’s optimizations. It is not to be confused with gccrs, which is a GCC frontend for Rust.
LPC 2022
I’ll be presenting at the Linux Plumbers Conference in Dublin next month. Make sure to attend if you want to discuss using this codegen for any specific purposes.
GCC patches status
This month, I did the following:
Those commits are not yet posted as patches for review since there are not ready.
State of rustc_codegen_gcc
Here’s what has been done this month:
-
Sort ui_tests to ensure they remain coherent across different jobs (thanks to GuillaumeGomez!)
-
Add cache for rust repository (thanks to GuillaumeGomez!)
I also looked at CPU features detection, but I haven’t anything working for now.
Here is the progress of the stdarch tests:
test result: FAILED. 4553 passed; 23 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.89s
Category | Last Month | This Month | Delta |
---|---|---|---|
Passed |
4548 |
4553 |
+5 |
Failed |
28 |
23 |
-5 |
Here’s a rough summary of what has been implemented:
Feature | Last month completion | Completion | Delta |
---|---|---|---|
target-specific builtins support in libgccjit |
Done |
||
support for vector shuffle (equivalent of |
Done |
||
|
Done |
||
|
Done |
||
|
Done |
||
|
Done |
||
|
implemented for x86 |
||
|
Done |
||
|
Done |
||
|
Done |
||
LLVM SIMD intrinsics |
~99% implemented for x86 |
~99% implemented for x86 |
0 (needs to fix some bugs) |
|
50% |
50% |
0 |
|
0% |
0% |
0 |
|
0% |
0% |
0 |
|
0% |
0% |
0 |
SIMD float intrinsics |
0% |
0% |
0 |
|
0% |
0% |
0 |
|
0% |
0% |
0 |
UI tests progress
Here are the results of running the UI tests in the CI:
-
https://github.com/rust-lang/rustc_codegen_gcc/runs/7683580881?check_suite_focus=true#step:19:11661
-
https://github.com/rust-lang/rustc_codegen_gcc/runs/7683580949?check_suite_focus=true#step:19:11661
-
https://github.com/rust-lang/rustc_codegen_gcc/runs/7683581038?check_suite_focus=true#step:19:14691 (failures)
Category | Last Month | This Month | Delta |
---|---|---|---|
Passed |
4698 |
4698 |
0 |
Failed |
57 |
57 |
0 |
For the next month, I’ll continue working on SIMD support: debugging those tests and fixing the issues found.
Summary of the failing UI tests.
There was no progress on those tests this month, but I wanted to show a summary describing those failing tests:
Category | Number of failing tests |
---|---|
Target features |
1 |
Panic |
1 |
Undefined reference |
2 |
Simd |
19 |
Allocator |
9 |
Asm |
3 |
Unwinding |
3 |
Async |
3 |
Emit IR |
1 |
LTO |
10 |
Debug info |
2 |
NaN (float) |
2 |
Segfault |
1 (this one is on rust’s side) |
Those do not include some of the tests that were intentionally disabled for now since the feature is not supported yet (LTO and unwinding, mainly).
How to contribute
rustc_codegen_gcc
If you want to help on the project itself, please do the following:
-
Run the tests locally.
-
Choose a test that fails.
-
Investigate why it fails.
-
Fix the problem.
Even if you can’t fix the problem, your investigation could help, so if you enjoy staring at assembly code, have fun!
Crates and rustc
If you would like to contribute on adding support for Rust on
currently unsupported platforms, you can help by adding the support
for those platforms in some crates like libc
and object
and also
in the rust compiler itself.
Test this project
Otherwise, you can test this project on new platforms and also compare the assembly with LLVM to see if some optimization is missing.
Good first issue
Finally, another good way to help is to look at good first issues. Those are issues that should be easier to start with.
Thanks for your support!
I wanted to personally thank all the people that sponsor this project: your support is very much appreciated.
A special thanks to the following sponsors:
-
saethlin
-
embark-studios
-
Traverse-Research
-
Shnatsel
A big thank you to bjorn3 for his help, contributions and reviews. And a big thank you to lqd and GuillaumeGomez for answering my questions about rustc’s internals. Another big thank you to Commeownist for his contributions.
Also, a big thank you to the rest of my sponsors:
-
kpp
-
0x7CFE
-
repi
-
nevi-me
-
oleid
-
acshi
-
joshtriplett
-
djc
-
TimNN
-
sdroege
-
pcn
-
alanfalloon
-
steven-joruk
-
davidlattimore
-
Nehliin
-
colelawrence
-
zmanian
-
alexkirsz
-
regiontog
-
berkus
-
belzael
-
vincentdephily
-
jam1garner
-
yvt
-
Shoeboxam
-
evanrichter
-
yerke
-
bes
-
seanpianka
-
srijs
-
kkysen
-
messense
-
riking
-
rafaelcaricio
-
Lemmih
-
memoryruins
-
pthariensflame
-
senden9
-
robjtede
-
Jonas Platte
-
zebp
-
spike grobstein
-
Oliver Marshall
-
Sam Harrington
-
Jonas
-
Jeff Muizelaar
-
Eugene Bulkin
-
Absolucy
-
Chris Butler
-
sierrafiveseven
-
Joseph Garvin
-
MarcoFalke
-
athre0z
-
icewind
-
Tommy Thorn
-
Sebastian Zivota
-
Oskar Nehlin
-
Nicolas Barbier
-
Daniel
-
Thomas Colliers
-
Justin Ossevoort
-
sbstp
-
Chris
-
Bálint Horváth
-
fanquake
-
sstadick
-
luizirber
-
kiyoshigawa
-
robinmoussu
-
Daniel Sheehan
-
Marvin Löbel
-
nacaclanga
-
Matthew Conolly
-
dandxy89
-
0x0177b11f
and a few others who preferred to stay anonymous.
Former sponsors/patreons:
-
igrr
-
finfet
-
Alovchin91
-
wezm
-
stuhood
-
mexus
-
raymanfx
-
0xdeafbeef
-
ghost
-
gilescope
-
Hofer-Julian
-
olanod
-
Denis Zaletaev
-
Chai T. Rex
-
Paul Ellenbogen
-
Dakota Brink
-
Botlabs
-
Cass
-
Oliver Marshall