Skip to content

perf(gemm): native float32 GEMM on ppc64le - #78

Merged
tannevaled merged 2 commits into
mainfrom
perf/gemm32-ppc64le
Oct 27, 2026
Merged

tannevaled merged 2 commits into
mainfrom
perf/gemm32-ppc64le

Conversation

@tannevaled

@tannevaled tannevaled commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Native float32 GEMM on ppc64le: gemmMicro8x16VSX, after OpenBLAS's POWER9 sgemm (kernel/power/sgemm_macros_power9.S, LOAD8x16), with no splats. Each A vector is rotated three ways with XXSLDWI, every rotation multiplies every B vector (32 XVMADDASP per k step), and the store untangles each rotated 4×4 block with three XXSELs per row. OpenBLAS rotates B; rotating A costs half the permutes.

float32 MatMul, POWER9 (cfarm29), abbench 8 rounds, 1 core 64² 256² 1024²
vs v0.27.0 (widened to the float64 GEMM) −59% −42% −37%

The NumPy 2.5.3 wheel on that host is no reference for products: 0.48 ms at 64² and 2.7 s at 1024², consistent with a BLAS without POWER9 kernels. docs/perf.md says so.

Sabotage check: the store reading the wrong rotation made only the qemu ppc64le lane fail, and the sabotage commit has been removed. The real POWER9 ran the kernel suite (including the PROT_NONE fence) and the root suite, both green.

🤖 Generated with Claude Code

tannevaled and others added 2 commits October 27, 2026 15:18
gemmMicro8x16VSX follows OpenBLAS's POWER9 sgemm (sgemm_macros_power9.S,
LOAD8x16): no splats. Each 4-float A vector is rotated three ways with
XXSLDWI, every rotation multiplies every B vector (32 XVMADDASP per k
step against 6 loads and 6 rotations), and the store untangles the
rotated 4x4 blocks with three XXSELs per row. OpenBLAS rotates B; this
kernel rotates A, which has half as many vectors per step.

POWER9 (cfarm29), abbench 8 rounds, one core, against v0.27.0, which
widened float32 to the float64 GEMM: -59/-42/-37% at 64²/256²/1024².

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tannevaled
tannevaled marked this pull request as ready for review October 27, 2026 20:19
@tannevaled
tannevaled merged commit 2c7a394 into main Oct 27, 2026
12 checks passed
@tannevaled
tannevaled deleted the perf/gemm32-ppc64le branch October 27, 2026 20:28
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