Skip to content

Increase the local buffer size in the AVX512 SGEMM fallback kernel used for LLVM on Windows - #6236

Merged
martin-frbg merged 1 commit into
OpenMathLib:developfrom
apullin:sgemm-fallback-buffer
Nov 7, 2026
Merged

martin-frbg merged 1 commit into
OpenMathLib:developfrom
apullin:sgemm-fallback-buffer

Conversation

@apullin

@apullin apullin commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Same problem as #6232, which #6234 fixed in the DGEMM kernel: the SGEMM twin has it too.
sgemm_kernel_16x4_skylakex.S copies 6 values of B per k into a stack buffer that was 8 KiB on Windows, enough for K ≤ 341.
SGEMM_Q is 448 for SKYLAKEX and up to 512 for COOPERLAKE, so longer K blocks overwrite the saved registers and the return address.
The kernel is only used for clang on Windows (#5756), so only those builds are affected: SGEMM, SSYRK and STRMM can crash on AVX512 machines.
The new SYRK utest in #6235 runs into it in the msys2 CLANG64 jobs.
The buffer now holds K up to 512 (512*4*6 bytes, the size other systems already used).

Tested with msys2 CLANG64 and the CI flags on a GitHub Windows runner (Xeon 8370C, Cooperlake kernels), on develop with #6234: openblas_utest crashed in SSYRK before, all 147 tests pass after.

…ed for LLVM on Windows

The kernel copies 6 values of B per k into its stack buffer, so the 8 KiB Windows buffer only held K <= 341, while SGEMM_Q is up to 512 for SKYLAKEX and COOPERLAKE. Same problem as OpenMathLib#6232 in the DGEMM kernel.
@apullin

apullin commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Extra check on the same runner (msys2 CLANG64, Cooperlake kernels, develop with #6234):
SGEMM with M=N=K=1000 segfaults without this change and runs clean with it.
The DGEMM and DSYRK checks pass either way, so #6234 covers the DGEMM side.

@martin-frbg

Copy link
Copy Markdown
Collaborator

Thanks, figures - not a fault of the original authors, but much later, seemingly innocuous changes to param.h trading GEMM_P for GEMM_Q to increase performance of the respective C kernel introduced at the same time.

@martin-frbg martin-frbg added this to the 0.3.35 milestone Nov 7, 2026
@martin-frbg
martin-frbg merged commit dc5f03a into OpenMathLib:develop Nov 7, 2026
108 of 110 checks passed
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.

2 participants