Repository navigation
#4938: OPENBLAS_L2_SIZE=2048 with the Haswell pin, so numpy >= 2.5.2 does not segfault on Zen 4 - #4947
Merged
Conversation
…BLAS_L2_SIZE=2048) OpenBLAS 0.3.34 (bundled with numpy >= 2.5.2) re-tunes GEMM blocking on an AMD Zen 4/5 host (1 MB L2, L3 % 32 MB, AVX-512) even under a forced OPENBLAS_CORETYPE (OpenMathLib/OpenBLAS#6021, fixed upstream in #6027, in no release yet). Under the Haswell pin that app.py, gridenv.sh and the cell runner set, float64 GEMM (K >= 320) and float32/float64 SVD then overrun a kernel's stack and segfault, and float32 GEMM/syrk differ from every other CPU. The block needs l2_kb == 1024 and the Haswell table reads the L2 size nowhere else, so OPENBLAS_L2_SIZE=2048 switches it off. - app.py, gridenv.sh, _expcommon.cpu_kernel_pins() and fhibe_supply.py default OPENBLAS_L2_SIZE=2048 whenever the core is Haswell; an exported value (empty = detect) wins; not set under another core. - Tests for each; DEPLOYMENT.md row; CHANGELOG (Fixed). - Probes (openblas_l2.sh, probe_blas_ops.py, collate_openblas_l2.py, figures_4938.py): numpy 2.2.6/2.4.6/2.5.1/2.5.4 x L2 setting x 24 ops on 6 nodes, 5 CPU models: crash/differ only on numpy 2.5.4 + EPYC 9534 without the setting; with it everything agrees; the setting changes no result on numpy 2.2.6/2.4.6/2.5.1 or scipy's OpenBLAS. - Suite on the EPYC 9534 with numpy 2.5.4 (suite_zen4.sh): 11 segfaults, all in structural_tiles.fit_projection's SVD, without; 0 with. - Report docs/experiments/2026-10-15-openblas-zen4-4938. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q8KvKjgBL7pTwLPQT1g77M
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.
Closes #4938
Why
numpy 2.5.2 and later bundle OpenBLAS 0.3.34. That release added a Zen 4 tuning block (OpenMathLib/OpenBLAS#5868) which fires on an AMD host with a 1 MB L2, an L3 that is a multiple of 32 MB, and AVX-512. It rewrites the GEMM blocking of whatever core table is active, including one forced by
OPENBLAS_CORETYPE(OpenMathLib/OpenBLAS#6021).Under the Haswell pin that
app.py,gridenv.shand the cell runner set (#4481), this has two effects on the L40S nodes' EPYC 9534:Upstream fixed it in OpenMathLib/OpenBLAS#6027 (merged 2026-09-13). The fix is in no release, and the newest
scipy-openblaswheels (0.3.34.237) predate it.The block requires an L2 of exactly 1024 KB, and the Haswell table reads the L2 size nowhere else. So
OPENBLAS_L2_SIZE=2048switches the block off, which is what upstream's fix does for a forced Haswell core.The GRID is not exposed today: the venv runs numpy 2.2.6 (OpenBLAS 0.3.29) and scipy's 0.3.31.dev. A fresh install resolves numpy 2.5.4, so a server on a Zen 4/5 machine would crash.
What changes
app.py,gridenv.sh,_expcommon.cpu_kernel_pins()(the cell runner) andpile/fhibe_supply.pydefaultOPENBLAS_L2_SIZE=2048whenever the core is Haswell.gridenv.sh, checked by sourcing a copy (default, another core, exported value wins).docs/DEPLOYMENT.mdgets a row for the variable;CHANGELOG.mdgets a Fixed entry.docs/experiments/2026-10-15-openblas-zen4-4938/.Results
np.linalg.svdofvtscore/media/structural_tiles.py:fit_projection(fitting a document collection's Stage-1 projection). pytest gave up after 10,720 tests.Test plan
test_cpu_kernel_pins.py,test_torch_threads_default.py,test_experiments_common.py,test_job_records.pyandtest_eval_app_sync.py: 129 passed on rack4n06 (Silver 4114) and rack7n11 (EPYC 7713).app.pyerrors thatdevalready has.suite-grid, advisory).🤖 Generated with Claude Code
https://claude.ai/code/session_01Q8KvKjgBL7pTwLPQT1g77M