Open
Conversation
The build failed due to missing <algorithm> header when using std::remove in the C++17 test section. The compiler incorrectly resolved to the C library remove() function instead of STL algorithm. This change: 1. Adds explicit #include <algorithm> for STL algorithms Fixes compilation error: error: cannot convert 'ValueIterator' to 'const char*' note: initializing argument 1 of 'int remove(const char*)'
royenheart
reviewed
Sep 11, 2025
| return __riscv_vreinterpret_v_u32m1_u16m1(v03); | ||
| } | ||
|
|
||
| static sonic_force_inline vuint16m1_t rvv_uzp2q_u16(vuint16m1_t a, |
There was a problem hiding this comment.
Seems that this part causes the func to be limited to vlen=128. vset will stitch the two regs together via VLMAX, resulting in wrong output after vlen=256. I have another implementation which has been tested(on vlen=256/512) and maybe helpful for it:
static sonic_force_inline vuint16m1_t rvv_uzp2q_u16(vuint16m1_t a, vuint16m1_t b) {
a = __riscv_vlmul_ext_v_u16mf2_u16m1(__riscv_vnsrl_wx_u16mf2(__riscv_vreinterpret_v_u16m1_u32m1(a), 16, 4));
b = __riscv_vlmul_ext_v_u16mf2_u16m1(__riscv_vnsrl_wx_u16mf2(__riscv_vreinterpret_v_u16m1_u32m1(b), 16, 4));
return __riscv_vslideup_vx_u16m1(a, b, 4, 8);
}since we know a and b contains 8 elems, we can just use nsrl and slideup to combine them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request introduces support for the RISC-V Vector Extension (RVV) with 128-bit vector size in the sonic-cpp library.
Key Changes
CMake Configuration:
Added a new build option ENABLE_RVV_128 to enable RVV support.
Updated set_arch_flags.cmake to include RVV-specific compile options.
RVV-Specific Implementations:
Added RVV-specific architecture files under include/sonic/internal/arch/rvv-128/.
Implemented various SIMD operations for RVV, including string processing, integer conversion, and JSON quoting.
Test Results