target_features: sse (or at least avx2) is incompatible with soft-float ABI - #160302
Conversation
|
r? @khyperia rustbot has assigned @khyperia. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
r? @workingjubilee or @dianqk |
|
|
|
Hm unfortunately it seems like LLVM does not crash on all functions with #[unsafe(no_mangle)]
#[target_feature(enable = "avx2")]
pub fn foobar(x: __m256i, y: __m256i) -> __m256i {
_mm256_or_si256(x, y)
}So we may have to add an FCW for this after all. @tarcieri do you know which function is causing the trouble in dalek-cryptography/curve25519-dalek#601? All we know is that it's somewhere in poly1305... |
|
Okay I have a reproducer: #![no_std]
use core::arch::x86_64::*;
#[unsafe(no_mangle)]
#[target_feature(enable = "avx2")]
pub fn foobar(ptr: *const __m256i) -> __m256i { unsafe {
let key = _mm256_loadu_si256(ptr);
_mm256_and_si256(
_mm256_permutevar8x32_epi32(key, _mm256_set_epi32(3, 7, 2, 6, 1, 5, 0, 4)),
_mm256_set_epi32(0, -1, 0, -1, 0, -1, 0, -1),
)
}} |
58062d1 to
21a23e9
Compare
|
I don't know these features on x86, but the PR seems reasonable to me. |
|
With Nikita on vacation, who might know which features LLVM supports on x86 in combination with But I guess we can also just warn about all vector features (as this PR does now) and if we get issues saying sse actually works fine we can always adjust. 🤷 |
|
FWIW the s390x target also has a "soft-float" target feature and there we already mark "vector" as incompatible. ARM also has "soft-float" and there we don't mark anything. ARM also has much more explicit ABI control so maybe setting |
This comment has been minimized.
This comment has been minimized.
21a23e9 to
5594310
Compare
This comment has been minimized.
This comment has been minimized.
|
@traviscross has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
|
@bors r=workingjubilee |
…kingjubilee target_features: sse (or at least avx2) is incompatible with soft-float ABI Fixes rust-lang#117938 Enabling both the avx2 and soft-float target features is [not supported by LLVM](rust-lang#117938 (comment)) and can crash the backend. Let's preempt that with rust-level checks. (I still think there's also an LLVM bug here, it shouldn't just SIGILL on unexpected target feature configurations, but that's a different discussion.) What is not clear to me is whether this just affects just avx2 or also avx or even sse (we don't support mmx/3dnow separately). @dianqk do you know more about this? To be safe, let's reject "sse" and therefore by implication also all other x86 vector target features. This PR turns `#[target_feature(enable = "sse")]` on a softfloat target into an FCW similar to what we do on aarch64 (see rust-lang#135160). The FCW only affects people building for soft-float targets which is a fairly small percentage of our overall users (and which means we cannot meaningfully crater this). I hence went for "report in deps" immediately so that the people building the actual binaries see these warnings that their upstreams probably will never see.
…uwer Rollup of 9 pull requests Successful merges: - #160302 (target_features: sse (or at least avx2) is incompatible with soft-float ABI) - #161586 (miri subtree update) - #155254 (Recover on attribute in use tree) - #161166 (add crashtests [5/N], remove unused aux files ) - #161294 (add crashtests [6/N]) - #161569 (Bump cfg_aliases to 0.2.2) - #161573 (re-bless `pretty-std` on windows) - #161588 (update eyre) - #161598 ([Bootstrap] Pass exact CI `llvm-config` executable path)
…kingjubilee target_features: sse (or at least avx2) is incompatible with soft-float ABI Fixes rust-lang#117938 Enabling both the avx2 and soft-float target features is [not supported by LLVM](rust-lang#117938 (comment)) and can crash the backend. Let's preempt that with rust-level checks. (I still think there's also an LLVM bug here, it shouldn't just SIGILL on unexpected target feature configurations, but that's a different discussion.) What is not clear to me is whether this just affects just avx2 or also avx or even sse (we don't support mmx/3dnow separately). @dianqk do you know more about this? To be safe, let's reject "sse" and therefore by implication also all other x86 vector target features. This PR turns `#[target_feature(enable = "sse")]` on a softfloat target into an FCW similar to what we do on aarch64 (see rust-lang#135160). The FCW only affects people building for soft-float targets which is a fairly small percentage of our overall users (and which means we cannot meaningfully crater this). I hence went for "report in deps" immediately so that the people building the actual binaries see these warnings that their upstreams probably will never see.
This comment has been minimized.
This comment has been minimized.
target_features: sse (or at least avx2) is incompatible with soft-float ABI Fixes #117938 Enabling both the avx2 and soft-float target features is [not supported by LLVM](#117938 (comment)) and can crash the backend. Let's preempt that with rust-level checks. (I still think there's also an LLVM bug here, it shouldn't just SIGILL on unexpected target feature configurations, but that's a different discussion.) What is not clear to me is whether this just affects just avx2 or also avx or even sse (we don't support mmx/3dnow separately). @dianqk do you know more about this? To be safe, let's reject "sse" and therefore by implication also all other x86 vector target features. This PR turns `#[target_feature(enable = "sse")]` on a softfloat target into an FCW similar to what we do on aarch64 (see #135160). The FCW only affects people building for soft-float targets which is a fairly small percentage of our overall users (and which means we cannot meaningfully crater this). I hence went for "report in deps" immediately so that the people building the actual binaries see these warnings that their upstreams probably will never see.
|
@bors yield |
|
Auto build was cancelled. Cancelled workflows: The next pull request likely to be tested is #161605. |
…uwer Rollup of 14 pull requests Successful merges: - #160302 (target_features: sse (or at least avx2) is incompatible with soft-float ABI) - #161187 (add `Complex<T>` layout tests for straightforward targets) - #161524 (Put back `tests/rustdoc-gui/search-result-display.goml`) - #161586 (miri subtree update) - #155254 (Recover on attribute in use tree) - #158695 (Replace `CrateDump` with the Debug impl from `CStore`) - #160452 (-Ctarget-feature is not unsafe (any more)) - #161007 (tests/ui/union/union-nodrop.rs: fix typo "expressios") - #161166 (add crashtests [5/N], remove unused aux files ) - #161569 (Bump cfg_aliases to 0.2.2) - #161573 (re-bless `pretty-std` on windows) - #161588 (update eyre) - #161589 (std: reduce visibility of some internal OsStr related types) - #161598 ([Bootstrap] Pass exact CI `llvm-config` executable path)
|
You're brave, rolling this up a 2nd time.^^ |
|
My idea there is that if the rollup fails because of this PR, we don't waste any queue time because this PR would've failed regardless and used the same amount of time |
target_features: sse (or at least avx2) is incompatible with soft-float ABI Fixes #117938 Enabling both the avx2 and soft-float target features is [not supported by LLVM](#117938 (comment)) and can crash the backend. Let's preempt that with rust-level checks. (I still think there's also an LLVM bug here, it shouldn't just SIGILL on unexpected target feature configurations, but that's a different discussion.) What is not clear to me is whether this just affects just avx2 or also avx or even sse (we don't support mmx/3dnow separately). @dianqk do you know more about this? To be safe, let's reject "sse" and therefore by implication also all other x86 vector target features. This PR turns `#[target_feature(enable = "sse")]` on a softfloat target into an FCW similar to what we do on aarch64 (see #135160). The FCW only affects people building for soft-float targets which is a fairly small percentage of our overall users (and which means we cannot meaningfully crater this). I hence went for "report in deps" immediately so that the people building the actual binaries see these warnings that their upstreams probably will never see.
This comment has been minimized.
This comment has been minimized.
|
@bors yield |
|
Auto build was cancelled. Cancelled workflows: The next pull request likely to be tested is #161605. |
…uwer Rollup of 14 pull requests Successful merges: - #160302 (target_features: sse (or at least avx2) is incompatible with soft-float ABI) - #161187 (add `Complex<T>` layout tests for straightforward targets) - #161524 (Put back `tests/rustdoc-gui/search-result-display.goml`) - #161586 (miri subtree update) - #155254 (Recover on attribute in use tree) - #158695 (Replace `CrateDump` with the Debug impl from `CStore`) - #160452 (-Ctarget-feature is not unsafe (any more)) - #161007 (tests/ui/union/union-nodrop.rs: fix typo "expressios") - #161166 (add crashtests [5/N], remove unused aux files ) - #161569 (Bump cfg_aliases to 0.2.2) - #161573 (re-bless `pretty-std` on windows) - #161588 (update eyre) - #161589 (std: reduce visibility of some internal OsStr related types) - #161598 ([Bootstrap] Pass exact CI `llvm-config` executable path)
This comment has been minimized.
This comment has been minimized.
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 9a4ad59 (parent) -> fb6531d (this PR) Test differencesShow 662 test diffsStage 1
Stage 2
Additionally, 650 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard fb6531d550e0075b9eb9a51464f404805eec87d9 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (fb6531d): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (secondary 3.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis perf run didn't have relevant results for this metric. Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 468.884s -> 469.882s (0.21%) |
View all comments
Fixes #117938
Enabling both the avx2 and soft-float target features is not supported by LLVM and can crash the backend. Let's preempt that with rust-level checks. (I still think there's also an LLVM bug here, it shouldn't just SIGILL on unexpected target feature configurations, but that's a different discussion.)
What is not clear to me is whether this just affects just avx2 or also avx or even sse (we don't support mmx/3dnow separately). @dianqk do you know more about this? To be safe, let's reject "sse" and therefore by implication also all other x86 vector target features.
This PR turns
#[target_feature(enable = "sse")]on a softfloat target into an FCW similar to what we do on aarch64 (see #135160). The FCW only affects people building for soft-float targets which is a fairly small percentage of our overall users (and which means we cannot meaningfully crater this). I hence went for "report in deps" immediately so that the people building the actual binaries see these warnings that their upstreams probably will never see.