d3d12: publish only the textures a heap write bitmap names #462
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/462"
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 brcly on 2026-11-29T10:19:31Z.
Summary
Builds on #439 and #460, both now on
main.A program that picks its image store's view from the resource heap at run time can write any texture with a view there. #460 traces most compute programs; what it cannot trace (all 120 pixel programs of this kind in ProjectScarlett, which store through a heap slot read from a constant buffer, and a few compute ones) still makes every writable texture in the heap count as written. In the world load that is 504 textures, 939 MiB, read back per batch.
This has the translation record the slots instead:
heap_writesfixes a bitmap layout: a root UAV atu0, space32766, bit 0 for a store whose slot is unknown, bitn + 1for guest slotn, 2^20 bits.heap_writes_variantappends it to an embedded root.bindless-heap-slot, below.Measured
ProjectScarlett, RTX 4070 Ti SUPER, warm caches,
mainat75453953with #439 and an earlier form of #460's tracing, one run, world load:What remains are textures the GPU did write; not reading those back at all is #413's ground.
Tested
Run the checks relevant to this change.
bindless-heap-slotfails onmain("the provider wrote back the texture at another heap slot: 4096 of 65536 title words replaced") and passes with this, in both the wide and the constrained (paged) trial, on both cards. The mesh-pipeline path has no Lanes scenario of its own; it was exercised in ProjectScarlett, and the existing mesh and raster scenarios pass.GPU, driver and backend:
10de:2705), 620.73.04, GE-Proton11-141002:13c0), Mesa RADV 26.3.1, GE-Proton11-14Commands run and their results:
🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by DrArroway on 2026-11-29T10:45:04Z.
Tested
#462(002ef885) on AMD (GE-Proton11-14, Mesa RADV 26.3.1, Linux 7.3.6).1. Missing AMD
verifySuites on Pure002ef885Ran on both AMD RX 6900 XT (
1002:73bf) and AMD Raphael Radeon 610M (1002:164e): 59/59 PASS on both cards2. ProjectScarlett 1.0.2.1 (3840×2160, offline, RX 6900 XT
1002:73bf,TUXBOX_SUBMIT_PROFILE=1)Built from
main(75453953) +#455(361df2d4) +#441(f244a687) +#462(002ef885, clean merge):606.3stotal,0GPU faults /0VK_ERROR_DEVICE_LOST.#439/#460/#462)#439alone (962a1cee)#462(002ef885)8.29 s/f(0.121 FPS)3.96 s/f(0.252 FPS)3.84 s/f(25frames /96s; steady22/83s=3.77 s/f,0.265 FPS)939 MiB) windows24/380/18(eliminated completely)939.3 MiB / 504 tex939.3 MiB / 504 tex270.1 MiB / 79 tex342.0 MiB346.8 MiB51.9 MiB(264batches,13,706.0 MiB,145.5 MiB/s)9.5%changed9.0%changed69.1%changed (9,156.0 MiBchanged vs4,095.0 MiBunchanged)placement publicationwall %83.2%(avg 685.9 ms)42.0%(avg 165.0 ms)22.6%(21.67s / 95.9s, avg85.6 ms, max480.5 ms)texture readbackbuffers3,247 MiB216–712 MiB(56created /5,591.7 MiB,208reused =78.8%)What Remains on RADV
With
placement publicationdown to22.6%of wall time, the dominant cost per frame on RADV shifted to CPUplacementsubmit prep on thecompute(1.34–2.58 s / 5s, max447 ms) anddirect(0.67–1.16 s / 5s, max236 ms) queues — driven byplacement scan(11.5%wall,11.04s / 95.9s) andplacement digest(7.8%wall,7.48s / 95.9s, hashing118,074.9 MiBacross95.9sbecausehost imports disturb the write watch on game memoryon RADV).Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-29T11:00:46Z.
Two things from reading this while building it together with #390, #441, #455 and #459 for a 5090 run (not run yet, and I have no test for either):
A mesh pipeline whose pixel stage keeps its root-less translation.
mesh_table::reflectedsetsheap_writesfrom the program's untraced stores. Instream::create, if neither attempt gives a variant ontable.pixel_rootthat isprepared,rooted[1]staysNoneand the stage runs root-less, so it can't write the bitmap, but the table still hasheap_writes. The draw would then be taken to record its stores in a bitmap that stays empty, and nothing would be copied back for it. Clearingheap_writesthere falls back to counting the whole heap, as without the PR. I did that in my build, after the second attempt:Whether a title program hits it I don't know: 167 of the 174 recorded programs I could form a bitmap variant of do translate (the 7 others are refused).
#460's check mode with #439's shared readback. The check records its copy into the queue's shared buffer, but nothing makes the next readback wait for the check, so it can overwrite what the check compares. Only with
TUXBOX_CHECK_NARROWEDset. Its own buffer fixes it; I'll send that for whichever of the two lands second.#460 is out of draft now: full checks passed on an RTX 5090 (185) and an AMD iGPU (184).
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-29T11:31:06Z.
First run on an RTX 5090 (620.70.10, GE-Proton11-14): your branch with #455, #441, #440, #390, #459 and a few diagnostics, on
main75453953. One run.mainat28717263) had it in 7 of the 11 windows of its world.Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-29T11:36:31Z.
Thanks both.
@NickStallman, the mesh case is fixed in
cb11fafbas you suggested: after both pixel-root attempts, a mesh pipeline whose pixel stage kept its root-less translation dropsheap_writes, so its draws count the whole heap as before. Only mesh pipelines can reach it: on the vertex/pixel path a missing translation for the reflected root already keeps the guest root or refuses the stream, and compute fails without one. I have no test that forms that case either;lanes-raster-tables8/8,d3d12-mesh,lanes-bindless-compute22/22 and the d3d12--libtests (376) still pass on the 4070 Ti SUPER. The check-mode buffer is yours, agreed.@DrArroway, thank you for the AMD suites, which fill what the description said was missing, and for the RX 6900 XT table. The scan and digest cost you found is where I'll look next for frame time.
Imported from brcly/TuxBox. Originally posted by 1093i3511 on 2026-11-29T11:42:34Z.
#462 on 8 GB, as @NickStallman asked on #413. RX 6600 (
1002:73ff, 8 GB, RADV, Mesa 26.3.1, Linux 7.3.6, GE-Proton11-14). The build is #462 at002ef885, so beforecb11fafb, onmain75453953, without #455 or #441. Default settings, so the write watch is on. Offline, 3840x2160. I did two runs: the first one cold for the new bitmap variants, the second one warm.On this card, #462 removes what ended our runs. All numbers are for the 5 s windows after world entry:
main2871726/75453953(8 runs today)reused=6–13Not enough memory for command submission!On
main, GTT reached the full 16 GB within 15–40 s of world entry. Twice, the kernel then refused the compositor's command submissions and the desktop went down. With #462, GTT stays flat at 10.6–11.3 GB in the world.Both runs still ended on the title's watchdog, 33–35 frames into the world:
The world frames come every 10–19 s. That's no faster than
mainwithTUXBOX_PLACEMENT_WATCH=0, and 3–5× slower than @DrArroway's 3.8 s per frame on the 6900 XT. So the run now stays in the world for 160–170 s instead of 10–40 s, but it doesn't get past the watchdog.Two observations for the frame-time work:
VRAM is full in the world. The card holds 8.2 of 8.6 GB, and the game asks for 7.6–7.9 GB with 7.25 GB of that resident. RAM grows to 28.2 of 32 GB and swap to 13.5 GB, and the audio drops out as they grow. So part of our slower frame pace is probably memory pressure that a 16 GB card doesn't have.
The write watch slows the start, with #462 too. Presents per 10 s from startup:
mainwithTUXBOX_PLACEMENT_WATCH=0: 911–994 and 882–938 in the first two windows.The Rockstar logo plays slower, with audio dropouts. This may be the same
placement scan/placement digestcost that @DrArroway found on RADV (host imports disturb the write watch on game memory), showing up before the world already on a smaller CPU budget. That's a guess; I haven't profiled it yet.Next on this card: a
TUXBOX_SUBMIT_PROFILE=1run of #462, in the first minutes and in the world, with the watch on and off, to put numbers on point 2. After that, #455 on top of #462. With #462 the runs now stay in the world long enough to show whether the occasional host-page fault frommainis still there.Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-29T13:17:12Z.
A caveat on the RTX 5090 game runs I reported here and on #460, #464 and #457: those builds also contained my #459, which turns out to compute wrong values in some mesh programs on NVIDIA. The readback sizes and counts don't depend on it, but how far each run got, and what ended it, aren't evidence about
main. I'll rerun without it.