Repository navigation
kernels: import go-simd/floats for sum, elementwise, extrema, clip, exp, log (K1) - #97
Merged
Merged
Conversation
…xp, log (K1) K1 of the go-scikit performance campaign (go-scikit/roadmap#27): ndarray now imports go-simd/floats v0.9.0 and deletes its copies. - exp, log, and the correctly rounded float32 exp/log (with the AVX2 kernels of #94/#96 and the NEON kernel of #95, now go-simd/floats#29): deleted here (Go sources, tests, generator kernels, assembly); Exp, Log, Exp32, Log32 and their P forms call floats. - amd64 and arm64: the sum/sqrt/max/min/add/sub/mul/div kernels are floats'; Clip is floats.ClampScalar. Max/Min resolve a zero result with the serial oracle (floats leaves the sign of zero unspecified). - Sum is floats.SumPairwise on every architecture: NumPy's order, bit-identical to np.sum; serial at every size. A changed last bit is the fix; the golden values of TestSumMatchesNumPy are NumPy 2.5.4's. - Not moved: the float32 elementwise/sqrt/extremum/AddBlocks8F32 kernels, the dot inside GEMM/Dot1D, and the ppc64le, loong64, riscv64 and s390x kernels (floats has none for them yet). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 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.
K1 of the go-scikit performance campaign (go-scikit/roadmap#27): ndarray imports go-simd/floats v0.9.0 and deletes its copies of kernels that live once, in the lowest shared library.
User-visible change:
Sum(and everything built on it: mean, var, std, ...) is now NumPy's pairwise sum,floats.SumPairwise: bit-identical tonp.sumof a contiguous 1-D float64 array, on every architecture and at every size. It replaces the lane-parallel sums of the per-architecture kernels, whose last bits differed from NumPy's and from one architecture to the next. NumPy's order is the reference, so a changed last bit is the fix; the golden values ofTestSumMatchesNumPyare NumPy 2.5.4's (computed withnp.arange, not by this package). It is serial:SumPno longer splits across cores, because folding per-chunk partials would regroup NumPy's order and make the result depend on the core count (an order-preserving split is possible, not done here).Moved/deleted:
exp,log, correctly rounded float32exp/log(Go sources, tests, exhaustive proofs, generator kernels, assembly): now Exp, Log, Float32Exp, Float32Log: the exp/log kernels of go-ndarray (K1) go-simd/floats#29, with the AVX2 kernels of Float32 results from the Workspace; cheaper range check in the AVX2 log #94/AVX2 kernel for float64 Log: 1.55x faster than NumPy #96 and the NEON kernel of NEON kernels for the correctly rounded float32 Exp and Log #95 (which closes without merging).Exp,Log,Exp32,Log32and theirPforms call floats.sum,sqrt,max/min,add/sub/mul/divkernels are floats';Clipisfloats.ClampScalar.Max/Minresolve a zero result with the serial oracle (floats leaves the sign of a zero result unspecified; follow-up for floats).asmgen/amd64andasmgen/arm64no longer emit those kernels;sum_amd64.sandsum_arm64.sregenerated;//go:generatelines moved togenerate.go.Not moved (stay here until floats has them): the float32 elementwise/sqrt/extremum/
AddBlocks8F32kernels, the dot inside GEMM andDot1D, and the ppc64le, loong64, riscv64 and s390x kernels (theirsum*assembly is now unused). On an amd64 CPU without AVX2+FMA, floats runs its portable loops where the SSE2 kernels used to run.Checked: full suite green on arm64/darwin (kernels, root, linalg, fft, random);
go vet ./...clean for amd64, arm64, riscv64, ppc64le, s390x, loong64, 386. The amd64 AVX2 path runs in CI only.🤖 Generated with Claude Code