Repository navigation
Conversation
Several level-1 kernels split vectors longer than 10000 elements across
num_cpu_avail(1) threads:
- x86_64: ddot.c, zdot.c
- arm64: dot.c, zdot_thunderx2t99.c, copy_thunderx2t99.c
Threaded level-2 drivers call those kernels from inside each worker job.
Callers reaching threaded DOT on columns longer than 10000 elements:
- ?GBMV('T'/'C'), ?TBMV('T'/'C'), ?TPMV('T'/'C'), ?HPMV
Callers reaching threaded COPY_K on strided vectors longer than 10000
elements on arm64:
- ?GER, ?TBMV, ?TRMV, ?TPMV
- ?SYR/?HER, ?SYR2/?HER2, ?SPR/?HPR, ?SPR2/?HPR2
In pthreads builds num_cpu_avail() had no nesting check, so each worker
re-entered exec_blas(). Once all pool threads were occupied by the outer
call, exec_blas_async() spun forever waiting for idle worker slots while
holding exec_queue_lock before signalling any assigned sub-jobs.
Track whether the current thread is executing a thread-server job and
make num_cpu_avail() return 1 when set. This covers pool workers in the
pthreads and win32 servers, exec_threads() for OpenMP and registered
threads callbacks, and the calling thread while it runs its own share in
exec_blas().
Cover threaded level-2 calls whose worker jobs invoke threaded level-1
kernels above 10000 elements:
- DGBMV('T'), SGBMV('T'), ZGBMV('C') (column DOT)
- DGER, DTBMV (strided COPY)
With the POSIX pthreads server each case runs in a child process under a
timeout so a regression fails cleanly instead of hanging the test run.
openblas_utest.h includes <stdlib.h> before common.h defines _GNU_SOURCE and __USE_XOPEN, which leaves __WAIT_STATUS undefined when <sys/wait.h> is included afterwards in the manylinux1 (CentOS 5 / glibc 2.5) build.
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.
Several level-1 kernels split vectors longer than 10,000 elements across
num_cpu_avail(1)threads.Affected level-1 kernels:
kernel/x86_64/ddot.c,kernel/x86_64/zdot.c(Haswell, Zen, SkylakeX/Cooperlake/Sapphire Rapids, Sandybridge, Bulldozer family)kernel/arm64/dot.c,kernel/arm64/zdot_thunderx2t99.c,kernel/arm64/copy_thunderx2t99.c(Neoverse N1/N2/V1/V2, SVE, SME, A64FX, Vortex, ThunderX2/3)Threaded level-2 drivers call those kernels from inside each worker job.
Affected level-2 callers on columns longer than 10,000 elements (
DOT):dgbmv,zgbmv(andsgbmv,cgbmvon arm64) withtrans = 'T'or'C'dtbmv,ztbmv(andstbmv,ctbmvon arm64) withtrans = 'T'or'C'dtpmv,ztpmv(andstpmv,ctpmvon arm64) withtrans = 'T'or'C'zhpmv(andchpmvon arm64)Affected level-2 callers on strided vectors longer than 10,000 elements on arm64 (
COPY_K):sger,dger,cgeru,cgerc,zgeru,zgercstrmv,dtrmv,ctrmv,ztrmvstbmv,dtbmv,ctbmv,ztbmvstpmv,dtpmv,ctpmv,ztpmvssyr,dsyr,csyr,zsyr,cher,zherssyr2,dsyr2,csyr2,zsyr2,cher2,zher2sspr,dspr,cspr,zspr,chpr,zhprsspr2,dspr2,cspr2,zspr2,chpr2,zhpr2In pthreads builds
num_cpu_avail()had no nesting check, so each worker re-enteredexec_blas(). Once all pool threads were occupied by the outer call,exec_blas_async()spun forever waiting for idle worker slots while holdingexec_queue_lockbefore signalling any assigned sub-jobs.This PR tracks whether the current thread is executing a thread-server job and makes
num_cpu_avail()return1when set. Covered execution paths:exec_threads()for OpenMP and registered threads callbacksexec_blas()Tests
utest/test_nested_thread.ccovers:dgbmv('T'),sgbmv('T'),zgbmv('C')with columnDOT> 10,000 elementsdger,dtbmvwith stridedCOPY> 10,000 elementsWith the POSIX pthreads server each case runs in a child process under a timeout so a regression fails cleanly instead of hanging CI.
Verification (before → after on
develop)dgbmv('T'),zgbmv('C'),zhpmv,dtpmv('T')hang → pass (170/170openblas_utest,1545/1545openblas_utest_ext)NEOVERSEN1under qemu): all 5nested_threadcases hang → pass (166/166openblas_utest)USE_OPENMP=1,USE_THREAD=0, and CMakeBUILD_SHARED_LIBS=ONbuilds: all pass