From 0a6dcd915ea20bd563c0be517ea3b5e960461b51 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: (cherry picked from commit 98a5acf352451e10046e9c5be3a2f0f1430ea6e9) --- .pick_status.json | 2 +- 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 +- 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 22ee31280f8..bc69ae1c250 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4294,7 +4294,7 @@ "description": "panvk/csf: rework cache flush reduction", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "28e4d2249725ddc3d4dd031820e209c3bc4183ad", "notes": null diff --git a/src/panfrost/vulkan/csf/panvk_cmd_buffer.h b/src/panfrost/vulkan/csf/panvk_cmd_buffer.h index b26c041d23b..092372bbe79 100644 --- a/src/panfrost/vulkan/csf/panvk_cmd_buffer.h +++ b/src/panfrost/vulkan/csf/panvk_cmd_buffer.h @@ -382,8 +382,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 2dfa71d1634..1081bf4f125 100644 --- a/src/panfrost/vulkan/csf/panvk_vX_cmd_buffer.c +++ b/src/panfrost/vulkan/csf/panvk_vX_cmd_buffer.c @@ -189,7 +189,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); @@ -205,8 +204,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 b67713f330f..dc1a0322376 100644 --- a/src/panfrost/vulkan/csf/panvk_vX_queue.c +++ b/src/panfrost/vulkan/csf/panvk_vX_queue.c @@ -937,7 +937,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), }; }