Skip to content

Commit

Permalink
Implemented runtime hardware detection via cpuid.
Browse files Browse the repository at this point in the history
Details:
- Added runtime support for selecting an appropriate arch_t value based
  on the results of the cpuid instruction (for x86_64). This allows
  deferral of choosing a context (kernels, blocksizes, etc.) until
  runtime, which allows BLIS to be built with support for multiple
  microarchitectures. Currently, only amd64 and intel64 configurations
  are registered in the config_registry; however, one could create
  custom configuration families to support arbitrary sets of x86_64
  microarchitectures.
- Current Intel microarchitectures supported via cpuid are knl, haswell,
  sandybridge, and penryn.
- Current AMD microarchitectures supported via cpuid are: zen, excavator,
  steamroller, piledriver, and bulldozer.
  • Loading branch information
fgvanzee committed Nov 1, 2017
1 parent e3f1055 commit 2c51356
Show file tree
Hide file tree
Showing 6 changed files with 872 additions and 43 deletions.
31 changes: 17 additions & 14 deletions frame/base/bli_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,21 @@ arch_t bli_arch_query_id( void )
{
arch_t id = -1;

// Architecture families
// Architecture families.
#ifdef BLIS_FAMILY_INTEL64
bli_check_error_code( BLIS_NOT_YET_IMPLEMENTED );
id = bli_cpuid_query_id();
#endif
#ifdef BLIS_FAMILY_AMD64
bli_check_error_code( BLIS_NOT_YET_IMPLEMENTED );
id = bli_cpuid_query_id();
#endif

// Intel architectures
// Intel microarchitectures.
#ifdef BLIS_FAMILY_KNL
id = BLIS_ARCH_KNL;
#endif
#ifdef BLIS_FAMILY_KNC
id = BLIS_ARCH_KNC;
#endif
#ifdef BLIS_FAMILY_HASWELL
id = BLIS_ARCH_HASWELL;
#endif
Expand All @@ -58,14 +64,8 @@ arch_t bli_arch_query_id( void )
#ifdef BLIS_FAMILY_PENRYN
id = BLIS_ARCH_PENRYN;
#endif
#ifdef BLIS_FAMILY_KNL
id = BLIS_ARCH_KNL;
#endif
#ifdef BLIS_FAMILY_KNC
id = BLIS_ARCH_KNC;
#endif

// AMD architectures
// AMD microarchitectures.
#ifdef BLIS_FAMILY_ZEN
id = BLIS_ARCH_ZEN;
#endif
Expand All @@ -82,7 +82,7 @@ arch_t bli_arch_query_id( void )
id = BLIS_ARCH_BULLDOZER;
#endif

// ARM architectures
// ARM microarchitectures.
#ifdef BLIS_FAMILY_CORTEXA57
id = BLIS_ARCH_CORTEXA57;
#endif
Expand All @@ -93,19 +93,22 @@ arch_t bli_arch_query_id( void )
id = BLIS_ARCH_CORTEXA9;
#endif

// IBM architectures
// IBM microarchitectures.
#ifdef BLIS_FAMILY_POWER7
id = BLIS_ARCH_POWER7;
#endif
#ifdef BLIS_FAMILY_BGQ
id = BLIS_ARCH_BGQ;
#endif

// Generic architecture
// Generic microarchitecture.
#ifdef BLIS_FAMILY_GENERIC
id = BLIS_ARCH_GENERIC;
#endif

//printf( "blis_arch_query_id(): id = %u\n", id );
//exit(1);

return id;
}

Loading

0 comments on commit 2c51356

Please sign in to comment.