Skip to content

Add Schur completment and its mat-free mode - #35

Merged
zitongzhan merged 56 commits into
releasefrom
memory-issue-swp
Jun 2, 2026
Merged

Add Schur completment and its mat-free mode#35
zitongzhan merged 56 commits into
releasefrom
memory-issue-swp

Conversation

@zitongzhan

Copy link
Copy Markdown
Collaborator

This pull request introduces significant improvements to the optimizer infrastructure, focusing on enhanced memory profiling, a new Schur complement optimizer, and better support for matrix-free operations.

Optimizer Enhancements

  • Added a new Schur optimizer class in bae.optim.optimizer, implementing the Schur complement method with support for both standard and matrix-free normal equations, block Jacobi preconditioning, and efficient memory usage.

  • Updated the LM optimizer to support a matrix_free_normal mode, allowing for more efficient computation and memory usage in large-scale problems.

  • Add a custom TrustRegion class that supports Warp, especially for use with the Schur optimizer.

Sparse Matrix and PyOps Improvements

  • Improved sparse matrix operations, including fixes to inv_op for correct tensor creation and a new test block in py_ops.py for diagonal operations on CUDA.

Comment threadbae/sparse/warp_wrappers.py Fixed
Comment threadbae/optim/optimizer.py Fixed
Comment threadbae/sparse/py_ops.py Fixed

@gemini-code-assistgemini-code-assistBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces high-performance Triton kernels for sparse BSR operations, including matrix-vector multiplication, matrix-matrix multiplication, and transposition. It also implements a matrix-free NormalMatVec operator and a new Schur complement-based optimizer to improve the efficiency of bundle adjustment tasks. The bundle adjustment example was updated with CUDA memory snapshotting and Warp mempool reporting. Review feedback highlights a critical issue where in-place diagonal modifications in the LM and Schur optimizers cause damping factors to accumulate incorrectly during step rejections. Additionally, the reviewer recommends removing performance-hindering torch.cuda.empty_cache() calls, addressing potential divisions by zero in the Conjugate Gradient solver, and cleaning up redundant or commented-out code.

Comment threadbae/optim/optimizer.py
Comment threadbae/optim/optimizer.py Outdated
Comment threadbae/optim/optimizer.py Outdated
Comment threadbae/optim/triton_kernel.py Outdated
Comment threadbae/optim/triton_kernel.py Outdated
Comment threadbae/sparse/warp_wrappers.py Outdated
Comment threadbae/utils/pysolvers.py Outdated
zitongzhanand others added 3 commits May 23, 2026 20:35
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Comment threadba_example.py Fixed
Comment threadba_example.py Fixed
Comment threadba_example.py Fixed
Comment threadba_example.py Fixed
SEOKWOOPARKand others added 2 commits May 31, 2026 22:04
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Comment threadexamples/schur.py Dismissed
@SEOKWOOPARK
SEOKWOOPARK self-requested a review June 1, 2026 21:44
@zitongzhan
zitongzhan requested review from SEOKWOOPARK and removed request for SEOKWOOPARKJune 1, 2026 23:41
@zitongzhan
zitongzhan merged commit 9f28349 into releaseJun 2, 2026
3 checks passed
@zitongzhan
zitongzhan deleted the memory-issue-swp branch July 19, 2026 08:06
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@zitongzhan@SEOKWOOPARK