Skip to content

ci: add riscv64 to release binaries#20991

Open
gounthar wants to merge 3 commits intoggml-org:masterfrom
gounthar:ci/add-riscv64-release
Open

ci: add riscv64 to release binaries#20991
gounthar wants to merge 3 commits intoggml-org:masterfrom
gounthar:ci/add-riscv64-release

Conversation

@gounthar
Copy link
Copy Markdown

@gounthar gounthar commented Mar 25, 2026

Overview

Add riscv64 to the Ubuntu CPU release matrix using cross-compilation from a standard ubuntu-24.04 runner with gcc-14-riscv64-linux-gnu.

Changes:

  • Add riscv64 / ubuntu-24.04 matrix entry with cross-compile flags
  • Add a dedicated "Install cross-compiler (riscv64)" step (installs gcc-14-riscv64-linux-gnu)
  • Exclude riscv64 from the "Toolchain workaround (GCC 14)" step (cross-compiler is already GCC 14)
  • Pass cross-compilation flags via matrix.cmake_cross into the cmake configure step
  • Add riscv64 line to release notes template

Closes #20988

Why cross-compilation rather than a native riscv64 runner?

We benchmarked both approaches on the same codebase. On RISE Project ubuntu-24.04-riscv runners, a full Release build takes roughly 49 minutes (build step alone). Cross-compiling from ubuntu-24.04 x86_64 with a gcc-14 RISC-V cross-compiler takes roughly 5 minutes total — about a 10x difference. Using a standard GitHub-hosted runner also avoids any dependency on runner availability or a third-party GitHub App installation.

What the binary supports

  • GGML_CPU_ALL_VARIANTS=ON — multiple ISA code paths compiled in; runtime detection selects the best available (RVV, ZVFH, etc.)
  • LLAMA_OPENSSL=OFF — avoids the libssl-dev:riscv64 multiarch setup needed for cross-compilation; the binary is fully functional without it
  • LLAMA_FATAL_WARNINGS=ON — kept consistent with other ubuntu-cpu builds; gcc-14 cross-compiler handles _Float16 without warnings on riscv64

Additional information

Requirements

@gounthar gounthar requested a review from a team as a code owner March 25, 2026 14:19
@CISC
Copy link
Copy Markdown
Member

CISC commented Mar 25, 2026

The existing riscv64 CI (build-riscv.yml) already validates that llama.cpp builds and passes tests on this architecture.

Nevertheless, can you provide a link to successful release on your fork?

@CISC
Copy link
Copy Markdown
Member

CISC commented Mar 25, 2026

The ubuntu-24.04-riscv runner label is provided by the RISE Project (https://riseproject.dev) and is available free of charge to open-source GitHub repositories. To enable it, a RISE admin needs to install the RISE GitHub App on the ggml-org organization. I can help coordinate that if needed.

We already have a RISC-V runner from Cloud-V, should be able to use that?

@CISC
Copy link
Copy Markdown
Member

CISC commented Mar 26, 2026

Relevant info: #16682 (comment)

@gounthar
Copy link
Copy Markdown
Author

Good to know the Cloud-V runners are back up. That simplifies things since they are already configured on ggml-org. 👍

One question: what GCC version do the Cloud-V RISCV64 runners have? The release build needs GCC 14+ because GCC 13 cannot parse the full ISA string from /proc/cpuinfo and rejects _Float16 in pedantic mode (at least on the rise runner). I hit both issues when testing on RISE runners (which run GCC 13.3.0 on Ubuntu 24.04).

If the Cloud-V runners have GCC 14, the release build should work with the same flags as x64/s390x. If not, we would need to either disable GGML_NATIVE and LLAMA_FATAL_WARNINGS, or install GCC 14 as a setup step.

I will update the PR to use runs-on: RISCV64 once I know the GCC version.

@CISC
Copy link
Copy Markdown
Member

CISC commented Mar 26, 2026

I will update the PR to use runs-on: RISCV64 once I know the GCC version.

14.2.0, but read the linked comment above.

@github-actions github-actions Bot added the devops improvements to build systems and github actions label Mar 27, 2026
@taronaeo
Copy link
Copy Markdown
Member

As requested by @/CISC, any chance you had a successful run in your fork? Can you share a link?

@gounthar
Copy link
Copy Markdown
Author

The release workflow only triggers on tags and workflow_dispatch, not on PRs, so CI did not run on this PR. I cannot trigger it on my fork either because the workflow needs the RISCV64 Cloud-V runners which are only configured on ggml-org.

I am building locally on native riscv64 hardware (BananaPi F3, GCC 14.2.0, rv64gc+RVV) and will share the results shortly. The existing CI (build-riscv.yml) also validates riscv64 builds on Cloud-V runners, so the release build should work with the same infrastructure.

Would a maintainer be able to trigger a manual workflow_dispatch run to validate the release matrix change?

@gounthar
Copy link
Copy Markdown
Author

Native riscv64 build succeeded on a BananaPi F3 (SpacemiT K1, GCC 14.2.0, rv64gc+RVV):

The Cloud-V RISCV64 runners also have GCC 14.2.0, so the release build should work with the same toolchain.

@gounthar
Copy link
Copy Markdown
Author

Rebased from upstream master and switched the approach: the original version used RISE Project ubuntu-24.04-riscv runners (which required installing a third-party GitHub App on ggml-org), and an earlier draft used Cloud-V RISCV64 runners. This version uses cross-compilation from a standard ubuntu-24.04 runner instead.

The practical reason: we measured build times on both. Native riscv64 (RISE runner) takes ~49 minutes for the build step. Cross-compiling with gcc-14-riscv64-linux-gnu from x86_64 takes ~5 minutes total. The end result is the same set of binaries, tested against the same runtime ISA detection (GGML_CPU_ALL_VARIANTS=ON).

The only dependency added is gcc-14-riscv64-linux-gnu and g++-14-riscv64-linux-gnu, which are in the standard Ubuntu 24.04 package repos — no new runners, apps, or service accounts needed.

Cross-compile riscv64 binaries from ubuntu-24.04 using
gcc-14-riscv64-linux-gnu. Builds with GGML_CPU_ALL_VARIANTS=ON
for runtime ISA detection (RVV etc.) and LLAMA_OPENSSL=OFF to
avoid multiarch dependency setup.

Adds release download link for Ubuntu riscv64 (CPU).

Signed-off-by: Bruno Verachten <gounthar@gmail.com>
@gounthar gounthar force-pushed the ci/add-riscv64-release branch from 70776e3 to 8e7d7b4 Compare April 26, 2026 12:30
Copy link
Copy Markdown
Member

@CISC CISC left a comment

Choose a reason for hiding this comment

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

Please provide a link to a successful release on your fork (disable s390x to allow it to complete).

-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH
-DLLAMA_OPENSSL=OFF
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.

Either make it link against the right libssl, or build with boringssl, we don't want a release without.

-DGGML_NATIVE=OFF \
-DGGML_CPU_ALL_VARIANTS=ON \
-DLLAMA_FATAL_WARNINGS=ON \
${{ matrix.cmake_cross || '' }} \
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.

Suggested change
${{ matrix.cmake_cross || '' }} \
${{ matrix.cmake_cross }} \

Doesn't it already evaluate to an empty string if not defined?

@gounthar gounthar requested a review from ggerganov as a code owner April 26, 2026 15:13
@github-actions github-actions Bot added the ggml changes relating to the ggml tensor library for machine learning label Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops improvements to build systems and github actions ggml changes relating to the ggml tensor library for machine learning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Add riscv64 to release binaries

3 participants