perf(pdlp): widen small-problem termination-check stride (10 → 25) - #1626
Draft
maxwbuckley wants to merge 1 commit into
Draft
perf(pdlp): widen small-problem termination-check stride (10 → 25)#1626maxwbuckley wants to merge 1 commit into
maxwbuckley wants to merge 1 commit into
Conversation
conditional_major() controls how often PDLP runs a full termination/convergence evaluation in the sub-1000-iteration regime. That evaluation is an un-graphed ~12-15 kernel eager launch chain plus a blocking cudaStreamSynchronize, which is disproportionately expensive next to a single graphed PDHG step on small edge/MPC-sized LPs. At the default stride of 10, a controller-sized LP that converges in a few hundred iterations pays 20-40 of these evaluations. Widen the small-problem stride to 25, trading a few extra cheap graphed PDHG steps of convergence-detection latency for roughly 2.5x fewer expensive evaluations. Larger regimes keep the x10 scaling. Not bit-identical: convergence is detected up to stride-1 iterations later, so a few extra PDHG steps may run; the reported optimum and termination status are unchanged. The constant should be re-tuned against measured net solve time on the mpc_H*/assign_* suite (bench_lp_robotics). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Max Buckley <maxwbuckley@gmail.com>
Contributor
|
Hi @maxwbuckley thank you for this contribution. We don't have a lot of those problems were: 1. only need a few amount of iterations (few hundreds) 2. the matrix is small 3. we can't batch (A matrix is the same across many similar LPs). I have a few questions:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
In
conditional_major()(cpp/src/pdlp/utils.cuh), widen the base termination/convergence-check stride for the sub-1000-iteration regime from 10 → 25. Larger regimes keep the existing ×10 scaling.Why
The termination evaluation is an un-graphed chain of ~12–15 eager kernel launches plus a blocking
cudaStreamSynchronize— disproportionately expensive next to a single graphed PDHG step on small edge/MPC-sized LPs. At stride 10, a controller-sized LP that converges in a few hundred iterations pays 20–40 of these evaluations. Widening the stride trades a few extra cheap graphed PDHG steps of convergence-detection latency for ~2.5× fewer expensive evaluations — a net win in the small-problem regime that dominates on-robot / edge use.Correctness
Not bit-identical: convergence is detected up to
stride−1iterations later, so a few extra PDHG steps may run; the reported optimum and termination status are unchanged. Verified — every benchmark objective matches the HiGHS reference (rel < 1e-3) across the whole suite; only the iteration count moves (usually by a handful).Benchmarks
Measured A/B on an RTX 5090 (WSL2, CUDA 13.2 conda toolkit) with a resident-solver latency harness. Interleaved base/opt invocations (order alternated each round) to avoid sequential-process cache bias; metric is the solver-internal GPU
solve_ms; n = 120 per cell (4 rounds × 30 reps). Baseline and this commit differ by exactly this one change.Median +15.1% across 8 problems (range −0.1% … +28.8%, mean +14.5%), statistically significant on 7 of 8. The mechanism is visible in the data: the optimized path runs slightly more PDHG iterations but far fewer expensive termination evaluations, netting faster with the same optimum.
Why this is a draft / open questions
mpc_H20is neutral — it runs ~700 extra PDHG iterations that exactly offset the evaluation savings. Worth understanding before finalizing.25constant is a first cut. It should be re-tuned against measured net solve time rather than fixed by intuition.Feedback on the tuning approach and on whether a size-parameterized stride (vs. a flat 25) is preferred would be welcome.
🤖 Generated with Claude Code