Repository navigation
Stabilize RISC-V Zk and Zb intrinsics - #2248
TechnoPorg wants to merge 6 commits into
Conversation
|
Thanks for the pull request, and welcome! The Rust Project has assigned @sayantn (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks. Why was this reviewer chosen?The reviewer was selected based on:
|
|
Whoops meant to open this against my fork... let me quickly write a stabilization report! |
|
Error: The feature Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip. |
Zkn intrinsicsZk and Zb intrinsics
4c5b583 to
ce1255a
Compare
| /// The `BS` parameter is expected to be a constant value and only the bottom 2 bits of `bs` are | ||
| /// used. | ||
| #[target_feature(enable = "zkne")] | ||
| #[rustc_legacy_const_generics(2)] |
There was a problem hiding this comment.
Also yes, this should be removed from stabilized intrinsics rust-lang/rust#149654. You could also put up a separate PR removing them from all RISC-V stdarch, if interested. (Or even more if there are arches aside from arm, aarch64, and x86 that use it).
I'm not sure when this started working, but I didn't have the problem in issue 1464.
ce1255a to
fbc461b
Compare
|
@rustbot blocked Based on rust-lang/rust#114544 (comment), we'd like to change to match the C API first. We should make sure there is fuzz testing against C intrinsics as mentioned in #2221 (comment). |
|
Error: The feature Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip. |
I've just updated #2247 to match the C API.
That seems reasonable. I can start on a branch for it now, but I'd ideally like to wait until #2247 and #2254 are merged so as to not be stuck in an endless cycle of rebases.
I tried the same thing 😂 |
Stabilization report
Summary
These intrinsics allow using instructions from the RISC-V ratified scalar crypto extensions and bit manipulation extensions. This includes:
ZkneandZkndZknhZbkbZbkcZbkxZksedZkshThese have the potential to significantly accelerate cryptographic operations on both RV32 and RV64 devices.
Tracking:
What isn't stabilized
Other RISC-V ratified extension intrinsics, such as the packed SIMD extension
P.Design
Answers to unresolved questions
From the tracking issue:
The conclusion in rust-lang/rust#114544 from the libs team is that for this set of intrinsics, u32/u64 are preferable. This matches the way they are used by current nightly consumers and feels more appropriate given that these operate on data and not addresses.
Feedback
Nightly use
Zknhbackend.In all of these, u32/u64 are more ergonomic than usize.
Breaking changes
None.
History
ZkintrinsicsZbintrinsicsAcknowledgments
Open items
rustc_legacy_const_genericsfrom unstable intrinsics #2254No LLMs were used to write this PR.