Skip to content

BLIS misdetects 2017 MBP #385

Closed
Closed

Description

@devinamatthews

My 2017 MBP is not correctly detected as haswell at runtime, although configure auto builds the haswell kernels. CPU info:

machdep.cpu.vendor: GenuineIntel
machdep.cpu.brand_string: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
machdep.cpu.family: 6
machdep.cpu.model: 158
machdep.cpu.extmodel: 9
machdep.cpu.extfamily: 0
machdep.cpu.stepping: 9

Activity

  1. jeffhammond commented on Mar 23, 2020

    @jeffhammond
    Member
  2. devinamatthews commented on Mar 23, 2020

    @devinamatthews
    MemberAuthor

    In theory it is straightforward:

    	// Check for expected CPU features.
    	const uint32_t expected = FEATURE_AVX  |
    	                          FEATURE_FMA3 |
    	                          FEATURE_AVX2;
    
    	if ( !bli_cpuid_has_features( features, expected ) ) return FALSE;
    
    	return TRUE;

    so I don't know that the problem is.

  3. jeffhammond commented on Mar 23, 2020

    @jeffhammond
    Member

    Sorry, I meant "what result is obtained from detection, if not Haswell?"

  4. devinamatthews commented on Mar 24, 2020

    @devinamatthews
    MemberAuthor

    I turned on all the printing in bli_cpuid.c and this looks like it might be the problem:

    fma3: 0
    

    I'll have to dig in to the cpuid leaves.

  5. devinamatthews commented on Mar 24, 2020

    @devinamatthews
    MemberAuthor

    Something very odd is up. This code:

    print_binary(*features);
    print_binary(FEATURE_SSE3);
    print_binary(FEATURE_SSSE3);
    print_binary(FEATURE_SSE41);
    print_binary(FEATURE_SSE42);
    print_binary(FEATURE_AVX);
    print_binary(FEATURE_FMA3);
    
    fprintf(stderr, "sse3: %d\n", bli_cpuid_has_features(features, FEATURE_SSE3));
    fprintf(stderr, "ssse3: %d\n", bli_cpuid_has_features(features, FEATURE_SSSE3));
    fprintf(stderr, "sse4.1: %d\n", bli_cpuid_has_features(features, FEATURE_SSE41));
    fprintf(stderr, "sse4.2: %d\n", bli_cpuid_has_features(features, FEATURE_SSE42));
    fprintf(stderr, "avx: %d\n", bli_cpuid_has_features(features, FEATURE_AVX));
    fprintf(stderr, "fma3: %d\n", bli_cpuid_has_features(features, FEATURE_FMA3));

    Produces this output:

    0000 0000 0000 0000 0000 0000 0111 1111 
    0000 0000 0000 0000 0000 0000 0000 0001 
    0000 0000 0000 0000 0000 0000 0000 0010 
    0000 0000 0000 0000 0000 0000 0000 0100 
    0000 0000 0000 0000 0000 0000 0000 1000 
    0000 0000 0000 0000 0000 0000 0001 0000 
    0000 0000 0000 0000 0000 0000 0100 0000 
    sse3: 0
    ssse3: 0
    sse4.1: 1
    sse4.2: 1
    avx: 1
    fma3: 0
    
  6. devinamatthews commented on Mar 24, 2020

    @devinamatthews
    MemberAuthor

    OK, this is crazy, but what is actually being checked is not the feature bits themselves, but the pointer to the feature bits. I have no idea how this ever "worked".

  7. devinamatthews commented on Mar 24, 2020

    @devinamatthews
    MemberAuthor

    Luckily, the checking the pointer thing only applied to the debugging output which, while very confusing, is not the core issue. I did find something else. After configure with ./configure auto, both configure and BLIS_ARCH_DEBUG show the active config as haswell. When I then edit the files kernels/zen/1/bli_amaxv_zen_int.c and ref_kernels/1/bli_amaxv_ref.c to print here zen and here ref, respectively, I get this confusing output:

    libblis: selecting sub-configuration 'haswell'.
    here ref
    

    from a simple program that just calls idamax. Confusingly, same happens after ./configure haswell. I'm not actually sure how I got it to use the vectorized kernel to test #382.

  8. fgvanzee commented on Mar 24, 2020

    @fgvanzee
    Member

    After configure with ./configure auto, both configure and BLIS_ARCH_DEBUG show the active config as haswell. When I then edit the files kernels/zen/1/bli_amaxv_zen_int.c and ref_kernels/1/bli_amaxv_ref.c to print here zen and here ref, respectively, I get this confusing output:

    @devinamatthews This is normal. The haswell subconfig uses part of the zen kernel set. AMD contributed several non-level3 kernels in the zen kernel set, but we use them for both haswell and zen subconfigs (and others).

  9. devinamatthews commented on Mar 24, 2020

    @devinamatthews
    MemberAuthor

    Yes, but isn't haswell supposed to use the zen level 1 kernels, hence #380? Here it uses the reference kernel even though it says it haswell is selected.

  10. fgvanzee commented on Mar 24, 2020

    @fgvanzee
    Member

    Yes, but isn't haswell supposed to use the zen level 1 kernels, hence #380? Here it uses the reference kernel even though it says it haswell is selected.

    Yes, but did you not see that I disabled use of the intrinsics zen kernel amaxv in e186d71? The kernel is still there, but I un-registered it.

  11. devinamatthews commented on Mar 24, 2020

    @devinamatthews
    MemberAuthor

    Ugh. Can you reenable it when you merge #382?

  12. devinamatthews commented on Mar 24, 2020

    @devinamatthews
    MemberAuthor

    Well, given that then this is a false alarm.

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions