-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] make host buffer state internally ref counted. #48303
Conversation
bdero
left a comment
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
| //---------------------------------------------------------------------------- | ||
| /// @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 [email protected] Roll Skia from cebd44423589 to 143b6b5b91a5 (1 revision) (flutter/engine#48305) 2023-11-22 [email protected] Roll Skia from 23b9316efd20 to cebd44423589 (1 revision) (flutter/engine#48304) 2023-11-22 [email protected] [Impeller] make host buffer state internally ref counted. (flutter/engine#48303) 2023-11-22 [email protected] 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 [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
…lutter#138872) flutter/engine@1ae1d53...dda2499 2023-11-22 [email protected] Roll Skia from cebd44423589 to 143b6b5b91a5 (1 revision) (flutter/engine#48305) 2023-11-22 [email protected] Roll Skia from 23b9316efd20 to cebd44423589 (1 revision) (flutter/engine#48304) 2023-11-22 [email protected] [Impeller] make host buffer state internally ref counted. (flutter/engine#48303) 2023-11-22 [email protected] 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 [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

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%