upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/vk_queue_query_sync_test.cpp
diff options
context:
space:
mode:
authorAlxcBTW <187763517+AlxcBTW@users.noreply.github.com>2026-11-22 22:20:36 +0100
committerAlxcBTW <187763517+AlxcBTW@users.noreply.github.com>2026-11-22 22:20:36 +0100
commit48cee7c2c69e502cc864b0789a9cf5bb88e98658 (patch)
tree52fd1d94d86ee5fe479111579e48c696e18d42cf /runtime/test/vk_queue_query_sync_test.cpp
parent0d75876278a3f6b238a8667cf42c66cf1ae1d99a (diff)
Queue holds: second review fixes (claim after submit, presenter locking and bound, teardown pump, tests)
- A Signal counts as submitted only after vkQueueSubmit succeeded: a failed submit releases no waiter and the retry goes through. - ~VulkanQueue pumps after dropping held work; fence keep-alives are also drained in wait() and marker(). - VulkanPresenter: counters are atomics, read_back/enable_capture take the presenter mutex, set_abort has its own mutex, a deferred present reports not tearing, and at most 8 presents queue up before the caller waits. - Tests: three presents (blit, blank, composed) queued behind held work run in order, a present behind a destroyed queue's held work runs, a failed Signal does not release its waiters; the handover modes also run on the host runtime. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/vk_queue_query_sync_test.cpp')
-rw-r--r--runtime/test/vk_queue_query_sync_test.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/runtime/test/vk_queue_query_sync_test.cpp b/runtime/test/vk_queue_query_sync_test.cpp
index b7237b911..49f4015c8 100644
--- a/runtime/test/vk_queue_query_sync_test.cpp
+++ b/runtime/test/vk_queue_query_sync_test.cpp
@@ -331,6 +331,33 @@ int main() {
331 std::printf("queue/query sync: failed held batch reported, its wait kept for the retry, Signal behind it ran\n"); 331 std::printf("queue/query sync: failed held batch reported, its wait kept for the retry, Signal behind it ran\n");
332 } 332 }
333 333
334 // 3c. A Signal whose vkQueueSubmit fails signals nothing: a queue waiting for it stays held (the value is not
335 // counted as submitted), and the application's retry of the Signal goes through and releases it.
336 {
337 VulkanFence fence(context, 0);
338 EXPECT(fence.semaphore() != VK_NULL_HANDLE);
339 const std::uint64_t pattern = 0x5ca1ab1e0ddba11ULL;
340 std::memcpy(src_ptr, &pattern, sizeof(pattern));
341 std::memset(dst_ptr, 0, sizeof(pattern));
342 CommandList copy_list;
343 EXPECT(copy_list.copy_buffer({2, 0, 1, 0, sizeof(pattern)}));
344 EXPECT(copy_list.close());
345 const CommandList* ptr = &copy_list;
346 queue_b.wait(fence.semaphore(), 1);
347 EXPECT(queue_b.execute({&ptr, 1}) == ReplayResult::success); // held for the Signal
348 driver::fail_next_submit.store(VK_ERROR_OUT_OF_HOST_MEMORY);
349 EXPECT(!queue_a.signal(fence.semaphore(), 1)); // the submit fails
350 EXPECT(queue_b.idle() && fence.completed() == 0);
351 std::uint64_t got = 1;
352 std::memcpy(&got, dst_ptr, sizeof(got));
353 EXPECT(got == 0); // the waiter did not run
354 EXPECT(queue_a.signal(fence.semaphore(), 1)); // the retry signals, and releases it
355 EXPECT(queue_b.idle() && queue_a.idle() && fence.completed() == 1);
356 std::memcpy(&got, dst_ptr, sizeof(got));
357 EXPECT(got == pattern);
358 std::printf("queue/query sync: a failed Signal does not release its waiters; the retry does\n");
359 }
360
334 // 4. Concurrent multi-queue EndQuery + ResolveQueries + temporary query pool add/remove stress. 361 // 4. Concurrent multi-queue EndQuery + ResolveQueries + temporary query pool add/remove stress.
335 // Each iteration uses a distinct query slot so no slot is reset while another submission resolves it. 362 // Each iteration uses a distinct query slot so no slot is reset while another submission resolves it.
336 { 363 {