Skip to content

Mixed-precision corrections, src reorganisation, tests, docs and benchmarks - #23

Open
AkhilAkkapelli wants to merge 16 commits into
mainfrom
mxp-corrections
Open

AkhilAkkapelli wants to merge 16 commits into
mainfrom
mxp-corrections

Conversation

@AkhilAkkapelli

@AkhilAkkapelli AkhilAkkapelli commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This PR started as the mixed-precision corrections on top of #22 (first commit). It now also
carries the work that was in #24 (closed), plus the fixes and tests that followed. There are five
commits, each reviewable on its own:

Commit What
mxp: Float32 scales, fixes for wrong results and crashes, and cleanups the original content of this PR
Reorganise src into dense/, mxp/ and tlr/ … src/ laid out like BLAS/LAPACK
Tests: one environment with ParallelTestRunner … the test suite, with paths that mirror src/
Docs: README as the home page … the Documenter site
Final source: fixes and tests, TLR removed, docs and a benchmark runner everything since; see below

The last commit

  • Fixes, found while testing and benchmarking:

    • flags accepted in either case and checked in trsm!, trmm! and unified_rectrxm!;
    • PosDefException from cholesky_lower! and cholesky_blocked!;
    • info counted in the whole matrix for the recursive LU and Cholesky;
    • empty inputs return at once;
    • Float16 sums in Float32 (SYRK kernel, QR norms);
    • CUDA views with non-consecutive rows, and vector batches of mixed sizes;
    • cuBLAS at the CUDA leaves of the triangular solve and multiply, and for larfb!/unmqr! in
      Float32;
    • concurrent tasks in the mixed-precision recursions;
    • transposed containers refused with a clear error.

    Docstrings were checked against the code and corrected.

  • TLR removed. The tile low-rank module is taken out of this PR; it will come back in its own.

  • Tests:

    • new and reorganised tests, with shared helpers in test/setup/;
    • options to choose cases inside the tests (--types, --uplo, --n, …), plus --failfast,
      --gpu-debug and --no-float64;
    • CI also runs the current Julia release.
  • Docs: a Dense matrices page, the Benchmarks page redone from final GPU runs, the WHPC/ISC 2026
    poster on the home page, and "Running the benchmarks".

  • benchmark/: run.jl reproduces the Benchmarks page against the vendor libraries, on the CPU
    or CUDA:

    julia --project=benchmark benchmark/run.jl gemm potrf --backends=CUDA

Performance

NVIDIA GB10, Julia 1.10.14: final runs against the runs of 2026-11-24. The vendor libraries ran
at the same speed in both (median 1.00–1.05×), so the differences come from NextLA.

Routine Median speed-up, all NextLA cases Largest
GEMM 1.03× 11.7× (mixed F16/F32, n = 16384)
SYRK 1.04× 14.7× (dense Float32 recsyrk!, n = 16384)
TRSM / TRMM 1.65× 29.7× (mixed F16/F32 multiply, n = 4096)
Cholesky 1.33× 7.9× (mixed F16/F32, n = 16384)
LU 1.57× 10.3× (mixed F16/F32, n = 16384)

Testing

The full suite on the final tree, on the CPU and with CUDA (NVIDIA GB10), passes on:

Julia Passed Broken (known bugs, pinned with @test_broken)
1.10.14 51,935 193
release 51,743 195
nightly 51,743 195

The docs build passes with every doctest.

AkhilAkkapelli and others added 4 commits November 16, 2026 16:59
Corrections on top of #22, agreed change by change: BFloat16, helper
names, then the mixed-precision corrections.

BFloat16
- BFloat16s.jl is a dependency and its BFloat16 replaces the _BFloat16
  constant in src, ext and tests, so BFloat16 blocks and GEMM work on
  Julia 1.10 as well as 1.11.

Names
- _supported -> _is_block_precision, _check_args -> _check_mixedprec_args.
- Block helpers renamed: _quantize_mixedprec_block,
  _requantize_mixedprec_offdiag_block!, _update_mixedprec_offdiag_block!,
  _solve_mixedprec_offdiag_block!, _triangular_mixedprec. No comments in
  blocks.jl.

Scales and leaves
- Scale factors are always Float32: scale_type and T_Scale are removed
  from the four containers and adaptive_precisions, and quantize is
  quantize(A, T=Float16) -> (Q, s).
- precisions[end] must be Float32 or Float64.
- A scale is only raised when an update or solve outgrows it; a scale past
  floatmax(Float32) throws ArgumentError instead of leaving the block Inf.

Fixes
- unified_rectrxm! with a SymmMixedPrec and trans = 'T' used the stored
  triangle untransposed (2-10% error, or DimensionMismatch).
- unified_rectrxm! throws when uplo is not A.uplo for a SymmMixedPrec or
  TriMixedPrec instead of giving a wrong result.
- recgemm! takes one product over the whole k per quadrant, so sizes that
  are not a power of two work in recgemm! and lu_recursive!.
- adaptive_precisions takes 16- and 8-bit block norms in Float64, so finite
  BFloat16 matrices with very large or very small entries are accepted.
- typemin of a signed integer matrix is scaled instead of stored as -Inf.
- A' on a container gives a TransposedMixedPrec.

Cleanups
- No clamp when quantizing; the block max is taken without a temporary.
- adaptive_precisions gives Float32 leaves to a Float32 matrix and reads A
  once; the adaptive_precision_LT, lu_recursive_mixed! and
  unified_rec_mixed names are removed.
