diff options
Diffstat (limited to 'runtime/test/vk_queue_query_sync_test.cpp')
| -rw-r--r-- | runtime/test/vk_queue_query_sync_test.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/runtime/test/vk_queue_query_sync_test.cpp b/runtime/test/vk_queue_query_sync_test.cpp index a03e369b9..b7237b911 100644 --- a/runtime/test/vk_queue_query_sync_test.cpp +++ b/runtime/test/vk_queue_query_sync_test.cpp | |||
| @@ -291,6 +291,46 @@ int main() { | |||
| 291 | std::printf("queue/query sync: pending Wait() preserved across failed vkQueueSubmit ok\n"); | 291 | std::printf("queue/query sync: pending Wait() preserved across failed vkQueueSubmit ok\n"); |
| 292 | } | 292 | } |
| 293 | 293 | ||
| 294 | // 3b. The same for a batch held behind a Wait with no submitted Signal (queue_holds.h): its submission | ||
| 295 | // fails when the CPU Signal releases it, the failure is reported through take_held_failure(), and its | ||
| 296 | // waits stay for the next submission, as when the call is not held. A Signal queued behind the failed | ||
| 297 | // batch still runs. | ||
| 298 | { | ||
| 299 | VulkanFence gate(context, 0), after(context, 0); | ||
| 300 | EXPECT(gate.semaphore() != VK_NULL_HANDLE && after.semaphore() != VK_NULL_HANDLE); | ||
| 301 | const std::uint64_t pattern = 0x0badf00dcafe1234ULL; | ||
| 302 | std::memcpy(src_ptr, &pattern, sizeof(pattern)); | ||
| 303 | std::memset(dst_ptr, 0, sizeof(pattern)); | ||
| 304 | CommandList copy_list; | ||
| 305 | EXPECT(copy_list.copy_buffer({2, 0, 1, 0, sizeof(pattern)})); | ||
| 306 | EXPECT(copy_list.close()); | ||
| 307 | const CommandList* ptr = ©_list; | ||
| 308 | |||
| 309 | queue_a.wait(gate.semaphore(), 1); | ||
| 310 | EXPECT(queue_a.execute({&ptr, 1}) == ReplayResult::success); // held: the Signal is not submitted yet | ||
| 311 | EXPECT(queue_a.signal(after.semaphore(), 1)); // held behind it | ||
| 312 | EXPECT(after.completed() == 0 && queue_a.take_held_failure() == ReplayResult::success); | ||
| 313 | driver::fail_next_submit.store(VK_ERROR_OUT_OF_HOST_MEMORY); | ||
| 314 | EXPECT(gate.signal(1)); // releases the batch on this thread | ||
| 315 | EXPECT(queue_a.take_held_failure() == ReplayResult::unsupported); | ||
| 316 | EXPECT(queue_a.take_held_failure() == ReplayResult::success); // reported once | ||
| 317 | EXPECT(queue_a.idle() && after.completed() == 1); // the Signal behind it still signaled | ||
| 318 | |||
| 319 | driver::captured_wait_count.store(0); | ||
| 320 | driver::captured_wait_sem.store(0); | ||
| 321 | driver::captured_wait_val.store(0); | ||
| 322 | driver::capture_next_waits.store(true); | ||
| 323 | EXPECT(queue_a.execute({&ptr, 1}) == ReplayResult::success); | ||
| 324 | EXPECT(queue_a.idle()); | ||
| 325 | EXPECT(driver::captured_wait_count.load() == 1); // the failed batch's wait on (gate, 1) came along | ||
| 326 | EXPECT(driver::captured_wait_sem.load() == reinterpret_cast<std::uintptr_t>(gate.semaphore())); | ||
| 327 | EXPECT(driver::captured_wait_val.load() == 1); | ||
| 328 | std::uint64_t got = 0; | ||
| 329 | std::memcpy(&got, dst_ptr, sizeof(got)); | ||
| 330 | EXPECT(got == pattern); | ||
| 331 | std::printf("queue/query sync: failed held batch reported, its wait kept for the retry, Signal behind it ran\n"); | ||
| 332 | } | ||
| 333 | |||
| 294 | // 4. Concurrent multi-queue EndQuery + ResolveQueries + temporary query pool add/remove stress. | 334 | // 4. Concurrent multi-queue EndQuery + ResolveQueries + temporary query pool add/remove stress. |
| 295 | // Each iteration uses a distinct query slot so no slot is reset while another submission resolves it. | 335 | // Each iteration uses a distinct query slot so no slot is reset while another submission resolves it. |
| 296 | { | 336 | { |