Skip to content

Commit 4e2a32f

Browse files
authored
Merge pull request #4454 from kseniyazaytseva/riscv-rvv07
Fix BLAS and LAPACK tests for C910V and RISCV64_ZVL256B targets
2 parents a21b2fa + 73530b0 commit 4e2a32f

20 files changed

+206
-39
lines changed

Makefile.prebuild

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ ifeq ($(TARGET), x280)
5959
TARGET_FLAGS = -march=rv64imafdcv_zba_zbb_zfh -mabi=lp64d
6060
endif
6161

62+
ifeq ($(TARGET), RISCV64_ZVL256B)
63+
TARGET_FLAGS = -march=rv64imafdcv -mabi=lp64d
64+
endif
65+
6266
ifeq ($(TARGET), RISCV64_ZVL128B)
6367
TARGET_FLAGS = -march=rv64imafdcv -mabi=lp64d
6468
endif

Makefile.riscv64

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ ifeq ($(CORE), x280)
66
CCOMMON_OPT += -march=rv64imafdcv_zba_zbb_zfh_zvl512b -mabi=lp64d -ffast-math
77
FCOMMON_OPT += -march=rv64imafdcv_zba_zbb_zfh -mabi=lp64d -static
88
endif
9+
ifeq ($(CORE), RISCV64_ZVL256B)
10+
CCOMMON_OPT += -march=rv64imafdcv_zvl256b -mabi=lp64d
11+
FCOMMON_OPT += -march=rv64imafdcv -mabi=lp64d -static
12+
endif
913
ifeq ($(CORE), RISCV64_ZVL128B)
1014
CCOMMON_OPT += -march=rv64imafdcv -mabi=lp64d
1115
FCOMMON_OPT += -march=rv64imafdcv -mabi=lp64d -static

TargetList.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ RISCV64_GENERIC (e.g. PolarFire Soc/SiFive U54)
122122
RISCV64_ZVL128B
123123
C910V
124124
x280
125+
RISCV64_ZVL256B
125126

126127
11.LOONGARCH64:
127128
LOONGSONGENERIC

common_riscv64.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static inline int blas_quickdivide(blasint x, blasint y){
9191
#define BUFFER_SIZE ( 32 << 20)
9292
#define SEEK_ADDRESS
9393

94-
#if defined(C910V) || (defined(RISCV64_ZVL256B) && (defined(__clang__) || defined(RVV_COMPATIBLE_GCC))) || defined(RISCV64_ZVL128B)
94+
#if defined(C910V) || (defined(RISCV64_ZVL256B) && (defined(__clang__) || defined(RVV_COMPATIBLE_GCC))) || defined(RISCV64_ZVL128B) || defined(x280)
9595
# include <riscv_vector.h>
9696
#endif
9797

getarch.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,6 +1691,20 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16911691
#define CORENAME "x280"
16921692
#else
16931693
#endif
1694+
1695+
#ifdef FORCE_RISCV64_ZVL256B
1696+
#define FORCE
1697+
#define ARCHITECTURE "RISCV64"
1698+
#define SUBARCHITECTURE "RISCV64_ZVL256B"
1699+
#define SUBDIRNAME "riscv64"
1700+
#define ARCHCONFIG "-DRISCV64_ZVL256B " \
1701+
"-DL1_DATA_SIZE=64536 -DL1_DATA_LINESIZE=32 " \
1702+
"-DL2_SIZE=262144 -DL2_LINESIZE=32 " \
1703+
"-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 "
1704+
#define LIBNAME "riscv64_zvl256b"
1705+
#define CORENAME "RISCV64_ZVL256B"
1706+
#endif
1707+
16941708
#ifdef FORCE_RISCV64_ZVL128B
16951709
#define FORCE
16961710
#define ARCHITECTURE "RISCV64"

kernel/riscv64/KERNEL.C910V

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ SDOTKERNEL = dot_vector.c
5959
DDOTKERNEL = dot_vector.c
6060
CDOTKERNEL = zdot_vector.c
6161
ZDOTKERNEL = zdot_vector.c
62+
DSDOTKERNEL = dsdot_vector.c
6263

6364
SNRM2KERNEL = nrm2_vector.c
6465
DNRM2KERNEL = nrm2_vector.c

kernel/riscv64/amin_vector.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,19 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3131
# define LMUL m2
3232
# if defined(DOUBLE)
3333
# define ELEN 64
34+
# define ABS fabs
3435
# else
3536
# define ELEN 32
37+
# define ABS fabsf
3638
# endif
3739
#else
3840
# define LMUL m8
3941
# if defined(DOUBLE)
4042
# define ELEN 64
43+
# define ABS fabs
4144
# else
4245
# define ELEN 32
46+
# define ABS fabsf
4347
# endif
4448
#endif
4549

@@ -69,7 +73,7 @@ FLOAT CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x)
6973
FLOAT minf=0.0;
7074
if (n <= 0 || inc_x <= 0) return(minf);
7175

