Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@jonahwilliams
Copy link
Contributor

@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
Contributor 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
Contributor 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
Contributor 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
Contributor 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
@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 [email protected] [Impeller] use fewer threads for shader bootstrap workers on low core machines. (flutter/engine#50726)
2024-02-16 [email protected] Fix implementation imports outside of lib (flutter/engine#50727)
2024-02-16 [email protected] Roll Skia from 87e8e9c8f42b to 2919d86cad12 (8 revisions) (flutter/engine#50723)
2024-02-16 [email protected] Roll Dart SDK from 947c8c487e28 to 21b9ee6f0a52 (2 revisions) (flutter/engine#50717)
2024-02-16 [email protected] Roll Skia from c89a4cd72308 to 87e8e9c8f42b (3 revisions) (flutter/engine#50716)
2024-02-16 [email protected] 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 [email protected],[email protected],[email protected] 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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App e: impeller

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants