-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Check for lazy memory support. #43339
[Impeller] Check for lazy memory support. #43339
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
} | ||
return flags; | ||
case StorageMode::kDevicePrivate: | ||
if (is_texture) { |
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.
Lets not use VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT until we have a case where it performs better
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 thought Angle did that for > 4MB allocations though. Perhaps just start off with that assumption, but for non-render targets?
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.
Lets follow up on this one in #43325 ?
If we don't remove this bit we'll have the same performance issues as dedicated allocations don't go into the pool.
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.
Sounds good.
std::weak_ptr<DeviceHolder> device_holder_; | ||
ISize max_texture_size_; | ||
bool is_valid_ = false; | ||
bool supports_lazy_memory_ = false; |
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 didn't put this in caps since its not clear that anything outside of the allocator needs to know yet...
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.
Perhaps call this supports_memoryless_textures_
since we have used the term before and are familiar with it?
std::weak_ptr<DeviceHolder> device_holder_; | ||
ISize max_texture_size_; | ||
bool is_valid_ = false; | ||
bool supports_lazy_memory_ = false; |
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.
Perhaps call this supports_memoryless_textures_
since we have used the term before and are familiar with it?
return max_texture_size_; | ||
} | ||
|
||
void AllocatorVK::CheckForMemoryTypeSupport() { |
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.
IMO, this should just be a cap check set in CapabilitiesVK::SetPhysicalDevice
. That way, if we decide this is a dealbreaker for Vulkan, we can decide to more easily terminate context setup and fallback to OpenGL. The check here is too late to make that call.
VmaAllocationCreateInfo allocation_info = {}; | ||
allocation_info.usage = ToVMAMemoryUsage(); | ||
allocation_info.preferredFlags = ToVKMemoryPropertyFlags(desc.storage_mode); | ||
allocation_info.preferredFlags = |
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.
We should probably use required instead of preferred flags now since we are sure the device supports the type.
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.
Ditto for the texture allocation too.
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 can do that. We will also need to cap check for host visible textures as well.
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 wasn't able to get this working with some quick effort. lets track switching to required flags once we've chased down all the loose ends.
return VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; | ||
case StorageMode::kDeviceTransient: | ||
return VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT; | ||
if (supports_lazy_memory) { |
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.
Looking at the memory types on vulkan.gpuinfo.org. We should be &
ing these to be both device local and lazily allocated (if supported).
I was putting stuff in caps not because many components would check it. But because we could terminate context setup and fallback to GL at any time based on the presence of a specific cap. |
I haven't been able to get the right check for host visible textures working, so I'm leaving us with preferred flags for now. |
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.
Some nits (like the cap check), but otherwise LGTM. I'll add a followup for what to do about devices in the lab that have device transient texture support.
I'm less optimistic about the improvements locally. Will study ANGLE more. |
…129818) flutter/engine@d333434...099a70e 2023-06-30 ditman@gmail.com [web] Add nonce configuration. (flutter/engine#42829) 2023-06-30 bdero@google.com [Impeller] Unwrap optional procs in EntityPass (flutter/engine#43352) 2023-06-30 bdero@google.com [Impeller] Assign missing user to TODO. (flutter/engine#43351) 2023-06-29 skia-flutter-autoroll@skia.org Roll Skia from a1ae27969207 to 2d05e3ec6b67 (1 revision) (flutter/engine#43350) 2023-06-29 skia-flutter-autoroll@skia.org Roll Dart SDK from ecc2440be198 to 2d98d9e27dae (1 revision) (flutter/engine#43347) 2023-06-29 jonahwilliams@google.com [Impeller] Check for lazy memory support. (flutter/engine#43339) 2023-06-29 bdero@google.com [Impeller] Remove all double empties (flutter/engine#43345) 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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Some Android devices do not support the memory type eLazilyAllocated, which we use for MSAA and stencil textures. These textures were falling back to device local in dedicated allocations, which are expensive to both allocate and free. The dedicated allocation is implied by asking for eLazilyAllocated Instead, perform a check for support for this memory type. Never request dedicated allocations (at least not until we have a compelling use case) This should fix flutter/flutter#129737 flutter/flutter#129784
Some Android devices do not support the memory type eLazilyAllocated, which we use for MSAA and stencil textures. These textures were falling back to device local in dedicated allocations, which are expensive to both allocate and free. The dedicated allocation is implied by asking for eLazilyAllocated
Instead, perform a check for support for this memory type. Never request dedicated allocations (at least not until we have a compelling use case)
This should fix flutter/flutter#129737
flutter/flutter#129784