-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Impeller] use fewer threads for shader bootstrap workers on low core machines. #50726
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, we really should have a clamp somewheres
size_t ChooseThreadCountForWorkers(size_t hardware_concurrency) { | ||
// Never create more than 4 worker threads. Attempt to use up to | ||
// half of the available concurrency. | ||
return std::min(4ull, std::max(hardware_concurrency / 2ull, 1ull)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This would be much easier to parse with a clamp
function
return clamp(hardware_concurrency / 2ull, /*min=*/1ull, /*max=*/4ull);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh cool, I didn't know they have one in std
. I think the linter is going to complain that the arg names should be lo
and hi
... yea, lo
and hi
🙄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they charge per letter
/// Choose the number of worker threads the context_vk will create. | ||
/// | ||
/// Visible for testing. | ||
size_t ChooseThreadCountForWorkers(size_t hardware_concurrency); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, this should be static too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
…n low core machines. (flutter/engine#50726)
…143607) flutter/engine@5fd5ccf...13dc857 2024-02-16 jonahwilliams@google.com [Impeller] use fewer threads for shader bootstrap workers on low core machines. (flutter/engine#50726) 2024-02-16 goderbauer@google.com Fix implementation imports outside of lib (flutter/engine#50727) 2024-02-16 skia-flutter-autoroll@skia.org Roll Skia from 87e8e9c8f42b to 2919d86cad12 (8 revisions) (flutter/engine#50723) 2024-02-16 skia-flutter-autoroll@skia.org Roll Dart SDK from 947c8c487e28 to 21b9ee6f0a52 (2 revisions) (flutter/engine#50717) 2024-02-16 skia-flutter-autoroll@skia.org Roll Skia from c89a4cd72308 to 87e8e9c8f42b (3 revisions) (flutter/engine#50716) 2024-02-16 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from fXqP_YC4zTp9G2hA5... to YN5KCfom7Ax0Z69s_... (flutter/engine#50719) Also rolling transitive DEPS: fuchsia/sdk/core/linux-amd64 from fXqP_YC4zTp9 to YN5KCfom7Ax0 If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC jsimmons@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Part of flutter/flutter#143540
We were using 4 threads for shader bootstrap on a device with only 4 cores. Using fewer threads seems to improve performance on fewer core machines.