Single-pass LSMR iterations and sorted observation layout - #86
Merged
Conversation
- Keep the Golub-Kahan u unnormalized, folding 1/beta into the scalar recurrences, so the gather A'u can be accumulated in the same loop that builds u (linearity: A'(u/beta) = (A'u)/beta) - bidiag_forward!: scatter of every block, the norm, and (when all blocks have per-thread buffers) the gathers in one pass over u; generic mul!-based fallback keeps the GPU extensions working - lsmr! now requires x = 0 on entry (both solvers already pass it)
- Sort observations by the block with the largest coefficient tile when it outgrows the cache: its coefficient accesses stream instead of scatter, and its gather runs race-free without per-thread buffers at any cardinality (SortedGather), inside the fused single-pass iteration - Metal: launch kernels asynchronously with one host wait per LSMR iteration, and pick threadgroup widths from each compiled pipeline - CUDA/Metal: fused bidiagonalization kernel (all scatters plus the norm in one launch), with the cross-block norm reduced without Float32 drift - Store the A'u workspace on the solvers instead of allocating per solve
benchmark.jl defines each problem once (simple, hard worker-firm, interacted, three-way, large-cardinality sorted) and runs 6 columns through one solver on cpu, Metal, and CUDA, with measured timings as comments; replaces the previous per-topic benchmark scripts.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #86 +/- ##
=======================================
Coverage ? 59.62%
=======================================
Files ? 12
Lines ? 1241
Branches ? 0
=======================================
Hits ? 740
Misses ? 501
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
lsmr!so each iteration runs one fused pass over the observations (bidiag_forward!).