* Add gcc7-generated assembly files for POWER8/9 isa/ica-min/max and POWER9 caxpy To work around internal compiler errors encountered when compiling the original C source with gcc 4 and 5, and wrong code generated by gcc 8.3.0 * Use gcc-generated assembly instead of original C sources to work around internal compiler errors encountered with gcc 4.8/5.4 and wrong code generation by gcc 8.3 * Use gcc-generated assembly instead of the original C source to work around internal compiler errors encountered with gcc 4.8 and 5.4, and wrong code generation by gcc 8.3 * Add gcc7-generated assembler version of caxpy for power8 to work around wrong code generated by gcc 8.3 * Handle CONJ define for caxpyc * Handle CONJ define for caxpyc * Add gcc7-generated assembly cdot for POWER9 * Use prebuilt assembly for POWER9 cdot created with gcc 7.3.1 to work around ICE in older gcc versions * Exclude POWER9 from DYNAMIC_ARCH when gcc versions is lower than 6 * Update Makefile.system * Use PROLOGUE macro to ensure correct function name for DYNAMIC_ARCH * Disable POWER9 with old gcc versions
111 lines
2.2 KiB
C
111 lines
2.2 KiB
C
|
|
#include "common.h"
|
|
|
|
extern gotoblas_t gotoblas_POWER6;
|
|
extern gotoblas_t gotoblas_POWER8;
|
|
#if (!defined C_GCC) || (GCC_VERSION >= 60000)
|
|
extern gotoblas_t gotoblas_POWER9;
|
|
#endif
|
|
|
|
extern void openblas_warning(int verbose, const char *msg);
|
|
|
|
static char *corename[] = {
|
|
"unknown",
|
|
"POWER6",
|
|
"POWER8",
|
|
"POWER9"
|
|
};
|
|
|
|
#define NUM_CORETYPES 4
|
|
|
|
char *gotoblas_corename(void) {
|
|
if (gotoblas == &gotoblas_POWER6) return corename[1];
|
|
if (gotoblas == &gotoblas_POWER8) return corename[2];
|
|
#if (!defined C_GCC) || (GCC_VERSION >= 60000)
|
|
if (gotoblas == &gotoblas_POWER9) return corename[3];
|
|
#endif
|
|
return corename[0];
|
|
}
|
|
|
|
static gotoblas_t *get_coretype(void) {
|
|
|
|
if (__builtin_cpu_is("power6") || __builtin_cpu_is("power6x"))
|
|
return &gotoblas_POWER6;
|
|
if (__builtin_cpu_is("power8"))
|
|
return &gotoblas_POWER8;
|
|
#if (!defined C_GCC) || (GCC_VERSION >= 60000)
|
|
if (__builtin_cpu_is("power9"))
|
|
return &gotoblas_POWER9;
|
|
#endif
|
|
return NULL;
|
|
}
|
|
|
|
static gotoblas_t *force_coretype(char * coretype) {
|
|
|
|
int i ;
|
|
int found = -1;
|
|
char message[128];
|
|
|
|
for ( i = 0 ; i < NUM_CORETYPES; i++)
|
|
{
|
|
if (!strncasecmp(coretype, corename[i], 20))
|
|
{
|
|
found = i;
|
|
break;
|
|
}
|
|
}
|
|
|
|
switch (found)
|
|
{
|
|
case 1: return (&gotoblas_POWER6);
|
|
case 2: return (&gotoblas_POWER8);
|
|
#if (!defined C_GCC) || (GCC_VERSION >= 60000)
|
|
case 3: return (&gotoblas_POWER9);
|
|
#endif
|
|
default: return NULL;
|
|
}
|
|
snprintf(message, 128, "Core not found: %s\n", coretype);
|
|
openblas_warning(1, message);
|
|
}
|
|
|
|
void gotoblas_dynamic_init(void) {
|
|
|
|
char coremsg[128];
|
|
char coren[22];
|
|
char *p;
|
|
|
|
|
|
if (gotoblas) return;
|
|
|
|
p = getenv("OPENBLAS_CORETYPE");
|
|
if ( p )
|
|
{
|
|
gotoblas = force_coretype(p);
|
|
}
|
|
else
|
|
{
|
|
gotoblas = get_coretype();
|
|
}
|
|
|
|
if (gotoblas == NULL)
|
|
{
|
|
snprintf(coremsg, 128, "Falling back to POWER8 core\n");
|
|
openblas_warning(1, coremsg);
|
|
gotoblas = &gotoblas_POWER8;
|
|
}
|
|
|
|
if (gotoblas && gotoblas -> init) {
|
|
strncpy(coren,gotoblas_corename(),20);
|
|
sprintf(coremsg, "Core: %s\n",coren);
|
|
openblas_warning(2, coremsg);
|
|
gotoblas -> init();
|
|
} else {
|
|
openblas_warning(0, "OpenBLAS : Architecture Initialization failed. No initialization function found.\n");
|
|
exit(1);
|
|
}
|
|
}
|
|
|
|
void gotoblas_dynamic_quit(void) {
|
|
gotoblas = NULL;
|
|
}
|