BatchLAS documentation

Batched dense and sparse linear algebra for SYCL: thousands of small-to-medium problems in one call. Each call is routed, per op, size and batch, between native SYCL kernels and the vendor library (cuBLAS, cuSOLVER, cuSPARSE, rocBLAS, netlib), whichever measured faster.

A minimal call

#include <batchlas.hh>
using namespace batchlas;
Queue ctx(Device::default_device()); // the backend comes from the device
gemm(ctx, A, B, C, {.alpha = 2.0f});
potrf(ctx, S, PotrfOptions{.uplo = Uplo::Upper});
ctx.wait(); // nothing is readable before this
The umbrella header: #include <batchlas.hh> gives the whole public API.
Event gemm(Queue &ctx, const MatrixView< T, MatrixFormat::Dense > &A, const MatrixView< T, MatrixFormat::Dense > &B, const MatrixView< T, MatrixFormat::Dense > &C, T alpha, T beta, Transpose transA, Transpose transB, ComputePrecision precision=ComputePrecision::Default)
Batched general matrix-matrix multiply.
@ Upper
The upper triangle (i <= j).
Definition enums.hh:288
Event potrf(Queue &ctx, const MatrixView< T, MatrixFormat::Dense > &descrA, Uplo uplo, Span< std::byte > workspace, Span< int32_t > info)
Batched Cholesky factorization of Hermitian positive-definite matrices.
static Device default_device()
The first GPU, else the first CPU, else the host device.
void wait() const
Block until the work this Event tracks has completed.
Options for potrf(): Cholesky (Lower) or (Upper).
Definition options.hh:549
Where BatchLAS work runs: a device, a backend, an ordered SYCL queue and a workspace arena.

Every entry point enqueues and returns an Event. Matrices are column-major in device-accessible (USM) memory. Use one Queue per thread. The full contract is in The BatchLAS C++ API.

Operations

Family Operations
Batched BLAS gemm, gemv, symm, syrk, syr2k, trmm, trsm, hemm, herk, her2k
Factorizations and solves potrf, posv, getrf, getrs, getri, gesv, geqrf, orgqr, ormqr
Eigenvalues and SVD syev, syevx (selected range), gesvd (one-sided Jacobi and blocked)
Sparse and spectral spmm, lanczos, steqr, stedc, ritz_values, ILU(k)
Utilities ortho, matrix generators, norms, condition numbers
Python pybind11 package with NumPy and SciPy interop (BatchLAS Python examples)

Performance against cuSOLVER

Float, RTX 4090, CUDA backend, large batch.

Op BatchLAS cuSOLVER Speed-up Conditions
syev with eigenvectors, n = 320, batch 819 67.8 µs/matrix 203.0 µs/matrix 3.0× measurement
syev with eigenvectors, n = 448, batch 585 (ratio only) (ratio only) 2.1× same
gesvd vs cusolverDnXgesvdjBatched, n = 8, batch 16384 0.0064 µs/matrix 0.339 µs/matrix 53× comparison
gesvd vs cusolverDnXgesvdjBatched, n = 32 0.468 µs/matrix 0.768 µs/matrix 1.6× same

Where the vendor library is faster for a shape, it runs instead (Kernel selection tables).

Source, issues and releases: github.com/jonasdelacour/BatchLAS.

User guide

Architecture and design

Algorithms

Routing and performance evidence

Results and evidence database

Developer guide