- Replace TitleWritePolicy's O(N) std::map full scans in collect() and frame()
with unordered_map + O(1) swap-and-pop active vectors (hot_list_, dirty_list_,
history_active_), preserving promotion/demotion/probe/arm-failure semantics
and address-ordered collect() delivery (~0.001 ms/iter for 200k cold + 100 hot).
- Add writable flag (default true) to TitleVaAliases::resolve() plus optional
AccessResolver hook; call note_reached() iff writable && to != 0 so read-only
CBV/SRV root views do not queue GPU write-back for either aliases or mirrored
pages.
- Pass writable=false for root CBV/SRV and writable=true only for root UAVs in
d3d12_com.cpp; record explicit GPU buffer-write destinations (CopyBufferRegion,
CopyTiles, CopyTextureRegion to footprint, CopyResource buffer dst,
WriteBufferImmediate, AtomicCopyBuffer, ClearUnorderedAccessView buffer,
ResolveQueryData) and note them for write-back at ExecuteCommandLists.
- Add scale/correctness tests in title_write_policy_test.cpp and read-only vs
writable tests in title_va_alias_test.cpp.
AI-assisted: Antigravity (Gemini 4 Neon).
HotColdTracking (src/title_mirror_hot_cold.h) implements TitleMirrorTracking (watch, unwatch, collect) over the
geometry watch's cells with TitleWritePolicy, so it can replace GuardTracking with no change in the mirror:
collect() returns the pages written since the last collect, each armed again first, and every time the pages
written so often that they are left writable. One collect is one interval of the policy's history.
A hot page's probe is now armed at the collect after it is asked for and judged on the interval after that;
judged on the interval of the arming itself, a page written every interval looked quiet and was turned cold
(seven promotions and six demotions of one page in 200 intervals). Test title_mirror_hot_cold (Windows, real
guards and a handler that does what the layer's does first): the page written every interval stops faulting
(12 faults in 200 intervals, the warm-up and the probes), the page written every 10th faults 19 times, and the
copy the collects name equals the memory after every collect.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
guard_fault_bench (Windows, prints a table): VirtualProtect per call and per page from 4 KiB to 4 MiB, one write
fault through a minimal handler and through the geometry watch's cells on one thread and on eight, re-arming a
tile, GetWriteWatch on private memory and on a section view, and Linux's soft-dirty bits through Z:\proc\self.
Under Wine on this machine: a fault 2-2.5 us, a tile re-armed 3 us, VirtualProtect 1.3 us for 4 KiB and 8 us for
4 MiB in one call against about 1 us a page one call at a time; GetWriteWatch works on private memory (37 of 37
pages) and not on a section view (error 87, as on Windows); soft-dirty bits read back clear (not usable here).
The geometry watch's cells reopened a faulted tile page by page, a VirtualQuery and a VirtualProtect each (16 us
a fault): reopen() now does one query and one protect per region of equal protection (5.3 us; 5.8 us of wall
time a fault with eight threads faulting, from 24).
TitleWritePolicy (src/title_write_policy.h, portable): pages written in most intervals are left writable and
copied at every collect, the others guarded and copied once a write faults; a page is armed before it is named,
so a write during the copy is in the next collect; hot pages are probed (guarded for one interval) every 32. Test
title_write_policy: scripted (hot stops faulting, cold faults once an interval, a quiet hot page turns cold) and
randomised against a byte-exact reference, writes during the copy and refused guards included.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>