Move aMessage instead of copying it in LlamaGenerateTask::MaybePushMessageLocked
Categories
(Core :: Machine Learning: On Device, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr153 | --- | wontfix |
| firefox160 | --- | wontfix |
| firefox161 | --- | wontfix |
| firefox162 | --- | wontfix |
| firefox163 | --- | fix-optional |
People
(Reporter: Sylvestre, Unassigned, Mentored)
References
(Blocks 1 open bug, Regression)
Details
(Keywords: good-first-bug, regression, Whiteboard: [lang=c++])
Filing as a good first bug to learn workflows.
Coverity (CID 1700948, COPY_INSTEAD_OF_MOVE) flags LlamaGenerateTask::MaybePushMessageLocked in toolkit/components/ml/backends/llama/LlamaRunner.cpp. The function takes mozilla::Maybe<LlamaChatResponse> aMessage by value, and when the queue is empty it copies it:
} else {
messageToResolve = aMessage;
}
aMessage is not used again after this branch, so it should be moved:
} else {
messageToResolve = std::move(aMessage);
}
Only change this else branch: in the other branch aMessage is passed to mMessagesQueue.Enqueue() and must stay as it is.
Link to the code:
https://searchfox.org/firefox-main/source/toolkit/components/ml/backends/llama/LlamaRunner.cpp
To verify the fix:
./mach build
./mach format toolkit/components/ml/backends/llama/LlamaRunner.cpp
Tutorial to contribute:
https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
https://firefox-source-docs.mozilla.org/contributing/stack_quickref.html
Please don't ask for the bug to be assigned. It will be automatically assigned to the first patch.
Comment 1•8 days ago
|
||
Set release status flags based on info from the regressing bug 1973711
| Reporter | ||
Updated•8 days ago
|
Updated•4 days ago
|
Comment 2•1 day ago
|
||
Set release status flags based on info from the regressing bug 1973711
Updated•1 day ago
|
Description
•