OpenBLAS/driver/level3
Keno Fischer 7a07c8e1f4 Add an asynchronous cancellation API for in-flight operations
Long-running BLAS calls (a large gemm can run for minutes) cannot
currently be interrupted: callers embedding OpenBLAS (e.g. the Julia
runtime responding to a user's ^C) can only wait for completion or kill
the process. Add a minimal cooperative cancellation protocol:

Every thread owns a pointer-sized generation slot in thread-local
storage, whose stable address is returned by openblas_cancel_token().
Instrumented compute drivers advance the slot to a fresh even
generation at operation entry on the issuing thread (forwarding the
slot and generation to worker threads through blas_arg_t) and poll it
at block granularity. openblas_cancel(token, loaded_token) - callable
from any thread - sets the cancel bit (bit 0) iff the slot still holds
loaded_token, so a canceller that loaded the value while an operation
was in flight stops exactly that operation, while stale or racing
requests either miss or dirty an already-dead generation, both
harmless. There is no object lifecycle: nothing to allocate, bind,
reset, or free.

A cancelled operation returns quickly, leaving its output buffer in an
unspecified partially-updated state that the caller must discard; every
synchronization point in the threaded driver is still executed, so
sibling threads never stall and the library remains consistent for
subsequent calls. Coverage: the level-3 gemm/symm/hemm drivers
(level3.c and level3_thread.c).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012nCkyKUguncLLJrH9K5o7m
2026-07-19 04:20:28 +00:00
..
CMakeLists.txt Fix corruption due to lock sharding issues by centralizing locking 2026-06-14 15:32:51 -06:00
Makefile Fix corruption due to lock sharding issues by centralizing locking 2026-06-14 15:32:51 -06:00
gemm.c Make GEMM_DIVIDE_RATE and GEMM_PREFERRED_SIZE available in DYNAMIC_ARCH builds 2026-03-20 15:34:04 +01:00
gemm3m.c Import GotoBLAS2 1.13 BSD version codes. 2011-01-24 14:54:24 +00:00
gemm3m_level3.c Update gemm3m_level3.c 2019-12-27 18:03:01 +08:00
gemm_batch_thread.c add gemm_batch driver 2024-05-29 15:49:20 +02:00
gemm_thread_m.c fix improper function prototypes (empty parentheses) 2023-09-30 12:49:24 +02:00
gemm_thread_mn.c fix improper function prototypes (empty parentheses) 2023-09-30 12:49:24 +02:00
gemm_thread_n.c fix improper function prototypes (empty parentheses) 2023-09-30 12:49:24 +02:00
gemm_thread_variable.c fix improper function prototypes (empty parentheses) 2023-09-30 12:49:24 +02:00
hemm3m_k.c Import GotoBLAS2 1.13 BSD version codes. 2011-01-24 14:54:24 +00:00
level3.c Add an asynchronous cancellation API for in-flight operations 2026-07-19 04:20:28 +00:00
level3_gemm3m_thread.c Fix corruption due to lock sharding issues by centralizing locking 2026-06-14 15:32:51 -06:00
level3_syr2k.c remove surplus parentheses to silence clang5 2018-01-01 20:56:26 +01:00
level3_syrk.c remove surplus parentheses to silence clang5 2018-01-01 20:56:26 +01:00
level3_syrk_threaded.c Fix corruption due to lock sharding issues by centralizing locking 2026-06-14 15:32:51 -06:00
level3_thread.c Add an asynchronous cancellation API for in-flight operations 2026-07-19 04:20:28 +00:00
level3_thread_lock.c fix thread safety of openmp backend 2026-07-02 15:39:09 +05:30
symm3m_k.c Import GotoBLAS2 1.13 BSD version codes. 2011-01-24 14:54:24 +00:00
symm_k.c Import GotoBLAS2 1.13 BSD version codes. 2011-01-24 14:54:24 +00:00
syr2k_k.c Changed a number of inline calls to use __inline. 2015-02-11 11:13:17 -06:00
syr2k_kernel.c Mark subbuffer as volatile to fix SIGBUS in multithreading with gcc15+ on 32bit FreeBSD/x86 2026-07-16 18:35:14 +02:00
syrk_k.c Changed a number of inline calls to use __inline. 2015-02-11 11:13:17 -06:00
syrk_kernel.c prepared driver/level3 functions for UNROLL values, that are not a power of two 2017-01-09 10:38:15 +01:00
syrk_thread.c fix improper function prototypes (empty parentheses) 2023-09-30 12:49:24 +02:00
trmm_L.c initial support for Sapphire Rapids platform 2021-10-12 01:30:40 -07:00
trmm_R.c initial support for Sapphire Rapids platform 2021-10-12 01:30:40 -07:00
trsm_L.c Fixing a performance bug in trsm_[LR].c. 2020-09-14 13:10:48 -05:00
trsm_R.c Fixing a performance bug in trsm_[LR].c. 2020-09-14 13:10:48 -05:00
zhemm_k.c Import GotoBLAS2 1.13 BSD version codes. 2011-01-24 14:54:24 +00:00
zher2k_k.c Remove all trailing whitespace except lapack-netlib 2014-06-27 12:05:18 -07:00
zher2k_kernel.c prepared driver/level3 functions for UNROLL values, that are not a power of two 2017-01-09 10:38:15 +01:00
zherk_beta.c Import GotoBLAS2 1.13 BSD version codes. 2011-01-24 14:54:24 +00:00
zherk_k.c Remove all trailing whitespace except lapack-netlib 2014-06-27 12:05:18 -07:00
zherk_kernel.c prepared driver/level3 functions for UNROLL values, that are not a power of two 2017-01-09 10:38:15 +01:00
zsyrk_beta.c Remove all trailing whitespace except lapack-netlib 2014-06-27 12:05:18 -07:00