Skip to content

Stabilize sha512, sm3 and sm4 for x86 #140767

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sayantn
Copy link
Contributor

@sayantn sayantn commented May 7, 2025

This PR stabilizes the feature flag sha512_sm_x86 (tracking issue #126624).

Public API

The 3 x86 target features sha512, sm3 and sm4, and the associated intrinsics in stdarch.

These target features are very specialized, and are only used to signal the presence of the corresponding CPU instruction. They don't have any nontrivial interaction with the ABI (contrary to something like AVX), and serve the only purpose of enabling 10 stdarch intrinsics, all of which have been implemented and propagated to rustc via a stdarch submodule update.

Also, these were added in LLVM17, and as the minimum LLVM required for rustc is LLVM19, we are safe in that front too!

Associated PRs

As all of the required tasks have been done (adding the target features to rustc, implementing their runtime detection in std_detect and implementing the associated intrinsics in core_arch), these target features can be stabilized now.

cc @rust-lang/lang
cc @rust-lang/libs-api for the intrinsics and runtime detection

I don't think anyone else worked on this feature, so no one else to ping, maybe cc @Amanieu. I will send the reference pr soon.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. A-target-feature Area: Enabling/disabling target features like AVX, Neon, etc. I-lang-nominated Nominated for discussion during a lang team meeting. O-x86_32 Target: x86 processors, 32 bit (like i686-*) (IA-32) O-x86_64 Target: x86-64 processors (like x86_64-*) (also known as amd64 and x64) labels May 7, 2025
@rustbot
Copy link
Collaborator

rustbot commented May 7, 2025

⚠️ Warning ⚠️

  • Some commits in this PR modify submodules.

@rustbot rustbot added T-lang Relevant to the language team and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 7, 2025
@rust-log-analyzer

This comment has been minimized.

@sayantn sayantn force-pushed the stabilize-sha512 branch from e7b5f40 to 871162c Compare May 7, 2025 20:06
@traviscross
Copy link
Contributor

traviscross commented May 13, 2025

Stabilizing target features are somewhat minimal as far as stabilizations go, but still, this is going to need something more in the way of a stabilization report in the description of this PR. We need some narrative about what we're stabilizing here and a review of the evidence about why it's OK for us to stabilize this now. Have a look at our new template for this in rust-lang/rustc-dev-guide#2219.

Please think too about who else in the Project has worked on this or related things and who might therefore be interested in this, and please ping those people here.

This will also need a PR to the Reference documenting the change, and that should be linked from the stabilization report as well.

@rustbot labels +S-waiting-on-documentation

Please renominate when the stabilization report is available.

@rustbot rustbot added the S-waiting-on-documentation Status: Waiting on approved PRs to documentation before merging label May 13, 2025
@traviscross traviscross added I-lang-radar Items that are on lang's radar and will need eventual work or consideration. and removed I-lang-nominated Nominated for discussion during a lang team meeting. labels May 13, 2025
@traviscross
Copy link
Contributor

is this okay? Or do I have to give more details?

Thanks for adding the details above. @scottmcm, @RalfJung, @workingjubilee, anything more you want to see for this sort of thing?

@traviscross traviscross added I-lang-nominated Nominated for discussion during a lang team meeting. and removed I-lang-radar Items that are on lang's radar and will need eventual work or consideration. labels May 14, 2025
@RalfJung
Copy link
Member

The main question are indeed ABI concerns, or more generally "is there any potential for problems when mixing code built with and without these target features". It seems the answer to that is "no".

The only other issue I think we had is, "does our minimum LLVM version support these target features".

@sayantn
Copy link
Contributor Author

sayantn commented May 15, 2025

@RalfJung updated the text with the minimum llvm version

@traviscross
Copy link
Contributor

Sounds OK to me then. Let's propose FCP.

@rfcbot fcp merge

@rfcbot
Copy link
Collaborator

rfcbot commented May 15, 2025

Team member @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.
See this document for info about what commands tagged team members can give me.

Sorry, something went wrong.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels May 15, 2025
@traviscross
Copy link
Contributor

@sayantn, do the sha512, sm3, and sm4 names match what is shown in /proc/cpuinfo or some other semi-standard source of flag names?

@sayantn
Copy link
Contributor Author

sayantn commented May 15, 2025

I don't know about /proc/cpuinfo, but these names are used by gcc, llvm and Intel, so I would say there should be no confusion about these names

@traviscross traviscross added the P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang label May 16, 2025
@bors
Copy link
Collaborator

bors commented May 18, 2025

☔ The latest upstream changes (presumably #141232) made this pull request unmergeable. Please resolve the merge conflicts.

@sayantn sayantn force-pushed the stabilize-sha512 branch from 871162c to f34cee7 Compare May 20, 2025 18:57
@tmandry
Copy link
Member

tmandry commented May 21, 2025

@rfcbot reviewed

@rfcbot rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels May 21, 2025
@rfcbot
Copy link
Collaborator

rfcbot commented May 21, 2025

🔔 This is now entering its final comment period, as per the review above. 🔔

@traviscross traviscross removed I-lang-nominated Nominated for discussion during a lang team meeting. P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang labels May 21, 2025
@bors
Copy link
Collaborator

bors commented May 22, 2025

☔ The latest upstream changes (presumably #141379) made this pull request unmergeable. Please resolve the merge conflicts.

@sayantn sayantn changed the title Stabilize sha512. sm3 and sm4 for x86 Stabilize sha512, sm3 and sm4 for x86 May 31, 2025
sayantn added 2 commits May 31, 2025 17:02

Verified

This commit was signed with the committer’s verified signature.
sayantn Sayantan Chakraborty
…eatures

Verified

This commit was signed with the committer’s verified signature.
sayantn Sayantan Chakraborty
…`sha512_sm_x86`
@sayantn sayantn force-pushed the stabilize-sha512 branch from f34cee7 to cb1d70f Compare May 31, 2025 11:33
@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-19-2 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[AOT] issue-59326
##[endgroup]
##[group][AOT] neon
[AOT] neon
warning: unsupported llvm intrinsic llvm.roundeven.v4f32; replacing with trap

warning: 1 warning emitted


thread 'main' panicked at library/core/src/panicking.rs:225:5:
llvm.roundeven.v4f32 is not yet supported.
See https://github.com/rust-lang/rustc_codegen_cranelift/issues/171
Please open an issue at https://github.com/rust-lang/rustc_codegen_cranelift/issues
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_nounwind_fmt
   2: core::panicking::panic_nounwind
   3: core::core_arch::arm_shared::neon::generated::vrndnq_f32
             at /checkout/library/core/src/../../stdarch/crates/core_arch/src/arm_shared/neon/generated.rs:58812:14
   4: neon::test_vrndnq_f32
             at ./example/neon.rs:239:30
   5: neon::main
             at ./example/neon.rs:274:9
   6: <fn() as core::ops::function::FnOnce<()>>::call_once
             at /checkout/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread caused non-unwinding panic. aborting.
"/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-tools/cg_clif/build/example/neon" exited with status ExitStatus(unix_wait_status(134))
Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:11:10
  local time: Sat May 31 11:54:25 UTC 2025
  network time: Sat, 31 May 2025 11:54:25 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

@sayantn
Copy link
Contributor Author

sayantn commented May 31, 2025

The job aarch64-gnu-llvm-19-2 failed! Check out the build log: (web) (plain)
Click to see the possible cause of the failure (guessed by this bot)

cc @bjorn3, iirc you mentioned this in the stdarch PR 😅

@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels May 31, 2025
@rfcbot
Copy link
Collaborator

rfcbot commented May 31, 2025

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

@bors
Copy link
Collaborator

bors commented Jun 4, 2025

☔ The latest upstream changes (presumably #141984) made this pull request unmergeable. Please resolve the merge conflicts.

@sayantn
Copy link
Contributor Author

sayantn commented Jun 4, 2025

I am updating the stdarch submodule in #141964, so I will update this after that merges

@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-target-feature Area: Enabling/disabling target features like AVX, Neon, etc. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. O-x86_32 Target: x86 processors, 32 bit (like i686-*) (IA-32) O-x86_64 Target: x86-64 processors (like x86_64-*) (also known as amd64 and x64) S-waiting-on-documentation Status: Waiting on approved PRs to documentation before merging S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-lang Relevant to the language team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants