Commit Graph
10576 Commits
Author SHA1 Message Date
Martin Kroeker b28cdccd2d Merge pull request #5915 from martin-frbg/fixup5802
Rework the -mpwr10 option to be only applied to POWER9/10 on FreeBSD
2026-07-14 22:05:19 +02:00
Martin Kroeker 036e835019 Merge pull request #5912 from martin-frbg/lapack1288
Fix seed advancement in SLARUV/DLARUV (Reference-LAPACK PR 1288)
2026-07-14 20:30:43 +02:00
Martin Kroeker fd88cac200 Merge pull request #5911 from martin-frbg/lapack1305
Replace HUGE intrinsic in ?TGSJA for consistency (Reference-LAPACK PR 1305)
2026-07-14 17:58:23 +02:00
Martin Kroeker 87aac59e87 Rework the -mpwr10 option to be only applied to POWER9/10 on FreeBSD 2026-07-14 16:27:16 +02:00
Martin Kroeker 1e14cc90f8 Merge pull request #5910 from martin-frbg/lapack1298
Fix test failures in ?CHKLQ when NB=1 with M=N (Reference-LAPACK PR 1298)
2026-07-14 15:44:45 +02:00
Martin Kroeker 136a714687 Merge pull request #5914 from martin-frbg/u74detect
Add cpu detection for Sifive U74
2026-07-14 15:20:31 +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 41aad1107a Add Sifive U74 2026-07-14 07:30:47 +02:00
Martin Kroeker 873f005957 Merge pull request #5903 from hmeiland/u74-gemm-4x4-kernel
Add SiFive U74 target with a scalar 4×4 register-tiled GEMM kernel
2026-07-14 07:27:12 +02:00
Martin Kroeker 6b1d101317 Fix seed advancement on rejected uniform deviate (Reference-LAPACK PR 1288) 2026-07-13 19:56:29 +02:00
Martin Kroeker cdde6e8c4d Replace HUGE intrinsic (Reference-LAPACK PR 1305) 2026-07-13 19:50:05 +02:00
Martin Kroeker 5e517085c5 Fix test failures when NB=1 with M=N (Reference-LAPACK PR 1298) 2026-07-13 19:40:43 +02:00
Martin Kroeker 65382d22d4 Merge pull request #5583 from vtjnash/fix-libnamesuffix-handling
build: Fix LIBNAMESUFFIX handling in CMake documentation
2026-07-13 16:59:12 +02:00
Hugo Meiland 5d7868f487 U74 target: move the U74-specific gemm kernel to kernel/riscv64
Per review, the U74-specific DGEMM micro-kernel does not belong under
kernel/generic (reserved for portable, architecture-neutral C kernels).
Move both the hybrid dispatcher and its readable assembly source into
kernel/riscv64, next to KERNEL.U74:

- git mv kernel/generic/gemmkernel_4x4_u74.c -> kernel/riscv64/
- git mv kernel/generic/kern_u74.S          -> kernel/riscv64/
- KERNEL.U74: DGEMMKERNEL ../generic/gemmkernel_4x4_u74.c
                       -> ../riscv64/gemmkernel_4x4_u74.c
- gemmkernel_4x4_u74.c: #include "conversion_macros.h"
                     -> #include "../generic/conversion_macros.h"
  (that header stays under kernel/generic; same form kernel/wasm
   already uses for it)

No functional change. The portable gemmkernel_4x4.c (SGEMMKERNEL) is
untouched and stays in kernel/generic. DGEMMKERNEL still resolves through
$(KERNELDIR), so both the Makefile ($(KERNELDIR)/$(DGEMMKERNEL)) and CMake
(GenerateNamedObjects "${KERNELDIR}/${DGEMMKERNEL}") builds pick the kernel
up from its new location.
2026-07-13 16:37:03 +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
Martin Kroeker 65b51b0c12 Merge pull request #5908 from moluopro/cleanup/remove-misplaced-lapacke-wrappers
Remove misplaced LAPACKE `?gesvdq_work` source files
2026-07-13 13:32:18 +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
moluopro 0f68da835c Remove misplaced LAPACKE GESVDQ wrapper sources
These stale duplicate sources are not referenced by the build. The canonical implementations remain under lapack-netlib/LAPACKE/src.

Signed-off-by: moluopro <moluopro@qq.com>
2026-07-13 12:40:03 +08: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
Martin Kroeker 992a536238 Merge pull request #5902 from wxpppp/develop
LoongArch64: avoid SGEMM LA464 ncopy fallthrough from N2 to N1
2026-07-12 01:11:37 +02:00
moluopro 6720959694 docs: summarize XERBLA handler semantics 2026-07-11 20:02:43 +08:00
moluopro 477131d547 cblas: clarify XERBLA handler lifetime 2026-07-11 20:02:13 +08:00
moluopro 03cfefcdcb cmake: propagate CBLAS test failures on Windows 2026-07-11 19:53:42 +08:00
moluopro 8ac41809cf test: register XERBLA for level 3 BLAS 2026-07-11 19:52:20 +08:00
moluopro e4891bc055 test: register XERBLA for level 2 BLAS 2026-07-11 19:50:56 +08:00
moluopro 7a24cf7a6a test: harden Makefile result handling 2026-07-11 19:49:33 +08:00
moluopro b5fa89f351 cmake: harden regular BLAS error tests 2026-07-11 19:48:33 +08:00
moluopro 066e9076c3 test: add a regular BLAS XERBLA bridge 2026-07-11 19:47:54 +08:00
Martin Kroeker d9788925a9 Merge pull request #5898 from moluopro/develop
Fix ARM64 SME direct-kernel build and dispatch
2026-07-11 10:52:51 +02:00
moluopro 97abc61bfc docs: clarify XERBLA handler behavior on ELF 2026-07-10 20:40:50 +08:00
moluopro d093ab90e9 docs: clarify XERBLA handler concurrency 2026-07-10 15:54:19 +08:00
moluopro ed8f1198b2 utest: bound XERBLA routine name diagnostics 2026-07-10 15:40:02 +08:00
moluopro f07e6a3d0d exports: preserve Windows ordinals in Perl generator 2026-07-10 15:39:22 +08:00
moluopro 490721cbd9 exports: preserve Windows ordinals for new symbols 2026-07-10 15:38:26 +08:00
moluopro 5daa61827a ctest: fail level-3 error-exit mismatches 2026-07-10 15:04:13 +08:00
moluopro cd4786dd78 ctest: fail level-2 error-exit mismatches 2026-07-10 15:03:18 +08:00
moluopro 39526d88c9 ctest: add a fatal test failure helper 2026-07-10 15:02:17 +08:00
moluopro 99bb32ae59 ctest: use explicit XERBLA handlers in error tests 2026-07-10 15:00:36 +08:00
moluopro 29703e52ad utest: cover explicit XERBLA handler registration 2026-07-10 14:59:30 +08:00
moluopro d7e007e0fb docs: document XERBLA handler semantics 2026-07-10 14:58:35 +08:00
moluopro 8da645954b exports: expose the XERBLA handler setter 2026-07-10 14:56:48 +08:00
moluopro 6a04925804 xerbla: add a portable handler API 2026-07-10 14:55:52 +08:00
moluopro b2ba228de5 install: preserve callback typedefs in generated CBLAS headers 2026-07-10 14:54:02 +08:00
moluopro 992ea2dab5 cmake: preserve callback typedefs in generated CBLAS headers 2026-07-10 14:53:18 +08:00
hmeiland d6e64e8032 U74 target: add CMake build support
Mirror the RISCV64_GENERIC target blocks for U74 in cmake/prebuild.cmake
(cache defines: 32 KiB L1D / 2 MiB L2, 64 B lines, matching getarch),
cmake/system.cmake and cmake/cc.cmake
(-march=rv64imafdc_zba_zbb -mabi=lp64d -mtune=sifive-u74), so
'cmake -DTARGET=U74' builds alongside the Makefile path.

