Add multi-threading support for LLVM profile merging#1394
Open
asthetik wants to merge 2 commits intomozilla:masterfrom
Open
Add multi-threading support for LLVM profile merging#1394asthetik wants to merge 2 commits intomozilla:masterfrom
asthetik wants to merge 2 commits intomozilla:masterfrom
Conversation
Collaborator
|
A couple of things:
|
When user doesn't pass --threads flag, avoid forcing --num-threads on llvm-profdata and llvm-cov to allow them to auto-detect optimal thread count. Only pass --num-threads when user explicitly sets a value.
Author
|
Hi @marco-c , I have updated the changes you mentioned, thanks. |
marco-c
reviewed
Feb 27, 2026
| guess_directory: bool, | ||
| binary_path: Option<&Path>, | ||
| ignore_parsing_error: bool, | ||
| llvm_threads: Option<usize>, |
Collaborator
There was a problem hiding this comment.
I'd call this num_threads
marco-c
reviewed
Feb 27, 2026
Comment on lines
+96
to
+102
| let num_threads_str: String; | ||
| // Only pass --num-threads if explicitly specified by the user | ||
| if let Some(num) = num_threads { | ||
| num_threads_str = num.to_string(); | ||
| args.push("--num-threads".as_ref()); | ||
| args.push(num_threads_str.as_ref()); | ||
| } |
Collaborator
There was a problem hiding this comment.
Can you refactor this to be nicer?
Something like the following might work:
if let Some(num) = num_threads {
args.push("--num-threads".to_string());
args.push(num.to_string());
}
marco-c
reviewed
Feb 27, 2026
| guess_directory, | ||
| binary_path.as_deref(), | ||
| ignore_parsing_error, | ||
| llvm_threads, |
Collaborator
There was a problem hiding this comment.
Just pass opt.threads and avoid defining an intermediate variable
Collaborator
|
Could you also add a test for this? |
Author
yes, I will add a new test |
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.
This PR fixes issue #1116 by passing the
--threadsparameter from grcov to the underlyingllvm-profdata mergecommand