Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/arm/windows/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,14 @@ static void set_cpuinfo_isa_fields(void) {
// guarantee that, but it holds in practice.
cpuinfo_isa.rdm = dotprod;

// PF_ARM_V82_FP16_INSTRUCTIONS_AVAILABLE may not be available in older
// Windows versions. If fp16arith was not detected with
// IsProcessorFeaturePresent(PF_ARM_V82_FP16_INSTRUCTIONS_AVAILABLE), fall
Copy link
Collaborator

Choose a reason for hiding this comment

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

Although this is true in practice, if the detection for FP16 is available and used, and it says false, we should respect that?
There have been recent A75 without FP16. They also dont have dot product.
Can you clarify a case for when this is necessary?

Copy link
Author

Choose a reason for hiding this comment

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

Although this is true in practice, if the detection for FP16 is available and used, and it says false, we should respect that?

Yes, I agree that if detection is available, we should respect it. However, I am not sure that it is actually available. IsProcessorFeaturePresent() returns 0 both when the feature is actually not detected to be present and also when detection is not available.

Can you clarify a case for when this is necessary?

The behavior I observed was that, on a CI build system with an Ampere Altra processor, cpuinfo_has_arm_fp16_arith() used to return true (prior to the use of IsProcessorFeaturePresent(PF_ARM_V82_FP16_INSTRUCTIONS_AVAILABLE) in src/arm/windows/init.c) and then started to return false. On that same system, I was able to run a test program with NEON FP16 intrinsics successfully, so it appears that FP16 instructions are actually available.

// back to using the value of dotprod.
if (!cpuinfo_isa.fp16arith) {
cpuinfo_isa.fp16arith = dotprod;
}

/* Windows API reports all or nothing for cryptographic instructions. */
const bool crypto = IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE) != 0;
cpuinfo_isa.aes = crypto;
Expand Down