Repository navigation
OLD-8414: restore old upstream PR 8414 - d3d12: arena AS resources take their address from vkGetAccelerationStructureDeviceAddressKHR - #710
Conversation
…ructureDeviceAddressKHR A default-heap acceleration-structure resource in the GPU address arena handed out buffer address + offset as its GPU VA without asking the driver. An instance must name its BLAS by a value obtained from vkGetAccelerationStructureDeviceAddressKHR (VUID-vkCmdBuildAccelerationStructuresKHR-pInfos-12281), and for a GENERIC structure the spec only promises consistent offsets between structures of one buffer, not equality with the buffer address. Query it as the committed path does; if a driver ever returns a different address, use the driver's and keep the arena address registered too. GPU-assisted validation only knows addresses it has seen that call return, so it reported every arena BLAS as "an invalid acceleration structure reference" and rewrote the instance to its dummy BLAS (the ray-query miss marso006 saw). It now reports the remaining layer limitation instead: a GENERIC structure built as bottom level is "not a bottom level acceleration structure", which the spec allows. Restored from old upstream PR 8414, which was closed unmerged when the original repository went private. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ddress is not buffer address + offset Every AS resource's GPU VA must be the driver's vkGetAccelerationStructureDeviceAddressKHR value for the structure behind it; the test checks that for the BLAS and both TLAS resources. Envyre's review of old upstream PR 8414: the branch that takes the driver's address when it differs only ran on such a driver. The test creates a second device whose get_instance_proc hands out a vkGetAccelerationStructureDeviceAddressKHR that answers the real address plus 256 MiB (the device's existing function-lookup hook, no change to the runtime), creates one AS resource on it and checks that its GPU VA is the driver's address, that the arena address still names the structure, and that releasing the resource forgets both. No builds run on that device. The checks sit right after the TLAS lookups, before the CLONE/COMPACT section main has added since. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
abnalstlll-byte
left a comment
There was a problem hiding this comment.
Reviewed and verified OLD-8414 restoration. Querying \�kGetAccelerationStructureDeviceAddressKHR\ for arena-backed acceleration structure resources satisfies VUID \VUID-vkCmdBuildAccelerationStructuresKHR-pInfos-12281\ while maintaining registration across driver-shifted addresses and raw arena offsets. CTest additions in \d3d12_indirect_rt_test.cpp\ confirm GPU VA lookup, driver address alignment, and dual-address teardown. Approved.
|
Tested 296508e on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300), native Windows: pass Built with
|
Claimed in the coordination issue as: OLD-8414 #14 (comment)
Restoration of my original pull request, old upstream PR 8414 in
ItsNotRexed/Leonida, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Ported onto main at 21625bc. The runtime change applies unchanged. Ind3d12_indirect_rt_test.cpp, main's CLONE/COMPACT tests stay as they are, and the new checks go right after the TLAS lookups, where they were in the original.What and why
vkGetAccelerationStructureDeviceAddressKHR(VUID-vkCmdBuildAccelerationStructuresKHR-pInfos-12281). For aGENERICstructure the spec only promises consistent offsets between the structures of one buffer, not that the address equals the buffer address.buffer_va_path.GENERICstructure built as bottom level is "not a bottom level acceleration structure", which the spec allows.d3d12_indirect_rt:get_instance_procreturns avkGetAccelerationStructureDeviceAddressKHRthat adds 256 MiB to the real address (no runtime change), an AS resource's GPU VA is the driver's address, and the arena address still names the structure.Tested
On Linux,
d3d12_indirect_rt_testwas cross-built with clang for the mingw target and run under Wine 11.22 (staging) on Mesa 26.3.1 RADV. CI's MSVC build was not run locally. Each GPU ran three builds: main, main with only the new test, and this branch. Every run used the host Khronos validation layer.LEONIDA_UPLOAD_SYSMEM=1LEONIDA_UPLOAD_SYSMEM=1With GPU-AV (
VK_KHRONOS_VALIDATION_GPUAV_ENABLE=1), both GPUs give the same result as each other and as the original PR:GENERICstructures, plus 1 invalid reference on the ARRAY_OF_POINTERS instance.Both changed files pass
git diff --checkandpython -I scripts/check_no_game_data.py.GPUs tested: AMD Radeon RX 7900 XTX (RDNA3) and the integrated AMD Radeon Graphics of a Ryzen 9 7950X3D (RDNA2, gfx1036), both on Mesa 26.3.1 RADV, Arch Linux, through Wine 11.22
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)AI-assisted (Claude Code, Claude Opus 5.5).