Skip to content

build(cmake): update spacemit-ort version - #3814

Merged
csukuangfj merged 2 commits into
k2-fsa:masterfrom
xiaotong-spacemit:master
Jul 28, 2026
Merged

csukuangfj merged 2 commits into
k2-fsa:masterfrom
xiaotong-spacemit:master

Conversation

@xiaotong-spacemit

@xiaotong-spacemit xiaotong-spacemit commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

update spacemit onnxruntime version from 2.0.2 to 2.0.6

Summary by CodeRabbit

  • Chores
    • Updated the ONNX Runtime package used for RISC-V Linux builds to version 2.0.6.
    • Updated the package verification checksum to match the new release.
  • Documentation
    • Refreshed the C++ API example’s version-reporting output to reflect the latest API usage style.

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 28, 2026
@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 32f03627-2586-4e13-8c46-ba3dd00bee5d

📥 Commits

Reviewing files that changed from the base of the PR and between d7fe598 and 63c239a.

📒 Files selected for processing (1)
  • cxx-api-examples/version-cxx-api.cc

📝 Walkthrough

Walkthrough

The RISC-V Spacemit CMake configuration now fetches ONNX Runtime 2.0.6 with its matching checksum. The C++ version example uses the sherpa_onnx::cxx namespace for version getter calls.

Changes

Version configuration and reporting

Layer / File(s) Summary
Update ONNX Runtime archive inputs
cmake/onnxruntime-linux-riscv64-spacemit.cmake
Bumps the ONNX Runtime version and updates the derived archive reference and SHA256 checksum.
Update C++ version reporting calls
cxx-api-examples/version-cxx-api.cc
Adds the C++ namespace directive and changes version getter calls to unqualified names.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

