d3d12: fix placement run-cache invalidation on watch rearm and skip first-upload double digest #550
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/550"
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-29T21:40:54Z.
Summary
Follow-up fix for #495 (
38894edc) resolving a stale watch-invalidation bug incheck_sequential, a wasted double-digest pass on first mip upload, and the 4tuxbox-d3d12hardware placement unit-test failures onmain(2d6dc338, also noted on #512 / #514 / #518):CELL_WRITTENacrossWatch::rearmand skip the cached fast path when written (runtime/d3d12/src/device/placement/tracking.rs,guest_read.rs):check_sequentialpreviously calledbegin_check()(which callswatch.rearm(), clearing theWRITTENbit) before checkingself.watch_cacheable(), so aWRITTENwatch looked clean immediately afterward and kept reusing stale cached runs without reacquiring (section_watched_texture_caches_runs_and_invalidates_on_watch_or_mapping_change).Watch::rearmnow returns(reason, was_written)usingCELL_WRITTEN,check_sequentialgates its cached fast path withself.watch_cacheable(), and bothprepare_parallelandcheck_sequentialrequire!check.watch_written && self.watch_cacheable()(markingcheck.settled = truewhenprepare_parallelfalls through to the uncached path).digest_runson first mip upload (runtime/d3d12/src/device/placement/guest_read.rs):check_mips_speculativepreviously randigest_runseven whenprevious[level]wasNone, counting twoStep::Digestoperations for a brand-new upload (check_chunk_collects_all_changes_and_merges_profileandcheck_chunk_runs_xmem_access_only_on_caller_threadmeasured 128 vs 64).previous[level]isSome(prev)and copies directly before computingDigest::of(&bytes)once whenprevious[level]isNone.check_chunkcalls in test (runtime/d3d12/src/tests/device/placement/check_pool.rs):check_chunk_reuses_cached_runs_and_retries_active_mapping_statenow records returnedchange.digestvalues intocontents.previous[change.level]after the initial and mutatedcheck_chunkpasses, matchingupload::commit.Tested
d3d12-placementregression control + the 4 fixedtuxbox-d3d12hardware unit tests)Commands & Results
tuxbox-d3d12 --libunder GE-Proton11-14 withvkd3d-proton(hardware adapter enabled):1002:73bf): 435 passed, 0 failed, 8 ignored (up from 431 passed / 4 failed onmain2d6dc338).1002:164e): 435 passed, 0 failed, 8 ignored.tuxbox.py checkon RX 6900 XT (1002:73bf, Mesa RADV, GE-Proton11-14,3d12a893):Build the shader compiler,Python tests,Shader compiler tests,DXBC tests,XG layout tests,Storage codec tests,D3D12 Windows typecheck,Build, 126/126 Lanes + fixtures (lanes-benchmark PASS pci=1002:73bf submit_us=92.4 roundtrip_us=143.9 copy64k_us=128.6 frame_us=258.4 frame_p99_us=501.5 shader_pipeline_us=417.0 dxil_pipeline_us=234.8), 22/22 D3D12 regression controls includingplacement, 66/66 shader translator GPU checks).tuxbox.py checkon AMD Raphael iGPU (1002:164e, Mesa RADV, GE-Proton11-14,3d12a893):1skipped;lanes-benchmark PASS pci=1002:164e submit_us=70.3 roundtrip_us=125.6 copy64k_us=90.3 frame_us=285.4 frame_p99_us=362.9 shader_pipeline_us=419.6 dxil_pipeline_us=247.7), 22/22 D3D12 regression controls, 66/66 shader translator GPU checks).main(2d6dc338) + this fix (default section mode): ran 54.6 min (3279.6s,93,278total presents;placement resolve70.8–302.0 ms / 5sacross555k–866ktexture checks;unwatched=0/0.0MiB; ended on the pre-existing#389host-pageTCPfault).#501(cbb6a2df,TUXBOX_XMEM_PRIVATE_VIEWS=1) +#389(3ea19fe+#441additions +walk_committed_run): ran 584.7s (15,653total presents,4–5 frames / 12 sin world;0GPUVM faults,0shadows (section=0/0.0MiB),placement resolve49–136 ms / 5s,placement digest168–472 ms / 5s,unwatched=0/0.0MiB).Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-29T22:13:32Z.
Merged as
038c478donmain(squashed into one commit). The full check passed on an RTX 4070 Ti SUPER and a Radeon 610M. Thanks!Pull request closed