Skip to content

Commit 6f0e0e4

Browse files
authored
Merge pull request #4438 from Dirreke/csky-support
Add CSKY support
2 parents 43cb266 + ec89466 commit 6f0e0e4

File tree

15 files changed

+325
-4
lines changed

15 files changed

+325
-4
lines changed

CONTRIBUTORS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,7 @@ In chronological order:
218218
* [2022-08] Fix building from sources for QNX
219219

220220
* Mark Seminatore <https://github.com/mseminatore>
221-
* [2023-11-09] Improve Windows threading performance scaling
221+
* [2023-11-09] Improve Windows threading performance scaling
222+
223+
* Dirreke <https://github.com/mseminatore>
224+
* [2024-01-16] Add basic support for the CSKY architecture

Makefile.csky

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ifeq ($(CORE), CK860FV)
2+
CCOMMON_OPT += -march=ck860v -mcpu=ck860fv -mfdivdu -mhard-float
3+
FCOMMON_OPT += -march=ck860v -mcpu=ck860fv -mfdivdu -mhard-float -static
4+
endif

Makefile.prebuild

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ ifeq ($(TARGET), C910V)
5555
TARGET_FLAGS = -march=rv64gcv0p7_zfh_xtheadc -mabi=lp64d
5656
endif
5757

58+
ifeq ($(TARGET), CK860FV)
59+
TARGET_FLAGS = -march=ck860v -mcpu=ck860fv -mfdivdu -mhard-float
60+
endif
61+
5862
all: getarch_2nd
5963
./getarch_2nd 0 >> $(TARGET_MAKE)
6064
./getarch_2nd 1 >> $(TARGET_CONF)

Makefile.system

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,11 @@ endif
873873
endif
874874
endif
875875

876+
ifeq ($(ARCH), csky)
877+
NO_BINARY_MODE = 1
878+
BINARY_DEFINED = 1
879+
endif
880+
876881
#
877882
# C Compiler dependent settings
878883
#

TargetList.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,7 @@ E2K
133133
EV4
134134
EV5
135135
EV6
136+
137+
14.CSKY
138+
CSKY
139+
CK860FV

c_check

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ case "$data" in
9191
*ARCH_ZARCH*) architecture=zarch ;;
9292
*ARCH_RISCV64*) architecture=riscv64 ;;
9393
*ARCH_LOONGARCH64*) architecture=loongarch64 ;;
94+
*ARCH_CSKY*) architecture=csky ;;
9495
esac
9596

9697
defined=0
@@ -236,6 +237,7 @@ case "$data" in
236237
*ARCH_ARM*) architecture=arm ;;
237238
*ARCH_ZARCH*) architecture=zarch ;;
238239
*ARCH_LOONGARCH64*) architecture=loongarch64 ;;
240+
*ARCH_CSKY*) architecture=csky ;;
239241
esac
240242

241243
binformat='bin32'

c_check.pl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
$architecture = zarch if ($data =~ /ARCH_ZARCH/);
9898
$architecture = riscv64 if ($data =~ /ARCH_RISCV64/);
9999
$architecture = loongarch64 if ($data =~ /ARCH_LOONGARCH64/);
100+
$architecture = csky if ($data =~ /ARCH_CSKY/);
100101

101102
$defined = 0;
102103

@@ -156,6 +157,11 @@
156157
$binary = 64;
157158
}
158159

160+
if ($architecture eq "csky") {
161+
$defined = 1;
162+
$binary = 32;
163+
}
164+
159165
if ($compiler eq "PGI") {
160166
$compiler_name .= " -tp p7" if ($binary eq "32");
161167
$compiler_name .= " -tp p7-64" if ($binary eq "64");
@@ -284,6 +290,7 @@
284290
$architecture = arm64 if ($data =~ /ARCH_ARM64/);
285291
$architecture = zarch if ($data =~ /ARCH_ZARCH/);
286292
$architecture = loongarch64 if ($data =~ /ARCH_LOONGARCH64/);
293+
$architecture = csky if ($data =~ /ARCH_CSKY/);
287294

288295
$binformat = bin32;
289296
$binformat = bin64 if ($data =~ /BINARY_64/);

common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,10 @@ please https://github.com/xianyi/OpenBLAS/issues/246
482482
#include "common_e2k.h"
483483
#endif
484484

485+
#ifdef ARCH_CSKY
486+
#include "common_csky.h"
487+
#endif
488+
485489
#ifndef ASSEMBLER
486490
#ifdef OS_WINDOWSSTORE
487491
typedef char env_var_t[MAX_PATH];

common_csky.h

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*****************************************************************************
2+
Copyright (c) 2011-2015, The OpenBLAS Project
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are
7+
met:
8+
9+
1. Redistributions of source code must retain the above copyright
10+
notice, this list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright
13+
notice, this list of conditions and the following disclaimer in
14+
the documentation and/or other materials provided with the
15+
distribution.
16+
3. Neither the name of the OpenBLAS project nor the names of
17+
its contributors may be used to endorse or promote products
18+
derived from this software without specific prior written
19+
permission.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
30+
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
**********************************************************************************/
32+
33+
#ifndef COMMON_CSKY
34+
#define COMMON_CSKY
35+
36+
#define MB __sync_synchronize()
37+
#define WMB __sync_synchronize()
38+
#define RMB __sync_synchronize()
39+
40+
#define INLINE inline
41+
42+
#ifndef ASSEMBLER
43+
44+
45+
static inline int blas_quickdivide(blasint x, blasint y){
46+
return x / y;
47+
}
48+
49+
#endif
50+
51+
52+
53+
#define BUFFER_SIZE ( 32 << 20)
54+
#define SEEK_ADDRESS
55+
56+
#endif

ctest.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ HAVE_C11
173173
ARCH_E2K
174174
#endif
175175

176+
#if defined(__csky__)
177+
ARCH_CSKY
178+
#endif
179+
176180
#if defined(__EMSCRIPTEN__)
177181
ARCH_RISCV64
178182
OS_WINDOWS

0 commit comments

Comments
 (0)