Skip to content

[CI/Build] Restore RISC-V support without README badge - #3816

Merged
stmatengss merged 5 commits into
kvcache-ai:mainfrom
stmatengss:sima/fix-riscv-build
Sep 2, 2026
Merged

stmatengss merged 5 commits into
kvcache-ai:mainfrom
stmatengss:sima/fix-riscv-build

Conversation

@stmatengss

@stmatengss stmatengss commented Sep 1, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Reintroduce the RISC-V build support from #3590 after it was reverted by #3759, while intentionally leaving README.md unchanged.

  • Add USE_RISCV to control RISC-V compatibility settings.
  • Disable pybind11 full IPO/LTO before any Python binding target is created, including TENT's tentpy module.
  • Detect 16-byte atomic support in RISC-V mode and link libatomic when required.
  • Document the validated native RISC-V build path with Go-dependent components disabled.
  • Do not add the RISC-V badge to the README.

No overlapping open issue or PR was found for RISC-V support.

Module

  • Mooncake Store (mooncake-store)
  • Integration (mooncake-integration)
  • Common (mooncake-common)
  • CI/CD
  • Docs

Type of Change

  • Bug fix
  • Documentation update

How Has This Been Tested?

Test commands:

pre-commit run --files \
  docs/source/getting_started/build.md \
  mooncake-common/common.cmake \
  mooncake-store/src/CMakeLists.txt

cmake -G Ninja .. \
  -DCMAKE_BUILD_TYPE=Release \
  -DUSE_RISCV=ON \
  -DWITH_STORE_GO=OFF \
  -DWITH_P2P_STORE=OFF \
  -DUSE_ETCD=OFF \
  -DSTORE_USE_ETCD=OFF \
  -DSTORE_USE_K8S_LEASE=OFF \
  -DBUILD_UNIT_TESTS=OFF \
  -DBUILD_EXAMPLES=OFF \
  -DBUILD_BENCHMARK=OFF
cmake --build . --parallel 4

Test results:

  • Unit tests pass

  • Integration tests pass (if applicable)

  • Manual testing done

  • Native RISC-V Release build completed successfully on riscv64 Linux.

  • mooncake_master, mooncake_client, and both Python extensions were validated as RISC-V ELF artifacts.

  • The engine and store Python extensions imported successfully.

  • A separate native riscv64 configuration with USE_TENT=ON confirmed that tentpy is generated without -flto.

  • All changed-file pre-commit hooks pass.

  • The same CMake and documentation changes passed the full [CI/Build] Add RISC-V build support #3590 CI matrix before Revert "[CI/Build] Add RISC-V build support" #3759 reverted the PR.

Checklist

  • I have performed a self-review of my own code
  • I have formatted my code using ./scripts/code_format.sh (not applicable: no C/C++ source changed; cmake-format passed)
  • I have run pre-commit on the files changed in this PR and all hooks pass
  • I have updated the documentation
  • I have added tests to prove my changes are effective (validated with native RISC-V builds)
  • For changes >500 LOC: I have filed an RFC issue (not applicable: 90 changed lines)

AI Assistance Disclosure

  • No AI tools were used
  • AI tools were used (specified below)

OpenAI Codex assisted with diagnosing the RISC-V build failures, implementing and reviewing the CMake changes, writing documentation, and running validation. The human submitter is responsible for reviewing and defending every changed line.

@stmatengss
stmatengss requested a review from ykwd as a code owner September 1, 2026 09:16
Copilot AI lite review requested due to automatic review settings September 1, 2026 09:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

Restores native RISC-V build support by reintroducing CMake compatibility switches, handling 16-byte atomic runtime requirements, and documenting a validated RISC-V build configuration (without README badge changes).

Changes:

  • Added USE_RISCV option to apply RISC-V-specific build settings (notably IPO/LTO behavior).
  • Added configure-time detection of 16-byte atomic support and conditional libatomic linkage.
  • Documented a working native riscv64 build path with Go-dependent components disabled.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
mooncake-store/src/CMakeLists.txt Detects 16-byte atomic support under RISC-V and links libatomic when needed; minor message formatting change.
mooncake-common/common.cmake Introduces USE_RISCV and disables IPO to avoid pybind11 full-LTO behavior on RISC-V hosts.
docs/source/getting_started/build.md Adds a RISC-V build section and documents USE_RISCV in the CMake options table.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +98 to +102
# Define this before any pybind11 module is created. Otherwise pybind11 adds
# its default full-LTO target, which is prohibitively resource-intensive on
# RISC-V build hosts.
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF)
message(STATUS "RISC-V: IPO disabled for Mooncake Python extensions")
Comment on lines +82 to +83
optimization for the Python extensions, avoiding the excessive memory use of
full GNU LTO on RISC-V build hosts. The build also detects whether 16-byte
Comment on lines +114 to +135
check_cxx_source_compiles(
"
alignas(16) volatile unsigned __int128 value = 0;
int main(int argc, char**) {
__atomic_store_n(&value, static_cast<unsigned __int128>(argc),
__ATOMIC_SEQ_CST);
return static_cast<int>(__atomic_load_n(&value, __ATOMIC_SEQ_CST));
}
"
MOONCAKE_HAS_NATIVE_16BYTE_ATOMICS)
if(NOT MOONCAKE_HAS_NATIVE_16BYTE_ATOMICS)
set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_LIBRARIES atomic)
check_cxx_source_compiles(
"
alignas(16) volatile unsigned __int128 value = 0;
int main(int argc, char**) {
__atomic_store_n(&value, static_cast<unsigned __int128>(argc),
__ATOMIC_SEQ_CST);
return static_cast<int>(__atomic_load_n(&value, __ATOMIC_SEQ_CST));
}
"
list(APPEND EXTRA_LIBS atomic)
message(STATUS "16-byte atomics: using libatomic")
else()
message(FATAL_ERROR "16-byte atomic operations are not supported")
@stmatengss
stmatengss merged commit f04927f into kvcache-ai:main Sep 2, 2026
26 checks passed

@catyans catyans left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. The RISC-V path is opt-in, the 16-byte atomic probe links libatomic only when native support is absent, and CI is green. suggestion (non-blocking): CMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF is project-wide, so please either document that scope or limit it to the Python extension targets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Common documentation Improvements or additions to documentation run-ci Store

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants