Skip to content

perf(logs): add C906 RVV text paths with scalar fallback - #500

Merged
dormancygrace merged 5 commits into
mainfrom
codex/c906-log-rvv
Oct 27, 2026
Merged

dormancygrace merged 5 commits into
mainfrom
codex/c906-log-rvv

Conversation

@dormancygrace

@dormancygrace dormancygrace commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Add runtime-gated C906 XTheadVector (RVV 0.7.1) kernels for ASCII classification, ESC search and secret-keyword candidates in the log sanitizer. Short/repetitive lines and unsupported CPUs retain scalar paths; purego and NANOKVM_LOG_TEXT=generic are supported. UTF-8 repair, control filtering, secret redaction, PEM handling and output limits retain their behavior.

Independent device qualification of eec4318 used C906 at 1 GHz, server running, GOMAXPROCS=1, the same prepared Go 1.27.2 for this head and shipped #499, and three rounds with rotated order. Default and generic used one binary. Median DHCP-fixture time was 351.9 ms (#499), 355.8 ms (generic), 202.9 ms (default), about 42% less than #499. Real device logs (2.2 MB, best of five per run) took 1.672/1.679/1.339 s, about 20% less. These numbers are attributed to that toolchain, not a new Go 1.27.3 run.

All seven vector tests executed and passed on the device; generic mode and the #499 package also passed. Real-log output digests matched across variants for identical bytes, with both truncation modes; inputs that grew between runs were not compared. Short-line ten-iteration measurements were too noisy for precise claims. Repeated-fixture differences are not presented as established gains.

Device report, final measurements, historical prototype attribution and reproduction commands are in tests/manual/c906-log-rvv/README.md. The follow-up commit updates documentation only.

Existing validation also covers host race/purego, native/RISC-V vet, RISC-V cross-build, all 76 instruction encodings, protected pages, concurrent vector state and nonperiodic printable sanitizer equivalence (16–4096 bytes). A deliberately disabled C906 dispatch is detected. All 12 linked kernels match the qualified prototype byte-for-byte. Emulated scalar fallback was checked separately; it does not substitute for the device execution reported above.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Build outputs

Compared with the build of main at d79196e.

1 changed, 0 added, 0 removed of 594 outputs.

directory files
changed server server/NanoKVM-Server
Hashes: outputs-sha256 artifact of this run.

@dormancygrace dormancygrace left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

I found no correctness defect.

What I checked:

  • Every operand field of the 76 WORDs against its mnemonic. check-encodings.py also passes.
  • v0/v1 do not overlap v8–v31 at LMUL 8.
  • vl = min(avl, VLMAX) everywhere, and the pair kernels never read past len-1.
  • The ABI0 frames and offsets.
  • The prctl and cpuinfo gating mirrors sha1mb.
  • Host tests pass in default and purego modes, and riscv64 go vet and go test -c are clean.
  • I emulated the keyword search on amd64 against strings.Contains: 3M inputs with no difference.

The weak points are verification and justification, not the code:

  • CI never compiles the riscv64 side.
  • The device tests can skip silently.
  • The headline number is from a prototype with a different baseline than #499.
  • The gain is about 150 ms per MiB snapshot on a path that runs about once a minute. I'd like to see whether pure-Go changes (skipping ToLower when a line has no upper-case byte, a first-byte prefilter) get most of it first. They would also help non-C906 builds and carry no vector-state risk.

Comment thread server/logs/sanitize_text_linux_riscv64_test.go
Comment thread .github/workflows/ci.yml
Comment thread server/logs/sanitize_text_reference_test.go
Comment thread tests/manual/c906-log-rvv/README.md Outdated
Base automatically changed from codex/c906-log-sanitize to main October 26, 2026 21:44

@dormancygrace dormancygrace left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Review completed at eec4318. Independently checked vector masks, bounded loads, LMUL grouping, keyword fallback, dispatch and sanitizer ordering. Fixed silent vector-test skipping, added CI RISC-V ABI/build coverage and expanded printable/control/keyword differential cases. Host race/purego, native/RISC-V vet, cross-build, all 76 encoding checks and QEMU scalar-fallback tests pass; a disabled-dispatch negative control is detected. The available emulator does not implement these RVV 0.7.1 instructions. Final C906 execution of the expanded corpus and same-binary measurements are outstanding, and the performance discussion remains open. The PR remains unmerged.

@dormancygrace dormancygrace left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Device results are in the README thread. Please move the final numbers (−42% against #499 on the DHCP fixture, −20% on real device logs) into the README and the PR description, in place of the prototype-only figures.

@dormancygrace dormancygrace left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Reviewed final head 8a0afbf9. The README and PR description now separate the final C906 hardware measurements from the historical prototype: median DHCP log time improves about 42%, and the matched real-log workload about 20%; no general short-line or zero-overhead claim is made. These hardware figures are from the independently recorded Go 1.27.2 run.

Resolved the CI workflow merge conflict against current main while retaining both log-vector and Keccak encoding checks. Rechecked the integration with Go 1.27.3: logs/logger race tests, pure-Go tests, host/RISC-V vet, RISC-V test-binary cross-build and all 76 embedded instruction encodings pass. All fast final-head CI checks pass; the full firmware build is still running. No remaining blocking findings.

@dormancygrace
dormancygrace merged commit 6c78048 into main Oct 27, 2026
19 checks passed
@dormancygrace
dormancygrace deleted the codex/c906-log-rvv branch October 27, 2026 11:24
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.

1 participant