Skip to content

Commit c1bdbc0

Browse files
authored
Merge pull request #96 from carlosqwqqwq/riscv-abpoa
Add explicit RISC-V portable build support
2 parents 6f8f93f + c9873c7 commit c1bdbc0

4 files changed

Lines changed: 21 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64|ARM64)$")
2323
set(_ABPOA_AARCH64 TRUE)
2424
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^armv7")
2525
set(_ABPOA_ARM32 TRUE)
26+
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(riscv64|riscv32|riscv)")
27+
set(_ABPOA_RISCV TRUE)
2628
endif()
2729

2830
if(_ABPOA_X86_64)
@@ -169,6 +171,15 @@ elseif(_ABPOA_WASM)
169171
target_sources(abpoa PRIVATE src/abpoa_align_simd.c)
170172
target_compile_options(abpoa PRIVATE -msimd128)
171173

174+
elseif(_ABPOA_RISCV)
175+
# RISC-V: like ARM, use the existing SIMDE-backed AVX2-flavored path
176+
# without injecting host-specific march flags or x86 dispatch machinery.
177+
# Leaving __AVX2__ undefined falls back to the 128-bit SSE2-style path,
178+
# which is not the project's validated portable configuration.
179+
message(STATUS "RISC-V target detected; building abPOA with the portable SIMDE path")
180+
target_sources(abpoa PRIVATE src/abpoa_align_simd.c)
181+
target_compile_definitions(abpoa PRIVATE __AVX2__)
182+
172183
else()
173184
# Fallback: single compile with -march=native
174185
target_sources(abpoa PRIVATE src/abpoa_align_simd.c)

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ else
7272
endif
7373
endif
7474

75+
ifneq ($(filter riscv%,$(ARCH)),)
76+
SIMD_FLAG = -D__AVX2__
77+
OBJS = ${BASIC_OBJS} $(addprefix $(SRC_DIR)/, abpoa_align_simd.o)
78+
endif
79+
7580
# override if user specified
7681
ifneq ($(armv7),) # for ARMv7
7782
SIMD_FLAG = -march=armv7-a -mfpu=neon -D__AVX2__

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ significant speed improvement over existing tools.
7979

8080
abPOA supports three alignment modes (global, local, extension) and flexible scoring schemes that allow linear, affine and convex gap penalties.
8181
It right now supports SSE2/SSE4.1/AVX2 vectorization.
82+
For `riscv64`, the current portability path uses the existing SIMDE-backed
83+
AVX2-style generic build rather than x86 runtime dispatch or a dedicated RVV
84+
backend.
8285

8386
For more information, please refer to our [paper](https://dx.doi.org/10.1093/bioinformatics/btaa963) published in Bioinformatics.
8487

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
simd_flag = ['-march=armv8-a+simd', '-D__AVX2__']
2727
elif machine_arch in ["aarch32"]:
2828
simd_flag = ['-march=armv8-a+simd', '-mfpu=auto -D__AVX2__']
29+
elif machine_arch.startswith("riscv"):
30+
simd_flag = ['-D__AVX2__']
2931
else: # x86_64
3032
simd_flag=['-march=native']
3133
if os.getenv('SSE4', False):

0 commit comments

Comments
 (0)