From 98a5acf352451e10046e9c5be3a2f0f1430ea6e9 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Wed, 19 Mar 2025 22:11:31 -0700 Subject: [PATCH] panvk/csf: rework cache flush reduction Per Vulkan spec 7.9. Host Write Ordering Guarantees, queue submission commands automatically perform a domain operation from host to device for all writes performed before the command executes. That is to say, host updates to the mappings can occur after the end of the command recording and must be flushed implicitly at submission boundary. Before this change, necessary cache flushes could be missed once the app starts reusing pre-recorded command buffers. e.g. a simple buffer copy cmd while the app only updates the source buffer mapping in different submissions. This changes backs out most of the current version of cache flush reduction while still assigning LATEST_FLUSH_ID to at least the final batch itself. This aligns with panfrost_batch submit behavior on the gallium side. Test: dEQP-VK.synchronization*.timeline_semaphore.* pass w/o flakiness via venus-on-panvk Fixes: 28e4d224972 ("panvk/csf: Pass a non-zero flush-id to benefit from cache flush reduction") Reviewed-by: Boris Brezillon Part-of: --- src/panfrost/vulkan/csf/panvk_cmd_buffer.h | 2 -- src/panfrost/vulkan/csf/panvk_vX_cmd_buffer.c | 3 --- src/panfrost/vulkan/csf/panvk_vX_queue.c | 2 +- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/panfrost/vulkan/csf/panvk_cmd_buffer.h b/src/panfrost/vulkan/csf/panvk_cmd_buffer.h index de806b89e43..8ce46c7d4c2 100644 --- a/src/panfrost/vulkan/csf/panvk_cmd_buffer.h +++ b/src/panfrost/vulkan/csf/panvk_cmd_buffer.h @@ -362,8 +362,6 @@ struct panvk_cmd_buffer { struct panvk_pool tls_pool; struct list_head push_sets; - uint32_t flush_id; - struct { struct u_trace uts[PANVK_SUBQUEUE_COUNT]; } utrace; diff --git a/src/panfrost/vulkan/csf/panvk_vX_cmd_buffer.c b/src/panfrost/vulkan/csf/panvk_vX_cmd_buffer.c index aa86de08c6d..12ef47a8d58 100644 --- a/src/panfrost/vulkan/csf/panvk_vX_cmd_buffer.c +++ b/src/panfrost/vulkan/csf/panvk_vX_cmd_buffer.c @@ -192,7 +192,6 @@ VKAPI_ATTR VkResult VKAPI_CALL panvk_per_arch(EndCommandBuffer)(VkCommandBuffer commandBuffer) { VK_FROM_HANDLE(panvk_cmd_buffer, cmdbuf, commandBuffer); - struct panvk_device *dev = to_panvk_device(cmdbuf->vk.base.device); emit_tls(cmdbuf); flush_sync_points(cmdbuf); @@ -208,8 +207,6 @@ panvk_per_arch(EndCommandBuffer)(VkCommandBuffer commandBuffer) } } - cmdbuf->flush_id = panthor_kmod_get_flush_id(dev->kmod.dev); - return vk_command_buffer_end(&cmdbuf->vk); } diff --git a/src/panfrost/vulkan/csf/panvk_vX_queue.c b/src/panfrost/vulkan/csf/panvk_vX_queue.c index 7948c15c267..89723d5f0fc 100644 --- a/src/panfrost/vulkan/csf/panvk_vX_queue.c +++ b/src/panfrost/vulkan/csf/panvk_vX_queue.c @@ -939,7 +939,7 @@ panvk_queue_submit_init_cmdbufs(struct panvk_queue_submit *submit, .queue_index = j, .stream_size = cs_root_chunk_size(b), .stream_addr = cs_root_chunk_gpu_addr(b), - .latest_flush = cmdbuf->flush_id, + .latest_flush = panthor_kmod_get_flush_id(dev->kmod.dev), }; }