feat(exp/simd): rewrite on go 1.27 portable simd package - #1005
Merged
Merged
Conversation
Go 1.26 simd/archsimd is amd64-only, with one hand-written kernel per instruction set (AVX/AVX2/AVX512) and a SIGILL hazard on CPUs without AVX2/AVX512. Go 1.27 ships a portable simd package (amd64, arm64, wasm, plus a pure-Go emulated fallback), so the sub-module can support every platform Go targets with a single set of kernels instead of three. - Split each operation into a non-generic kernel (kernel.go, the only file importing "simd") and a generic wrapper, sidestepping the midway compiler pass generics limitations. - Min/Max/Clamp on float32/float64 detect NaN cheaply and fall back to the exact scalar algorithm so SIMD and lo.Min/lo.Max/lo.Clamp always agree, instead of following architecture-dependent hardware NaN semantics. - Clamp with mn > mx now always returns mn on both the SIMD and scalar-fallback paths (lo.Clamp itself is value-dependent for that malformed precondition, so no two-op composition can match it). Raises the exp/simd minimum Go version to 1.27.
The simd package is portable, so exercise it across the minimum supported compiler, the current stable release, and both amd64 and arm64 hardware, instead of a single Go version on amd64 only.
The exp/simd docs described the old per-ISA archsimd API (AVX/AVX2/ AVX512 variants, CPU-flag detection). Update source references and examples for the portable go 1.27 package, which picks the vector width at runtime instead of exposing one function per width.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1005 +/- ##
==========================================
+ Coverage 96.10% 98.87% +2.77%
==========================================
Files 32 32
Lines 5520 4728 -792
==========================================
- Hits 5305 4675 -630
+ Misses 176 53 -123
+ Partials 39 0 -39
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The old benchmark report described the archsimd implementation (Fallback-lo/AVX-x16/AVX2-x32/AVX512-x64 sub-benchmarks, tiny/massive size tiers) and had gone stale relative to the current code. Replace it with a fresh amd64 (AVX-512) and arm64 (NEON) comparison, plus a summary of how speedup scales with vector width across Sum/Min/Clamp/ Contains.
This was referenced Sep 9, 2026
samber
marked this pull request as ready for review
September 9, 2026 10:00
llms.txt never listed the exp/simd module, so LLM agents reading it had no way to discover the SIMD helpers. The dedicated SIMD docs page still described the old amd64-only, Go 1.26 AVX/AVX2/AVX512 implementation and its retired per-ISA benchmark names; update it to match the go 1.27 portable rewrite and link to the regenerated BENCHMARK.md.
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.
Summary
Test plan