1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
Bug: https://bugs.gentoo.org/837806
From https://github.com/xianyi/OpenBLAS/pull/3613
From: Han Gao <gaohan@uniontech.com>
Date: Wed, 27 Apr 2022 01:34:55 +0800
Subject: [PATCH 1/2] Fix other arch build in detect.
When CORE is empty, use -march=loongson3a. Fix it.
Signed-off-by: Han Gao <gaohan@uniontech.com>
--- a/Makefile.system
+++ b/Makefile.system
@@ -847,7 +847,7 @@ CCOMMON_OPT += -mabi=32
BINARY_DEFINED = 1
endif
-ifeq ($(CORE), $(filter $(CORE),LOONGSON3R3 LOONGSON3R4))
+ifneq (, $(filter $(CORE),LOONGSON3R3 LOONGSON3R4))
CCOMMON_OPT += -march=loongson3a
FCOMMON_OPT += -march=loongson3a
endif
From: Han Gao <gaohan@uniontech.com>
Date: Wed, 27 Apr 2022 02:29:43 +0800
Subject: [PATCH 2/2] Fix riscv64 arch detect
Signed-off-by: Han Gao <gaohan@uniontech.com>
--- a/cpuid_riscv64.c
+++ b/cpuid_riscv64.c
@@ -1,5 +1,5 @@
/*****************************************************************************
-Copyright (c) 2011-2014, The OpenBLAS Project
+Copyright (c) 2011-2022, The OpenBLAS Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -13,9 +13,9 @@ modification, are permitted provided that the following conditions are
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
- 3. Neither the name of the OpenBLAS project nor the names of
- its contributors may be used to endorse or promote products
- derived from this software without specific prior written
+ 3. Neither the name of the OpenBLAS project nor the names of
+ its contributors may be used to endorse or promote products
+ derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
@@ -70,16 +70,16 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
-#define CPU_UNKNOWN 0
-#define CPU_C910V 1
+#define CPU_GENERIC 0
+#define CPU_C910V 1
static char *cpuname[] = {
- "UNKOWN",
+ "RISCV64_GENERIC",
"C910V"
};
int detect(void){
- return CPU_UNKNOWN;
+ return CPU_GENERIC;
}
char *get_corename(void){
@@ -98,7 +98,7 @@ void get_subdirname(void){
}
void get_cpuconfig(void){
- printf("#define UNKNOWN\n");
+ printf("#define %s\n", cpuname[detect()]);
printf("#define L1_DATA_SIZE 65536\n");
printf("#define L1_DATA_LINESIZE 32\n");
printf("#define L2_SIZE 512488\n");
--- a/getarch.c
+++ b/getarch.c
@@ -1731,7 +1731,7 @@ int main(int argc, char *argv[]){
#ifdef FORCE
printf("CORE=%s\n", CORENAME);
#else
-#if defined(INTEL_AMD) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__) || defined(ZARCH) || defined(sparc) || defined(__loongarch__)
+#if defined(INTEL_AMD) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__) || defined(ZARCH) || defined(sparc) || defined(__loongarch__) || defined(__riscv)
printf("CORE=%s\n", get_corename());
#endif
#endif
@@ -1879,7 +1879,7 @@ printf("ELF_VERSION=2\n");
#ifdef FORCE
printf("#define CHAR_CORENAME \"%s\"\n", CORENAME);
#else
-#if defined(INTEL_AMD) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__) || defined(ZARCH) || defined(sparc) || defined(__loongarch__)
+#if defined(INTEL_AMD) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__) || defined(ZARCH) || defined(sparc) || defined(__loongarch__) || defined(__riscv)
printf("#define CHAR_CORENAME \"%s\"\n", get_corename());
#endif
#endif
|