Skip to content

Commit 028955a

Browse files
committed
[ET-VK] 4/n Split dispatches between multiple command buffers. Removing flush function call from submit_current_cmd_and_wait.
Pull Request resolved: #12525 This diff removes the `flush` function call from `submit_current_cmd_and_wait` and instead adds it to the `encode_prepack` method. This change will allow better control over flush which is needed in follow up diffs. ghstack-source-id: 296712817 @exported-using-ghexport Differential Revision: [D78360036](https://our.internmc.facebook.com/intern/diff/D78360036/)
1 parent 38dbd5c commit 028955a

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

backends/vulkan/runtime/graph/ComputeGraph.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -765,8 +765,6 @@ void ComputeGraph::submit_current_cmd_and_wait(const bool final_use) {
765765
context_->submit_cmd_to_gpu(fence.get_submit_handle(), final_use);
766766
fence.wait();
767767
context_->fences().return_fence(fence);
768-
769-
context_->flush();
770768
}
771769

772770
void ComputeGraph::prepack() {
@@ -787,7 +785,12 @@ void ComputeGraph::prepack() {
787785
// Otherwise, just submit the current command buffer for execution and
788786
// proceed. This results in lower load latency at the cost of higher peak
789787
// memory usage.
790-
reduce_peak_memory ? submit_current_cmd_and_wait() : submit_current_cmd();
788+
if (reduce_peak_memory) {
789+
submit_current_cmd_and_wait();
790+
context_->flush();
791+
} else {
792+
submit_current_cmd();
793+
}
791794
staging_nbytes_in_cmd_ = 0;
792795
context_->set_cmd();
793796
submitted = true;
@@ -797,6 +800,7 @@ void ComputeGraph::prepack() {
797800
i++;
798801
}
799802
submit_current_cmd_and_wait(/*final_use=*/true);
803+
context_->flush();
800804
staging_nbytes_in_cmd_ = 0;
801805
}
802806

backends/vulkan/runtime/graph/ComputeGraph.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -847,8 +847,7 @@ class ComputeGraph final {
847847

848848
/*
849849
* Submits the current command buffer in the Context to the GPU for execution,
850-
* and wait for it to complete before returning. This function will also flush
851-
* the Context after execution.
850+
* and wait for it to complete before returning.
852851
*/
853852
void submit_current_cmd_and_wait(const bool final_use = false);
854853

0 commit comments

Comments
 (0)