Fix RISC-V compilation without RVV by kxxt · Pull Request #2637 · simdjson/simdjson · GitHub
Skip to content

Fix RISC-V compilation without RVV#2637

Merged
lemire merged 1 commit intosimdjson:masterfrom
kxxt:rvv-check
Mar 20, 2026
Merged

Fix RISC-V compilation without RVV#2637
lemire merged 1 commit intosimdjson:masterfrom
kxxt:rvv-check

Conversation

@kxxt
Copy link
Copy Markdown
Contributor

@kxxt kxxt commented Mar 20, 2026

Short title (summary): Fix RISC-V compilation without RVV

Description

Type of change

  • Bug fix
  • Optimization
  • New feature
  • Refactor / cleanup
  • Documentation / tests
  • Other (please describe):

How to verify / test

  • Build node.js with simdjson 4.4.1 with -march=rv64gc in CFLAGS.

Please read before contributing:

If you can, we recommend running our tests with the sanitizers turned on.
For non-Visual Studio users, it is as easy as doing:

cmake -B build -D SIMDJSON_SANITIZE=ON -D SIMDJSON_DEVELOPER_MODE=ON
cmake --build build
ctest --test-dir build

Our CI checks, among other things, for trailing whitespace. If a test fails for that reason,
use the "artifacts" button to download the artifact and inspect the problematic lines,
or run scripts/remove_trailing_whitespace.sh locally if you have a bash shell and sed.

Checklist before submitting

  • I added/updated tests covering my change (if applicable)
  • Code builds locally and passes my check
  • Documentation / README updated if needed
  • Commits are atomic and messages are clear
  • I linked the related issue (if applicable)

Final notes

  • For large PRs, prefer smaller incremental PRs or request staged review.

Thanks for the contribution!

simdjson#2617 introduced an RVV check that only checks if the compiler supports RVV intrinsics without checking if RVV is enabled at compile time.

This has caused compilation failure of node.js on riscv64. Fix it by appending a check for __riscv_vector.
kxxt added a commit to kxxt/archriscv-packages that referenced this pull request Mar 20, 2026
kxxt added a commit to kxxt/archriscv-packages that referenced this pull request Mar 20, 2026
felixonmars pushed a commit to felixonmars/archriscv-packages that referenced this pull request Mar 20, 2026
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am trying to understand here... The compiler would set __riscv_v_intrinsic to a value greater or equal to 11000 but without enabling RVV?

Here is what ChatGPT is telling me:

The macro __riscv_v_intrinsic is a feature-test macro used by compilers (GCC/Clang) to indicate that the RISC-V Vector intrinsics API is available.

Now why would the RISC-V Vector intrinsics API be enabled if RISC-V Vector is not itself enabled?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lemire lemire merged commit a1ff05a into simdjson:master Mar 20, 2026
84 of 85 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants