Hand a pool's device address record to its new mirror by a store the GPU runs after the mirror's first copy.

The table still named a new mirror at record time, as the pages' twin: parts already handed to the queue wrote
through the table into the new block before its first copy, the same early access the delayed read was made to stop.
The reads then moved to the mirror some submissions later by a second change that took a second record, cleared its
note before it knew the record was there, and until it ran left the table's readers on guest memory, without what
other shaders had written into the mirror through a buffer binding.

Nothing is changed when the mirror is made now. The prologue that holds the mirror's first copy also holds a store
into the pool's record, after the copy: what was queued before it reads and writes guest memory through the table as
if no mirror existed, what comes after reads the mirror and writes both. No second record, no second change, no
window in which the table is behind. gpa_late = 0 still changes the table at once, as up to 0.9.2.

--probe-vkmem makes a mirror in a recorded submission and reads the table's own memory back: the page names the
mirror with guest memory as the twin, and the mirror holds the pool's bytes. tests\gpa_check.py runs the store as the
GPU would, before and after. A table with no record left now says so once in the log.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-12 22:18:14 -05:00
parent a8639f1cb6
commit e548180da2
6 changed files with 227 additions and 88 deletions

View File

@@ -24,9 +24,12 @@ uint32_t vk_gpa_remap(uint64_t lo, uint64_t hi, uint32_t old_rec, VkBuffer buf,
// The same without the twin: the pages name buf alone (a pool whose VRAM mirror is evicted goes back to its imported
// buffer).
uint32_t vk_gpa_remap_plain(uint64_t lo, uint64_t hi, uint32_t old_rec, VkBuffer buf, uint64_t buf_lo);
// The pages of [lo, hi) that name old_rec keep reading old_rec's buffer and get buf as their twin: shaders read the
// pool where they did and write buf too (a VRAM mirror until its first copy has run, vk_memory.c mirror_create).
// Returns the new record, or 0 when there is none to give or twins are off (old_rec then stays as it is).
uint32_t vk_gpa_remap_writes(uint64_t lo, uint64_t hi, uint32_t old_rec, VkBuffer buf, uint64_t buf_lo);
// Records into cb the store that hands record rec over to buf (a pool's new VRAM mirror) in queue order: what is
// queued after it reads buf through rec's pages, with the buffer they read before as the twin (keep_twin) or buf
// again; what was queued before it sees no change. 0 when nothing was recorded (no record, no table).
int vk_gpa_flip_cmd(VkCommandBuffer cb, uint32_t rec, VkBuffer buf, uint64_t buf_lo, int keep_twin);
// --probe-vkmem: the device addresses the table, read from its own memory, gives a shader for addr: the one it
// reads and the one it writes as well. 0 when no page maps addr.
int vk_gpa_probe(uint64_t addr, uint64_t *first, uint64_t *twin);
void vk_gpa_report(void);
void vk_gpa_shutdown(void);