Skip to content

[BUGFIX] Make ContainerModel::SetSlimmableSize thread-safe#260

Merged
sdatkinson merged 4 commits intomainfrom
container-fix
Apr 28, 2026
Merged

[BUGFIX] Make ContainerModel::SetSlimmableSize thread-safe#260
sdatkinson merged 4 commits intomainfrom
container-fix

Conversation

@sdatkinson
Copy link
Copy Markdown
Owner

Bug discovered from multiple threads calling SetSlimmableSize() (UI and processor threads). Both would end up calling Reset and cause massive issues with internal state as prewarming was attempted.

Fix with a mutex to make it thread-safe.

Added calls to ResetAndPrewarm in test_container_default_is_max_size to guarantee that both predictions start from the same model state, enhancing test reliability.
Use atomic active-index loads/stores and a mutex-protected activation path so concurrent SetSlimmableSize calls cannot race with RT processing.

Made-with: Cursor
@sdatkinson sdatkinson merged commit cf78459 into main Apr 28, 2026
4 checks passed
@sdatkinson sdatkinson deleted the container-fix branch April 28, 2026 05:27
synchu pushed a commit to synchu/NeuralAmpModelerCore that referenced this pull request Apr 29, 2026
…n#260)

* [BUGFIX] Avoid prewarming container slimmable model when SetSlimmableSize doesn't change which model is active.

* [TEST] Ensure consistent model state before processing in test_container

Added calls to ResetAndPrewarm in test_container_default_is_max_size to guarantee that both predictions start from the same model state, enhancing test reliability.

* [BUGFIX] Make container model activation thread-safe.

Use atomic active-index loads/stores and a mutex-protected activation path so concurrent SetSlimmableSize calls cannot race with RT processing.

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant