Skip to content
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 autodetection for POWER7, POWER9 & POWER10 #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
27 changes: 23 additions & 4 deletions frame/base/bli_cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ bool bli_cpuid_is_avx_supported( void )
return is_avx_supported;
}

#elif defined(__aarch64__) || defined(__arm__) || defined(_M_ARM)
#elif defined(__aarch64__) || defined(__arm__) || defined(_M_ARM) || defined(_ARCH_PPC)

arch_t bli_cpuid_query_id( void )
{
Expand Down Expand Up @@ -571,9 +571,14 @@ arch_t bli_cpuid_query_id( void )
return BLIS_ARCH_GENERIC;
}
}
else if ( vendor == VENDOR_UNKNOWN )
else if ( vendor == VENDOR_IBM )
{
return BLIS_ARCH_GENERIC;
if ( model == MODEL_POWER7)
return BLIS_ARCH_POWER7;
else if ( model == MODEL_POWER9)
return BLIS_ARCH_POWER9;
else if ( model == MODEL_POWER10)
return BLIS_ARCH_POWER10;
}

return BLIS_ARCH_GENERIC;
Expand Down Expand Up @@ -1072,7 +1077,7 @@ int vpu_count( void )
}
}

#elif defined(__aarch64__) || defined(__arm__) || defined(_M_ARM)
#elif defined(__aarch64__) || defined(__arm__) || defined(_M_ARM) || defined(_ARCH_PPC)

#define TEMP_BUFFER_SIZE 200

Expand All @@ -1094,6 +1099,20 @@ uint32_t bli_cpuid_query
char feat_str[ TEMP_BUFFER_SIZE ];
char* r_val;

#ifdef _ARCH_PPC
r_val = find_string_in( "cpu", proc_str, TEMP_BUFFER_SIZE, pci_str );
if ( r_val == NULL ) return VENDOR_IBM;

if ( strstr( proc_str, "POWER7" ) != NULL )
*model = MODEL_POWER7;
else if ( strstr( proc_str, "POWER9" ) != NULL )
*model = MODEL_POWER9;
else if ( strstr( proc_str, "POWER10" ) != NULL )
*model = MODEL_POWER10;

return VENDOR_IBM;
#endif

//printf( "bli_cpuid_query(): beginning search\n" );

// Search /proc/cpuinfo for the 'Processor' entry.
Expand Down
6 changes: 5 additions & 1 deletion frame/base/bli_cpuid.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,23 @@ enum



#elif defined(__aarch64__) || defined(__arm__) || defined(_M_ARM)
#elif defined(__aarch64__) || defined(__arm__) || defined(_M_ARM) || defined(_ARCH_PPC)

char* find_string_in( char* target, char* buffer, size_t buf_len, char* filepath );

enum
{
VENDOR_ARM = 0,
VENDOR_IBM,
VENDOR_UNKNOWN
};
enum
{
MODEL_ARMV7 = 0,
MODEL_ARMV8,
MODEL_POWER7,
MODEL_POWER9,
MODEL_POWER10,
MODEL_UNKNOWN
};
enum
Expand Down