Skip to content
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

Merged
merged 4 commits into from
Feb 16, 2024

Conversation

jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented Feb 16, 2024

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.

@jonahwilliams jonahwilliams changed the title [Impeller] use fewer threads for workers on low core machines. [Impeller] use fewer threads for shader bootstrap workers on low core machines. Feb 16, 2024
Copy link
Member

@gaaclarke gaaclarke left a 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));
Copy link
Member

@gaaclarke gaaclarke Feb 16, 2024

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);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Give 'em the clamps.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

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 🙄

Copy link
Member Author

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);
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 16, 2024
@auto-submit auto-submit bot merged commit 13dc857 into flutter:main Feb 16, 2024
29 checks passed
@jonahwilliams jonahwilliams deleted the threading_config branch February 16, 2024 20:41
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 16, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Feb 16, 2024
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller
Projects
None yet
2 participants