Skip to content

Add native RISC-V support#55

Merged
potuz merged 20 commits into
mainfrom
riscv
Apr 8, 2026
Merged

Add native RISC-V support#55
potuz merged 20 commits into
mainfrom
riscv

Conversation

@potuz
Copy link
Copy Markdown
Collaborator

@potuz potuz commented Jan 3, 2026

fixes #41

h/t to @washosk for lending me a metal board access.

@potuz potuz force-pushed the riscv branch 5 times, most recently from 86a7636 to 46a7652 Compare January 3, 2026 11:14
@potuz potuz force-pushed the riscv branch 2 times, most recently from a3bd434 to 0465811 Compare January 19, 2026 20:35
Comment thread .gitignore
target
build
tests
.gitignore
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.

why does gitignore , ignore git ignore lol

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I made the mistake of adding it early on. Lazy to remove it now

Comment thread src/sha256_riscv_x1.S Outdated
Comment thread src/sha256_riscv_zbb_x1.S Outdated
@satushh
Copy link
Copy Markdown

satushh commented Apr 8, 2026

Could we add benchmark numbers/results to readme (if available)?

Comment thread bindings_riscv64.go Outdated
@@ -0,0 +1,6 @@
//go:build riscv64
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should the tags be same in both wrapper and binding files? As one mentions linux and other doesn't

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fixed in c40aa59

@potuz
Copy link
Copy Markdown
Collaborator Author

potuz commented Apr 8, 2026

Could we add benchmark numbers/results to readme (if available)?

Added the only ones I have on 6ff8671, don't have a board anymore and I never had one with crypto extensions to bench

potuz and others added 16 commits April 8, 2026 13:50
- Base RV64I arithmetic assembly
- No Zb nor Vector extensions
- Naive implementation 1 block at a time and no pipelining for
  scheduling
- Add RISC-V 64 target to CI workflow with QEMU emulation
- Add riscv_hwprobe syscall for runtime CPU feature detection
- Detect Zknh+Zbkb for crypto, Zbb for bit manipulation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add bindings_riscv64.go with supportedCPU=false (falls back to generic
  Go implementation until .syso file is added)
- Add RISC-V to go-bindings CI matrix with QEMU testing
- Cross-compile and test Go bindings on RISC-V using qemu-riscv64

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add build-syso.yml workflow that builds syso files for all platforms:
  - Linux x86 (hashtree_amd64.syso)
  - macOS arm64 (hashtree_darwin_arm64.syso)
  - Linux arm64 (hashtree_linux_arm64.syso)
  - Windows x86 (hashtree_windows_amd64.syso)
  - Linux RISC-V 64 (hashtree_linux_riscv64.syso)
- Workflow commits syso files back to the repo
- Triggers on any branch when src/ changes, or manual dispatch
- Enable native RISC-V support in bindings_riscv64.go

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use CGO_ENABLED=1 with the cross-compiler to properly link the
RISC-V syso file when building the test binary.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Bridges Go's HashtreeHash function to the C library's hashtree_hash,
which handles runtime CPU feature detection internally.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com>
potuz and others added 3 commits April 8, 2026 13:50
Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@james-prysm james-prysm left a comment

Choose a reason for hiding this comment

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

I tried to review the best I can without much knowledge in assembly, with ai assistance it seems things are isolated and I trust that potuz has made the right implementation. Nothing was ran manually in this review. symbolically approving allowing potuz to make best judgement on this repo

@potuz potuz merged commit fba1449 into main Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support RISC V natively

3 participants