Repository navigation
perf(logs): add C906 RVV text paths with scalar fallback - #500
Conversation
dormancygrace
left a comment
There was a problem hiding this comment.
I found no correctness defect.
What I checked:
- Every operand field of the 76 WORDs against its mnemonic.
check-encodings.pyalso passes. v0/v1do not overlapv8–v31at LMUL 8.vl = min(avl, VLMAX)everywhere, and the pair kernels never read pastlen-1.- The ABI0 frames and offsets.
- The prctl and cpuinfo gating mirrors
sha1mb. - Host tests pass in default and
puregomodes, and riscv64go vetandgo test -care 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
ToLowerwhen 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.
dormancygrace
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
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.