Skip to content

Make AVX512IFMA opt-in backend #695

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 4 commits into from
Sep 8, 2024

Conversation

pinkforest
Copy link
Contributor

@pinkforest pinkforest commented Aug 29, 2024

Closes #694 #635 #693

Provides cfg(curve25519_dalek_backend = "unstable_avx512")

Errors

  • If nightly is not in use -> Must use nightly in order to use it (similar to compiler main when attempting to use unstables)
  • If not x86_64 simd capable target -> As with simd error out similarly

Note: I avoided whole lot of any(curve25519_dalek_backend = "simd", curve25519_dalek_backend = "unstable_avx512") gating because compilre allows multi-value per cfg-key where we emit "simd" in addition to unstable_avx512 when potential use validated giving AVX2 fallback through simd.

If it's desirable to instead have explicit gating then let me know - but it pollutes a lot of gating.

Copy link
Contributor

@rozbb rozbb left a comment

Choose a reason for hiding this comment

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

Thank you! Left some small nits here and there

@rozbb
Copy link
Contributor

rozbb commented Sep 6, 2024

Ok this seems good to me, thoughts @tarcieri ?

@rozbb rozbb merged commit b636fb8 into dalek-cryptography:main Sep 8, 2024
22 checks passed
@rozbb
Copy link
Contributor

rozbb commented Sep 8, 2024

Thanks again!

@nazar-pc
Copy link

Can this be reverted considering AVX512 was stabilized in Rust and AVX10/256 is no longer a thing. The impact of this change is very substantial on modern AVX512-capable CPUs.

@tarcieri
Copy link
Contributor

@nazar-pc a simple revert won't help, since that just goes back to nightly autodetection, which is undesirable.

The code instead needs to actually be updated to support stable Rust, once 1.89 is released, I believe.

@nazar-pc
Copy link

Since unstable_avx512 wasn't included in any of the published releases yet, reverting it seems like the first step towards stable support anyway since it would only cause more churn. Not sure how much of the original justification is still relevant with AVX512 being already stable in the nightly channel.

Requiring unstable_avx512 configuration option is a lot less friendly, so I'm worried about the next release dropping performance on modern CPUs to almost half of what it was previously (for those who use nightly of course).

Maybe extending feature check to nightly or Rust 1.89.0+ instead could already provide a future-compatible solution, I don't think waiting for stable to be out is a blocker for this.

@tarcieri
Copy link
Contributor

Autodetecting nightly is antipattern that has caused massive ecosystem breakages (see e.g. ahash). We had several people from rust-core lecture us that we should not be doing it

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.

Experimental supports cfg
4 participants