-
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] make host buffer state internally ref counted. #48303
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 modulo missing symbol
impeller/core/host_buffer.h
Outdated
size_t generation_ = 1u; | ||
std::string label_; | ||
class HostBufferState : public Buffer, public Allocation { | ||
public: |
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: mark as struct and remove access modifier?
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
impeller/core/host_buffer.h
Outdated
|
||
void Reset(); | ||
|
||
size_t GetSize() const; |
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.
I think the definition is missing for this symbol and it's not being used by anything.
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
@@ -116,14 +114,42 @@ class HostBuffer final : public std::enable_shared_from_this<HostBuffer>, | |||
void Reset(); | |||
|
|||
//---------------------------------------------------------------------------- | |||
/// @brief Returns the size of the HostBuffer in memory in bytes. | |||
/// @brief Returns the capacity of the HostBuffer in memory in bytes. | |||
size_t GetSize() const; |
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.
(Just a drive-by comment, but this name is weird for what it is. It looks like the functionality is the same as it was before, though.)
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.
Yeah, should be called capacity. I changed the doc comment so it was approximately accurate...
…138872) flutter/engine@1ae1d53...dda2499 2023-11-22 skia-flutter-autoroll@skia.org Roll Skia from cebd44423589 to 143b6b5b91a5 (1 revision) (flutter/engine#48305) 2023-11-22 skia-flutter-autoroll@skia.org Roll Skia from 23b9316efd20 to cebd44423589 (1 revision) (flutter/engine#48304) 2023-11-22 jonahwilliams@google.com [Impeller] make host buffer state internally ref counted. (flutter/engine#48303) 2023-11-22 skia-flutter-autoroll@skia.org Roll Skia from b6f33389cefa to 23b9316efd20 (2 revisions) (flutter/engine#48302) 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 jacksongardner@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
…lutter#138872) flutter/engine@1ae1d53...dda2499 2023-11-22 skia-flutter-autoroll@skia.org Roll Skia from cebd44423589 to 143b6b5b91a5 (1 revision) (flutter/engine#48305) 2023-11-22 skia-flutter-autoroll@skia.org Roll Skia from 23b9316efd20 to cebd44423589 (1 revision) (flutter/engine#48304) 2023-11-22 jonahwilliams@google.com [Impeller] make host buffer state internally ref counted. (flutter/engine#48303) 2023-11-22 skia-flutter-autoroll@skia.org Roll Skia from b6f33389cefa to 23b9316efd20 (2 revisions) (flutter/engine#48302) 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 jacksongardner@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
std::shared_from_this is actually incredibly slow, and dominates the cost of host buffer allocation at 20x more expensive than the memcpy. We can remove the usage of shared_from_this by making an internal class hold the actual allocation/buffer state instead.
Before
146 ms / 647ms = ~20%
After
33 ms / 540 ms = ~6%