Skip to content

Commit 204e021

Browse files
authored
Merge pull request #3518 from martin-frbg/elbrus
Add basic support for the (mostly x86_64 compatible) Elbrus E2000 architecture
2 parents b0d3934 + 5d24f3d commit 204e021

File tree

12 files changed

+253
-1
lines changed

12 files changed

+253
-1
lines changed

CONTRIBUTORS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,6 @@ In chronological order:
204204
* [2021-11-12] SVE kernels for SGEMM, STRMM and corresponding SVE copy functions
205205
* [2022-01-06] SVE kernels for CGEMM, ZGEMM, CTRMM, ZTRMM and corresponding SVE copy functions
206206
* [2022-01-18] SVE kernels and copy functions for TRSM
207+
208+
* Ilya Kurdyukov <https://github.com/ilyakurdyukov>
209+
* [2021-02-21] Add basic support for the Elbrus E2000 architecture

Makefile.e2k

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
COPT = -Wall -O2 # -DGEMMTEST

TargetList.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,7 @@ C910V
115115

116116
11.LOONGARCH64:
117117
LOONGSON3R5
118+
119+
12. Elbrus E2000:
120+
E2K
121+

c_check

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ $os = Haiku if ($data =~ /OS_HAIKU/);
8484

8585
$architecture = x86 if ($data =~ /ARCH_X86/);
8686
$architecture = x86_64 if ($data =~ /ARCH_X86_64/);
87+
$architecture = e2k if ($data =~ /ARCH_E2K/);
8788
$architecture = power if ($data =~ /ARCH_POWER/);
8889
$architecture = mips if ($data =~ /ARCH_MIPS/);
8990
$architecture = mips64 if ($data =~ /ARCH_MIPS64/);
@@ -124,6 +125,11 @@ if ($architecture eq "zarch") {
124125
$binary = 64;
125126
}
126127

128+
if ($architecture eq "e2k") {
129+
$defined = 1;
130+
$binary = 64;
131+
}
132+
127133
if ($architecture eq "alpha") {
128134
$defined = 1;
129135
$binary = 64;
@@ -223,6 +229,7 @@ if (($architecture eq "mips") || ($architecture eq "mips64")) {
223229

224230
$architecture = x86 if ($data =~ /ARCH_X86/);
225231
$architecture = x86_64 if ($data =~ /ARCH_X86_64/);
232+
$architecture = e2k if ($data =~ /ARCH_E2K/);
226233
$architecture = power if ($data =~ /ARCH_POWER/);
227234
$architecture = mips if ($data =~ /ARCH_MIPS/);
228235
$architecture = mips64 if ($data =~ /ARCH_MIPS64/);

common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,10 @@ please https://github.com/xianyi/OpenBLAS/issues/246
474474
#include "common_loongarch64.h"
475475
#endif
476476

477+
#ifdef ARCH_E2K
478+
#include "common_e2k.h"
479+
#endif
480+
477481
#ifndef ASSEMBLER
478482
#ifdef OS_WINDOWSSTORE
479483
typedef char env_var_t[MAX_PATH];

common_e2k.h

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*****************************************************************************
2+
Copyright (c) 2011-2016, 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_E2K
34+
#define COMMON_E2K
35+
36+
#ifdef ASSEMBLER
37+
#error
38+
#endif
39+
40+
#define MB do { __asm__ __volatile__("": : :"memory"); } while (0)
41+
#define WMB do { __asm__ __volatile__("": : :"memory"); } while (0)
42+
#define RMB
43+
44+
#define INLINE __attribute__((__always_inline__)) inline
45+
46+
static inline int blas_quickdivide(blasint x, blasint y) {
47+
return x / y;
48+
}
49+
50+
#ifndef PAGESIZE
51+
#define PAGESIZE ( 4 << 10)
52+
#endif
53+
#define HUGE_PAGESIZE ( 2 << 20)
54+
55+
#ifndef BUFFERSIZE
56+
#define BUFFER_SIZE (32 << 20)
57+
#else
58+
#define BUFFER_SIZE (32 << BUFFERSIZE)
59+
#endif
60+
61+
#define SEEK_ADDRESS
62+
63+
#endif
64+

common_macro.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2611,7 +2611,7 @@
26112611

26122612
#ifndef ASSEMBLER
26132613
#if defined(ARCH_X86) || defined(ARCH_X86_64) || defined(ARCH_IA64) || defined(ARCH_MIPS64) || defined(ARCH_ARM64)\
2614-
|| defined(ARCH_LOONGARCH64)
2614+
|| defined(ARCH_LOONGARCH64) || defined(ARCH_E2K)
26152615
extern BLASLONG gemm_offset_a;
26162616
extern BLASLONG gemm_offset_b;
26172617
extern BLASLONG sbgemm_p;

ctest.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,7 @@ ARCH_LOONGARCH64
165165
HAVE_C11
166166
#endif
167167

168+
#if defined(__e2k__)
169+
ARCH_E2K
170+
#endif
171+

getarch.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,6 +1536,17 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15361536
#endif
15371537

15381538

1539+
#if defined(FORCE_E2K) || defined(__e2k__)
1540+
#define FORCE
1541+
#define ARCHITECTURE "E2K"
1542+
#define ARCHCONFIG "-DGENERIC " \
1543+
"-DL1_DATA_SIZE=16384 -DL1_DATA_LINESIZE=64 " \
1544+
"-DL2_SIZE=524288 -DL2_LINESIZE=64 " \
1545+
"-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
1546+
#define LIBNAME "generic"
1547+
#define CORENAME "generic"
1548+
#endif
1549+
15391550
#ifndef FORCE
15401551

15411552
#ifdef USER_TARGET

kernel/Makefile.L3

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,10 @@ $(KDIR)zgemm_beta$(TSUFFIX).$(SUFFIX) : $(KERNELDIR)/$(ZGEMM_BETA)
617617
$(KDIR)xgemm_beta$(TSUFFIX).$(SUFFIX) : $(KERNELDIR)/$(XGEMM_BETA)
618618
$(CC) $(CFLAGS) -c -DXDOUBLE -DCOMPLEX $< -o $@
619619

620+
ifeq ($(ARCH), E2K)
621+
USE_TRMM = 1
622+
endif
623+
620624

621625
ifeq ($(BUILD_BFLOAT16), 1)
622626

0 commit comments

Comments
 (0)