-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
rustc does not detect CPU features correctly when target-cpu=native on Zen 3 #80633
Comments
I believe zen 3 support will be included with LLVM 12, and rustc should pick it up when it upgrades to that release (upstream change). I would guess that the 12 release is still a few months out. |
The only question is how can we better manage user's expectations wrt I'll mark this as a duplicate of #54688 for now as that improvement would resolve this specific issue. |
…nagisa Make target-cpu=native detect individual features This PR makes target-cpu=native check for and enable/disable individual features instead of detecting and targeting a CPU by name. This brings the flag's behavior more in line with clang and gcc and ensures that the host actually supports each feature that we are compiling for. This should resolve issues with miscompilations on e.g. "Haswell" Pentiums and Celerons that lack support for AVX, and also enable support for `aes` on Broadwell processors that support it. It should also resolve issues with failing to detect feature support in newer CPUs that aren't yet known by LLVM (see: rust-lang#80633). Fixes rust-lang#54688 Fixes rust-lang#48464 Fixes rust-lang#38218
I (actually, @tykosa, who managed to get a Ryzen 5 5600X) tried this code:
I expected to see this happen: the compiler detects that the CPU has AVX support and compiles the code, like it does on other CPUs
Instead, this happened:
Meta
rustc --version --verbose
:rustc --print=target-cpus
Snippet of /proc/cpuinfo:
The text was updated successfully, but these errors were encountered: