Repository navigation
simd(riscv64): RVV kernels for sum, dot, sqrt and add/sub/mul/div - #35
Merged
Merged
Conversation
…ed on AT_HWCAP) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
riscv64 gets SIMD kernels, generated by go-asmgen (
internal/kernels/asmgen/riscv64/gen.go→sum_riscv64.s) for sum, dot, sqrt and add/sub/mul/div.VFSUBVV V1, V2, V3gives V3 = V2 − V1.VSETVLIstrip-mining with LMUL=8, no scalar tail. sum and dot keep a VLMAX-wide accumulator updated tail-undisturbed, then reduce it withvfredusum.1 << ('V'-'A')), through the auxv parser already used for loong64. V is optional on RISC-V.vfmax/vfminare IEEE 754-2019 maximumNumber and drop a NaN that NumPy propagates. The GEMM micro-kernel stays the scalar 4×4; an RVV micro-kernel is the next step.reduce_generic.goand the newdot_generic.goexclude riscv64. The fence and guard tests now include riscv64. CI regenerates and checkssum_riscv64.sin the riscv64 qemu lane.Tests on real hardware
useRVV = true): kernels and root suites PASS, including the PROT_NONE fence tests andTestParallelStress. Positive control:sumRVVreading len+1 faults.useRVV = false): the same binary takes the scalar path and passes.b(TestDot1DP / TestDotSIMD).go veton 8 architectures;go test -con everygo tool dist listpair.Measured (X60, one core pinned to an idle CPU, 6 interleaved rounds, median vs scalar v0.6.1)
MatVec 1024² 2.02×, Dot 2^20 1.29×. The host was 54% busy overall, so measurements ran on a CPU checked idle (2%).
Docs
README (SIMD now covers riscv64; "s390x is next"), perf.md (riscv64 section), plan, and SECURITY.md audit entry.
Version: v0.7.0 (new architecture kernels).
🤖 Generated with Claude Code