Suggested reviewers: csukuangfj

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the main change: updating the Spacemit ONNX Runtime version.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmake/onnxruntime-linux-riscv64-spacemit.cmake`:
- Around line 16-19: Update the ONNX Runtime artifact handling associated with
onnxruntime_URL and onnxruntime_SOURCE_DIR so the extracted root directory
spacemit-ort.riscv64.2.0.6 is included when resolving lib/libonnxruntime.so and
imported-target include paths. Alternatively, switch to an archive whose root
directly contains lib/ and include/, while preserving the existing version,
package, and hash consistency.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 258e26c8-9de9-4540-9b05-da45ac46863a

📥 Commits

Reviewing files that changed from the base of the PR and between 75e1fc3 and d7fe598.

📒 Files selected for processing (1)
  • cmake/onnxruntime-linux-riscv64-spacemit.cmake

Comment on lines +16 to +19
set(onnxruntime_version "2.0.6")
set(onnxruntime_pkg_name "spacemit-ort.riscv64.${onnxruntime_version}.tar.gz")
set(onnxruntime_URL "https://github.com/spacemit-com/onnxruntime/releases/download/${onnxruntime_version}/${onnxruntime_pkg_name}")
set(onnxruntime_HASH "SHA256=b9d038eab644c42712b93e14648427467a02d1b66115795033093efbeb53c868")
set(onnxruntime_HASH "SHA256=bebcdfb7df6b49eefa3863afcd85a3da2aa83c3ae9252d7d856188c38a70b0e6")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

version=2.0.6
asset="spacemit-ort.riscv64.${version}.tar.gz"
url="https://github.com/spacemit-com/onnxruntime/releases/download/${version}/${asset}"
expected="bebcdfb7df6b49eefa3863afcd85a3da2aa83c3ae9252d7d856188c38a70b0e6"
tmp="$(mktemp)"
trap 'rm -f "$tmp"' EXIT

curl --fail --location --output "$tmp" "$url"
test "$(sha256sum "$tmp" | cut -d' ' -f1)" = "$expected"

tar -tzf "$tmp" | grep -Eq '(^|/)lib/libonnxruntime\.so$'
tar -tzf "$tmp" | grep -Eq '(^|/)lib/libspacemit_ep\.so$'
tar -tzf "$tmp" | grep -Eq '(^|/)include/'

Repository: k2-fsa/sherpa-onnx

Length of output: 668


🏁 Script executed:

#!/bin/bash
set -euo pipefail

version=2.0.6
asset="spacemit-ort.riscv64.${version}.tar.gz"
url="https://github.com/spacemit-com/onnxruntime/releases/download/${version}/${asset}"
expected="bebcdfb7df6b49eefa3863afcd85a3da2aa83c3ae9252d7d856188c38a70b0e6"
tmp="$(mktemp)"
trap 'rm -f "$tmp"' EXIT

echo "Downloading archive..."
curl --fail --location --output "$tmp" "$url"

echo "Computing SHA256..."
sha256="$(python3 - <<'PY'
import hashlib
data = open("tmp", "rb").buffer.read()
PY
)"
sha256="$(openssl dgst -sha256 -hex "$tmp" | awk '{print $NF}')"
echo "expected=$expected"
echo "actual=$sha256"
test "$sha256" = "$expected"

echo "Archive contents for required contracts:"
python3 - <<'PY'
import tarfile, sys
path=sys.argv[1]
tar=tarfile.open(path)
names=[m.name for m in tar.getmembers() if ('/' in m.name or m.name.endswith('.so'))]
checks={
 "lib/libonnxruntime.so": any(n=="lib/libonnxruntime.so" for n in names),
 "lib/libspacemit_ep.so": any(n=="lib/libspacemit_ep.so" for n in names),
 "include/": any(n.startswith("include/") for n in names),
}
for k,v in checks.items():
    print(f"{k}: {v}")
sys.exit(0 if all(checks.values()) else 1)
PY

echo "Extracted layout sample:"
export TAR_TMP="${TAR_TMP:-}"
mkdir -p "$TAR_TMP"
(cd "$TAR_TMP" && tar -tzf "$tmp" "$tmp" | head -80)

Repository: k2-fsa/sherpa-onnx

Length of output: 806


🏁 Script executed:

#!/bin/bash
set -euo pipefail

version=2.0.6
asset="spacemit-ort.riscv64.${version}.tar.gz"
url="https://github.com/spacemit-com/onnxruntime/releases/download/${version}/${asset}"
expected="bebcdfb7df6b49eefa3863afcd85a3da2aa83c3ae9252d7d856188c38a70b0e6"
tmp="$(mktemp --suffix=.tar.gz)"
tmpdir="$(mktemp -d)"
trap 'rm -f "$tmp" ; rm -rf "$tmpdir"' EXIT

echo "Downloading archive..."
curl --fail --location --output "$tmp" "$url"

echo "Computing SHA256..."
actual="$(openssl dgst -sha256 -hex "$tmp" | awk '{print $NF}')"
echo "expected=$expected"
echo "actual=$actual"

echo "Checksum check:"
if [ "$actual" = "$expected" ]; then
  echo "OK"
else
  echo "MISMATCH"
  exit 1
fi

echo "Archive contents for required contracts:"
python3 - "$tmp" <<'PY'
import tarfile, sys
path=sys.argv[1]
names=[m.name for m in tarfile.open(path).getmembers()]
checks={
 "lib/libonnxruntime.so": any(n=="lib/libonnxruntime.so" for n in names),
 "lib/libspacemit_ep.so": any(n=="lib/libspacemit_ep.so" for n in names),
 "include/": any(n.startswith("include/") for n in names),
}
for k,v in checks.items():
    print(f"{k}: {v}")
sys.exit(0 if all(checks.values()) else 1)
PY

echo "Root-level names:"
tar -tzf "$tmp" | head -30

Repository: k2-fsa/sherpa-onnx

Length of output: 717


🏁 Script executed:

#!/bin/bash
set -euo pipefail

version=2.0.6
asset="spacemit-ort.riscv64.${version}.tar.gz"
url="https://github.com/spacemit-com/onnxruntime/releases/download/${version}/${asset}"
expected="bebcdfb7df6b49eefa3863afcd85a3da2aa83c3ae9252d7d856188c38a70b0e6"
tmp="$(mktemp --suffix=.tar.gz)"
tmpdir="$(mktemp -d)"
trap 'rm -f "$tmp" ; rm -rf "$tmpdir"' EXIT

echo "Downloading archive..."
curl --fail --location --output "$tmp" "$url"

echo "Computing SHA256 with Python hashlib..."
actual="$(python3 - <<'PY' "$tmp"
import hashlib, pathlib, sys
h = hashlib.sha256()
with open(sys.argv[1], "rb") as f:
    while True:
        data = f.read(65536)
        if not data:
            break
        h.update(data)
print(h.hexdigest())
PY
)"
echo "expected=$expected"
echo "actual=$actual"

echo "Checksum check:"
if [ "$actual" = "$expected" ]; then
  echo "OK"
else
  echo "MISMATCH"
  exit 1
fi

echo "Root-level archive entries:"
python3 - "$tmp" <<'PY'
import tarfile, sys
with tarfile.open(sys.argv[1], "r:gz") as tar:
    for m in tar.getmembers():
        if m.name.find("/") == -1:
            print(m.name)
PY

echo "Required contract entries:"
python3 - "$tmp" <<'PY'
import tarfile, sys
with tarfile.open(sys.argv[1], "r:gz") as tar:
    names = {m.name for m in tar.getmembers()}
checks={
 "lib/libonnxruntime.so": "lib/libonnxruntime.so" in names,
 "lib/libspacemit_ep.so": "lib/libspacemit_ep.so" in names,
 "include/": any(n.startswith("include/") for n in names),
 "CMakeLists.txt": any(n.startswith("lib/cmake/") or n == "CMakeLists.txt" for n in names),
}
for k,v in checks.items():
    print(f"{k}: {v}")
PY

echo "Relevant install snippets in onnxruntime config:"
sed -n '1,220p' cmake/onnxruntime-linux-riscv64-spacemit.cmake 2>/dev/null || true

Repository: k2-fsa/sherpa-onnx

Length of output: 4443


Fix the onnxruntime artifact layout.

The downloaded 2.0.6 archive is valid, but it stores everything under spacemit-ort.riscv64.2.0.6/, so ${onnxruntime_SOURCE_DIR}/lib/libonnxruntime.so and the imported targets’ include/ paths won’t resolve. Update the expected paths or switch to an archive whose root contains lib/ and include/.

[functional_correctness, stability_and_availability]

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmake/onnxruntime-linux-riscv64-spacemit.cmake` around lines 16 - 19, Update
the ONNX Runtime artifact handling associated with onnxruntime_URL and
onnxruntime_SOURCE_DIR so the extracted root directory
spacemit-ort.riscv64.2.0.6 is included when resolving lib/libonnxruntime.so and
imported-target include paths. Alternatively, switch to an archive whose root
directly contains lib/ and include/, while preserving the existing version,
package, and hash consistency.

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Jul 28, 2026

@csukuangfj csukuangfj 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.

Thank you for your contribution!

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

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants