Skip to content

Commit 4dc435b

Browse files
author
Chip Kerchner
committed
Merge branch 'XLC-AIX' of github.ibm.com:PowerAppLibs/openblas into XLC-AIX
2 parents af3e172 + b677d0d commit 4dc435b

2 files changed

Lines changed: 60 additions & 10 deletions

File tree

Makefile.system

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,8 +1170,6 @@ CCOMMON_OPT += -DF_INTERFACE_IBM
11701170
FEXTRALIB += -lxlf90
11711171
ifeq ($(C_COMPILER), $(filter $(C_COMPILER),GCC CLANG))
11721172
FCOMMON_OPT += -qextname
1173-
else ifeq ($(C_COMPILER), CLANG)
1174-
FCOMMON_OPT += -qextname
11751173
endif
11761174
# FCOMMON_OPT += -qarch=440
11771175
ifdef BINARY64

driver/others/dynamic_power.c

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static char *corename[] = {
2020
"POWER10"
2121
};
2222

23-
#define NUM_CORETYPES 4
23+
#define NUM_CORETYPES 5
2424

2525
char *gotoblas_corename(void) {
2626
#ifndef C_PGI
@@ -43,6 +43,13 @@ static int __builtin_cpu_supports(char* arg)
4343
}
4444
#endif
4545

46+
#define CPU_UNKNOWN 0
47+
#define CPU_POWER6 6
48+
#define CPU_POWER7 7
49+
#define CPU_POWER8 8
50+
#define CPU_POWER9 9
51+
#define CPU_POWER10 10
52+
4653
#if defined(C_PGI) || defined(__clang__)
4754
/*
4855
* NV HPC compilers do not yet implement __builtin_cpu_is().
@@ -61,13 +68,6 @@ static int __builtin_cpu_supports(char* arg)
6168
* NOTE NV HPC SDK compilers only support POWER8 and POWER9 at this time
6269
*/
6370

64-
#define CPU_UNKNOWN 0
65-
#define CPU_POWER5 5
66-
#define CPU_POWER6 6
67-
#define CPU_POWER8 8
68-
#define CPU_POWER9 9
69-
#define CPU_POWER10 10
70-
7171
static struct {
7272
uint32_t pvr_mask;
7373
uint32_t pvr_value;
@@ -188,6 +188,54 @@ static int __builtin_cpu_is(const char *cpu) {
188188

189189
#endif /* C_PGI */
190190

191+
#ifdef _AIX
192+
#include <sys/systemcfg.h>
193+
194+
static int cpuid(void)
195+
{
196+
int arch = _system_configuration.implementation;
197+
#ifdef POWER_6
198+
if (arch == POWER_6) return CPU_POWER6;
199+
#endif
200+
#ifdef POWER_7
201+
else if (arch == POWER_7) return CPU_POWER7;
202+
#endif
203+
#ifdef POWER_8
204+
else if (arch == POWER_8) return CPU_POWER8;
205+
#endif
206+
#ifdef POWER_9
207+
else if (arch == POWER_9) return CPU_POWER9;
208+
#endif
209+
#ifdef POWER_10
210+
else if (arch == POWER_10) return CPU_POWER10;
211+
#endif
212+
return CPU_UNKNOWN;
213+
}
214+
215+
#ifndef __BUILTIN_CPU_SUPPORTS__
216+
static int __builtin_cpu_supports(char* arg)
217+
{
218+
static int ipinfo = -1;
219+
if (ipinfo < 0) {
220+
ipinfo = cpuid();
221+
}
222+
if (ipinfo >= CPU_POWER10) {
223+
if (!strcmp(arg, "power10")) return 1;
224+
}
225+
if (ipinfo >= CPU_POWER9) {
226+
if (!strcmp(arg, "power9")) return 1;
227+
}
228+
if (ipinfo >= CPU_POWER8) {
229+
if (!strcmp(arg, "power8")) return 1;
230+
}
231+
if (ipinfo >= CPU_POWER6) {
232+
if (!strcmp(arg, "power6")) return 1;
233+
}
234+
return 0;
235+
}
236+
#endif
237+
#endif
238+
191239
static gotoblas_t *get_coretype(void) {
192240

193241
#ifndef C_PGI
@@ -201,7 +249,11 @@ static gotoblas_t *get_coretype(void) {
201249
return &gotoblas_POWER9;
202250
#endif
203251
#ifdef HAVE_P10_SUPPORT
252+
#ifdef _AIX
253+
if (__builtin_cpu_supports("power10"))
254+
#else
204255
if (__builtin_cpu_supports ("arch_3_1") && __builtin_cpu_supports ("mma"))
256+
#endif
205257
return &gotoblas_POWER10;
206258
#endif
207259
/* Fall back to the POWER9 implementation if the toolchain is too old or the MMA feature is not set */

0 commit comments

Comments
 (0)