Add tri-diagonal solve support#982
Merged
cliffburdick merged 1 commit intoNVIDIA:mainfrom Jun 3, 2025
Merged
Conversation
This uses cuSPARSE's legacy API to solve a tri-diagonal matrix direct solve operation (lower diagonal, main diagonal, upper diagonal). This involves a run-time check on DIA (which is more general) to ensure only those three diagonals are used.
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds direct tri-diagonal solve support using cuSPARSE’s legacy API with runtime checks for three diagonals in DIA format and updates test and example code.
- Introduce
solve_cusparse.himplementingSolveTridiagonalSystemand hooking it intosparse_dia_solve_impl - Update
SolveOpto dispatch to the new DIA solver for I–indexed DIA tensors - Add tests (
SolveDIAI) and an example for tri-diagonal solves
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/00_sparse/Dia.cu | Renamed test fixtures and added SolveDIAI tests |
| include/matx/transforms/solve/solve_cusparse.h | New file implementing cuSPARSE-based tridiagonal solve |
| include/matx/operators/solve.h | Include solver header and dispatch solve for DIA |
| examples/sparse_tensor.cu | Example usage demonstrating direct tri-diagonal solve |
Comments suppressed due to low confidence (4)
test/00_sparse/Dia.cu:118
- [nitpick] The test suite registration uses
MatXFloatNonHalfTypesCUDAExec, which doesn’t match the suite used elsewhere. Ensure this type list is correct or replace it withMatXFloatNonComplexHalfTypesCUDAExecfor consistency.
TYPED_TEST_SUITE(DiaSolveSparseTestsAll, MatXFloatNonHalfTypesCUDAExec);
include/matx/operators/solve.h:95
- The dispatch allows both
DIAIandDIAJbut the implementation only supports I-index DIA. Restrict this toisDIAI()to prevent runtime errors when usingDIAJ.
if constexpr (OpA::Format::isDIAI() || OpA::Format::isDIAJ()) {
include/matx/transforms/solve/solve_cusparse.h:159
- [nitpick] The message 'Tridiagonal solve overwrites rhs' is ambiguous. Consider clarifying it to 'In-place RHS required for tridiagonal solve' to better convey the constraint.
MATX_THROW(matxNotSupported, "Tridiagonal solve overwrites rhs");
test/00_sparse/Dia.cu:184
- The new
SolveDIAItest covers real types but omits complex specializations. Add tests for complex value types to ensure full coverage of supported data types.
TYPED_TEST(DiaSolveSparseTestsAll, SolveDIAI) {
Collaborator
|
/build |
cliffburdick
reviewed
Jun 3, 2025
cliffburdick
approved these changes
Jun 3, 2025
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.
This uses cuSPARSE's legacy API to solve a tri-diagonal matrix direct solve operation (lower diagonal, main diagonal, upper diagonal). This involves a run-time check on DIA (which is more general) to ensure only those three diagonals are used.