Repository navigation
Fix batched GEMM guards, Fortran arguments and empty batches - #6126
Merged
Merged
Conversation
Add the missing small-kernel guards used by ordinary GEMM, including the alpha-zero and small-matrix permit checks. Correct the Fortran argument swaps in grouped and strided batched GEMM. Avoid the empty-batch crash by returning before dispatch when strided members have zero M or N. Fixes OpenMathLib#6121 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
|
Thank you |
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.
Fixes #6121.
Submitting the proposed two-file implementation patch following @martin-frbg's request. The implementation diff is unchanged from the issue and is based on
developat6d8c8801.GEMM_SMALL_MATRIX_PERMIT, avoiding the alpha-zero NaN propagation and the unsupported BF16 small-kernel route.a_arrayas A andb_arrayas B. The CBLAS row-major mapping is unchanged.Validation
Compared unpatched
6d8c8801with the same library sources plus this fix. Builds used LP64,NOFORTRAN=1,NO_LAPACK=1, and BF16 support. The C-implemented Fortran ABI entry points were exercised; no Fortran compiler or Fortran-language caller was used.The first-call M=0 crash is absent after the fix. Alpha-zero edge probes at sizes up to and across the old small-matrix threshold also pass.
The existing unit tests passed on x86 (141 core tests) and ARM64 NEOVERSEN1 under QEMU and on the M5 guest (143 core tests), including all 1,502 pre-existing extension tests. The x86 unit suites were also run with four threads. Validation used a local checkout containing an additional test-only commit; that commit does not change library sources and is not included in this PR. The fix-only commit was not separately rebuilt.
QEMU caveat: with forced ARMV9SME at VL128, eight ordinary
cblas_dgemmcontrol cases in the wider probe fail on both the unpatched and patched trees, and also on the earlier33746423baseline. All exercised batched cases pass after the fix, but the unmodified aggregate ARM validator remains FAIL (two failing invocations among 280 records, baseline and patched). The control discrepancy has not been diagnosed as an emulator or hardware/kernel issue.The probes force one runtime thread; the four-thread unit runs do not establish parallel batched-dispatch coverage. No real SVE/SME hardware, additional SVE lengths, ILP64, LAPACK-enabled, CMake, macOS, or GitHub CI validation is claimed.
Found through AI-assisted code review and differential testing by the GPT-6.1 Sol noninterference lane, coordinated and independently reproduced by Opus 5.5. GPT-6 Astra and Opus 5.5 prepared and validated the fix.