Repository navigation
fix(rocalution): fall back to host when rocBLAS/rocSPARSE handle creation fails - #13230
Merged
ntrost57 merged 2 commits intoOct 8, 2026
Merged
Conversation
…tion fails rocalution_init_hip() decided whether initialization succeeded by checking HIP_dev == -1. When the device was preset through set_device_rocalution() (as rocalution-test does), HIP_dev was already set, so a failure in rocblas_create_handle or rocsparse_create_handle went unnoticed. The backend then reported HIP as available with uninitialized handles, and info_rocalution() passed an invalid handle to rocsparse_get_version, which crashed (SEGV under ASAN). Track handle creation with a local flag instead, so a failure falls back to the host backend. Also destroy a rocBLAS handle that was created when the subsequent rocSPARSE handle creation fails, so it is not leaked. JIRA ID : ROCM-32358 Co-authored-by: Cursor <cursoragent@cursor.com>
JIRA ID : ROCM-32358 Co-authored-by: Cursor <cursoragent@cursor.com>
✅ All Checks Passed — Ready for Review
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🎉 All checks passed! This PR is ready for review. |
kliegeois
approved these changes
Oct 7, 2026
ntrost57
deleted the
users/ntrost/rocalution/fix/hip-init-handle-failure
branch
October 8, 2026 06:46
Contributor
TheRock Submodule Bump ActivityNewest first
|
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.
Motivation
Under ASAN,
rocalution-testcrashes at startup on gfx950 before any testruns. HIP reports that device 0 cannot create the rocBLAS/rocSPARSE context,
yet rocALUTION still reports the HIP backend as available, and
info_rocalution()then crashes insiderocsparse_get_versionwith aninvalid handle (
0xbebebebe..., ASAN's fill pattern for uninitialized heapmemory).
Technical Details
rocalution_init_hip()decided whether initialization succeeded by checkingHIP_dev == -1after the device loop. If the device was preset throughset_device_rocalution(), asrocalution-testdoes,HIP_devis already setbefore init. A failure in
rocblas_create_handleorrocsparse_create_handlethen went unnoticed: init returned
true, and the backend kept theuninitialized handles.
info_rocalution()passed the rocSPARSE handle torocsparse_get_version, which crashed, andstop_rocalution()would alsohave tried to destroy both handles.
Initialization now records whether the handles were created in a local flag,
so a failure falls back to the host backend as intended. In addition, if
rocBLAS handle creation succeeds but rocSPARSE handle creation fails, the
rocBLAS handle is destroyed instead of leaked.
This PR does not address why handle creation fails in the ASAN
configuration in the first place; it only makes rocALUTION handle that
failure correctly.
JIRA ID : ROCM-32358