Repository navigation
perf: float32 pairwise sum blocks on s390x (VFASB, z14+) - #58
Merged
Merged
Conversation
blocks8VXE keeps the eight accumulators in two vector registers (two dependency chains) and adds each block with vfasb, one IEEE float32 addition per lane, bit-identical to the scalar loop. It runs behind useVXE (vector-enhancements facility 1), the gate max/min already use. Go's assembler has no vfasb; go-asmgen v0.19.0 emits it as WORD+BYTE+BYTE pinned against GNU as and llvm-mc (go-asmgen/asmgen#29; the cmd/asm side is CL 846286). Regenerating the other targets with v0.19.0 changes no byte. IBM Z (LinuxONE), alternating base/head, GOMAXPROCS=1, pinned core, benchstat n=10: float32 Sum -73% (2^14) / -78% (2^20); int32 unchanged; float64 unchanged at 2^14 and +2.0% at 2^20 with a byte-identical kernel that moved 32 bytes (layout, not proven). Kernel tests, the PROT_NONE fence and the whole suite pass there; a sabotaged kernel (vfssb) fails. Every 64-bit target now has a SIMD float32 block. Co-Authored-By: Claude Opus 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.
blocks8VXE, the float32 pairwise-sum block kernel for s390x. Every 64-bit target now has a SIMD float32 block (SSE2 #54, NEON #54, RVV/LSX #55, VSX #56).vfasb, one IEEE float32 addition per lane, so the result is the scalar loop's bit for bit.VL/VSTkeep memory order. The kernel runs behinduseVXE(vector-enhancements facility 1, z14+), the same gate as max/min; older CPUs take the scalar loop.vfasb. go-asmgen v0.19.0 (gap/s390x: vector float32 family (VFASB ... WFSQSB) as 6-byte entries go-asmgen/asmgen#29) emits it asWORD+BYTE+BYTE, pinned against GNU as 2.42 and llvm-mc, and executed bit-exact on the same z machine. The cmd/asm spelling is CL 846286. Regenerating the other targets with v0.19.0 changes no byte.GOMAXPROCS=1, pinned core, benchstat n=10:SumSum(control)Sum(control)The float64 kernel is byte-identical; the change moved
sumVXby 32 bytes (0x18f920 → 0x18f940). The +2.0% is attributed to layout, not proven.vfssb) failsTestAddBlocks8F32MatchesScalar.docs/perf.mdgets an s390x section, andSECURITY.mdgets an audit entry.🤖 Generated with Claude Code