Address guard: share the page-table buffer across queue families (RT-ADDRESS-GUARD-QUEUE-SHARING) #2527
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2527
Loading…
Reference in a new issue
No description provided.
Delete branch "claude/address-guard-sharing"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Claimed in the coordination issue as: RT-ADDRESS-GUARD-QUEUE-SHARING (https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7231125400). Found by @kevincommits, item 4 of https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7230685285. Thanks!
What and why
With
LEONIDA_ADDRESS_GUARD,DeviceState::create_address_guard()creates the page table that shaders translated with--address-guardread through its device address. Those shaders run on the direct and the async-compute queue, but the buffer was created withVK_SHARING_MODE_EXCLUSIVE. That is the same class of bug as #2489: on a device with more than one queue family, a buffer one family owns is used by another without an ownership transfer. The other buffers every queue reads are shared throughDeviceState::share(share_across_queue_families).Fix. A small header,
runtime/src/address_guard_buffer.h, builds the create info (address_guard::table_buffer_info): storage plus device address, shared by the device's queue families (concurrent on two or more, exclusive on one).create_address_guard()uses it withfamilies. Nothing else changes.Tested
address_guard_buffer_test(CPU only, no device): two families giveVK_SHARING_MODE_CONCURRENTwith both indices; one family stays exclusive; size and usage are the old ones.gta6rt_d3d12_com(which buildsd3d12_vulkan_device.cpp) builds with MSVC 17, Release; no new warnings.GPUs tested: n/a (CPU test).
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).🤖 Generated with Claude Code
Reviewed at head
f06577169on Windows 11 (MSVC 202219.44).Verification
address_guard_buffer_testandgta6rt(confirmingd3d12_vulkan_device.cppcompiles cleanly with the change).address_guard_buffer_test: ok.Notes
vkCreateBuffer, keepingVK_SHARING_MODE_EXCLUSIVE(count 0, null pointer) for a single distinct family andVK_SHARING_MODE_CONCURRENTwhen 2+ distinct families exist, with the family array outlivingvkCreateBuffer(d3d12_vulkan_device.cpp:15043-15045,address_guard_buffer.h:14-20,queue_families.h:28-36).Approve.
AI-assisted review + local MSVC verification.
#2527 | head f06577169c4052e6363256896a9b46eb98ffa10f (merged cleanly with main 09c153948386fd658fe2f999f6176efbaa8c8345) |
ctest --test-dir runtime/build -C RelWithDebInfo -R "^(address_guard_buffer|address_guard|d3d12_inner_coverage_guards)$" --output-on-failure(LEONIDA_VK_VALIDATION=1) | red on main:address_guard_buffer_test.cppfails to compile (C1083: missingaddress_guard_buffer.h; onmain,DeviceStatecreatedguard.bufferwithVK_SHARING_MODE_EXCLUSIVEeven when graphics and async-compute queues live on distinct queue families) | green on PR+main:3/3CTests pass (address_guard_bufferin0.07s,address_guardin0.26s, andd3d12_inner_coverage_guardson RTX 3090 in0.62swithLEONIDA_VK_VALIDATION=1and0Khronos validation errors);check_no_game_data.py0violations | Windows 11, RTX 3090 (610.88), Vulkan SDK 1.4.363.1 | AI-assisted: yesReviewed the diff and tested merged onto
main(493867366) with Ninja Release (MSVC).Extracting the address guard buffer logic into
address_guard_buffer.hwith dedicated unit coverage inaddress_guard_buffer_test.cppis clean and well scoped.Tests run
ctest --output-on-failure -R "^address_guard_buffer$": 1/1 passed (address_guard_buffer0.02 s).AI-assisted (Antigravity, Gemini).
Tested
f06577169merged (no commit) withmainc8bf0e7b6. GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40, Windows 11 10.0.26300; MSVC 19.52 (Visual Studio 18), Ninja, RelWithDebInfo.check_no_game_data.pyis clean.address_guard_bufferpasses.address_guard_buffer.handd3d12_vulkan_device.cppback tomain, the test does not compile (the header is new). For a runtime red, I kept the header and cutshare_across_queue_families(create, families);fromtable_buffer_info. The test then fails withline 20: shared.sharingMode == VK_SHARING_MODE_CONCURRENT.d3d12_vulkan_device.cppcall site keeps it green.xbox_presentfails, as on plainmainhere.gta6rt.exelinked withoutws2_32.libgivesmain's 26 unresolved Rust-std symbols, nothing new. Its imports are identical tomain's.runtime/CMakeLists.txt. Each adds a test block right afteradd_test(NAME vulkan_scratch ...). These are add/add conflicts: keep both blocks.No blocker from my side. AI-assisted (Claude Code).
Merged after TheGeogeo's red/green check (check: green with this PR merged onto
main, red without it;gta6rt.exestill links) and a re-check here: no conflict withmain451afe327, same head as checked, not frozen,no-game-datagreen.AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.