-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
System.Runtime.Intrinsics.Arm.Sha256 APIs are unavailable on Apple Silicon #62832
Comments
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsDescriptionIt appears that Please let me know if you need any additional details. Unfortunately, I have no experience with C++ specifically but otherwise would be happy to investigate if you point me to the right direction where to look for the bits and pieces responsible for CPU feature detection on macOS. Reproduction StepsExecute the following snippet: using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
Console.WriteLine(
$"{nameof(ArmBase)}:{ArmBase.IsSupported}, " +
$"{nameof(ArmBase.Arm64)}:{ArmBase.Arm64.IsSupported}, " +
$"{nameof(AdvSimd)}:{AdvSimd.IsSupported}, " +
$"{nameof(Sha256)}:{Sha256.IsSupported}\n");
var msg0 = Vector128<uint>.Zero;
var msg1 = Vector128<uint>.Zero;
msg0 = Sha256.ScheduleUpdate0(msg0, msg1); Expected behaviorOutput:
Actual behaviorOutput:
Regression?No response Known WorkaroundsNo response ConfigurationNB: Reproducible with both 6.0.100 and 6.0.101
Other informationNo response
|
Looks like some ISA checks are missed here https://github.com/dotnet/runtime/blob/main/src/coreclr/pal/src/misc/jitsupport.cpp#L263 I'll take a look on my m1 |
I assume we need to check these:
the only small problem that macOS 11.x on M1 doesn't report these, they were added in macOS 12.0 but I guess it's ok - I'm updating my M1 mini to verify it now |
On one hand we can't just assume SHA256 is supported because according to https://developer.arm.com/documentation/ddi0487/gb/ page 278 the cryptographic extensions instruction set is optional. On the other, all You can see the same assumptions made in various codebases:
p.s.: yes, |
@neon-sunset are you interested in contributing it? |
That would be awesome. Will probably get this fixed over the upcoming weekend 😀 |
Change submitted in #62958 Despite flag detection now performing as expected, I think this is a somewhat fragile approach and a better option would be to implement it directly in CC: @EgorBo |
Description
It appears that
System.Runtime.Intrinsics.Arm.Sha256.IsSupported
returnsfalse
on M1 Pro and, consequently, fails JIT when attempting to use the corresponding intrinsics.Please let me know if you need any additional details. Unfortunately, I have no experience with C++ specifically but otherwise would be happy to investigate if you point me to the right direction where to look for the bits and pieces responsible for CPU feature detection on macOS.
Reproduction Steps
Execute the following snippet:
Expected behavior
Output:
Actual behavior
Output:
Regression?
No response
Known Workarounds
No response
Configuration
NB: Reproducible with both 6.0.100 and 6.0.101
dotnet --info
sysctl -a | grep hw.optional
:Other information
No response
The text was updated successfully, but these errors were encountered: