Skip to content

Commit 0e433e8

Browse files
trivedivivekSS-JIA
andauthored
[ET-VK] 4/n Split dispatches between multiple command buffers. Removing flush function call from submit_current_cmd_and_wait. (#12525)
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom): * __->__ #12525 * #12523 * #12522 * #12519 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/) --------- Co-authored-by: Stephen Jia <[email protected]>
1 parent 5c9afa6 commit 0e433e8

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
@@ -773,8 +773,6 @@ void ComputeGraph::submit_current_cmd_and_wait(const bool final_use) {
773773
context_->submit_cmd_to_gpu(fence.get_submit_handle(), final_use);
774774
fence.wait();
775775
context_->fences().return_fence(fence);
776-
777-
context_->flush();
778776
}
779777

780778
void ComputeGraph::prepack() {
@@ -795,7 +793,12 @@ void ComputeGraph::prepack() {
795793
// Otherwise, just submit the current command buffer for execution and
796794
// proceed. This results in lower load latency at the cost of higher peak
797795
// memory usage.
798-
reduce_peak_memory ? submit_current_cmd_and_wait() : submit_current_cmd();
796+
if (reduce_peak_memory) {
797+
submit_current_cmd_and_wait();
798+
context_->flush();
799+
} else {
800+
submit_current_cmd();
801+
}
799802
staging_nbytes_in_cmd_ = 0;
800803
context_->set_cmd();
801804
submitted = true;
@@ -805,6 +808,7 @@ void ComputeGraph::prepack() {
805808
i++;
806809
}
807810
submit_current_cmd_and_wait(/*final_use=*/true);
811+
context_->flush();
808812
staging_nbytes_in_cmd_ = 0;
809813
}
810814

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)