Commit Graph

321 Commits

Author SHA1 Message Date
Martin Kroeker c3db185d6c
Merge pull request #5879 from amritahs-ibm/BGEMM_PPC
BGEMM Kernel implementation for Power PC Architecture
2026-07-31 00:04:15 +02:00
Amrita H S 8d439717c5 power/sbgemm_kernel_power10.c: reformat to 4-space indentation
Pure cosmetic cleanup; no functional changes.

Convert all tab-indented code to 4-space indent, align macro
continuation backslashes, switch brace placement to consistent K&R
style, reformat multi-line vector initialisers, and remove trailing
whitespace on SAVE4x2_ACC1_SCALAR.

Signed-off-by: Amrita H S <amritahs@linux.vnet.ibm.com>
2026-07-23 02:14:01 -05:00
Amrita H S 0d6d459161 power/bgemm: add BFloat16-in, BFloat16-out GEMM kernel for POWER10
Add BGEMM (BF16 input → BF16 output) for POWER10 by reusing the
existing SBGEMM kernel infrastructure. A -DBGEMM compile flag switches
only the store path; the xvbf16ger2pp MMA instruction and BF16 packing
routines are shared with SBGEMM unchanged.

Changes
-------
kernel/power/KERNEL.POWER10
  - Register BGEMM kernel and copy-routine targets, reusing the
    sbgemm_ncopy/tcopy sources (packing layout is identical).

kernel/power/sbgemm_kernel_power10.c
  - Under BGEMM: force v4sf_t to float so accumulators stay in
    float32; add STORE4_BF16/STORE2_BF16 macros (read BF16 C, widen,
    apply alpha*acc, convert back via xvcvspbf16, store); add
    f32_to_bf16_scalar() for m&1/n&1 tails; add BGEMM variants of
    all SAVE_ACC macros covering the full m/n tile hierarchy.

param.h
  - Add BGEMM_DEFAULT_UNROLL_M=16, UNROLL_N=8, P/Q/R blocking
    parameters for POWER10, matching the 16x8 kernel tile.

Unit test (utest/test_extensions/test_bgemm.c)
  - Uses SBGEMM as a trusted reference. 21 test cases cover all four
    transpose combinations, all m/n remainder paths, odd-k, alpha=0,
    beta=0/1, and the m>=32 fast path. Tolerance 0.01 to account for
    the one extra BF16 rounding on the BGEMM store.

Performance (POWER10, single-threaded, Transa=N Transb=N)
----------------------------------------------------------
Step=1 (sizes 1–200):
  - Sizes 1–80:   baseline 0.1–128 MFlops (scalar fallback);
                  patch 0.1–39,656 MFlops (up to ~350x faster at M=80).
  - Sizes 81–200: patch 3x–24x faster (avg ~10x) with 16×8 MMA tile
                  engaged.

Step=8 (sizes 8–1024):
  - Baseline peaks at ~2,950 MFlops (avg ~1,746 MFlops).
  - Patch sustains 75,000–1,009,866 MFlops for sizes 384–960,
    exceeding 1 TFlops at large sizes.
  - Median speedup ~99x; average speedup ~140x across all sizes.

Signed-off-by: Amrita H S <amritahs@linux.vnet.ibm.com>
2026-07-23 02:13:31 -05:00
Martin Kroeker 63ad298a67
Merge branch 'develop' into attrib-hidden 2026-07-21 20:00:16 +02:00
Martin Kroeker ef20ea1644
Merge pull request #5828 from amritahs-ibm/fix_dcbt_constraints
Fix incorrect inline assembly constraints in dcbt prefetch instructions
2026-06-15 11:22:10 +02:00
Ayappan Perumal faf7ddbbea Fix AIX build with OpenXL (ibm-clang) 2026-06-10 04:22:48 -05:00
amritahs-ibm 7e3877f263
Merge branch 'develop' into fix_dcbt_constraints 2026-06-09 14:45:02 +05:30
Amrita H S 831b822b94 Fix incorrect inline assembly constraints in dcbt prefetch instructions
Corrected the register constraints for the PowerPC dcbt (Data Cache Block
Touch) instruction in Power10 kernel implementations. The dcbt instruction
has special behavior where if the first operand (RA) is r0, it uses the
value 0 instead of the register contents. Therefore, RA must use the "b"
constraint (any GPR except r0), while RB can use "r" (any GPR including r0).

