AMD SMI was initialized multiple times - #1244
Open
manoj-freyr wants to merge 2 commits into
Open
Conversation
in RVS per run (module init, systemOverview(), get_gpu_name()) but shut down once — causing heap corruption and a post-summary segfault Fix — centralized AMD SMI lifecycle. One ownership and idempotent cleanup API to work with both CLI run as well as API and ensure multi module loads are handled (ufor -r and -m cases)
jkottiku
reviewed
Jul 7, 2026
|
|
||
| /* Ensure AMD SMI and loaded modules are torn down if the client skipped | ||
| * session destroy or exited without running module::terminate via exec. */ | ||
| rvs::module::terminate(); |
Collaborator
There was a problem hiding this comment.
Is this really required here ? As it would be called in run() function anyways.
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
Fix — centralized AMD SMI lifecycle. One ownership and idempotent cleanup API to work with both CLI run as well as API and ensure multi module loads are handled (ufor -r and -m cases)
Technical Details
amdsmi_init() called more than once in a process as of now and a single shutdoqwn() call at exit of a RVS module. This resulted in corrupted heap and causes a segfault. A mutex guard for amd smi as a resource ensures single init and cleanup path . This solves cases for :
Rootcause
Typical RVS run is :
This double init and single shutdown causes Clib heap corruption error.
WIth the current PR: we use guard to init and shutdown smi. We ensure gpulist::Initialize() calls smi init and gpulist::Terminate() calls smi shutdown. gpulist::Terminate() is called from module::terminate() after unloading modules.
For API cases, we add module::terminate() in rvs_terminate() but since this is idempotent and a no-op in case SMI already shutdown.
Retaubed existing behavior in unit tests as they run as standalone binaries.
Test Plan
Run rvs with a multi module conf on latest rocm,.