-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
@bdero reported p90 raster time went up ~40% for animated_advanced_blend_perf__timeline_summary:
Roll: flutter/engine@4909256...8c2203b
The only item of interest I see is flutter/engine#45654? FYI @matanlurey
@jonahwilliams and I looked at this using a Pixel 7/Pixel Fold with similar performance specs, and we were able to confirm that there was a drop in performance - not expected however. Jonah also immediately pointed out some possible root causes:
This benchmark is definitely stressing the phone, it would be interesting to see what the profile of this shows? Is the resetting happening on the wrong thread, or are we resetting too often, or is it a threading issue?
Something unique about this app is that the frames are really expensive, so the fence waiter will fire much much later than you might expect
We were able to debunk that we're needlessly creating too many command pools:
auto [result, pool] = device.createCommandPoolUnique(info);
if (result != vk::Result::eSuccess) {
return std::nullopt;
}
+FML_LOG(ERROR) << "Creating new command pool";And was able to confirm the errors are because of resetting on a background thread:
static bool kResetOnBackgroundThread = false;
...
auto reset_pool = BackgroundCommandPoolVK(
std::move(pool_), std::move(collected_buffers_), recycler);
if (kResetOnBackgroundThread) {
UniqueResourceVKT<BackgroundCommandPoolVK> pool(
context->GetResourceManager(), std::move(reset_pool));
}After using the "Draw Vertices" benchmark, we now suspect it's due to driver/validation errors:
E/flutter (13448): --- Vulkan Debug Report ----------------------------------------
E/flutter (13448): | Severity: Error
E/flutter (13448): | Type: { Validation }
E/flutter (13448): | ID Name: UNASSIGNED-Threading-MultipleThreads
E/flutter (13448): | ID Number: 337425955
E/flutter (13448): | Queue Breadcrumbs: [NONE]
E/flutter (13448): | CMD Buffer Breadcrumbs: [NONE]
E/flutter (13448): | Related Objects: CommandPool [405719790649713] [UNNAMED]
E/flutter (13448): | Trigger: Validation Error: [ UNASSIGNED-Threading-MultipleThreads ] Object 0: handle = 0x1710000000171, type = VK_OBJECT_TYPE_COMMAND_POOL; | MessageID = 0x141cb623 | THREADING ERROR : vkAllocateCommandBuffers(): object of type VkCommandPool is simultaneously used in thread 520790568112 and thread 521429589168
E/flutter (13448): -----------------------------------------------------------------The root cause appears to be the final command buffer we create for a frame, which is untracked (in other words, the Swapchain-created buffer calls submit directly, so the tracked objects are just dropped at the end of the method.