Changes:
- Changed first operand constraint from "r" to "b" to exclude r0
- Changed second operand constraint from "b" to "r" for flexibility

This ensures correct prefetch behavior and compliance with PowerPC ISA
specifications, preventing potential issues where r0 might be incorrectly
used as the base address register.

Signed-off-by: Amrita H S <amritahs@linux.vnet.ibm.com>
2026-06-04 01:49:08 -05:00
Amrita H S 3863a7778d Power10: Replace vector pair loads with __builtin_vsx_lxvp
Replace normal vector pair pointer dereferences with the optimized
__builtin_vsx_lxvp builtin across DGEMM, ZGEMM, and DGEMV kernels.

Also done some identation corrections in dgemm_kernel_power10.c.
This is done as part of POWER code cleanup and may not have any
performance impact.

Signed-off-by: Amrita H S <amritahs@linux.vnet.ibm.com>
2026-06-03 02:34:53 -05:00
Martin Kroeker 33c14c66c7
spell out ifdefined 2026-04-30 17:31:01 +02:00
Martin Kroeker 703710763d
Correct stack offset of FLAG on FreeBSD 2026-04-30 17:29:31 +02:00
Martin Kroeker 54efe8ae71
Correct stack offset of FLAG on FreeBSD 2026-04-30 17:28:10 +02:00
Martin Kroeker 57765364fc
Return to using assembly SCAL kernels on FreeBSD 2026-04-30 17:25:25 +02:00
Martin Kroeker ef27ec6bed
Add pragma to limit optimization level 2026-02-22 13:42:41 +01:00
Martin Kroeker 46b963b9a0
Use generic C kernels for SCAL on FreeBSD 2026-02-19 22:46:03 +01:00
mattip be7da1f111 add visibility=default to exported functions, visibility=hidden to most assembler 2026-02-05 06:31:17 +11:00
Martin Kroeker 601bdde8ec
fix stack location of dummy2 flag 2026-01-27 22:40:50 +01:00
Martin Kroeker d53d2b11a9
fix stack location of dummy2 flag 2026-01-27 22:39:37 +01:00
Amrita H S b53d18b3ad Fixing warning messages in dgemm and dgemv kernels
Signed-off-by: Amrita H S <amritahs@linux.vnet.ibm.com>
2026-01-06 10:20:56 -06:00
Rajalakshmi Srinivasaraghavan 2283fcbbe7 POWER10: Reduce sgemm loop unrolling
With GCC 14, unnecessary move and lxvp instructions appear when unrolling the inner loop for larger sizes.
Reducing the loop unroll factor restores performance to GCC 11.
2026-01-04 17:01:01 -06:00
Martin Kroeker f7b7296bff
Fix compilation with LLVM 2025-11-22 16:07:34 +01:00
Martin Kroeker 0c59ae0b45
Merge pull request #5453 from pratiklp00/dgemm_optimization
Dgemm loop unroll and 4x1, 4x2 dgemv VSX implementation for power10.
2025-10-28 16:51:41 -07:00
pratiklp00 6637352260 remmove spacing 2025-10-14 00:06:04 -05:00
pratiklp00 e2399be6d2 add macro 2025-10-08 23:24:41 -05:00
Martin Kroeker 46fc6c0794
fix unspecified array size in clobber list 2025-10-08 08:23:24 +02:00
pratiklp00 d7b11605d1 fix build issue 2025-09-29 02:02:13 -05:00
Dan Horák f5ec1c4e53 fix typos in Power8 routines
Fixes: https://github.com/OpenMathLib/OpenBLAS/pull/5448
2025-09-26 16:54:03 +02:00
Dan Horák 681af71d95 drop gcc 15 workaround
As the assembler routines has correctly specified parameter we can drop
the previously applied workaround in https://github.com/OpenMathLib/OpenBLAS/pull/5409.
2025-09-26 16:52:17 +02:00
Martin Kroeker c92f7f6bb2
Merge pull request #5448 from martin-frbg/issue5372-2
Fix clobber list entries for arrays in POWER kernels that use inline asm
2025-09-26 02:24:50 -07:00
Martin Kroeker 14c9dcaac7
Use generic kernels for SCAL to fix corner cases of Inf/NAN 2025-09-25 20:31:12 +02:00
pratiklp00 16be28af7c dgemm loop unroll and 4x1 4x2 dgemv implimentation 2025-09-21 23:00:21 -05:00
Martin Kroeker 1d5279fd29
Fix clobber list entries for arrays in inline asm 2025-09-17 07:02:18 -07:00
Martin Kroeker a3b9c933c5
mark xbuffer as volatile to work around gcc15.1 optimizer bug 2025-07-30 17:05:36 +02:00
Martin Kroeker cf06250d36
add handling of dummy2 flag 2025-05-24 06:06:24 -07:00
Martin Kroeker 4ec62d7f73
remove non-vectorized code path for power8, restoring PR4880 2025-04-21 23:14:10 +02:00
Ubuntu 0cc2485594 Explicit unaligned vector load/stores in PPC64LE GEMV kernels 2025-04-20 08:00:29 +00:00
Martin Kroeker 77fba0f400
Fix "dummy2" flag handling 2025-02-22 20:09:21 +01:00
Martin Kroeker 81eed868b6
Restore the non-vectorized code from before PR4880 for POWER8 2025-02-12 09:07:20 +01:00
Martin Kroeker 98b5ef929c
Restore the non-vectorized code from before PR4880 for POWER8 2025-02-12 09:04:22 +01:00
Martin Kroeker d7036cfd74
Remove trailing blanks that break the cmake parser 2025-01-27 09:32:17 +01:00
tingbo.liao 3c8df6358f Further rearranged the rotm kernel for the different architectures.
Signed-off-by: tingbo.liao <tingbo.liao@starfivetech.com>
2025-01-22 11:41:12 +08:00
Sergey Fedorov 229efa42ff scal.S: use r11 on 32-bit Darwin on powerpc 2025-01-05 00:31:27 +08:00
Sergey Fedorov 81e1be8d90 Revert "temporarily disable the default S/DSCAL kernel"
This reverts commit 9b9c0aa5c9.
2025-01-04 22:54:54 +08:00
Martin Kroeker 9b9c0aa5c9
temporarily disable the default S/DSCAL kernel 2025-01-03 21:36:46 +01:00
Ayappan Perumal 020cce1068 Fix build issues with gcc compiler as well 2024-10-23 04:24:06 -05:00
Ayappan Perumal b6ec73e77c Fix AIX build 2024-10-21 07:38:03 -05:00
Chip Kerchner ab71a1edf2 Better VSX. 2024-10-17 08:25:02 -05:00
Chip Kerchner 36bd3eeddf Vectorize BF16 GEMV (VSX & MMA). Use GEMM_GEMV_FORWARD_BF16 (for Power). 2024-10-13 13:46:11 -05:00
Martin Kroeker e52d9b4cf1
Merge pull request #4928 from austinpagan/czgemm_in_c
CGEMM & ZGEMM using C code, Power only, P10 only.
2024-10-09 20:26:21 +02:00
Gordon Fossum 0b7fb5c791 CGEMM & ZGEMM using C code. 2024-10-09 09:42:23 -05:00