Commit Graph

890 Commits

Author SHA1 Message Date
Martin Kroeker 446c436e10
Merge pull request #5965 from martin-frbg/issue5958-2
Return a specific XERBLA error to the caller when buffer assignment fails
2026-08-07 22:34:18 +02:00
Martin Kroeker 75b93b4465
Fix missing declaration of info 2026-08-07 13:56:43 +02:00
Martin Kroeker 761ebe91ab
Fix return without code and buffer leak on other error path 2026-08-07 13:51:01 +02:00
Martin Kroeker ed2ba87203
Add error return on buffer assignment failure 2026-08-07 12:28:01 +02:00
Nathan Goldbaum 28da957ee1 cache ntdll pointer at startup 2026-08-05 09:02:15 -06:00
Nathan Goldbaum 4ea40779bd Add explanatory note about RtlDllShutdownInProgress 2026-08-05 08:37:44 -06:00
Nathan Goldbaum 8c7c04b671 Merge branch 'develop' into shutdown-release-race 2026-08-05 08:14:52 -06:00
Nathan Goldbaum b8d83a72f4 Avoid possible hang on Windows by introspecting shutdown state 2026-08-05 08:10:43 -06:00
Nathan Goldbaum 95120da710 Centralize buffer release bookkeeping 2026-08-05 08:10:30 -06:00
moluopro 61f5f03311 Use worker workspace for threaded SBMV 2026-08-04 12:06:17 +08:00
moluopro dddd08507e Preserve Windows queue workspace inputs 2026-08-04 12:06:17 +08:00
moluopro a7b6ce7ae0 Preserve OpenMP queue workspace inputs 2026-08-04 12:06:17 +08:00
moluopro 21d02cf01e Preserve pthread queue workspace inputs 2026-08-04 12:06:17 +08:00
Martin Kroeker 28e75a8530
Tag get/set_affinity with OPENBLAS_EXPORT 2026-07-28 20:52:15 +02:00
Martin Kroeker 4230fe472e
Tag openblas_set_num_threads and get/set_affinity with OPENBLAS_EXPORT 2026-07-28 20:45:46 +02:00
Martin Kroeker b080247a21
Revert "Mark temporaries as volatile to avoid SIGBUS in multithreaded builds with gcc15+ on 32bit FreeBSD/x86" 2026-07-26 22:51:58 +02:00
Martin Kroeker 39cdbe6a3c
expose openblas_set_xerbla 2026-07-22 00:07:43 +02:00
Martin Kroeker 63ad298a67
Merge branch 'develop' into attrib-hidden 2026-07-21 20:00:16 +02:00
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
Martin Kroeker 15351019ea
Mark subbuffer as volatile to fix SIGBUS in multithreading with gcc15+ on 32bit FreeBSD/x86 2026-07-16 18:35:14 +02:00
Martin Kroeker dd69b9d0ce
Mark floats as volatile to fix SIGBUS in multithreading with gcc15+ on 32bit FreeBSD/x86 2026-07-16 18:33:19 +02:00
Martin Kroeker a5dcb2a8a8
Merge pull request #5909 from hmeiland/riscv64-blas-set-parameter
RISC-V: cache-aware GEMM blocking (get_L2_size + blas_set_parameter)
2026-07-14 12:27:10 +02:00
Martin Kroeker 113410db3e
Merge pull request #5904 from moluopro/fix/xerbla-handler
Add a portable XERBLA handler API
2026-07-13 15:15:03 +02:00
Martin Kroeker b668c9a376
Merge pull request #5808 from nh2/issue-5806-openblas_set_num_threads-openmp
Make OpenBLAS's usage of OpenMP respect `openblas_set_num_threads()`
2026-07-13 14:38:03 +02:00
Hugo Meiland 269e1cd505 RISC-V: add get_L2_size() and blas_set_parameter() for cache-aware GEMM blocking
RISC-V was the only major architecture without a get_L2_size() /
blas_set_parameter() implementation, so the GEMM cache-blocking parameters
(P/Q/R) were fixed at compile time regardless of the actual L2 cache size.

Because the blocking is now derived from the L2 cache detected at runtime
rather than a fixed compile-time constant, future RISC-V cores - which are
arriving with progressively larger and more varied L2 caches - get more
optimal blocking automatically, and the port gains the same runtime-tuning
hook x86 and LoongArch already use.

This adds, under ARCH_RISCV64:

- get_L2_size(): reads the level-2 (unified) cache size from Linux sysfs
  (/sys/devices/system/cpu/cpu0/cache/index*/{level,size}); RISC-V has no
  architectural cache-size query like x86 CPUID or LoongArch CPUCFG. Falls
  back to 512 KB when sysfs is unavailable.

- blas_set_parameter(): scales each precision's packed-A dimension P from the
  detected L2. The base blocking and the reference cache size come from the
  active core's own param.h block (*_DEFAULT_P_BASE, RISCV_L2_REFERENCE_KB),
  so the function carries no core-specific constants and is a no-op for cores
  that do not opt in. Q and R keep their param.h defaults.

- driver/others/memory.c and common_macro.h: add ARCH_RISCV64 to the existing
  architecture lists that call blas_set_parameter() and declare the runtime
  parameter variables (sgemm_p, dgemm_p, ...).

