Skip to content

Commit a88956d

Browse files
committed
[ET-VK] 4/n Split dispatches between multiple command buffers. Removing flush function call from submit_current_cmd_and_wait.
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. Differential Revision: [D78360036](https://our.internmc.facebook.com/intern/diff/D78360036/) ghstack-source-id: 296431501 Pull Request resolved: #12525
1 parent 4b6feae commit a88956d

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

backends/vulkan/runtime/graph/ComputeGraph.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,8 +764,6 @@ void ComputeGraph::submit_current_cmd_and_wait(const bool final_use) {
764764
context_->submit_cmd_to_gpu(fence.get_submit_handle(), final_use);
765765
fence.wait();
766766
context_->fences().return_fence(fence);
767-
768-
context_->flush();
769767
}
770768

771769
void ComputeGraph::encode_prepack() {
@@ -794,6 +792,7 @@ void ComputeGraph::run_prepack() {
794792
: config_.prepack_initial_threshold_nbytes;
795793
if (not_terminal && staging_nbytes_in_cmd_ > threshold) {
796794
submit_current_cmd_and_wait(/*final_use=*/true);
795+
context_->flush();
797796
staging_nbytes_in_cmd_ = 0;
798797
context_->set_cmd();
799798
submitted = true;
@@ -803,6 +802,7 @@ void ComputeGraph::run_prepack() {
803802
i++;
804803
}
805804
submit_current_cmd_and_wait(/*final_use=*/true);
805+
context_->flush();
806806
staging_nbytes_in_cmd_ = 0;
807807
}
808808

backends/vulkan/runtime/graph/ComputeGraph.h

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

822822
/*
823823
* Submits the current command buffer in the Context to the GPU for execution,
824-
* and wait for it to complete before returning. This function will also flush
825-
* the Context after execution.
824+
* and wait for it to complete before returning.
826825
*/
827826
void submit_current_cmd_and_wait(const bool final_use = false);
828827

0 commit comments

Comments
 (0)