72-
minf = *x;
76+
minf = ABS(*x);
7377
x += inc_x;
7478
--n;
7579
if (n == 0) return(minf);

kernel/riscv64/asum_vector.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6767
FLOAT CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x)
6868
{
6969
BLASLONG i=0, j=0;
70-
BLASLONG ix=0;
7170
FLOAT asumf=0.0;
7271
if (n <= 0 || inc_x <= 0) return(asumf);
7372
unsigned int gvl = 0;
@@ -103,17 +102,15 @@ FLOAT CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x)
103102
unsigned int stride_x = inc_x * sizeof(FLOAT);
104103
if(gvl <= n/2){
105104
v_sum = VFMVVF_FLOAT(0, gvl);
106-
BLASLONG inc_xv = inc_x * gvl;
107105
for(i=0,j=0; i<n/(gvl*2); i++){
108-
v0 = VLSEV_FLOAT(&x[ix], stride_x, gvl);
106+
v0 = VLSEV_FLOAT(&x[j*inc_x], stride_x, gvl);
109107
v0 = VFABS_FLOAT(v0, gvl);
110108
v_sum = VFADDVV_FLOAT(v_sum, v0, gvl);
111109

112-
v1 = VLSEV_FLOAT(&x[ix+inc_xv], stride_x, gvl);
110+
v1 = VLSEV_FLOAT(&x[(j+gvl)*inc_x], stride_x, gvl);
113111
v1 = VFABS_FLOAT(v1, gvl);
114112
v_sum = VFADDVV_FLOAT(v_sum, v1, gvl);
115113
j += gvl * 2;
116-
inc_xv += inc_xv * 2;
117114
}
118115
v_res = VFREDSUMVS_FLOAT(v_sum, v_res, gvl);
119116
}

kernel/riscv64/axpby_vector.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6060

6161
int CNAME(BLASLONG n, FLOAT alpha, FLOAT *x, BLASLONG inc_x, FLOAT beta, FLOAT *y, BLASLONG inc_y)
6262
{
63-
if (n < 0) return(0);
63+
if (n <= 0) return(0);
6464

6565
BLASLONG i=0, j=0;
6666
unsigned int gvl = 0;

kernel/riscv64/dgemm_kernel_8x4_c910v.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ int CNAME(BLASLONG bm,BLASLONG bn,BLASLONG bk,FLOAT alpha,FLOAT* ba,FLOAT* bb,FL
196196

197197
asm volatile(
198198
"vsetvli zero, zero, e64,m1 \n\t"
199-
"fmv.w.x ft11, zero \n\t"
199+
"fmv.d.x ft11, zero \n\t"
200200
"mv t0, %[BK] \n\t"
201201

202202
"vfmv.v.f v16, ft11 \n\t"

0 commit comments

Comments
 (0)