Skip to content

fix(rocsparse): Remove use of mat->analysed in SpSV#9295

Open
jsandham wants to merge 1 commit into
ROCm:developfrom
jsandham:spsv_fix
Open

fix(rocsparse): Remove use of mat->analysed in SpSV#9295
jsandham wants to merge 1 commit into
ROCm:developfrom
jsandham:spsv_fix

Conversation

@jsandham

@jsandham jsandham commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Motivation

Why this is needed: hipsparse PR #8565 expands SpSV regression testing (testing_spsv_csr_reuse_descr) to exercise the descriptor-reuse paths — sweeping over multiple operations (NON_TRANSPOSE/TRANSPOSE), fill modes (LOWER/UPPER), and diag types while reusing a single sparse-matrix descriptor. Those new tests exposed a correctness bug in rocsparse's SpSV preprocess path, which these changes fix.

What changed:

  • rocsparse_spsv.cpp (CSR and COO preprocess stages): Previously, analysis was gated by a single boolean mat->analysed flag. Once the matrix was analyzed for one configuration, the flag was set to true and subsequent preprocess calls were skipped entirely. When the same descriptor was reused with a different (trans, fill_mode), the required analysis never ran, producing incorrect results. The check is now per-configuration — csrsv_info->get(trans, fill_mode) == nullptr — so analysis runs for each unique (operation, fill_mode) combination, and the stale mat->analysed flag is no longer set.

  • rocsparse_csrsv_analysis.cpp: Simplified the reuse-policy lookup of the trm_info_t pointer to directly fetch the per-(trans, fill_mode) info (removing the redundant nullptr-initialize-then-conditionally-assign dance).

Net effect: SpSV now computes correct results across all (op, fill_mode, diag_type) combinations when reusing a sparse-matrix descriptor, which is exactly what the new hipsparse regression tests validate.

JIRA ID: AISPARSE-572

@therock-pr-bot

therock-pr-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

❌ PR Check — Action Required

Check Status Details
🌿 Branch Name ✅ Pass
📝 PR Title/Description ✅ Pass
Forbidden Files ✅ Pass
🧪 Unit Test ❌ Fail Error: Source/code files changed without an accompanying unit test.
Expected: add at least one test file named like test_<name>.py / test_<name>.cpp (or <name>_test.*).
Current: code file(s) changed: projects/rocsparse/library/src/level2/rocsparse_csrsv_analysis.cpp, projects/rocsparse/library/src/level2/rocsparse_spsv.cpp; no test file found
🔎 pre-commit ✅ Pass
🚫 Draft PR 🔜 To Be Enabled
🚩 Feature Flag 🔜 To Be Enabled
📊 Code Coverage 🔜 To Be Enabled

⚠️ 1 policy check(s) failed. Please address the issues above before this PR can be Reviewed.

🚫 Please fix the failed policies

  • ❌ Unit Test

The Not ready to Review label was added to this PR. Once all policies pass, the label is removed automatically.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

@therock-pr-bot

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ Unit Test

The Not ready to Review label has been added to this PR.
Once all policies pass, the label will be removed automatically.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

❌ Your project status has failed because the head coverage (76.84%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9295      +/-   ##
===========================================
- Coverage    65.07%   65.07%   -0.00%     
===========================================
  Files         2685     2685              
  Lines       422269   422266       -3     
  Branches     62742    62741       -1     
===========================================
- Hits        274763   274761       -2     
  Misses      126785   126785              
+ Partials     20721    20720       -1     
Flag Coverage Δ *Carryforward flag
TensileLite 35.07% <ø> (ø) Carriedforward from 17fba97
hipBLAS 90.81% <ø> (ø) Carriedforward from 17fba97
hipBLASLt 34.69% <ø> (ø) Carriedforward from 17fba97
hipCUB 82.68% <ø> (ø) Carriedforward from 17fba97
hipDNN 86.12% <ø> (ø) Carriedforward from 17fba97
hipFFT 50.88% <ø> (ø) Carriedforward from 17fba97
hipRAND 76.12% <ø> (ø) Carriedforward from 17fba97
hipSOLVER 69.18% <ø> (ø) Carriedforward from 17fba97
hipSPARSE 86.10% <ø> (ø) Carriedforward from 17fba97
rocBLAS 47.91% <ø> (ø) Carriedforward from 17fba97
rocFFT 51.65% <ø> (ø) Carriedforward from 17fba97
rocRAND 57.02% <ø> (ø) Carriedforward from 17fba97
rocSOLVER 76.84% <ø> (ø) Carriedforward from 17fba97
rocSPARSE 72.37% <100.00%> (+<0.01%) ⬆️
rocThrust 91.36% <ø> (ø) Carriedforward from 17fba97

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
...se/library/src/level2/rocsparse_csrsv_analysis.cpp 82.90% <100.00%> (+0.27%) ⬆️
...ts/rocsparse/library/src/level2/rocsparse_spsv.cpp 79.88% <100.00%> (-0.24%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants