mirror of https://github.com/xianyi/OpenBLAS.git
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 |
||
|---|---|---|
| .. | ||
| CMakeLists.txt | ||
| Makefile | ||
| gemm.c | ||
| gemm3m.c | ||
| gemm3m_level3.c | ||
| gemm_batch_thread.c | ||
| gemm_thread_m.c | ||
| gemm_thread_mn.c | ||
| gemm_thread_n.c | ||
| gemm_thread_variable.c | ||
| hemm3m_k.c | ||
| level3.c | ||
| level3_gemm3m_thread.c | ||
| level3_syr2k.c | ||
| level3_syrk.c | ||
| level3_syrk_threaded.c | ||
| level3_thread.c | ||
| level3_thread_lock.c | ||
| symm3m_k.c | ||
| symm_k.c | ||
| syr2k_k.c | ||
| syr2k_kernel.c | ||
| syrk_k.c | ||
| syrk_kernel.c | ||
| syrk_thread.c | ||
| trmm_L.c | ||
| trmm_R.c | ||
| trsm_L.c | ||
| trsm_R.c | ||
| zhemm_k.c | ||
| zher2k_k.c | ||
| zher2k_kernel.c | ||
| zherk_beta.c | ||
| zherk_k.c | ||
| zherk_kernel.c | ||
| zsyrk_beta.c | ||