build(cmake): update spacemit-ort version - #3814
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe RISC-V Spacemit CMake configuration now fetches ONNX Runtime 2.0.6 with its matching checksum. The C++ version example uses the ChangesVersion configuration and reporting
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
cmake/onnxruntime-linux-riscv64-spacemit.cmake
| 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") |
There was a problem hiding this comment.
🔒 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 -30Repository: 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 || trueRepository: 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.
csukuangfj
left a comment
There was a problem hiding this comment.
Thank you for your contribution!
update spacemit onnxruntime version from 2.0.2 to 2.0.6
Summary by CodeRabbit