dxbc: trace more image stores, so fewer batches copy back a whole heap #460
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/460"
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 NickStallman on 2026-11-29T08:54:27Z.
Summary
A program whose image writes can't be traced makes every writable texture of its heap count as written, and each is copied back after the batch. In ProjectScarlett's world a few programs do this for 504 textures (939 MiB per batch).
Two rules gave up on what the code settles, and a third case is now followed:
Over 19,051 distinct recorded programs (
table_image_writes), unknown ones go from 211 to 141 (compute 91 to 21, pixel 120 to 120). No known program changed, and every slot named is one the program's own records declare.TUXBOX_CHECK_NARROWED=1tests the result at run time: it copies back what a batch is taken not to write, compares, and logs a change. It is heavier than normal play and skips batches with label waits.Measured in ProjectScarlett (RTX 5090,
mainat28717263plus #436, #389, #390 and diagnostics; one run each, warm)Weak evidence: the run with the change ended about 44 s into the world, against 64 s, so it didn't reach as far into the world, and both are single runs. An earlier version of this branch (compare and path rules only). Offline, 15 to 28 of the 34 batches were expected to remain, because 119 recorded pixel programs pick a UAV by a constant-buffer index and can't be traced; two of them appear in that run's log. The likeliest reason fewer remained is that this run reached a shorter, earlier scene (44 s in the world, one such batch) than the one without (64 s, 14 of them), so the 1 of 339 shouldn't be read as the result. Most of those 339 batches also lie before the world.
Not claimed
Tested
python tuxbox.py check --no-gpu: passed on this head.tuxbox.py checkon6ac9fbf7: RTX 5090 (620.70.10) 185 pass, 0 fail; AMD iGPU (1002:13c0, RADV) 184 pass, 0 fail, guest-present-4k-splash skipped (software display). Both includebindless-table-compareandbindless-table-select, wide and constrained. Those two were not run againstmain's tracer on a GPU; offline it returns unknown for both and this change names their slots.6ac9fbf7: brcly,lanes-bindless-compute22/22 on an RTX 4070 Ti SUPER and a Radeon 610M, in a build with #439 and #462. DrArroway on an RX 6900 XT,lanes-bindless-compute20/20 and a game run of the check mode:changed=0over 1,461 mips. That compared 2 batches only and skipped 14,202 textures whose publication was pending, so it is a small sample.changed=0over 7,966 mips, 11 batches compared, 10,408 skipped.With #439: #439 shares one readback buffer per queue, relying on the queue waiting for each publication. The check mode's copies have no such wait, so with both merged the next readback could overwrite them and log false changes. Whichever merges second should give the check its own buffer. Normal play isn't affected.
This changes
runtime/dxbc, so the next launch prepares again; the translator is unchanged.🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-29T10:19:52Z.
Tested combined with #439 and a heap write bitmap for what this can't trace (#462, stacked on both), on an RTX 4070 Ti SUPER (620.73.04) and a Radeon 610M (RADV 26.3.1), GE-Proton11-14:
lanes-bindless-compute: 22/22 on both cards, including yourtable-compareandtable-select.lanes-raster-tables8/8,d3d12-placement,lanes-selftest27/27 on NVIDIA.--lib376 under Wine, Python 635: all pass.I'd independently landed on the same two rules (odd compare destination, slot sets over paths) before seeing this, and dropped mine for yours since it also follows the lane spills and adds the check mode. Over our recorded corpus mine got compute from 91 to 25; yours gets 21.
In ProjectScarlett the programs left untraced are pixel shaders in mesh pipelines (store slot from a constant buffer), so the 504-texture batches persist without #462. With both, the world load shows no whole-heap batch.
One interaction to know about: #462 puts the textures a bitmap may name in read-only ranges, so it passes them to
narrowed::chooseas writes to keep the check mode from flagging them.Could this come out of draft? #462 needs it on
mainfirst.Imported from brcly/TuxBox. Originally posted by DrArroway on 2026-11-29T10:21:09Z.
Tested
#460(6ac9fbf7) on AMD Radeon RX 6900 XT (1002:73bf, RADV NAVI21, Mesa 26.3.1, Linux 7.3.6,GE-Proton11-14), built onmain(75453953) +#455(361df2d4) +#441(f244a687) +#460(6ac9fbf7, without#439for standalone & check-mode runs, plus a separate normal-play run with#439962a1cee).1. Targeted AMD Checks (
1002:73bf)cargo test -p tuxbox-dxbc --features native-bindings:93 passed; 0 failedtuxbox.py verify --only lanes-bindless-compute:20/20 PASS(includinglanes-bindless-table-compare-wide,lanes-bindless-table-compare-constrained,lanes-bindless-table-select-wide,lanes-bindless-table-select-constrained)2. ProjectScarlett
TUXBOX_CHECK_NARROWED=1Run (389.9s,113D frames in67s,0GPU faults)narrowed write check: batches copied=2 textures chosen=967 mips compared=1461 changed=0 skipped=14202, in allchanged=0across1,461compared mips (967textures).batches copiedstopped at2whileskippedreached14,202: the remaining pixel-program939.3 MiB / 504 texturesdumps keep overlapping publications pending on the worker, sonarrowed::choose()skips subsequent doubted textures while those publications are still in flight.3. ProjectScarlett 4-Point 3D World Comparison (
TUXBOX_SUBMIT_PROFILE=1)#439/#460)#460alone (492.7s)#439alone (623.6s)#460+#439normal (361.3s)21/174s(8.29 s/f,0.121 FPS)12/66s(5.50 s/f,0.182 FPS,1.51×faster)27/107s(3.96 s/f,0.252 FPS)25/88s(3.52 s/fincl. transition; steady16/76s=4.75 s/f)placement publication83.2%wall, avg685.9 ms(~3,435 MiB/frame)70.7%wall, avg435.6 ms(~1,699 MiB/frame,50.5%less)42.0%wall, avg165.0 ms30.8%wall, avg123.7 ms(max816.3 ms)342.0 MiB(240batches)193.7 MiB(144batches,43.4%less)346.8 MiB(306batches)178.6 MiB(226batches)189(88.7 GiB,21.2%)100(29.4 GiB,30.6%)32(1.50 GiB,89.5%) (0in steady state)61(11.7 GiB,73.0%)DEVICE_LOST0000Notes
#460cuts published MiB per 3D frame in half (~3,435→~1,699 MiB/frame) and speeds up 3D frames by~1.51×.#439,placement publicationdrops to30.8%of wall time (123.7 ms/batch). However, because#460narrows compute batches into varied medium sizes (~269 MiB, etc.) while the remaining pixel-program batches still dump939.3 MiB,#439's per-size readback pool begins churning again (~1.4 GiB / 5s,61buffers created /11.7 GiBvs32/1.50 GiBwith#439alone), pushingdirectqueueplacement=from503–684 msup to840–1,139 ms/5s.Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-29T10:49:51Z.
Thank you both. @brcly: yes. The full check of
6ac9fbf7is running now on an AMD iGPU and follows on an RTX 5090; I'll take this out of draft when both pass, and post it if one doesn't. #439 is already out of draft.The pixel shaders #462 covers are the part I couldn't do: I'd only logged that the index stayed the same over 30 draws on the 5090, with a possible GPU write I couldn't rule out, so recording the slots is better and I've dropped mine. I'll run #462 in the game on the 5090.
@DrArroway:
changed=0over 1,461 mips is the first result the check mode has given; with 2 batches copied it's a small sample, as you say, so I'll put it in the description as that. The pool churn with #439 is worth knowing: the pool is per size, and #460 makes the sizes vary.Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-29T11:48:46Z.
First
TUXBOX_CHECK_NARROWED=1game run on NVIDIA (RTX 5090, 620.70.10; your #462 with this, onmain75453953, plus #455, #441, #440, #390, #459), one run, about 50 s of the world:batches copied=11 textures chosen=5283 mips compared=7966 changed=0 skipped=10408, in allNo missed write in what it compared. Two windows in this run did show the 504-texture set, which the run before without the check mode never did; I think those are the check's own copies, but I haven't confirmed it. The run then ended in a GPU MMU fault (Xid 13), as the one without the check did.
The check has its own readback buffer in that build (the collision with #439 I mentioned).