Repository navigation
Conversation
Kam471
left a comment
There was a problem hiding this comment.
Built and ran vk_bindless_queue_sync_test at 11d905f7 on Windows 11, RTX 5070 Ti: vk_bindless_queue_sync_test: ok, exit 0.
It reports five checks: first upload gated queue B (mask=63 found=42), no redundant wait after completion, incremental vkCmdUpdateBuffer gated (found=77), queue B works after queue A is destroyed (found=99), and a failed submit rolls back fallbacks_ready and retries cleanly. No blocking issue.
|
Tested Two controls on this head, each one line changed and nothing else:
Locking: AI-assisted (Claude Code). |
Flyander
left a comment
There was a problem hiding this comment.
[P1] Keep a queue wait for the first consumer after a host query
vkGetSemaphoreCounterValue only observes the timeline counter. If queue A completes the upload before queue B's first shader use, this code records the completed value and leaves wait_sem null, so B is submitted without the signal-to-batch memory dependency. Vulkan defines the queue semaphore wait as establishing that memory dependency: https://docs.vulkan.org/spec/latest/chapters/synchronization.html#semaphore-waiting. Please retain a timeline wait for a consumer even when the value is already reached; the satisfied wait still establishes the dependency.
[P2] Avoid blocking submissions that do not consume bindless data
prepare_bindless_sync is called for every non-transfer submission. When another queue has a pending upload, a copy-only or empty direct/compute submission can receive the wait even though it has no dispatch, draw, or ExecuteIndirect that reads the bindless set. This serializes unrelated work behind the upload. Gate the consumer wait on actual shader use while keeping any ordering needed for upload submissions.
[P2] Propagate timeline semaphore creation failure
When vkCreateSemaphore fails, the constructor sets bindless_timeline_ to VK_NULL_HANDLE and leaves the context loaded; prepare_bindless_sync then returns without synchronization. Bindless resources can still be used across queues without the guarantee this change adds. Fail context/bindless initialization or use a safe serialized fallback instead of silently disabling the sync.
|
Tested
Synthetic inputs only, no game files. AI-assisted. |
|
AI-assisted. No game files used. Following @Parakeet-Wheat's NVIDIA controls: AMD iGPU mutation/coverage results for 11d905f, plus two additional mutants. Ryzen 5 7600X (RDNA2 gfx1036, AMD 26.10.1), Windows 11 build 26200, MSVC 19.50 / Ninja Release. No validation layer enabled here; this is not the author's 6900 XT. vk_bindless_queue_sync_test used distinct queues, A family 0 / B family 1. Five builds, 50 runs each; each mutant is a single-line replacement:
Thus this AMD run also fails to distinguish the no-CONCURRENT-sharing mutant from the PR. Correct returned values in that mutant do not establish valid queue-family ownership or safe EXCLUSIVE sharing. This is observed test coverage on this driver, without validation, not a driver-conformance conclusion. The additional mutants pin the existing assertions for B's later dispatch and failed-submit rollback. Subtest 2 comes after B has already waited for its first upload. It does NOT address the first-consumer-after-host-query scenario in Flyander's review; passing this test does not resolve that synchronization concern or endorse every wait-elision policy. Two further coverage observations from source:
Existing vk_queue_test, vk_queue_query_sync_test, descriptor_table_test and d3d12_descriptor_test each passed three times on PR and parent 03b09a0 (24 executions). The descriptor test's sampling shader was unavailable (no glslangValidator). vk_bindless_test was not successfully exercised: no-argument invocations returned usage and are not counted. Scope: targeted mutation/coverage feedback, not a synchronization-correctness or merge verdict. No NVIDIA, validation-layer, full-CTest or same-family-path check here; dropping the signal, semaphore-creation failure and the access-mask change were not independently tested. |
|
Tested This pull request is for item 7 of my audit note (#4257 (comment)). That item came from the code only. This is the first test of it on an RTX 40-series GPU. Full
New test
Code read I looked for a deadlock between the new wait and a D3D12 I do not repeat the points in the review from @Flyander. Correction (added later): in the AMD column of the full |
…its, fail on timeline creation error
|
Addressed @Flyander's review points and @Parakeet-Wheat / @Zombins2's
Verification at
|
|
Tested Cause. That test builds
To fix it, either give the mock a table that makes Controls on
So the new test now pins @Flyander's P1 (first-consumer wait after host-observed completion), the P2 gating, and the AI-assisted (Claude Code). |
…mit TimelineOp span
|
Fixed the
Verification at
|
|
Retested Control on the new AI-assisted (Claude Code). |
|
FAIL to merge, verified: git merge-tree conflicts exactly in runtime/src/vulkan_backend.h against current main. At the PR head the build_runtime suites pass (1 + 4 with the documented skip); the new vk_bindless_queue_sync_test was not built, but its embedded compute probe passes static spirv-val and the disassembly matches the described GLSL probe. Two suggestions: include the GLSL source alongside the embedded words so provenance and regeneration are checkable, and note #4224 also edits vulkan_backend.h and CMakeLists — the rebase should anticipate it. Main's bb36812 is related submission work, not this bindless-upload protocol, so rebase rather than close. No CI checks reported. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
|
Rebase integration note for head |
|
AI-assisted. No game files used. A rebase note for @Persudes: #2740 merged on 2026-11-23 at 11:36Z and includes a8fae90, which adds another bindless-upload wait to main. At main Setup:
In both non-replacing cases, B completed while A's upload was still gated and returned the unexpected values shown above. For the replaced generation, B's 50 ms wait timed out; after gate release, B returned the expected values. Generation counts stayed at 0 through the in-place addition and became 1 on replacement, matching the The probe has no pending storage-image initialization or buffer zeroing. In production, either can publish For the rebase:
Scope: |
Summary
Addresses
@shdann's runtime audit item 7 (cross-queue synchronization ofBindlessSetuploads and fallback image initialization).Changes
runtime/src/vulkan_bindless.h:BindlessFeatures::queue_familiesandBindlessSet::share()so table/staging buffers and fallback images useVK_SHARING_MODE_CONCURRENTwhen 2+ unique queue families access the bindless set.fallbacks_in_flight_) alongsideupload_in_flight_, rolling backfallbacks_ready_as well astable_dirty_/force_full_upload_whenvkQueueSubmitfails.BindlessSet::has_recorded_upload()and expandedrecord_table_barrier()dstAccessMasktoVK_ACCESS_SHADER_READ_BIT | VK_ACCESS_TRANSFER_WRITE_BIT.runtime/src/vulkan_backend.h:bindless_timeline_VK_SEMAPHORE_TYPE_TIMELINEsemaphore, upload sequence counter (bindless_upload_value_), cached completed value (bindless_completed_value_), and last uploader queue handle (bindless_upload_owner_) inVulkanContext(guarded bytracker_mutex_).VulkanContext::set_bindless_prepareto report whether GPU bindless commands were recorded (keeping a backward-compatible 1-arg overload) and wiredVulkanQueue::prepare_bindless_sync()/VulkanQueue::submit()so any non-transfer-only queue waits on pending cross-queue uploads without mutatingwaits_and advancesbindless_timeline_when recording new uploads.runtime/shims/d3d12_vulkan_device.cpp:state_.familiesintoBindlessFeatures::queue_familiesand reportedstate_.bindless->has_recorded_upload()frombindless_prepare_.runtime/test/vk_bindless_queue_sync_test.cpp&runtime/CMakeLists.txt:record_fallback_init+vkCmdCopyBuffer) on queue A gating queue B's compute lookup, (2) zero redundant waits after upload completion, (3) incrementalvkCmdUpdateBuffergating across queues, (4) safe queue B execution after queue A teardown, and (5) failedvkQueueSubmitrollback + retry.Verification
Tested on Windows 11 x64, MSVC 19.52.37029, Windows SDK 10.0.26100.0, Vulkan SDK 1.4.363.1, AMD Radeon RX 6900 XT (AMD proprietary driver 26.11.2, Vulkan 1.4.315, distinct direct family
0and async compute family1queues).main(03b09a08):vk_bindless_queue_sync_test.exefailed on subtest 1 withwaits=0 blocked=0 mask=0 found=0(queue B ran ahead of the gated queue A upload and read zeros)..\runtime\build\vk_bindless_queue_sync_test.exe: passed (all 5 subtests).LEONIDA_VK_VALIDATION=1 .\runtime\build\vk_bindless_queue_sync_test.exe(5 consecutive runs): 5/5 passed, 0 validation errors.LEONIDA_VK_VALIDATION=1 .\runtime\build\vk_queue_test.exe: passed, 0 validation errors.LEONIDA_VK_VALIDATION=1 .\runtime\build\d3d12_descriptor_test.exe: passed.ctest --test-dir runtime/build --output-on-failure:100% tests passed, 0 tests failed out of 156(8 expected skips without retail files / sync validation layers, 1 disabledgameinput).python -I tests/test_ctest_registration.py: 4/4 passed.AI-assisted. No game files were used.