Verified on a VisionFive 2: configure recognizes the target and a full
'cmake --build' produces libopenblas.a with the U74 march/mtune flags
applied to the kernel objects (0 errors).
2026-07-10 06:36:10 +02:00
hmeiland cfdaa69b9f U74 asm kernel: note full-memory HPL result in header
Full-memory HPL N=27456 (asm hybrid + Q=256) measured at 5.99 GFLOPS
(residual PASSED, ~50% of the 12 GF peak, +10.7% over the tuned C kernel,
1.81x the stock 2x2) - the best clean figure. Doc-only header update.
2026-07-10 05:44:15 +02:00
hmeiland 4999e881a5 U74 target: hand-scheduled scalar asm DGEMM micro-kernel
Adds a hand-written RV64GC scalar 4x4 DGEMM micro-kernel (kern_u74.S) and
wires it as the U74 DGEMMKERNEL via a hybrid dispatcher
(gemmkernel_4x4_u74.c): the fast path (bm,bn multiples of 4, even bk,
non-TRMM) runs the asm; all other shapes, odd bk, and the TRMM builds fall
back to the portable C 4x4 kernel.

The asm uses a 4x4 register tile (16 accumulators), full operand double-
buffering (P/Q ping-pong) with one-iteration lookahead, and load-before-FMA
issue ordering matched to the U74's dual-issue in-order front end.  Probes
show this reaches the FP-pipe peak (~16.5 cycles / 16 fmadd.d = 2.9 GF on
L1-resident data); the streaming plateau is memory-latency-bound, not the
schedule.

Measured on a VisionFive 2 (single-core, KC=256): micro-kernel 1.88 vs 1.54
GF (+22%), full blocked DGEMM 1.77 vs 1.48 GF (+20%); the advantage holds
under 4-core contention (+17%).  End-to-end HPL N=10000 (4 cores, Q=256):
5.17 vs 4.97 GF (+4.0%), residual PASSED.  Correctness validated against the
full BLAS Level-3 test suite (DGEMM 17,496 computational calls, 0 failures).
kern_u74.S is the readable source; the .c embeds it via top-level __asm__ so
it builds as a single OpenBLAS kernel object with no build-system changes.
2026-07-10 03:31:45 +02:00
hmeiland e4228c3255 U74 target: raise DGEMM_DEFAULT_Q to 256
A same-board controlled HPL A/B (VisionFive 2, TARGET=U74, N=10000,
NB=192, 2x2 grid, both libraries clean-built, residual PASSED) measures
4.97 vs 4.86 GFLOPS (+2.25%) for DGEMM_Q=256 over the inherited 128; at
a memory-filling N=27456 the tuned build sustains 5.41 vs 5.24 GFLOPS
(+3.24%). With HPL's NB=192, KC=256>=192 lets each trailing-update K
panel run in a single KC block, halving the C read-modify-write traffic
versus KC=128 (which splits K=192 into 128+64). A single-core P/Q sweep
over the real packing + micro-kernel objects confirms the GEMM is
compute-bound (whole grid within 3%), so P and R are left unchanged;
SGEMM_Q was already 240.
2026-07-10 01:26:18 +02:00
hmeiland b8949d1663 U74 target: build for the full JH7110 ISA (add Zba/Zbb)
The StarFive JH7110's U74 cores implement rv64imafdc_..._zba_zbb, so the U74
target now compiles with -march=rv64imafdc_zba_zbb. The generic RISCV64_GENERIC
target stays at bare rv64imafdc for portability across unknown RV64GC cores.

Measured on the VisionFive 2 (GCC 13.3, -mtune=sifive-u74 held constant): GCC
emits Zba shift-add instructions in the packing routines, but DGEMM is unchanged
-- the 4x4 kernel holds 1.533 GF either way and packing 1.74 vs 1.75 GB/s. The
4x4 micro-kernel is FMA-bound (fused fmadd.d with immediate-offset loads) and
packing is LPDDR4-bandwidth-bound, so integer address generation is not on the
critical path. The flag is nonetheless the correct -march for the silicon, is
free, and can only help address-gen-bound code elsewhere in the library. The
remaining GEMM headroom on the U74 is microarchitectural scheduling (a
hand-written assembly micro-kernel), not the ISA.
2026-07-09 20:21:40 +02:00