Skip to content

perf: float32 pairwise sum blocks on VSX (ppc64le) - #56

Merged
tannevaled merged 1 commit into
mainfrom
float32-blocks-vsx
Oct 18, 2026
Merged

tannevaled merged 1 commit into
mainfrom
float32-blocks-vsx

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

blocks8VSX, the float32 pairwise-sum block kernel for ppc64le. It completes the set after SSE2/NEON (#54) and RVV/LSX (#55).

  • Kernel. The eight accumulators sit in two VSX registers, so there are two dependency chains. Each block is added with xvaddsp, one IEEE float32 addition per lane, so the result is the scalar loop's bit for bit. LXVW4X/STXVW4X keep every word in its lane. VSX is the ppc64le baseline, so there is no feature check.
  • Encoding. Go's assembler has no xvaddsp. go-asmgen v0.18.0 emits it as a WORD, pinned against GNU as 2.44 and llvm-mc on a POWER9 (gap/ppc64: the VSX single-precision family (xvaddsp ... xvsqrtsp) go-asmgen/asmgen#27). The cmd/asm spelling is CL 846285. Regenerating every other arch with v0.18.0 changes no byte.
  • Measured on POWER9 (cfarm29), idle. Base and head runs alternated, GOMAXPROCS=1, pinned core, benchstat n=10:
2¹⁴ 2²⁰
float32 Sum −36.4% −48.3%
float64 Sum (control) ~ ~
int32 Sum (control) ~ ~
  • Tests on the POWER9. The kernel tests, the PROT_NONE fence (TestBlocks8StaysInsideItsOperands) and the whole root suite pass. A sabotaged kernel (one xvsubsp) fails TestAddBlocks8F32MatchesScalar.
  • Docs. docs/perf.md gets a ppc64le section, and s390x is what is left (vfasb, CL 846286). SECURITY.md gets an audit entry for the float32 block kernels.

🤖 Generated with Claude Code

blocks8VSX keeps the eight accumulators in two VSX registers (two
dependency chains) and adds each block with xvaddsp, one IEEE float32
addition per lane, so the result is the scalar loop's bit for bit.
LXVW4X/STXVW4X keep every word in its lane. VSX is the ppc64le baseline.

Go's assembler has no xvaddsp; go-asmgen v0.18.0 emits it as a WORD
pinned against GNU as and llvm-mc (go-asmgen/asmgen#27; the cmd/asm side
is CL 846285).

POWER9 (cfarm29), alternating base/head, GOMAXPROCS=1, pinned core,
benchstat n=10: float32 Sum -36% (2^14) / -48% (2^20); float64 and int32
unchanged. The kernel tests and the PROT_NONE fence pass there; a
sabotaged kernel (xvsubsp) fails them.

docs/perf.md: the ppc64le section; s390x is what is left (vfasb, CL 846286).
SECURITY.md: audit entry for the float32 block kernels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit cfbca31 into main Oct 18, 2026
12 checks passed
@tannevaled
tannevaled deleted the float32-blocks-vsx branch October 18, 2026 18:51
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