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: 28e4d22497 ("panvk/csf: Pass a non-zero flush-id to benefit from cache flush reduction")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34093>
(cherry picked from commit 98a5acf352)
This commit is contained in:
Yiwei Zhang 2025-03-19 22:11:31 -07:00 committed by Eric Engestrom
parent c432dfe79c
commit 0a6dcd915e
4 changed files with 2 additions and 7 deletions

View file

@ -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

View file

@ -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;

View file

@ -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);
}

View file

@ -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),
};
}