Skip to content

[ET-VK] 3/n Split dispatches between multiple command buffers. Track previous semaphore in context. #12523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jul 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
bb3c625
[ET-VK] Fix caching mechanism to account for included files
SS-JIA Jul 14, 2025
5892e42
[ET-VK] Split up prepack command buffer
SS-JIA Jul 14, 2025
641157c
Update base for Update on "[ET-VK] Split up prepack command buffer"
SS-JIA Jul 14, 2025
e447656
Update on "[ET-VK] Split up prepack command buffer"
SS-JIA Jul 14, 2025
6bf4695
[ET-VK] 1/n Split dispatches between multiple command buffers. Add se…
trivedivivek Jul 15, 2025
261d821
[ET-VK] 2/n Split dispatches between multiple command buffers. Add se…
trivedivivek Jul 15, 2025
33d3e29
Update on "[ET-VK] 2/n Split dispatches between multiple command buff…
trivedivivek Jul 15, 2025
ec8cc51
[ET-VK] 3/n Split dispatches between multiple command buffers. Track …
trivedivivek Jul 15, 2025
635e33f
Update base for Update on "[ET-VK] 3/n Split dispatches between multi…
trivedivivek Jul 15, 2025
738b36c
Update on "[ET-VK] 3/n Split dispatches between multiple command buff…
trivedivivek Jul 15, 2025
1564583
Update base for Update on "[ET-VK] 3/n Split dispatches between multi…
trivedivivek Jul 16, 2025
fba8f2a
Update on "[ET-VK] 3/n Split dispatches between multiple command buff…
trivedivivek Jul 16, 2025
4eb6326
Update base for Update on "[ET-VK] 3/n Split dispatches between multi…
trivedivivek Jul 16, 2025
a374513
Update on "[ET-VK] 3/n Split dispatches between multiple command buff…
trivedivivek Jul 16, 2025
c78bcfc
Update base for Update on "[ET-VK] 3/n Split dispatches between multi…
trivedivivek Jul 17, 2025
e0fb032
Update on "[ET-VK] 3/n Split dispatches between multiple command buff…
trivedivivek Jul 17, 2025
42aa635
Update base for Update on "[ET-VK] 3/n Split dispatches between multi…
trivedivivek Jul 17, 2025
a0acb3e
Update on "[ET-VK] 3/n Split dispatches between multiple command buff…
trivedivivek Jul 17, 2025
f1eafd8
Merge branch 'main' into gh/trivedivivek/123/head
SS-JIA Jul 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion backends/vulkan/runtime/api/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Context::Context(vkapi::Adapter* adapter, const ContextConfig& config)
// Command buffer submission
cmd_mutex_{},
cmd_(VK_NULL_HANDLE, VK_NULL_HANDLE, 0u),
prev_semaphore_(VK_NULL_HANDLE),
submit_count_{0u},
// Memory Management
buffer_clearlist_mutex_{},
Expand Down Expand Up @@ -195,10 +196,21 @@ void Context::register_blit(
}

void Context::submit_cmd_to_gpu(VkFence fence_handle, const bool final_use) {
// Wait semaphore would be previous command buffer's signal semaphore
VkSemaphore wait_semaphore = prev_semaphore_;
// Signal semaphore for the the current command buffer
VkSemaphore signal_semaphore = cmd_.get_signal_semaphore();
// Next command buffer would wait on this command buffer's signal semaphore
prev_semaphore_ = signal_semaphore;

if (cmd_) {
cmd_.end();
adapter_p_->submit_cmd(
queue_, cmd_.get_submit_handle(final_use), fence_handle);
queue_,
cmd_.get_submit_handle(final_use),
fence_handle,
wait_semaphore,
signal_semaphore);

submit_count_ = 0u;
}
Expand All @@ -214,6 +226,8 @@ void Context::flush() {
if (cmd_) {
cmd_.invalidate();
}
// Reset previous command buffer semaphore
prev_semaphore_ = VK_NULL_HANDLE;

std::lock_guard<std::mutex> bufferlist_lock(buffer_clearlist_mutex_);
std::lock_guard<std::mutex> imagelist_lock(image_clearlist_mutex_);
Expand Down
2 changes: 2 additions & 0 deletions backends/vulkan/runtime/api/Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class Context final {
// Command buffers submission
std::mutex cmd_mutex_;
vkapi::CommandBuffer cmd_;
// Semaphore for the previously submitted command buffer, if any
VkSemaphore prev_semaphore_;
uint32_t submit_count_;
// Memory Management
std::mutex buffer_clearlist_mutex_;
Expand Down
Loading