Closed
Description
Description
It appears that System.Runtime.Intrinsics.Arm.Sha256.IsSupported
returns false
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:
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 behavior
Output:
ArmBase:True, Arm64:True, AdvSimd:True, Sha256:True
Actual behavior
Output:
ArmBase:True, Arm64:True, AdvSimd:True, Sha256:False
Unhandled exception. System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.Runtime.Intrinsics.Arm.Sha256.ScheduleUpdate0(Vector128`1 w0_3, Vector128`1 w4_7)
at Program.<Main>$(String[] args) in /Users/____/Code/LOC/Sha256Repro/Program.cs:line 11
Regression?
No response
Known Workarounds
No response
Configuration
NB: Reproducible with both 6.0.100 and 6.0.101
dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.101
Commit: ef49f6213a
Runtime Environment:
OS Name: Mac OS X
OS Version: 12.1
OS Platform: Darwin
RID: osx.12-arm64
Base Path: /usr/local/share/dotnet/sdk/6.0.101/
Host (useful for support):
Version: 6.0.1
Commit: 3a25a7f1cc
sysctl -a | grep hw.optional
:
hw.optional.arm.FEAT_AES: 1
hw.optional.arm.FEAT_BF16: 0
hw.optional.arm.FEAT_BTI: 0
hw.optional.arm.FEAT_CSV2: 1
hw.optional.arm.FEAT_CSV3: 1
hw.optional.arm.FEAT_DPB: 1
hw.optional.arm.FEAT_DPB2: 1
hw.optional.arm.FEAT_DotProd: 1
hw.optional.arm.FEAT_ECV: 1
hw.optional.arm.FEAT_FCMA: 1
hw.optional.arm.FEAT_FHM: 1
hw.optional.arm.FEAT_FP16: 1
hw.optional.arm.FEAT_FPAC: 0
hw.optional.arm.FEAT_FRINTTS: 1
hw.optional.arm.FEAT_FlagM: 1
hw.optional.arm.FEAT_FlagM2: 1
hw.optional.arm.FEAT_I8MM: 0
hw.optional.arm.FEAT_JSCVT: 1
hw.optional.arm.FEAT_LRCPC: 1
hw.optional.arm.FEAT_LRCPC2: 1
hw.optional.arm.FEAT_LSE: 1
hw.optional.arm.FEAT_LSE2: 1
hw.optional.arm.FEAT_PAuth: 1
hw.optional.arm.FEAT_PAuth2: 0
hw.optional.arm.FEAT_PMULL: 1
hw.optional.arm.FEAT_RDM: 1
hw.optional.arm.FEAT_SB: 1
hw.optional.arm.FEAT_SHA1: 1
hw.optional.arm.FEAT_SHA256: 1
hw.optional.arm.FEAT_SHA3: 1
hw.optional.arm.FEAT_SHA512: 1
hw.optional.arm.FEAT_SPECRES: 0
hw.optional.arm.FEAT_SSBS: 1
hw.optional.AdvSIMD: 1
hw.optional.AdvSIMD_HPFPCvt: 1
hw.optional.arm64: 1
hw.optional.armv8_1_atomics: 1
hw.optional.armv8_2_fhm: 1
hw.optional.armv8_2_sha3: 1
hw.optional.armv8_2_sha512: 1
hw.optional.armv8_3_compnum: 1
hw.optional.armv8_crc32: 1
hw.optional.armv8_gpi: 1
hw.optional.breakpoint: 6
hw.optional.floatingpoint: 1
hw.optional.neon: 1
hw.optional.neon_fp16: 1
hw.optional.neon_hpfp: 1
hw.optional.ucnormal_mem: 1
hw.optional.watchpoint: 4
Other information
No response