Repository navigation
Conversation
Contributor
Author
|
The two msys2 CLANG64 failures are not from this change. |
Each thread of the threaded SYRK/HERK driver packs one K block of op(A) for its whole row range behind sb, and nothing limited that to the space left in the BUFFER_SIZE work area, so for large N it wrote past the end (also through threaded ?POTRF). Shorten the K block until the panels of the widest thread fit; all threads use the same blocking. Fixes OpenMathLib#6224
Threaded ?SYRK/?HERK (all variants, several thread partitions and K blocks) and threaded ?POTRF must reproduce an exact integer reference and leave the other triangle, the padding and the guard zones untouched. With a work area of 16 MiB or less (e.g. 32-bit x86) a large ZHERK also checks the shortened K blocks of OpenMathLib#6224.
Call the threaded DSYRK/ZSYRK driver directly with a work area owned by the test, followed by memory that must stay zero, at the smallest n where the unfixed driver of OpenMathLib#6224 writes at least 64 KiB past BUFFER_SIZE. With k=1 and ldc=0 this costs about n*n/2 multiply-adds and a few MB. Skipped where it would take longer than OPENBLAS_UTEST_TIME_LIMIT seconds (default 10). Needs the static library (driver symbols).
clock_gettime() needs -lrt with glibc before 2.17, which broke linking openblas_utest in the manylinux1 CI job.
This branch has not been deployed
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 #6224.
Each thread of the threaded SYRK/HERK driver packs one K block of op(A) for its whole row range behind
sbin its work area.For the widest thread that is about
GEMM_Q * N / sqrt(nthreads)elements.Nothing limited it to the space left in the
BUFFER_SIZEwork area, so for large N it wrote past the end (in #6224: into C and its malloc header).Threaded ?POTRF uses the same driver and was affected too.
The threshold scales with
BUFFER_SIZE: 32 MiB in scipy-openblas (BUFFERSIZE=20), 128 MiB by default.A default x86_64 build overflows too, at larger N (Haswell kernels, 2 threads: from N ≈ 92,000).
The fix shortens the K block until the widest thread's panels fit behind
sb.All threads use the same blocking, since they read each other's panels.
Where the panels already fit, nothing changes.
Tests:
utest/test_syrk_thread.cchecks threaded ?SYRK/?HERK (all variants) and ?POTRF against an exact integer reference; with a work area of 16 MiB or less (32-bit x86) it also runs a ZHERK that overflowed.utest/test_syrk_thread_workarea.ccalls the threaded driver with a work area the test owns, at the smallest N that overflowed (a few seconds natively; needs the static library; skipped aboveOPENBLAS_UTEST_TIME_LIMIT, default 10 s, e.g. under qemu). It uses driver internals, so it is a separate commit you can drop.Tested on develop c2fc6cf, before → after:
BUFFERSIZE=20 INTERFACE64=1, SkylakeX kernels under Intel SDE, 12 threads): SIGSEGV → all elements correctwork_area_bound: fails → passes on x86_64 and 32-bit x86, and with the time limit lifted on arm64, POWER, riscv64 and LoongArch (qemu)Where SYRK is already broken (SVE wider than the kernels assume, #6100; RISCV64_ZVL256B at VLEN ≥ 512; 32-bit Penryn/Dunnington), the new exactness tests fail before and after, like existing tests.