Skip to content

Add instruction set detection for SVE_AES, SVE_SHA3, SVE_SM4, SHA3, SM4#124637

Open
a74nh wants to merge 14 commits intodotnet:mainfrom
a74nh:svesets_github
Open

Add instruction set detection for SVE_AES, SVE_SHA3, SVE_SM4, SHA3, SM4#124637
a74nh wants to merge 14 commits intodotnet:mainfrom
a74nh:svesets_github

Conversation

@a74nh
Copy link
Contributor

@a74nh a74nh commented Feb 20, 2026

Mostly a copy/paste of #115117

Copilot AI review requested due to automatic review settings February 20, 2026 12:50
@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Feb 20, 2026
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Feb 20, 2026
@a74nh a74nh marked this pull request as draft February 20, 2026 12:51
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds end-to-end ARM64 instruction set detection and plumbing for SHA3/SM4 and SVE crypto extensions so the runtime/JIT/R2R toolchain can recognize and gate these features consistently across platforms.

Changes:

  • Extend minipal_getcpufeatures to detect SHA3/SM4 and SVE AES/SHA3/SM4 (Linux hwcaps, Apple sysctlbyname, Windows IsProcessorFeaturePresent).
  • Add new ARM64 instruction sets (including R2R IDs/implications) and propagate them through CoreCLR instruction-set enums and helpers.
  • Gate JIT enablement via new CLRConfig/JitConfig switches and wire feature bits into EE JIT compile flags.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/native/minipal/cpufeatures.h Adds new ARM64 feature-bit constants for SHA3/SM4 and SVE crypto extensions.
src/native/minipal/cpufeatures.c Detects new ARM64 capabilities via HWCAP/HWCAP2, sysctl, and Windows PF_* flags.
src/coreclr/vm/codeman.cpp Sets CPU compile flags for new instruction sets, gated by CLRConfig switches.
src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt Registers new ARM64 instruction sets, R2R bits, and ISA implications.
src/coreclr/tools/Common/JitInterface/CorInfoInstructionSet.cs Updates managed instruction-set enums and implication handling for new ARM64 ISAs.
src/coreclr/tools/Common/Internal/Runtime/ReadyToRunInstructionSetHelper.cs Maps new ARM64 instruction sets to R2R instruction set IDs.
src/coreclr/tools/Common/Internal/Runtime/ReadyToRunInstructionSet.cs Adds new R2R instruction set enum values for ARM64 SHA3/SM4 and SVE crypto.
src/coreclr/jit/jitconfigvalues.h Introduces JIT config toggles for enabling/disabling the new ARM64 ISAs.
src/coreclr/jit/hwintrinsicarm64.cpp Adds name-to-instruction-set and Arm64-variant mapping for new ISAs.
src/coreclr/jit/hwintrinsic.cpp Extends ISA range table to include the new ARM64 instruction sets.
src/coreclr/jit/compiler.cpp Enables new ARM64 instruction sets in “enable available ISAs” flow based on JitConfig.
src/coreclr/inc/readytoruninstructionset.h Adds new R2R instruction set IDs on the native side.
src/coreclr/inc/jiteeversionguid.h Bumps JIT/EE version GUID due to instruction-set enum changes.
src/coreclr/inc/corinfoinstructionset.h Extends CORINFO instruction-set enums/validation/mappings for new ARM64 ISAs.
src/coreclr/inc/clrconfigvalues.h Adds CLRConfig switches to gate the new ARM64 ISAs.

Copilot AI review requested due to automatic review settings February 20, 2026 14:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Copilot AI review requested due to automatic review settings February 20, 2026 14:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

@a74nh a74nh marked this pull request as ready for review February 20, 2026 16:48
@a74nh
Copy link
Contributor Author

a74nh commented Feb 20, 2026

@dotnet/arm64-contrib
This is ready now

Copilot AI review requested due to automatic review settings February 26, 2026 11:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.

@dhartglassMSFT
Copy link
Contributor

The changes to the jit all lgtm

Copilot AI review requested due to automatic review settings March 18, 2026 16:01
@a74nh
Copy link
Contributor Author

a74nh commented Mar 18, 2026

@jkotas - I think we need someone from your area to review this. Could you take a look please.

@a74nh a74nh requested a review from jkotas March 18, 2026 16:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.


; The ISA definitions should also be mapped to `hwintrinsicIsaRangeArray` in hwintrinsic.cpp.
; NEXT_AVAILABLE_R2R_BIT = 82
; NEXT_AVAILABLE_R2R_BIT = 90
Comment on lines +230 to +234
instructionset ,ARM64 ,Sha3 , ,85 ,Sha3 ,sha3
instructionset ,ARM64 ,Sm4 , ,86 ,Sm4 ,sm4
instructionset ,ARM64 ,SveAes , ,87 ,SveAes ,sve_aes
instructionset ,ARM64 ,SveSha3 , ,88 ,SveSha3 ,sve_sha3
instructionset ,ARM64 ,SveSm4 , ,89 ,SveSm4 ,sve_sm4
Copy link
Member

Choose a reason for hiding this comment

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

Does the copilot feedback needs addressing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does the copilot feedback needs addressing?

Yes, I'll take a look - they are new since I did the request :)

@jkotas
Copy link
Member

jkotas commented Mar 18, 2026

@jkotas - I think we need someone from your area to review this. Could you take a look please.

@dhartglassMSFT is on my team.

Do we have approved APIs from these extensions? When is the hardware with the extensions going to be broadly available?

I do not see a problem with adding this proactively, but I would rather want to see more energy to be spent on making SVE/SVE2 work great. SVE/SVE2 is much more important than a future HW crypto extensions. The HW crypto extensions are low value for .NET runtime since we depend on OpenSSL exclusively for anything crypto related.

@a74nh
Copy link
Contributor Author

a74nh commented Mar 18, 2026

@jkotas - I think we need someone from your area to review this. Could you take a look please.

@dhartglassMSFT is on my team.

Do we have approved APIs from these extensions? When is the hardware with the extensions going to be broadly available?

These are all available on cobalt 100 and 200, so the the idea was to add everything available on the cobalts that hadn't been added to .NET yet

Approvals are:
#98696
#98692
#94426
#94425
#94423

I do not see a problem with adding this proactively, but I would rather want to see more energy to be spent on making SVE/SVE2 work great. SVE/SVE2 is much more important than a future HW crypto extensions. The HW crypto extensions are low value for .NET runtime since we depend on OpenSSL exclusively for anything crypto related.

Agreed getting SVE/SVE2 working better is much more important. I was expecting these not to take too long to implement given they are only a few APIs per set - I have a PR ready to push that implements all of SHA3 and SVE SHA3 in one go.

If people agree, then I'm happy to drop these - and we'd remove them from #121787

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants