From 742b95b9e482c52f82af74c360a0db3f786b9fdf Mon Sep 17 00:00:00 2001 From: Vivek Trivedi <5340687+trivedivivek@users.noreply.github.com> Date: Sun, 11 May 2025 19:06:24 -0700 Subject: [PATCH] [ET-VK] Return fence after waiting is done. Pull Request resolved: https://github.com/pytorch/executorch/pull/10787 This change returns a fence to fence pool after it has been waited on. ghstack-source-id: 283339435 @exported-using-ghexport Differential Revision: [D74484825](https://our.internmc.facebook.com/intern/diff/D74484825/) --- backends/vulkan/runtime/graph/ComputeGraph.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backends/vulkan/runtime/graph/ComputeGraph.cpp b/backends/vulkan/runtime/graph/ComputeGraph.cpp index 7fde7e04f91..59fd561a2c5 100644 --- a/backends/vulkan/runtime/graph/ComputeGraph.cpp +++ b/backends/vulkan/runtime/graph/ComputeGraph.cpp @@ -625,6 +625,7 @@ void ComputeGraph::prepack() const { vkapi::VulkanFence fence = context_->fences().get_fence(); context_->submit_cmd_to_gpu(fence.get_submit_handle(), /*final_use = */ true); fence.wait(); + context_->fences().return_fence(fence); context_->flush(); } @@ -649,6 +650,7 @@ void ComputeGraph::execute() const { vkapi::VulkanFence fence = context_->fences().get_fence(); context_->submit_cmd_to_gpu(fence.get_submit_handle()); fence.wait(); + context_->fences().return_fence(fence); } void ComputeGraph::resize_input(