Repository navigation
Use R-only QR for larger static backward messages - #201
Merged
Merged
Conversation
Square-root backward messages only need the triangular factor. For static Float32/Float64 matrices beyond the unrolled size, run Julia's generic in-place Householder QR on MMatrix storage instead of qr(A), which falls back to LAPACK, materialises Q and contends for BLAS workspace under threaded ancestor scoring. Tiny static matrices keep the unrolled QR; other array and scalar types keep qr's own dispatch, including AD numbers.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #201 +/- ##
==========================================
+ Coverage 71.89% 71.92% +0.03%
==========================================
Files 104 104
Lines 4127 4136 +9
==========================================
+ Hits 2967 2975 +8
- Misses 1160 1161 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ 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.
Square-root backward messages (
SqrtBackwardInformationPredictor, used by default for CSMC ancestor sampling and backward simulation) only need the triangular factor of each QR. For static Float32/Float64 matrices beyond the unrolled-QR size,qr(A)falls back to LAPACK, materialises Q, and contends for BLAS workspace when ancestor scoring runs underThreadedExecution.This adds
_backward_qr_upper, which runs Julia's generic in-place Householder QR onMMatrixstorage for those matrices and returns only R. Tiny static matrices keep the unrolled static QR; dense arrays and non-BLAS scalar types (including AD numbers) keepqr's own dispatch. Both residual compression and the identity-plus-root factor use the helper. No Gram matrix is formed and no covariance repair is added.Measured on a complete CSMC-AS sweep (N=1024, T=20, Float32, state dimension 16, 4 observations):
Dimension-2 serial timing is unchanged (it keeps the same kernel).
The new test covers Float32/Float64; tall, square and wide static matrices; rank-deficient and badly scaled columns; static result types; dimension-16 normalised suffix likelihoods against a forward Kalman filter; and the ForwardDiff fallback.