-
Notifications
You must be signed in to change notification settings - Fork 270
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
add x86/avx512_fp16 detection #279
Conversation
PR looks good. @gchatelet, @Mizux please review |
Thx @damageboy for the PR. Can you add some tests as well? |
@gchatelet, could you also look at #266 and #277, please? |
Sure, but just to be clear, this is only available right now in Aldel-Lake, no in tiger-lake. The tests I manually ran and quote in the PR message above show this. |
@gchatelet maybe I misunderstood, but currently there are no specific tigerlake tests. I can added both tiger-lage + alder-lake tests, if that helps. Was that your intention? |
Anyway, I added new tests for Tiger-lake + Alder-lake according to their respective CPUID's from @InstLatx64 repository |
I'm experiencing macos test failures... for what should be a synthetic test... Are there any explanations for what needs to happen for these tests to succeed? I'm assuming that this is not a case where officially macos has not tiger-lake or alder-lake support (as sold from Apple) and therefore the tests are failing due to that reason... right? |
not deeply investigate, but your new tests may miss few leafs EDIT: seems linux and windows amd64 pass so it may be a macos-latest only issue... |
cpu_features/src/impl_x86_macos.c Lines 38 to 43 in 627959f
and cpu_features/test/cpuinfo_x86_test.cc Lines 56 to 58 in 627959f
so the test may need to insert "hw.optional.avx512f" to correctly mock darwin os ? |
Ha I misread your message then. I just wanted to have some coverage for this addition. |
@damageboy, so you need to enable avx512f, as an example: https://github.com/google/cpu_features/blob/main/test/cpuinfo_x86_test.cc#L1066-L1072 could you check with this configuration for macOS? cpu().SetDarwinSysCtlByName("hw.optional.avx512f"); |
I'll ask a question that I know I'll regret: Something like: // https://github.com/InstLatx64/InstLatx64/blob/master/GenuineIntel/GenuineIntel00106A1_Nehalem_CPUID.txt
TEST_F(CpuidX86Test, Nehalem) {
// Pre AVX cpus don't have xsave
cpu().SetOsBackupsExtendedRegisters(false);
cpu().EnableFakeFeatures(FakeX86Features::AVX2 | FakeX86Features::AVX512);
// Rest of the test goes as usual
...
} The current state of the mocking infra here leaves a lot of ugliness throughout the code... Would a unification be a welcome addition to this PR? |
@damageboy, in this PR, there is no need to rewrite the TEST_F(CpuidX86Test, INTEL_ALDER_LAKE_AVX512) {
cpu().SetOsBackupsExtendedRegisters(true);
#if defined(CPU_FEATURES_OS_MACOS)
cpu().SetDarwinSysCtlByName("hw.optional.avx512f");
#endif
// Rest of the code
...
} test code layout changes should be considered as a separate patch |
I see everything is green now, LMK if anything additional is required. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
For reference, on an alder-lake CPU with
AVX512
(and therefore,AVX512_FP16
support) enabled:On a tiger-lake laptop, predating
AVX512_FP16
support: