Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions docs/source/getting_started/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,38 @@ sudo make install
`-DUSE_NOF=ON` builds the NoF registration APIs and deployment tools. Use
`-DUSE_NOF=OFF` or omit the option when the NVMe-oF SSD pool is not needed.

### RISC-V Build

Mooncake supports native 64-bit RISC-V Linux builds with `USE_RISCV` enabled.
The option keeps regular Release optimizations but disables interprocedural
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 +82 to +83
atomic operations require `libatomic` and links it automatically.

The following configuration builds the C++, Python, and Rust components while
disabling every component that requires Go:

```bash
mkdir build-riscv
cd build-riscv
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
```

Adjust the parallel job count for the available memory. The example uses four
jobs because optimized C++ and Python binding translation units can each need
several gigabytes of memory on RISC-V.

### Hardware Backend Setup

Run `sudo bash dependencies.sh` before using any of these backend-specific build
Expand Down Expand Up @@ -206,6 +238,7 @@ The following options can be passed to `cmake ..`.
| `-DUSE_HYGON=ON/OFF` | `OFF` | Enable Hygon DCU support via DTK SDK. Uses a CUDA-compatible runtime. |
| `-DUSE_COREX=ON/OFF` | `OFF` | Enable Iluvatar CoreX GPU support. Uses a CUDA-compatible runtime. |
| `-DUSE_MLU=ON/OFF` | `OFF` | Enable Cambricon MLU memory support via Neuware, including memory detection, topology discovery, and RDMA registration. |
| `-DUSE_RISCV=ON/OFF` | `OFF` | Enable RISC-V build compatibility settings, including disabling full IPO/LTO for Python extensions. |
| `-DUSE_ASCEND_DIRECT=ON/OFF` | `OFF` | Enable Ascend Direct transport and HCCS support via the ADXL engine. Recommended for Ascend builds. |
| `-DUSE_UBSHMEM=ON/OFF` | `OFF` | Enable Huawei Ascend NPU shared memory transport via CANN VMM APIs. |
| `-DUSE_INTRA_NVLINK=ON/OFF` | `OFF` | Enable intranode NVLink transport. |
Expand Down
14 changes: 14 additions & 0 deletions mooncake-common/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ option(USE_HIP "option for enabling gpu features for AMD GPU" OFF)
option(USE_HYGON "option for enabling gpu features for Hygon DCU with DTK" OFF)
option(USE_COREX "option for enabling gpu features for Iluvatar CoreX" OFF)
option(USE_SUPA "option for enabling gpu features for Biren GPU with SUPA" OFF)
option(USE_RISCV "Enable RISC-V build compatibility settings" OFF)
if(USE_RISCV)
if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^riscv")
message(
WARNING
"USE_RISCV is enabled, but CMAKE_SYSTEM_PROCESSOR is '${CMAKE_SYSTEM_PROCESSOR}'"
)
endif()
# 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 +98 to +102
endif()
option(USE_NVMEOF "option for using NVMe over Fabric" OFF)
option(USE_TCP "option for using TCP transport" ON)
option(USE_BAREX "option for using accl-barex transport" OFF)
Expand Down
43 changes: 42 additions & 1 deletion mooncake-store/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,44 @@ endif()
set(EXTRA_LIBS "")
set(SPDK_STATIC_LIBS "")

# RISC-V toolchains may implement 16-byte atomic operations in libatomic rather
# than emitting native instructions. Boost.Lockfree uses these operations in the
# Store master, so detect and propagate the runtime library in RISC-V mode.
if(USE_RISCV)
include(CheckCXXSourceCompiles)
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));
}
"
Comment on lines +114 to +135
MOONCAKE_HAS_LIBATOMIC_16BYTE_ATOMICS)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE})
if(MOONCAKE_HAS_LIBATOMIC_16BYTE_ATOMICS)
list(APPEND EXTRA_LIBS atomic)
message(STATUS "16-byte atomics: using libatomic")
else()
message(FATAL_ERROR "16-byte atomic operations are not supported")
endif()
endif()
endif()

# Find AWS SDK
find_package(AWSSDK QUIET COMPONENTS s3)
if(AWSSDK_FOUND)
Expand Down Expand Up @@ -179,7 +217,10 @@ int main() {
set(MOONCAKE_HAVE_NVME_URING_CMD ON)
message(STATUS "io_uring: NVMe uring command support enabled")
else()
message(STATUS "io_uring: NVMe uring command support unavailable, NVMe KV io_uring executor disabled")
message(
STATUS
"io_uring: NVMe uring command support unavailable, NVMe KV io_uring executor disabled"
)
endif()
endif()

Expand Down
Loading