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

Conversation

@jonahwilliams
Copy link
Contributor

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

image

146 ms / 647ms = ~20%

After

33 ms / 540 ms = ~6%

image

@jonahwilliams
Copy link
Contributor Author

Fun before times:

image

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 modulo missing symbol

size_t generation_ = 1u;
std::string label_;
class HostBufferState : public Buffer, public Allocation {
public:
Copy link
Member

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?

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


void Reset();

size_t GetSize() const;
Copy link
Member

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.

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

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

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

Copy link
Contributor Author

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...

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 22, 2023
@auto-submit auto-submit bot merged commit 1a16fcd into flutter:main Nov 22, 2023
fluttermirroringbot pushed a commit to flutter/flutter that referenced this pull request Nov 22, 2023
…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
caseycrogers pushed a commit to caseycrogers/flutter that referenced this pull request Dec 29, 2023
…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
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