Repository navigation
perf: RVV Max/Min (float64, float32); fix a small-n RVV sum; run RVV in CI - #66
Merged
Merged
Conversation
…in CI - RVV extremum kernels: vfmax.vv/vfmin.vv into a tail-undisturbed group, a vmfne.vv + vcpop.m NaN count (fmax drops NaN), vfredmax.vs at the end. SpacemiT X60 (abbench): Max float64 -89% / -83%, float32 -93% / -90%; Sum controls flat. A sabotaged kernel (no NaN count) fails the sequential-oracle test. - Defect, found by running the root suite on a real X60: MeanAxis(1) of int64 [MaxInt64, MinInt64, -3] was 0, NumPy -1. The strip-mined sum took 3 elements as one vector and its unordered reduction cancelled MaxInt64 + (-3). Below 8 elements the sum is sequential now, as on the other targets. - CI: the riscv64 qemu lane ran without V, so no RVV kernel had ever run in CI. It now uses QEMU_CPU=rv64,v=true,vlen=256 and sets NDARRAY_REQUIRE_RVV, which TestRVVWhenRequired turns into a failure if the CPU lacks V. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 26, 2026
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.
Three changes for riscv64.
1. RVV
Max/Min, float64 and float32.vfmax.vv/vfmin.vvinto a register group. The tail-undisturbed policy keeps a short last strip from touching the other lanes.fmaxreturns the non-NaN operand, so each strip counts its NaN lanes (vmfne.vv x, x, thenvcpop.m). A non-zero count gives NaN.vfredmax.vsreduces the group.fmaxalready orders −0 below +0.Measured on a SpacemiT X60 with
abbench(6 rounds, alternated, pinned core):MaxMaxSum, all dtypes (controls)The kernels pass the sequential-oracle test (NaN, real signed zeros and infinities at every position) and the PROT_NONE fence on the X60. A sabotaged kernel with no NaN count fails it.
2. Defect: the small-n RVV sum. Running the root suite on that real X60 failed on
main:MeanAxis(1)of the int64 row[MaxInt64, MinInt64, −3]gave 0 where NumPy gives −1.MaxInt64 + (−3)first. In float64 that rounds back toMaxInt64and cancels.3. CI: RVV actually runs. The riscv64 qemu lane used qemu's default CPU, which has no V, so no RVV kernel had ever run in CI. That is how (2) stayed hidden. The lane now sets
QEMU_CPU=rv64,v=true,vlen=256andNDARRAY_REQUIRE_RVV. The newTestRVVWhenRequiredfails if the CPU does not report V, so the lane can't pass on the scalar paths unnoticed.SECURITY.mdrecords the defect and the CI gap. The local coverage gate (covblocks) reports 0 uncovered blocks.A minor release, v0.22.0.
🤖 Generated with Claude Code