d3d12: keep scenes off title-memory structures the host could not build #406
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/406"
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 gtb-sbe on 2026-11-28T17:40:21Z.
Follow-up to #320, for two ways a structure in title memory could still end up unbuilt while a scene points at it.
Refused builds
build_destinationreserved and published a title-memory structure's storage before the build's inputs were translated. When the build was then refused (#375 refuses index formats the host can't read; an import can fail), the scene's instance fixup still found storage for that address: either nothing had ever been built into it, or it still held the structure the title had just replaced.acceleration structure build at ... refused (...); scene instances that use it are inactive.Scratch the host can't reach
In one ProjectScarlett run on my card, 5 BLAS builds were refused with
0x800701e7(ERROR_INVALID_ADDRESS). Their scratch is title GPU memory with no CPU backing the provider can import; that error comes from XMem's page backing lookup. Scratch in memory the title only reserved was worse:buffer_athas no buffer for uncommitted memory, so the scratch address went to vkd3d-proton raw.D3D12 leaves scratch contents undefined before and after a build, so nothing has to reach title memory. When the host can't reach the title's scratch, the build now gets private device-local scratch that the list keeps, with a bounded log line. Committed title scratch still goes through the import as before.
Tests
Two new Lanes scenarios, both tracing rays through
query.hlsl:ray-tracing-refused-structure: two BLASes in title memory are built and hit; the first is then rebuilt with 8-bit indices, which the provider refuses. The ray onto it must miss and the other must still hit.FAIL ... ray onto the refused rebuild: expected instance -1, found 7(the old triangle stays in the scene).PASS.ray-tracing-reserved-scratch: a BLAS in title memory built with scratch the title only reserved.FAIL ... did not finish within 2 seconds, with GPU page faults on the compute and gfx rings and a gfx ring reset.PASS.The scene-and-ray code they share is a small helper (
SceneProbe);ray-tracing-rehydrateis unchanged.ProjectScarlett
Title 1.0.2.1, offline, 3840x2160. RX 9060 XT, Mesa 26.2.6 RADV, GE-Proton11-14, no preload, this branch before the rebase, on
e380da1.Checks
RX 9060 XT (RDNA4), Mesa 26.2.6 RADV, kernel 6.18, Proton Experimental, on
de6af11(rebased on5de0e62).python tuxbox.py check --backend proton --adapter 1002:7590 --proton <Proton Experimental> --prefix <prefix> --windows-dxc <DXC 2026-09-29>: every GPU group passes (115 of 115 gates). The Python tests fail on one test,test_stage_baseline.GuestWatch.test_a_guest_that_died_stops_the_sandbox_instead_of_waiting_out_the_timeout(AssertionError: 0 != 'guest gone'). It fails the same way on5de0e62without this branch on my machine, and this branch doesn't touch it.python tuxbox.py verify --only lanes-selftest: all 25 scenarios pass. Both new scenarios fail with5de0e62's own provider, as described above.AI use
This branch was made with an AI coding agent (Claude Opus 5.5 via Claude Code, following
AGENTS.md). The agent traced the refused builds and the scratch errors in my run logs, wrote both provider changes, the Lanes scenarios and helper, and this description. I reviewed the changes before committing them. The Lanes runs and the checks above ran on my machine.No title files, shader bytes or logs included.
Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-30T04:12:27Z.
Heads-up: main just landed a large cleanup (up to
e5d2e913), so this PR needs a rebase.rustfmt.toml).unwrap(), lossyascasts and undocumentedunsafeoutside tests.cargo fmt --check, rustdoc with warnings denied, and Miri on the providers' unit tests.The least painful way is to format your branch first, so the rebase only shows real changes:
Then run
python tuxbox.py check --no-gpu, which now includes the format step.If clippy flags something new:
Fromfor widening,TryFromfor narrowing, and a mask for bit fields.unwrap(): use?, orexpectwith the reason it can't fail.unsafeblock: it needs a// SAFETY:comment.CONTRIBUTING's "Code checks" section lists the commands. Thanks!
Imported from brcly/TuxBox. Originally posted by gtb-sbe on 2026-12-01T12:39:17Z.
Closing this, since its changes are already on
main: #442 (refused builds leave their scene instances inactive) and #443 (private scratch where the host can't reach the title's) landed both commits. The README fix from the last commit is covered too, as the reserved-scratch row appears only once onmain. A rebase would leave an empty diff.Thanks @glovepost for picking them up!
Pull request closed