- MixedPrecision re-exports the five routines it extends.
- Seven single-caller _ helpers are folded into their callers;
  lu_recursive! and recgemm! recurse into themselves.
- src/recursion.jl and src/backend_traits.jl are folded into src/NextLA.jl.
- Docstrings match the code; tests cover every fix above.
…le; fixes for nightly, larfb! aliasing and the mixed-precision containers on the GPU

Co-authored-by: Alessandro <axelcar482@gmail.com>
…r src/, --backends option, tests for the mixed-precision containers and TLR
…ed precision, tile low-rank, benchmarks), API reference organised like src/, CONTRIBUTING, CITATION; move the poster and handout to docs/src/assets
Code (src/, ext/):
- Fixes found by the test and benchmark work (runs T127-T146): flags accepted in either case
  and checked in trsm!/trmm!/unified_rectrxm!; PosDefException from cholesky_lower! and
  cholesky_blocked!; info counted in the whole matrix for the recursive LU and Cholesky;
  empty inputs return at once; Float16 sums in Float32 (SYRK kernel, QR norms); CUDA views
  with non-consecutive rows and mixed-size vector batches; cuBLAS at the CUDA leaves of the
  triangular solve and multiply, and for larfb!/unmqr! in Float32; concurrent tasks in the
  mixed-precision recursions; transposed containers refused with a clear error.
- Docstrings checked against the code and corrected.
- The tile low-rank (TLR) module is removed; it will come back in its own PR.

Tests (test/): new and reorganised tests, shared helpers in test/setup/, options to choose
cases inside the tests (--types, --uplo, --n, ...), --failfast, --gpu-debug, --no-float64.
CI also runs the current Julia release.

Docs: a Dense matrices manual page, the Benchmarks page redone from the final GPU runs
(speed, accuracy, adaptive_precisions, the Euro-Par 2026 experiments), the WHPC/ISC 2026
poster on the home page, and "Running the benchmarks".

benchmark/: run.jl reproduces the Benchmarks page for gemm, syrk, trsm, trmm, potrf and lu
against the vendor libraries (CPU or CUDA):
    julia --project=benchmark benchmark/run.jl gemm potrf --backends=CUDA
@AkhilAkkapelli AkhilAkkapelli changed the title mxp: Float32 scales, fixes for wrong results and crashes, and cleanups Mixed-precision corrections, src reorganisation, tests, docs and benchmarks Nov 29, 2026
Akhil Akkapelli and others added 9 commits November 29, 2026 06:01
…HPC/ISC 2026 poster

The Float64 points at n = 32768 (and Cholesky at 65536) are run without time caps; the
comparison uses the poster's numbers against the vendor Float64 routines; formulas in LaTeX.
Same behaviour, easier to read: run.jl reads the command line; routines.jl has the six routines,
their test matrices and what each line calls; harness.jl measures the points and writes the results.
Checked on the CPU and with CUDA: the same points and fields as the single-file version.
The full suite with coverage ran past 60 minutes on the Julia 1 runner and was cancelled; 1.10 and
nightly finished in time. Test sizes are unchanged.
…timeout, benchmark timing, docs

- Float16 x Float16 products on Metal and oneAPI form the sum in Float32 instead of failing (B50);
  recgemm! keeps wider operands wide where gemmEx! is refused (T51).
- uplo flags in either case (C18); parfb! with m2 = 0, CUDA potrf_batched! returns (A, info),
  ttqrt!/ttmqr! read only the upper triangle; TriMixedPrec(::SymmMixedPrec) docstring.
- CI: coverage off for Julia 1, test timeout 60 minutes.
- benchmark/: the timer waits for every GPU stream; README timing rule and one device per run.
- Docs: Backends, dense and mixed-precision pages follow the fixes.
…(pf5, pf6a)

- recsyrk! into a SymmMixedPrec: a Float64 leaf updated by Float16 or Float32 rows takes the
  product in Float32 and adds it into the leaf in Float64 (pf5).
- A faster SymmMixedPrec/TriMixedPrec container build (pf6a).
- Tests for both; the Mixed precision page describes the Float64-leaf update.
…paper [3]'s code; pf5 accuracy note, README bound 1e-6

- Benchmarks page rewritten: mixed-precision Cholesky, SYRK and TRSM against paper [3]'s own code and the
  vendor libraries at n = 65536, GEMM and LU against the same code, papers [1] and [2], the GB10
  Float16 : Float32 ceiling, and how it was measured. Eight new charts (Markdown images, so their paths
  work with pretty URLs); the old charts are removed. Some points are still being rerun, as the page says.
- pf5's Float32 sums for a Float64 leaf's update cost accuracy when only Float32 blocks feed the leaf:
  the Mixed precision page and the source comment say so, and the README's [Float32, Float64] example
  checks < 1e-6 (measured up to 1.9e-7).
…as the other branches

- TRSM/TRMM on CUDA recurse instead of one whole-call cuBLAS solve;
  smallest TRMM block 16; Float32/Float64 updates via Sgemm/Dgemm.
- Cholesky's Float32/Float64 panel solves use trsm!, which on CUDA is
  one cuBLAS call.
- Dense Float64 GEMM on CUDA via Dgemm.
- Dense SYRK runs its halves in parallel when n > 4096; mixed-type
  SYRK/GEMM is computed in the wider type.
- Mixed SYRK smallest block 4096; TF32 off in mixed GEMM (mixed LU
  keeps TF32). Float16 GEMM/LU keep Float32 sums.

This branch was successfully deployed

1 active deployment
github-pages — 1091941f Deployed Dec 3, 2026 by AkhilAkkapelli via deploy #3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant