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 Dec 12, 2023

The hash function we use for pipeline hashncash is actually pretty slow. Since all of the properties we hash on fit in 64 bits, we can compute a hash value directly. From local benchmarking this is about twice as fast, which still leaves quite a bit of room for future improvement (faster hashmap? not using a hashmap at all?)

@jonahwilliams jonahwilliams marked this pull request as ready for review December 12, 2023 16:18
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.

Nice find. We should change the bool conversions and add static_asserts to be safe.

static_cast<uint64_t>(o.primitive_type) << 24 | //
static_cast<uint64_t>(o.color_attachment_pixel_format) << 16 | //
// bools
static_cast<uint64_t>(o.has_stencil_attachment) << 2 |
Copy link
Member

Choose a reason for hiding this comment

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

This approach for the bools is correct.

Suggested change
static_cast<uint64_t>(o.has_stencil_attachment) << 2 |
(o.has_stencil_attachment ? 1 : 0) << 2

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

o.primitive_type, o.color_attachment_pixel_format,
o.has_stencil_attachment, o.wireframe, o.is_for_rrect_blur_clear);
constexpr uint64_t operator()(const ContentContextOptions& o) const {
return static_cast<uint64_t>(o.sample_count) << 56 | //
Copy link
Member

Choose a reason for hiding this comment

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

nit: I think this would be a bit easier to read if you count up instead of down.

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

o.primitive_type, o.color_attachment_pixel_format,
o.has_stencil_attachment, o.wireframe, o.is_for_rrect_blur_clear);
constexpr uint64_t operator()(const ContentContextOptions& o) const {
return static_cast<uint64_t>(o.sample_count) << 56 | //
Copy link
Member

Choose a reason for hiding this comment

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

All of this is predicated on those fields being 8bits so you should add static_asserts here.

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

@gaaclarke
Copy link
Member

Otherwise LGTM (fyi I'm OOO today so might have to approve tomorrow)

Copy link
Member

@bdero bdero left a comment

Choose a reason for hiding this comment

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

LGTM!

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!

static_assert(sizeof(o.primitive_type) == 1);
static_assert(sizeof(o.color_attachment_pixel_format) == 1);

return static_cast<uint64_t>(o.is_for_rrect_blur_clear ? 1u : 0u) << 0 |
Copy link
Member

Choose a reason for hiding this comment

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

fyi you can get rid of these static casts if you use uint64_t literals. I think its 1llu? something like that.

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 Dec 13, 2023
@auto-submit auto-submit bot merged commit d84fd91 into flutter:main Dec 13, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 13, 2023
zanderso pushed a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 13, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Dec 13, 2023
…140090)

flutter/engine@fc32677...9f7004e

2023-12-13 [email protected] [Impeller] Made the new blur work on devices without the decal address mode (flutter/engine#48899)
2023-12-13 [email protected] Allow tests to run on macOS 13 (flutter/engine#48894)
2023-12-13 [email protected] [Impeller] Compute ContextContentOptions key via bit manipulating (instead of hashing each property). (flutter/engine#48902)
2023-12-13 [email protected] Roll Skia from f3401c6186c1 to 69c02c9d56b2 (1 revision) (flutter/engine#48992)

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

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants