Skip to content

Commit d414b27

Browse files
lvshuo2016pablodelara
authored andcommitted
erasure_code: optimize RVV implementation
The ISA-L EC code has been written using RVV vector instructions and the minimum multiplication table, resulting in a performance improvement of over 10 times compared to the existing implementation. Signed-off-by: Shuo Lv <[email protected]>
1 parent f2883f2 commit d414b27

27 files changed

+3137
-536
lines changed

Release_notes.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ v2.32
152152
- Added new RVV xor_gen, pq_gen implementations.
153153

154154
* Erasure coding improvements:
155-
- Added new RVV ec_encode_data, gf_vect_dot_prod, gf_vect_mul implementations.
155+
- Added new RVV ec_encode_data,ec_encode_data_update,gf_vect_mad, gf_vect_dot_prod, gf_vect_mul implementations.
156156

157157
* Zero-memory detection improvements:
158158
- Added new RVV implementations.

configure.ac

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,13 @@ case "${CPU}" in
6767
])],
6868
[AC_DEFINE([HAVE_RVV], [1], [Enable RVV instructions])
6969
AM_CONDITIONAL([HAVE_RVV], [true]) rvv=yes],
70-
[AM_CONDITIONAL([HAVE_RVV], [false]) rvv=no]
70+
[AC_DEFINE([HAVE_RVV], [0], [Disable RVV instructions])
71+
AM_CONDITIONAL([HAVE_RVV], [false]) rvv=no]
7172
)
73+
if test "x$rvv" = "xyes"; then
74+
CFLAGS+=" -march=rv64gcv"
75+
CCASFLAGS+=" -march=rv64gcv"
76+
fi
7277
AC_MSG_RESULT([$rvv])
7378
;;
7479

erasure_code/erasure_code_test.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
#define EFENCE_TEST_MIN_SIZE 16
5151
#define EFENCE_TEST_MAX_SIZE EFENCE_TEST_MIN_SIZE + 0x100
5252

53+
#if HAVE_RVV
54+
#define EC_ALIGNED_ADDR
55+
#endif
5356
#ifdef EC_ALIGNED_ADDR
5457
// Define power of 2 range to check ptr, len alignment
5558
#define PTR_ALIGN_CHK_B 0

erasure_code/erasure_code_update_test.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,13 @@
3535
#include "test.h"
3636

3737
#ifndef ALIGN_SIZE
38+
#if HAVE_RVV
39+
#define EC_ALIGNED_ADDR
40+
#define ALIGN_SIZE 32
41+
#else
3842
#define ALIGN_SIZE 16
3943
#endif
44+
#endif
4045

4146
// By default, test multibinary version
4247
#ifndef FUNCTION_UNDER_TEST

erasure_code/riscv64/Makefile.am

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
#########################################################################
2+
# Copyright (c) 2025 sanechips Technologies Co., Ltd.
3+
#
4+
# Redistribution and use in source and binary forms, with or without
5+
# modification, are permitted provided that the following conditions
6+
# are met:
7+
# * Redistributions of source code must retain the above copyright
8+
# notice, this list of conditions and the following disclaimer.
9+
# * Redistributions in binary form must reproduce the above copyright
10+
# notice, this list of conditions and the following disclaimer in
11+
# the documentation and/or other materials provided with the
12+
# distribution.
13+
# * Neither the name of sanechips Corporation nor the names of its
14+
# contributors may be used to endorse or promote products derived
15+
# from this software without specific prior written permission.
16+
#
17+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
########################################################################
129
########################################################################
230
# Copyright (c) 2025 Institute of Software Chinese Academy of Sciences (ISCAS).
331
#
@@ -28,8 +56,20 @@
2856
########################################################################
2957

3058
lsrc_riscv64 += \
31-
erasure_code/riscv64/ec_multibinary_riscv64_dispatcher.c \
32-
erasure_code/riscv64/ec_multibinary_riscv64.S \
33-
erasure_code/riscv64/ec_gf_vect_mul_rvv.S \
34-
erasure_code/riscv64/ec_gf_vect_dot_prod_rvv.S \
35-
erasure_code/riscv64/ec_encode_data_rvv.S
59+
erasure_code/riscv64/ec_riscv64_dispatcher.c \
60+
erasure_code/riscv64/ec_multibinary_riscv64.S \
61+
erasure_code/riscv64/ec_riscv64_highlevel_func.c \
62+
erasure_code/riscv64/gf_vect_dot_prod_rvv.S \
63+
erasure_code/riscv64/gf_2vect_dot_prod_rvv.S \
64+
erasure_code/riscv64/gf_3vect_dot_prod_rvv.S \
65+
erasure_code/riscv64/gf_4vect_dot_prod_rvv.S \
66+
erasure_code/riscv64/gf_5vect_dot_prod_rvv.S \
67+
erasure_code/riscv64/gf_6vect_dot_prod_rvv.S \
68+
erasure_code/riscv64/gf_7vect_dot_prod_rvv.S \
69+
erasure_code/riscv64/gf_vect_mad_rvv.S \
70+
erasure_code/riscv64/gf_2vect_mad_rvv.S \
71+
erasure_code/riscv64/gf_3vect_mad_rvv.S \
72+
erasure_code/riscv64/gf_4vect_mad_rvv.S \
73+
erasure_code/riscv64/gf_5vect_mad_rvv.S \
74+
erasure_code/riscv64/gf_6vect_mad_rvv.S \
75+
erasure_code/riscv64/gf_vect_mul_rvv.S

erasure_code/riscv64/ec_encode_data_rvv.S

Lines changed: 0 additions & 154 deletions
This file was deleted.

erasure_code/riscv64/ec_gf_vect_dot_prod_rvv.S

Lines changed: 0 additions & 120 deletions
This file was deleted.

0 commit comments

Comments
 (0)