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

Fix simd_backend + --no-default-features #433

Merged
merged 2 commits into from
Nov 14, 2022
Merged

Fix simd_backend + --no-default-features #433

merged 2 commits into from
Nov 14, 2022

Conversation

tarcieri
Copy link
Contributor

...and one other alloc cleanup.

simd_backend requires alloc and so this combination previously caused a compile error.

Also one additional test that works with an alloc-only profile wasn't enabled, causing a warning in this case.

Finally, changes CI to test this configuration.

@tarcieri tarcieri requested a review from rozbb November 13, 2022 17:52
@tarcieri
Copy link
Contributor Author

Well that's fun...

https://github.com/dalek-cryptography/curve25519-dalek/actions/runs/3456308070/jobs/5768944920

error: failed to run custom build command for `typenum v1.15.0`

Caused by:
  process didn't exit successfully: `/home/runner/work/curve25519-dalek/curve25519-dalek/target/debug/build/typenum-e88f9767296c4856/build-script-main` (signal: 4, SIGILL: illegal instruction)
  --- stdout
  cargo:rustc-env=TYPENUM_BUILD_CONSTS=/home/runner/work/curve25519-dalek/curve25519-dalek/target/debug/build/typenum-11848c0af93[14](https://github.com/dalek-cryptography/curve25519-dalek/actions/runs/3456308070/jobs/5768944920#step:5:15)bcc/out/consts.rs
warning: build failed, waiting for other jobs to finish...
Error: Process completed with exit code 101.

It seems the RUSTFLAGS to enable the SIMD target features are being applied to a build script, which is then executed in CI, and dies due to SIGILL.

I'm not sure if there's a way to selectively enable RUSTFLAGS only for the target executable and not for the build scripts.

@rozbb
Copy link
Contributor

rozbb commented Nov 13, 2022

Ugggh I've fought this before. I don't think there's a way to do crate-specific RUSTFLAGS, but I might be wrong.

Is the only alternative the feature flag route?

tarcieri added a commit that referenced this pull request Nov 13, 2022
A pinned nightly may potentially work around the build failures we're
experiencing due to build scripts using SIMD features:

#433 (comment)
tarcieri added a commit that referenced this pull request Nov 13, 2022
A pinned nightly may potentially work around the build failures we're
experiencing due to build scripts using SIMD features:

#433 (comment)
@tarcieri
Copy link
Contributor Author

@rozbb my best guess is it's a change in a recent nightly which is auto-vectorizing something which wasn't being vectorized before. See #434 as a trivial code change which is also breaking in CI now.

I tried pinning the nightly version in #435 and that seems to provide a band-aid until we can figure out a better solution.

...and one other `alloc` cleanup.

`simd_backend` requires `alloc` and so this combination previously
caused a compile error.

Also one additional test that works with an `alloc`-only profile wasn't
enabled, causing a warning in this case.

Finally, changes CI to test this configuration.
@tarcieri
Copy link
Contributor Author

@rozbb this is green now

src/lib.rs Show resolved Hide resolved
@rozbb
Copy link
Contributor

rozbb commented Nov 14, 2022

Actually, it seems that only tests require alloc. cargo +nightly build --no-default-features --features "simd_backend" works for me

@rozbb
Copy link
Contributor

rozbb commented Nov 14, 2022

Finally, changes CI to test this configuration.

I don't see the changes anymore

@tarcieri
Copy link
Contributor Author

Actually, it seems that only tests require alloc. cargo +nightly build --no-default-features --features "simd_backend" works for me

Aah hmmm, ok. Maybe the tests should be gated on alloc.

I don't see the changes anymore

Was lost in a rebase unfortunately

@rozbb
Copy link
Contributor

rozbb commented Nov 14, 2022

If it's a pain to feature-gate the tests, I don't think it matters that much. I don't think there's an AVX2-capable machine that also has no RAM

Adds `cfg(feature = "alloc")` gating to all tests that require `alloc`.

This allows the tests to run with the `alloc` feature disabled.
@tarcieri
Copy link
Contributor Author

tarcieri commented Nov 14, 2022

Gated the alloc-dependent tests in a94629c.

If it's a pain to feature-gate the tests, I don't think it matters that much. I don't think there's an AVX2-capable machine that also has no RAM

I'm a little curious why this only pops up with simd_backend enabled. But also, I think it's generally good to ensure all combinations of features work unless you explicitly bail out with compile_error! for invalid combinations.

@rozbb rozbb merged commit d05afa0 into release/4.0 Nov 14, 2022
@tarcieri tarcieri deleted the fix-simd+alloc branch May 31, 2023 02:12
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.

2 participants