TDLS 0.2.0
Tiny Device-callable Linear Solvers
Loading...
Searching...
No Matches
solver_dynamic.hpp File Reference

Runtime-size variant of the TiledLUpp solver. More...

#include <tdls/core/math.hpp>
#include <type_traits>
#include <tdls/solvers/tiled_lupp/config.hpp>
Include dependency graph for solver_dynamic.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tdls::TiledLUppSolverDynamic< T, Config >
 Runtime-size tiled dense LU factorization with logical partial pivoting and out-of-tile pivot recovery, solving one n x n system per call. More...
 

Macros

#define TDLS_LUPP_DYN_A(r, c)
 Strided element (r, c) of the factor matrix, flat index remapped by Config.layout.
 
#define TDLS_LUPP_DYN_PIV(i)
 Strided pivot entry i.
 
#define TDLS_LUPP_DYN_X(i)
 Strided entry i of the solution vector.
 
#define TDLS_LUPP_DYN_B(i)
 Strided entry i of the right-hand side.
 
#define TDLS_LUPP_DYN_XW(w, i)
 Strided entry i of column w of a multi right-hand-side block.
 
#define TDLS_LUPP_DYN_BW(w, i)
 Strided entry i of column w of a multi right-hand-side block of b, addressed exactly as TDLS_LUPP_DYN_XW (b and x share both strides).
 
#define TDLS_LUPP_DYN_Y(i)
 Strided entry i of the fused right-hand side of solve_inplace.
 

Detailed Description

Runtime-size variant of the TiledLUpp solver.

Author
Tristan Chenaille

Same algorithm as TiledLUppSolverStatic (solver_static.hpp): tiled LU with logical partial pivoting, out-of-tile recovery, reciprocal-diagonal factored format, right- and left-looking schedules. The difference is that the system dimension n is a runtime function parameter instead of a template parameter. Only the tile size (Config.tile_size) stays compile-time: register tiles keep a fixed tile_size x tile_size footprint, while all loop bounds over tiles and inside partial tiles are runtime values.

Deliberate differences with the compile-time solver:

  • No unroll pragma anywhere: with runtime bounds nothing can be register-resident by full unrolling, so the unroll_inner knob of TiledLUppConfig is ignored.
  • No internal_rhs / internal_piv / internal_matrix booleans: without unrolling, the internal residency mode degenerates into "external with stride 1", so every array is plain pointer + stride. The predicated register gathers/swaps of the static TiledLUpp solver become direct indexed accesses (same values, simpler code).
  • substitute_inplace dispatches at runtime (warp-uniform: n is the same for every lane): a 64-bit visited bitmask up to n = 64, a cycle-leader scan beyond: zero extra storage and no ceiling on n.

For equal shapes (same n, tile_size, schedule, TiledLUppConfig thresholds), results are bitwise identical to the compile-time solver: the arithmetic sequence is the same, only addressing and loop mechanics differ.

The compile-time solver is the performance path; this variant is the flexibility path (dimensions unknown at compile time, fast builds).

The matrix layout follows Config.layout, exactly as in the compile-time solver: row-major by default, the flat index remapped for column-major storage, resolved at compile time.

Preconditions: n >= 1. tile_size may exceed n (the grid is then a single partial tile). Offsets are computed in 32-bit arithmetic: the flat element index (for the matrix, n*n) must stay below 2^31 and the largest element offset of every array (for the matrix, (n*n-1)*A_stride) below 2^32.

Macro Definition Documentation

◆ TDLS_LUPP_DYN_A

#define TDLS_LUPP_DYN_A ( r,
c )
Value:
A[TDLS_LAYOUT_INDEX(r, c, n) * unsigned(A_stride)]
#define TDLS_LAYOUT_INDEX(r, c, dim)
Flat index of matrix element (r, c) under the configured layout: r * dim + c row-major,...
Definition options.hpp:62

Strided element (r, c) of the factor matrix, flat index remapped by Config.layout.

◆ TDLS_LUPP_DYN_B

#define TDLS_LUPP_DYN_B ( i)
Value:
b[unsigned(i) * unsigned(rhs_stride)]

Strided entry i of the right-hand side.

◆ TDLS_LUPP_DYN_BW

#define TDLS_LUPP_DYN_BW ( w,
i )
Value:
b[unsigned(i) * unsigned(rhs_stride) + unsigned(w) * unsigned(xcol_stride)]

Strided entry i of column w of a multi right-hand-side block of b, addressed exactly as TDLS_LUPP_DYN_XW (b and x share both strides).

◆ TDLS_LUPP_DYN_PIV

#define TDLS_LUPP_DYN_PIV ( i)
Value:
piv[unsigned(i) * unsigned(piv_stride)]

Strided pivot entry i.

◆ TDLS_LUPP_DYN_X

#define TDLS_LUPP_DYN_X ( i)
Value:
x[unsigned(i) * unsigned(rhs_stride)]

Strided entry i of the solution vector.

◆ TDLS_LUPP_DYN_XW

#define TDLS_LUPP_DYN_XW ( w,
i )
Value:
x[unsigned(i) * unsigned(rhs_stride) + unsigned(w) * unsigned(xcol_stride)]

Strided entry i of column w of a multi right-hand-side block.

◆ TDLS_LUPP_DYN_Y

#define TDLS_LUPP_DYN_Y ( i)
Value:
y[unsigned(i) * unsigned(rhs_stride)]

Strided entry i of the fused right-hand side of solve_inplace.