Skip to content

Make AVX512IFMA opt-in backend#695

Merged
rozbb merged 4 commits intodalek-cryptography:mainfrom
pinkforest:opt-in-unstable-avx512
Sep 8, 2024
Merged

Make AVX512IFMA opt-in backend#695
rozbb merged 4 commits intodalek-cryptography:mainfrom
pinkforest:opt-in-unstable-avx512

Conversation

@pinkforest
Copy link
Copy Markdown
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
Copy Markdown
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

Comment thread curve25519-dalek/build.rs Outdated
Comment thread curve25519-dalek/build.rs
Comment thread curve25519-dalek/src/backend/mod.rs
Comment thread curve25519-dalek/build.rs
Comment thread curve25519-dalek/src/backend/mod.rs
@rozbb
Copy link
Copy Markdown
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
@rozbb
Copy link
Copy Markdown
Contributor

rozbb commented Sep 8, 2024

Thanks again!

@nazar-pc
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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

astefano pushed a commit to Beneficial-AI-Foundation/curve25519-dalek that referenced this pull request Mar 22, 2026
* field_canonical + field64

* rebase

* field specs

* rebase tweaks

* fmt

* oneline json

* PR comments

* PR comments p2
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