Skip to content

simd(s390x): vector max/min on z14+ (VFMAXDB Java mode) - #39

Merged
tannevaled merged 1 commit into
mainfrom
simd/s390x-maxmin
Oct 9, 2026
Merged

tannevaled merged 1 commit into
mainfrom
simd/s390x-maxmin

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

What

  • maxVXE/minVXE, generated by go-asmgen, using VFMAXDB/VFMINDB and the scalar WFMAXDB/WFMINDB in mode 1, Java's Math.max/min: a NaN operand gives NaN, and −0 orders below +0. That is NumPy's and Go's rule. Four two-lane accumulators from 8 elements up, then a fold and a scalar tail.
  • Gating: AT_HWCAP VXRS_EXT (bit 13, vector-enhancements facility 1, z14+). On the z13 that Go still supports, the scalar reducers remain.

Tests on the real IBM z17 (ssh linuxone)

  • TestMaxMinSIMD and TestMaxMinSIMDSpecialsInVectorLanes (±0, ±Inf in every lane) pass, with useVXE = true. TestVXEDetected re-runs both with the kernel forced off.
  • The fence tests (both flags off in the fallback) and the parallel stress test pass, plus the full suites.
  • Sabotage, caught: mode 0 (IEEE maxNum, which drops NaN) gives n=16 NaN@0: maxSIMD=1421.09…, want NaN.
  • Coverage 100% with -race; go vet on 5 architectures.

Measured (z17, one core, hostload 0.1% busy, benchstat over 8 interleaved runs, p = 0.000)

before after
Max 1 Ki 2.58 µs 112 ns −95.7%
Max 16 Ki 41.6 µs 1.78 µs −95.7%
Max 4 Mi 10.7 ms 0.81 ms −92.4%
MaxAxis(1) 2.69 ms 0.17 ms −93.6%

Sum is untouched and serves as the control: ±0.6%.

Docs: README (max/min SIMD on s390x z14+), perf.md, plan, SECURITY.md.

Version: v0.9.1 (performance, no API change).

🤖 Generated with Claude Code

… a z17

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit dcf4f7a into main Oct 9, 2026
12 checks passed
@tannevaled
tannevaled deleted the simd/s390x-maxmin branch October 9, 2026 06:55
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