Repository navigation
Description
Found while working on: no task; follow-up of #193 (the wiring half lands in PR #192: KKTSolver gets matching and a deferred analysis, and chooses the stock pipeline when matching or pivot replacement is asked for).
What: With #193 resolved through the stock pipeline, an interior-point KKT system that needs matching (MadNLP's ShiftedPreset, as its cuDSS preset asks for) no longer runs on the fused pipeline. STATE.md §2 (cuDSS 1.0 comparison, PR #190) puts the stock LDLᵀ with algo5 matching on the K2 dumps at 3.57× cuDSS's factorization time and 4.21× its solve time, so SDSSolver gets cuDSS's iteration count at several times its cost per iteration. The fused LDLᵀ (src/fused.jl) cannot take over because it has none of the three ingredients:
- no pivot replacement: a zero or non-finite pivot fails the front (
isfinite(dk) && !iszero(dk)in the"S"paths of the fused factorization kernel);pivot_epsilonandpivot_signare not read; - no scaling:
_check_fused_optionsrejectsmatching_alg ≠ "none"; - no ordering from the matching: the 2×2 pairs of the matching cycles (
matching_pairs, 2×2 pivot pairs: fixed candidate tolerance τ = 1e-6 and greedy matching; matching-based pairs (T21) #67) never reach its analysis.
The measurements of #193 suggest these three are enough for the inertia: the row "SDS DirectSolver, static, matching_alg = "algo5", pivot_epsilon = 1e-10" factors with pivot_type = 'N', so every pivot is 1×1 (the reference returns (k, 0) for PIVOT_NONE); what it has over the failing rows is the symmetric scaling D A D, the ordering compressed by the matching pairs, and the ±ε replacement with pivot_sign. It gets 0 wrong inertias of 60 and no failure (median residual 1.1e-06, max 1.0e-05; cuDSS with matching: 6.8e-09 and 4.2e-06). None of the three needs pivoting inside the kernel:
- scaling: the values enter as
dᵢ aᵢⱼ dⱼ(one extra multiply where the fused assembly scattersnzval, or a scaled copy as the stock_numeric_valuesmakes), and the solve scales the right-hand side and the solution asSolveScalingdoes; - ordering: the fused plans are built from the inner
DirectSolver's host analysis, which already computes the matching and the pairs; - replacement: at the two pivot sites,
|d| < εbecomespivot_sign · εinstead of a failure, counted for"npivots".
Not known: whether a residual near 1e-6 without Bunch–Kaufman is good enough for MadNLP's iteration count on the flowsheet of #193 (the stock Bunch–Kaufman + matching row is at 8.1e-08), and what the replacement costs in the fused kernel.
Why it is out of scope: none in TASKS.md. It does not block a task; it decides whether SDSSolver under MadNLP's ShiftedPreset is competitive with cuDSS in time, not only in iterations.
Suggested fix or plan change: a task "fused LDLᵀ for interior-point KKT systems: symmetric scaling, matching-pair ordering, static pivot replacement", gated on the 60-matrix table of #193 (0 wrong inertias, no failure) and on the fused factor/solve times staying near today's; KKTSolver then selects the fused pipeline for matching ≠ "none" with pivoting = :none. First step before any kernel work: run MadNLP on the flowsheet with the stock static + matching configuration to see whether its residuals give cuDSS's iteration count.
Activity
michel2323 commentedon Nov 10, 2026
Measurement that changes the first step proposed above. Same 60 KKT matrices as the table of #193 (design solve of the CO2 capture flowsheet driven by cuDSS, n = 2657),
pivot_epsilon = 1e-10, analysis on the first matrix, then refactorization; residual‖Ax − b‖∞ / ‖b‖∞of the 31 factorizations followed by a solve (H200, CUDSS 1.0.0, SDSmaint/kkt-solver-0.4.0at dc6989b, stockDirectSolverwithreordering_alg = "algo4"andpivot_sign):ir_n_stepsalgo6(default)'A'(default)algo6'B'algo6'N'algo5'A'algo5'N''A''N'algo6'N'algo6'N'algo5'N'(static)algo5'N'(static)algo5'N'(static)algo5No factorization failed in any row.
What it says for this issue:
pivot_type = 'N'its median goes from 6e-09 to 9.4e-05.algo5andalgo6give the same residuals and the same replaced-pivot counts on these matrices, so building the fused path onalgo5loses nothing against cuDSS's default here.pivot_signare the candidates.Open:
FusedSolverrejectsir_n_steps > 0, so the refinement step is either new there or left to MadNLP's own refinement; the rows above ran on the stock pipeline. With Bunch–Kaufman, SDS is about 10 times behind cuDSS in the median (6.1e-08 against 5.6e-09) at the same replaced-pivot counts; not investigated (pivot_threshold, 0.01 here, is one difference).Fused LDLᵀ: static pivot replacement at the three pivot sites (refs #194
Fused LDLᵀ: matching (scaling, pivot pairs, solve) on structure "S" (…
Fused LDLᵀ: KKTSolver keeps the fused pipeline with matching and pivo…
Fused LDLᵀ: iterative refinement on the fused solve (ir_n_steps), KKT…
Fused LDLᵀ: refinement advice from the live solves (two steps), pivot…
Fused LDLᵀ: pivot pairs only with a job-5 matching, as on the stock p…
Fused LDLᵀ: graph-replay refinement test compares the same solver (refs
Fused LDLᵀ: static pivot replacement at the three pivot sites (refs #194
Fused LDLᵀ: matching (scaling, pivot pairs, solve) on structure "S" (…
Fused LDLᵀ: KKTSolver keeps the fused pipeline with matching and pivo…
Fused LDLᵀ: iterative refinement on the fused solve (ir_n_steps), KKT…
Fused LDLᵀ: refinement advice from the live solves (two steps), pivot…
Fused LDLᵀ: pivot pairs only with a job-5 matching, as on the stock p…
Fused LDLᵀ: graph-replay refinement test compares the same solver (refs
0.4.0: README and docs after the 0.3.0 registration, STATE, MadNLP pa…
michel2323 commentedon Nov 15, 2026
Resolved in 0.4.0: the fused LDLᵀ has static pivot replacement (381572e), matching with scaling and pivot pairs (2c5e879), and iterative refinement (f219ebf);
KKTSolverkeeps the fused pipeline with matching and pivot replacement (5d38cfa). Instances that still need pivoting inside the fronts are tracked in #167.