perf: move the mel buffer into the 1-item MelBatch instead of copying it - #67
Open
sylvestre wants to merge 1 commit into
Open
perf: move the mel buffer into the 1-item MelBatch instead of copying it#67sylvestre wants to merge 1 commit into
sylvestre wants to merge 1 commit into
Conversation
encode_16k and transcribe_16k_ctc_logits both assigned feats to mb1.data by copy. That branch is the long-audio path, where feats is n_mels * T floats (tens of MB for minutes of audio), so the copy doubles peak mel-buffer footprint for exactly the inputs where memory is tightest. feats is dead after the assignment on that branch: it is only read again by the encoder.forward() call in the else branch. Found by Coverity (COPY_INSTEAD_OF_MOVE) running over the copy of parakeet.cpp vendored in Firefox. Signed-off-by: Sylvestre Ledru <sylvestre@debian.org> Assisted-by: Claude:claude-opus-5 [Claude Code]
Collaborator
|
@mudler This is good to merge from source review at |
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.
encode_16k and transcribe_16k_ctc_logits both assigned feats to mb1.data by copy. That branch is the long-audio path, where feats is n_mels * T floats (tens of MB for minutes of audio), so the copy doubles peak mel-buffer footprint for exactly the inputs where memory is tightest.
feats is dead after the assignment on that branch: it is only read again by the encoder.forward() call in the else branch.
Found by Coverity (COPY_INSTEAD_OF_MOVE) running over the copy of parakeet.cpp vendored in Firefox.
https://bugzilla.mozilla.org/show_bug.cgi?id=2069578
Assisted-by: Claude:claude-opus-5 [Claude Code]