mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 08:39:57 -04:00
Add wb_probe = 1, which finds out who reads what the GPU wrote back into guest memory.
Per-pass GPU timestamps put the write-back of GPU-written storage buffers at 3.6 to 5.3 ms of GPU time a frame in play, against 1.8 to 2.5 ms for all of the game's own passes and dispatches: about 67 MiB a frame goes from the mirrors back into guest memory, from the same eleven pools all session, in case the CPU or a host path reads it. Nothing said whether anything does. With wb_probe = 1 the 2 MiB regions that lie wholly inside a range just written back are made inaccessible. The first read or write of such a region faults; the handler gives the region back the protection it had (read-only when frozen, else read-write), notes the address, the instruction and the thread, and the access runs again. The bytes are in guest memory all along, so nothing changes for the game. A log block every perf window gives the regions armed, the probes a read or a write ended, and the first accesses by instruction. Every thaw ends the probe of its region first, which covers file reads into guest memory and mapping changes; a file write from guest memory thaws its buffer while the probe is on; a probed region is not frozen anew. The platform layer gets a hook for every read or write access fault beside the write-fault hook; it is installed only with the setting. --probe-gfx-abi checks that nothing is armed without it and, run with NX2NAVI_WB_PROBE=1, that reads and writes end a probe and run again, that a frozen region thaws after it and that mem_thaw ends and holds. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -1146,7 +1146,10 @@ static void gpu_written(uint64_t addr, uint64_t size, int back) {
|
||||
}
|
||||
|
||||
void vk_gpu_written(uint64_t addr, uint64_t size) { gpu_written(addr, size, 0); }
|
||||
void vk_gpu_written_back(uint64_t addr, uint64_t size) { gpu_written(addr, size, 1); }
|
||||
void vk_gpu_written_back(uint64_t addr, uint64_t size) {
|
||||
gpu_written(addr, size, 1);
|
||||
mem_probe(addr, size); // NX2NAVI_WB_PROBE: the bytes are in guest memory now; note who reads them next
|
||||
}
|
||||
|
||||
int vk_mem_mirrored(uint64_t addr, uint64_t size) {
|
||||
VkMemSpan sp;
|
||||
@@ -2426,6 +2429,7 @@ static void mirror_log(uint64_t frame) {
|
||||
ww_last = frame;
|
||||
uint64_t fz, ff, ft, fo;
|
||||
mem_freeze_stats(&fz, &ff, &ft, &fo);
|
||||
mem_probe_report(frame);
|
||||
if (rt_trace & RT_TRACE_PERF)
|
||||
rt_log("mem: write-watch frame %llu: per frame, every consumer: %.1f queries over %.1f MiB, %.3f ms (%.1f found "
|
||||
"%.0f written pages, %.3f ms); frozen %.0f MiB; since the last line: freezes %llu, thaws by a write %llu, by a file read "
|
||||
|
||||
Reference in New Issue
Block a user