d3d12: pin guest-memory BLAS storage per TLAS and normalize prebuild geometry #455
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/455"
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?
Imported from brcly/TuxBox. Originally posted by DrArroway on 2026-11-29T07:45:03Z.
Summary
Contributes toward #403 (scoped cleanly around what is already merged in #409/#428 and open in #436, #442, #443, and #445):
TLAS-pinned BLAS storage lifetime & fence-backed retirement
Mappings.resourcesalongsideMappings.addresses, and binds a snapshot (tlas_deps) to each live non-empty TLAS build (Instances).tlas_depsacrossCopy(CLONE/COMPACT), clears it on overwrite/release (publish_release,Native, cookedInput), and removes stale entries onRegistration::drop, with fullMappingSubmissionrollback support.queue_trace::pending_fences()and a dedicatedRetirementQueue(device/blas/lifetime.rs) so superseded private AS storages and TLAS dependency snapshots remain alive until all pending queue fences recorded at retirement time complete.Prebuild-after-translation, Xbox vertex format normalization &
vertex_bytesguest_addresses::geometry) before callingGetRaytracingAccelerationStructurePrebuildInfoinbuild_raytracing::translate, so host prebuild sizing sees decoded formats (R32_UINT,R32G32B32_FLOAT) and index-expandedVertexCount.53(toR32_UINT, clampingVertexCountto1 << 16) and packedR32G32_FLOATvertex format (toR32G32B32_FLOAT, stride12) indevice::ray_build::prebuild.guest_addresses::vertex_bytes(DXGI_FORMAT_R32G32B32_{FLOAT,UINT,SINT}andDXGI_FORMAT_R32G32B32A32_{FLOAT,UINT,SINT}).Tested
GPU, driver and backend:
1002:73bf), Mesa RADV 26.3.1, GE-Proton11-14 (Linux 7.3.6)1002:164e), Mesa RADV 26.3.1, GE-Proton11-14 (Linux 7.3.6)Added coverage:
normalize_prebuild_geometry_converts_xbox_formats_only(runtime/d3d12/src/tests/device/ray_build.rs),tlas_dependencies_replace_retire_and_roll_backandtlas_dependencies_copy_and_roll_back(runtime/d3d12/src/tests/device/blas/guest_memory.rs).ray-tracing-guest-memory(examples/lanes/selftest.cpp): verifies a live TLAS still hits an evicted guest-memory BLAS after destroying the overwriting queue/allocator and reopening the earlier build list, then observes it as inactive once the scene is rebuilt.Commands run and their results:
Imported from brcly/TuxBox. Originally posted by DrArroway on 2026-11-29T09:44:00Z.
Rebased onto current
main(75453953) at361df2d4:#436,#442,#443, and#445:publish_lockedinruntime/d3d12/src/device/blas/guest_memory.rsnow maintains bothmappings.addressesandmappings.resources(removingmappings.resourceswhenpublish_refusedsets0).#445'sin_place/updated_extenttests,#443'sprivate_scratch, and#436'sunbuilt/withdraw/Sizes::Zeropaths alongside#455's TLAS-pinned storage lifetime and prebuild geometry normalization.ray_tracing_guest_memoryinexamples/lanes/selftest.cppto preserve both the#436unbuilt-copy checks and the TLAS-pinned survival check.Re-verified on
361df2d41002:73bf, RADV NAVI21, Mesa 26.3.1,GE-Proton11-14):python tuxbox.py check— all 11 steps passed (117/117Lanes & guest fixtures including all 7ray-tracing-*selftests,22/22D3D12 regression controls, shader translator on GPU, and all CPU/CI suites).1002:164e, RADV, Mesa 26.3.1,GE-Proton11-14):python tuxbox.py check— all 11 steps passed (116/116Lanes & guest fixtures,guest-present-4k-splashskipped on software display,22/22D3D12 regression controls, shader translator on GPU, and all CPU/CI suites).tuxbox-d3d12 --libvia Proton):357 passed; 0 failed; 8 ignored.1002:73bf, with#441+#439on top for the unrelated root-SRV fault and faster readbacks):403.9s, 30 consecutive 3D world frames (7548→7578), live BLAS churn across512+pools (3,700→2,784→3,854live allocations),0GPU faults /0VK_ERROR_DEVICE_LOST.Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-29T09:49:37Z.
Thanks for rebasing it so quickly. Two things:
tuxbox.py checkof361df2d4on an RTX 5090. It comes after my own checks, and I'll post the result, pass or fail.guest_memory.rsand its tests. From reading361df2d4, the same gap is in this branch, as onmain:publish_refusedremoves the published address and resource but not the entry intargets, sounbuilt()still sees a source with storage. It's a small change next to yours: withdraw the storage there and let the recording list keep what comes back. If yours lands first I'll rebase #461 on it, so there's nothing for you to do. I haven't run either on a GPU together.Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-29T11:35:56Z.
The NVIDIA full check of
361df2d4is done:python tuxbox.py checkon an RTX 5090 (620.70.10, GE-Proton11-14): 181 pass, 0 fail, including 7 ray-tracing selftests. This is a rerun with no game running, though small GPU shader tests of mine may have overlapped it; the first attempt was stopped by a game reaching its world.