Skip to content

kernels: import go-simd/floats for sum, elementwise, extrema, clip, exp, log (K1) - #97

Merged
tannevaled merged 2 commits into
mainfrom
k1/import-floats
Nov 7, 2026
Merged

tannevaled merged 2 commits into
mainfrom
k1/import-floats

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

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 to np.sum of 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 of TestSumMatchesNumPy are NumPy 2.5.4's (computed with np.arange, not by this package). It is serial: SumP no 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:

Not moved (stay here until floats has them): the float32 elementwise/sqrt/extremum/AddBlocks8F32 kernels, the dot inside GEMM and Dot1D, and the ppc64le, loong64, riscv64 and s390x kernels (their sum* 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

tannevaled and others added 2 commits November 7, 2026 22:20
…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>
@tannevaled
tannevaled merged commit 0549cb0 into main Nov 7, 2026
12 checks passed
@tannevaled
tannevaled deleted the k1/import-floats branch November 7, 2026 21:44
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