fix(dsp): correct dspDestoryHandle to use cluster ID (MY_RANK % dsp_count)#7357
Merged
Cstandardlib merged 1 commit intoMay 18, 2026
Merged
Conversation
…ount) dspInitHandle uses MY_RANK % dsp_count but dspDestoryHandle used raw MY_RANK, causing heap corruption when MY_RANK >= dsp_count. Fixes issue deepmodeling#7269.
There was a problem hiding this comment.
Pull request overview
This PR fixes DSP handle teardown by using the same cluster ID mapping used during DSP initialization, preventing invalid handle destruction on multi-node runs.
Changes:
- Updates DSP finalization to call
dspDestoryHandle()withGlobalV::MY_RANK % PARAM.inp.dsp_count. - Aligns DSP teardown with existing init and routing sites that already use modulo-based cluster IDs.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mohanchen
approved these changes
May 18, 2026
Collaborator
Author
|
Verified on DSP. |
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.
Summary
Closes #7269
Fix DSP segfault during memory statistics on multi-node runs (issue #7269).
Details
dspDestoryHandle(GlobalV::MY_RANK)indriver_run.cpp:153uses the raw MPI rank as the DSP cluster handle ID, butdspInitHandle()usesMY_RANK % dsp_count. WhenMY_RANK >= dsp_count, destroying an uninitialized handle corrupts the heap. This manifests as acfree()crash duringMemory::print_all()at program exit.Change
Fix dsp rank when handle destroyed:
Note
Need to verify on DSP device.