xmem, d3d12: cache placement backing runs across clean section-backed textures #495

Merged
DrArroway merged 1 commit from upstream-pr/495 into main 2026-11-29 18:28:37 +00:00
DrArroway commented 2026-11-29 16:48:14 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by DrArroway on 2026-11-29T16:48:14Z.


Summary

  • Export TuxBoxPhysicalMappingState (MappingMutationGuard seqlock around physical page mapping, unmap, free, copy-mappings, arena allocation, deferred-unmap flush, and secondary-alias promotion mutations).
  • Cache resolved RunMaps lock-free on clean XMem-monitored and non-XMem placed textures using cached_xmem / cached_not_xmem + cached_not_xmem_state seqlock validation, skipping redundant TuxBoxAcquirePhysicalBacking FFI calls when section-backed / clean textures undergo repeated in-place digest checks.
  • Track UNMONITORED watch cells and cache contiguous own_region_span / empty_aperture_span bounds in xmem::physical_pages::tracking to cut rearm syscall/BTree overhead, skip empty flush_deferred_unmaps calls, and throttle trace_backing_stats.
  • Add lock-free mapped_first / checked_gen residency checks (Images::generation) and widen CheckPool worker cap from 6 to 12 with 1024-texture chunks.
  • Related to #472 (reduces placement resolve and digest-loop overhead in section-backed 3D world frames).

Verification

  • Wine Rust unit tests (GE-Proton11-14):
    • tuxbox-xmem (physical_pages): 32 passed, 0 failed, 1 ignored (scan_cost).
    • tuxbox-d3d12 (device::placement): 99 passed, 0 failed, 7 ignored.
  • tuxbox.py check on RX 6900 XT (1002:73bf, Mesa RADV, GE-Proton11-14):
    • All CI code checks, builds, Lanes + guest fixtures (126/126 passed; lanes-benchmark: submit_us=116.7 roundtrip_us=155.5 copy64k_us=163.1 frame_us=268.8 frame_p99_us=522.4), all 22/22 D3D12 synthetic regression controls, and shader translator GPU checks passed.
  • tuxbox.py check on AMD Raphael iGPU (1002:164e, Mesa RADV, GE-Proton11-14):
    • All CI code checks, builds, Lanes + guest fixtures (125/125 passed; lanes-benchmark: submit_us=68.7 roundtrip_us=118.9 copy64k_us=95.7 frame_us=286.7 frame_p99_us=330.1), all 22/22 D3D12 synthetic regression controls, and shader translator GPU checks passed.
  • ProjectScarlett live run (RX 6900 XT, default section-backed #464 mode, TUXBOX_SUBMIT_PROFILE=1):
    • 3D world placement dropped from 245.5 ms/batch to 137.3 ms/batch (resolve = 5.08 ms/batch, read = 1.48 ms/batch, late world 4.7–12 s/frame vs 12–23 s/frame baseline).
<!-- greyfinch-sync:brcly/TuxBox:issue:5552887488 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/495). Originally posted by [DrArroway](https://github.com/DrArroway) on 2026-11-29T16:48:14Z. --- ## Summary - Export `TuxBoxPhysicalMappingState` (`MappingMutationGuard` seqlock around physical page mapping, unmap, free, copy-mappings, arena allocation, deferred-unmap flush, and secondary-alias promotion mutations). - Cache resolved `RunMap`s lock-free on clean XMem-monitored and non-XMem placed textures using `cached_xmem` / `cached_not_xmem` + `cached_not_xmem_state` seqlock validation, skipping redundant `TuxBoxAcquirePhysicalBacking` FFI calls when section-backed / clean textures undergo repeated in-place digest checks. - Track `UNMONITORED` watch cells and cache contiguous `own_region_span` / `empty_aperture_span` bounds in `xmem::physical_pages::tracking` to cut `rearm` syscall/BTree overhead, skip empty `flush_deferred_unmaps` calls, and throttle `trace_backing_stats`. - Add lock-free `mapped_first` / `checked_gen` residency checks (`Images::generation`) and widen `CheckPool` worker cap from 6 to 12 with 1024-texture chunks. - Related to #472 (reduces placement resolve and digest-loop overhead in section-backed 3D world frames). ## Verification - **Wine Rust unit tests (`GE-Proton11-14`):** - `tuxbox-xmem` (`physical_pages`): 32 passed, 0 failed, 1 ignored (`scan_cost`). - `tuxbox-d3d12` (`device::placement`): 99 passed, 0 failed, 7 ignored. - **`tuxbox.py check` on RX 6900 XT (`1002:73bf`, Mesa RADV, GE-Proton11-14):** - All CI code checks, builds, Lanes + guest fixtures (**126/126 passed**; `lanes-benchmark`: `submit_us=116.7 roundtrip_us=155.5 copy64k_us=163.1 frame_us=268.8 frame_p99_us=522.4`), all **22/22** D3D12 synthetic regression controls, and shader translator GPU checks passed. - **`tuxbox.py check` on AMD Raphael iGPU (`1002:164e`, Mesa RADV, GE-Proton11-14):** - All CI code checks, builds, Lanes + guest fixtures (**125/125 passed**; `lanes-benchmark`: `submit_us=68.7 roundtrip_us=118.9 copy64k_us=95.7 frame_us=286.7 frame_p99_us=330.1`), all **22/22** D3D12 synthetic regression controls, and shader translator GPU checks passed. - **ProjectScarlett live run (RX 6900 XT, default section-backed `#464` mode, `TUXBOX_SUBMIT_PROFILE=1`):** - 3D world `placement` dropped from `245.5 ms/batch` to `137.3 ms/batch` (`resolve = 5.08 ms/batch`, `read = 1.48 ms/batch`, late world `4.7–12 s/frame` vs `12–23 s/frame` baseline).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
brcly/TuxBox!495
No description provided.