- param.h RISCV64_ZVL256B: declares the per-core base blocking + reference and
  maps SGEMM/DGEMM/CGEMM/ZGEMM DEFAULT_P to the runtime variables for static
  builds; DYNAMIC_ARCH keeps the literals, since kernel/setparam-ref.c
  init_parameter() initialises the gotoblas table from these macros and
  blas_set_parameter() is not called on the dynamic path.

Only RISCV64_ZVL256B opts in so far; its base + reference are tuned on the
SpaceMiT X60, where a 512 KB L2 reproduces the stock blocking, so this is
performance-neutral on current hardware. Verified: a static RISCV64_ZVL256B
build reproduces the stock 128/128/16384 (SGEMM) and 64/128/8192 (DGEMM)
blocking; a DYNAMIC_ARCH build compiles cleanly (per-core setparam-ref objects
build without error); and get_L2_size() reads the correct size on both a
SpaceMiT X60 (512 KB L2) and a SiFive U74 / VisionFive 2 (2 MB L2).
2026-07-13 11:00:15 +02:00
Niklas Hambüchen f8674a7be8 Make OpenBLAS's usage of OpenMP respect openblas_set_num_threads(). Fixes #5806.
Until now, the code in `num_cpu_avail()`,

    if (blas_cpu_number != openmp_nthreads) {
      goto_set_num_threads(openmp_nthreads);
    }

would just always set the threads back to OpenMP's thread count.
2026-07-12 06:11:17 +02:00
moluopro 6a04925804 xerbla: add a portable handler API 2026-07-10 14:55:52 +08:00
Kumar Aditya a2261f9e52 fix thread safety of openmp backend 2026-07-02 15:39:09 +05:30
Kumar Aditya 298d53c061 fix data races in blas_server and level3_thread 2026-06-23 18:42:25 +05:30
Martin Kroeker 7126fcf40c
fix extraneous brace 2026-06-15 15:42:16 +02:00
Martin Kroeker 18e2fe9fa4
Add support for QEMU's virtual AMD cpu to avoid misdetection as Opteron 2026-06-15 14:54:24 +02:00
Nathan Goldbaum 9363452742 Fix corruption due to lock sharding issues by centralizing locking 2026-06-14 15:32:51 -06:00
pengxu 6731dac68b optimize zgemm lsx kernel for 2k3000 cpu 2026-05-29 10:05:39 +08:00
Martin Kroeker 7324f370bf
Restore use of strnicmp for strncasecmp on Windows 2026-05-05 00:00:47 +02:00
Martin Kroeker bd3cd916a5
fix typo in redirect 2026-05-03 18:54:57 +02:00
Martin Kroeker 2f6a673980
Add target redirects for building on Apple hardware 2026-05-03 12:12:56 +02:00
Ludovic Henry 43aa35c2ef Fix compilation with DYNAMIC_TARGET=1 and BUILD_BFLOAT16
coremsg isn't defined outside the BUILD_BFLOAT16 and BUILD_HFLOAT16 blocks, leading to the use of an undefined variable
2026-04-30 16:28:56 +02:00
Martin Kroeker feca8f994d
Recognize other AVX2-capable Zhaoxin cpus 2026-04-25 19:18:28 +02:00
Martin Kroeker 54b939e4e3
Undefine GEMM_PREFERRED_SIZE before redefining to silence warning 2026-04-22 16:30:12 +02:00
Martin Kroeker 6f0dfd5276
Guard against eventual overflow of the config string 2026-04-16 18:37:08 +02:00
Martin Kroeker 4991de5f3e
Merge pull request #5759 from nSircombe/feature/v3support
Add CPU ID for Neoverse V3
2026-04-16 14:38:32 +02:00
Nathan John Sircombe 5f4a5b323d Update (c) years and contributors 2026-04-16 08:53:32 +01:00
Nathan John Sircombe 3a3903a49e Add CPU ID for Neoverse V3 2026-04-15 22:07:32 +01:00
Martin Kroeker 822b873c7c
Automatically assume BIGNUMA if more than 256 CPUs 2026-04-15 22:59:12 +02:00
Martin Kroeker 330abcd5a9
Merge pull request #5707 from vtjnash/jn/makefile-rule-dynamic-2
Reapply "build: fix rule for building dynamic files"
2026-04-15 21:58:21 +02:00
Martin Kroeker 16211b7170
Add CortexA75/76 via CortexA73 and restore VORTEX for use with DYNAMIC_LIST 2026-03-29 22:10:44 +02:00
Martin Kroeker 75511cb67c
POSIX strncasecmp is strnicmp in Windows on Arm 2026-03-27 13:40:39 +01:00
Jameson Nash c114ca5247 Reapply "build: fix rule for building dynamic files"
This reverts commit 7eab365219 and fixes
the pattern rule requirement "% must match a non-empty stem" to match at
least '.' in the pattern.

This whole file could actually be substantially simplified to just:

	%.$(SUFFIX): %.c
		$(CC) $(CFLAGS) -c $< -o $(@F)

	%.$(PSUFFIX): %.c
		$(CC) $(PFLAGS) -c $< -o $(@F)

if desired to entirely avoid the copy-paste duplication, but the net
effect is the same.
2026-03-23 23:09:47 -04:00
Martin Kroeker 7eab365219
Revert "build: fix rule for building dynamic files" 2026-03-23 20:03:52 +01:00
Martin Kroeker 8b9b3f0f5e
Merge pull request #5698 from martin-frbg/issue5638
Improve error message displayed when running out of buffers
2026-03-23 08:37:45 +01:00