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

[Impeller] track the sizes of all outstanding MTLTexture allocations and report per frame in MB, matching Vulkan implementation. #53618

Merged
merged 11 commits into from
Jul 1, 2024

Conversation

jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented Jun 27, 2024

Does what it says!

Fixes flutter/flutter#150936

@jonahwilliams
Copy link
Member Author

FYI @gaaclarke

@jonahwilliams jonahwilliams requested a review from gaaclarke June 28, 2024 16:28
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.

Overall looks good. I just have a question about accounting for the other mip levels.


~DebugAllocatorStats() {}

void Increment(size_t size);
Copy link
Member

Choose a reason for hiding this comment

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

nit: note the units of size in a docstring.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done


void Increment(size_t size);

void Decrement(size_t size);
Copy link
Member

Choose a reason for hiding this comment

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

same

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

}

void DebugAllocatorStats::Decrement(size_t size) {
size_.fetch_sub(size, std::memory_order_relaxed);
Copy link
Member

Choose a reason for hiding this comment

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

Do you think we should have an assert that size will not go below zero?

Copy link
Member Author

Choose a reason for hiding this comment

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

Well since its an unsigned type, it won't go below zero 🤓

Copy link
Member

Choose a reason for hiding this comment

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

Semantics! haha. It'll go below zero, but you won't like it.

}

size_t DebugAllocatorStats::GetAllocationSizeMB() {
return size_ * 1e-6;
Copy link
Member

Choose a reason for hiding this comment

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

nit: this is doing a conversion between 64bit floats and 64bit integers.

Copy link
Member Author

Choose a reason for hiding this comment

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

What change are you requesting?

Copy link
Member Author

Choose a reason for hiding this comment

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

friendly ping @gaaclarke

Copy link
Member

Choose a reason for hiding this comment

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

It's not a huge deal but divide by 1_000_000 instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

@@ -212,11 +226,23 @@ static MTLStorageMode ToMTLStorageMode(StorageMode mode,
}
}

#ifdef IMPELLER_DEBUG
if (desc.storage_mode != StorageMode::kDeviceTransient) {
debug_allocater_->Increment(desc.GetByteSizeOfBaseMipLevel());
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean we aren't tracking the size of the other mip levels? That will give us quite a different result?

Copy link
Member 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

@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, outstanding nit on an assert and double conversion

}

void DebugAllocatorStats::Decrement(size_t size) {
size_.fetch_sub(size, std::memory_order_relaxed);
Copy link
Member

Choose a reason for hiding this comment

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

Semantics! haha. It'll go below zero, but you won't like it.

@gaaclarke
Copy link
Member

I commented on the commit but I don't know if that shows up for you anywhere. I made a mistake with 1_000_000. That's what it'd be for rust. For C++14 the delimiter is ', not '_'.

@jonahwilliams
Copy link
Member Author

you fooled me , I was like ... I guess C++has this too!

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 1, 2024
@auto-submit auto-submit bot merged commit 0d36bd5 into flutter:main Jul 1, 2024
31 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 1, 2024
…locations and report per frame in MB, matching Vulkan implementation. (flutter/engine#53618)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 1, 2024
…locations and report per frame in MB, matching Vulkan implementation. (flutter/engine#53618)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 1, 2024
…locations and report per frame in MB, matching Vulkan implementation. (flutter/engine#53618)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 1, 2024
…locations and report per frame in MB, matching Vulkan implementation. (flutter/engine#53618)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 2, 2024
…locations and report per frame in MB, matching Vulkan implementation. (flutter/engine#53618)
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jul 2, 2024
…151150)

flutter/engine@3456fee...fc5bc14

2024-07-01 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Output .js files as ES6 modules. (#52023)" (flutter/engine#53674)
2024-07-01 skia-flutter-autoroll@skia.org Roll Dart SDK from 21c08743ee4a to c23e58143793 (1 revision) (flutter/engine#53670)
2024-07-01 skia-flutter-autoroll@skia.org Roll Skia from ae2b97d74812 to 8375bdc6e191 (3 revisions) (flutter/engine#53669)
2024-07-01 jacksongardner@google.com Output .js files as ES6 modules. (flutter/engine#52023)
2024-07-01 skia-flutter-autoroll@skia.org Roll Skia from a62bf018429c to ae2b97d74812 (3 revisions) (flutter/engine#53668)
2024-07-01 fmil@google.com [icu] Ignores the dir `flutter/third_party/icu/patches` (flutter/engine#53667)
2024-07-01 jonahwilliams@google.com [Impeller] track the sizes of all outstanding MTLTexture allocations and report per frame in MB, matching Vulkan implementation. (flutter/engine#53618)
2024-07-01 skia-flutter-autoroll@skia.org Roll Dart SDK from 338c6d4fd9c5 to 21c08743ee4a (1 revision) (flutter/engine#53666)

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 jimgraham@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
sigurdm pushed a commit to sigurdm/flutter that referenced this pull request Jul 2, 2024
…lutter#151150)

flutter/engine@3456fee...fc5bc14

2024-07-01 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Output .js files as ES6 modules. (flutter#52023)" (flutter/engine#53674)
2024-07-01 skia-flutter-autoroll@skia.org Roll Dart SDK from 21c08743ee4a to c23e58143793 (1 revision) (flutter/engine#53670)
2024-07-01 skia-flutter-autoroll@skia.org Roll Skia from ae2b97d74812 to 8375bdc6e191 (3 revisions) (flutter/engine#53669)
2024-07-01 jacksongardner@google.com Output .js files as ES6 modules. (flutter/engine#52023)
2024-07-01 skia-flutter-autoroll@skia.org Roll Skia from a62bf018429c to ae2b97d74812 (3 revisions) (flutter/engine#53668)
2024-07-01 fmil@google.com [icu] Ignores the dir `flutter/third_party/icu/patches` (flutter/engine#53667)
2024-07-01 jonahwilliams@google.com [Impeller] track the sizes of all outstanding MTLTexture allocations and report per frame in MB, matching Vulkan implementation. (flutter/engine#53618)
2024-07-01 skia-flutter-autoroll@skia.org Roll Dart SDK from 338c6d4fd9c5 to 21c08743ee4a (1 revision) (flutter/engine#53666)

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 jimgraham@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
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jul 2, 2024
TahaTesser pushed a commit to TahaTesser/flutter that referenced this pull request Jul 8, 2024
victorsanni pushed a commit to victorsanni/flutter that referenced this pull request Jul 8, 2024
…lutter#151150)

flutter/engine@3456fee...fc5bc14

2024-07-01 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Output .js files as ES6 modules. (flutter#52023)" (flutter/engine#53674)
2024-07-01 skia-flutter-autoroll@skia.org Roll Dart SDK from 21c08743ee4a to c23e58143793 (1 revision) (flutter/engine#53670)
2024-07-01 skia-flutter-autoroll@skia.org Roll Skia from ae2b97d74812 to 8375bdc6e191 (3 revisions) (flutter/engine#53669)
2024-07-01 jacksongardner@google.com Output .js files as ES6 modules. (flutter/engine#52023)
2024-07-01 skia-flutter-autoroll@skia.org Roll Skia from a62bf018429c to ae2b97d74812 (3 revisions) (flutter/engine#53668)
2024-07-01 fmil@google.com [icu] Ignores the dir `flutter/third_party/icu/patches` (flutter/engine#53667)
2024-07-01 jonahwilliams@google.com [Impeller] track the sizes of all outstanding MTLTexture allocations and report per frame in MB, matching Vulkan implementation. (flutter/engine#53618)
2024-07-01 skia-flutter-autoroll@skia.org Roll Dart SDK from 338c6d4fd9c5 to 21c08743ee4a (1 revision) (flutter/engine#53666)

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 jimgraham@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
victorsanni pushed a commit to victorsanni/flutter that referenced this pull request Jul 8, 2024
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.

Devicelab memory usage probes aren't working on iOS
2 participants