diff --git a/docs/agents/symptoms.md b/docs/agents/symptoms.md index 84955c11..7db8bb33 100644 --- a/docs/agents/symptoms.md +++ b/docs/agents/symptoms.md @@ -55,6 +55,7 @@ GPU semantics behind the graphics rows: [maxwell.md](../maxwell.md). The method | Symptom | Usual causes | First check | |---|---|---| +| with `replay_workers` above 0: the picture freezes for good mid-play while the window still closes, or a crash in `chunk_record` reading address 0x8 | the chunked replay's state (`RP` in vk_exec.c) overwritten: the submitting thread waits in `chunks_submit` for a chunk no `vk replay` thread takes (fixed: `tfr_note` walked its oldest-way search past the set, and from the last set into `RP`) | `replay_workers = 0`; `--probe-vkexec`'s target history part | | device lost a few frames in, GPU writes to address 0 (older NVIDIA) | present from another thread or queue | every submit and present on one queue under one lock | | device lost or garbage on one AMD generation | views the driver branch mishandles (BC block views of 3D textures) | `vk: pass marks`, validation; the formats in the pass | | device lost on one scene, every run, one vendor | a shader or pass that driver cannot run | pass marks name the pass; skip shaders by hash to bisect | diff --git a/runtime/vk_exec.c b/runtime/vk_exec.c index d0649826..957f1eb3 100644 --- a/runtime/vk_exec.c +++ b/runtime/vk_exec.c @@ -528,15 +528,38 @@ static void tfr_note(const VkExecTarget *t, uint64_t stamp) { plat_mutex_lock(&tfr_lock); TargetFrames *e = tfr_find(t); if (!e) { - e = tfr_set(t); + // the way rendered longest ago, indexed from the set's start: the ways past the last set are RP's words + TargetFrames *s = tfr_set(t); + e = s; for (int i = 1; i < TFR_WAYS; i++) - if (e[i].last < e->last) e = &e[i]; + if (s[i].last < e->last) e = &s[i]; *e = (TargetFrames){t->image, t->level, t->base_layer, 0, 0}; } if (e->last != stamp) e->prev = e->last, e->last = stamp; plat_mutex_unlock(&tfr_lock); } +// --probe-vkexec: a new target noted into a full set takes the way rendered longest ago, and the set after it keeps +// its entries. The ways are stamped so that a search stepping from the way it picked last would leave the set. 1 when +// it holds; the two sets are cleared afterwards. +int vk_exec_tfr_check(void) { + VkExecTarget t[TFR_WAYS + 1]; + for (int n = 0, k = 1; n <= TFR_WAYS; k++) { + t[n] = (VkExecTarget){.image = (VkImage)(uintptr_t)k}; + n += tfr_set(&t[n]) == tfr[0]; + } + static const uint64_t last[TFR_WAYS] = {8, 7, 100, 6, 100, 100, 5, 100}; + TargetFrames next[TFR_WAYS]; + for (int i = 0; i < TFR_WAYS; i++) tfr[0][i] = (TargetFrames){t[i].image, 0, 0, last[i], 0}; + memcpy(next, tfr[1], sizeof next); + tfr_note(&t[TFR_WAYS], 200); + plat_mutex_lock(&tfr_lock); + int ok = tfr_find(&t[TFR_WAYS]) == &tfr[0][6] && !memcmp(next, tfr[1], sizeof next); + plat_mutex_unlock(&tfr_lock); + memset(tfr, 0, sizeof tfr[0] * 2); + return ok; +} + static int tfr_recent(const VkExecTarget *t, uint64_t stamp) { plat_mutex_lock(&tfr_lock); const TargetFrames *e = tfr_find(t); diff --git a/runtime/vk_exec.h b/runtime/vk_exec.h index 266c8aa9..bc98dcd1 100644 --- a/runtime/vk_exec.h +++ b/runtime/vk_exec.h @@ -222,6 +222,7 @@ void vk_exec_noatt_dims(const VkExec *ex, uint32_t *w, uint32_t *h); // pass s int vk_exec_targets_recent(VkExec *ex, int any); // The current pass's targets with their formats, extents and the frames they were last rendered in (diagnostics). void vk_exec_targets_describe(VkExec *ex, char *buf, size_t cap); +int vk_exec_tfr_check(void); // --probe-vkexec: a new target replaces a way of its own set; 1 when it does extern VkExecFrame vk_exec_frame; void vk_exec_frame_written(const tex_t *t); // vk_texture_gpu_written: t rendered or copied into diff --git a/runtime/vk_exec_probe.c b/runtime/vk_exec_probe.c index 825b47a6..e6574ef4 100644 --- a/runtime/vk_exec_probe.c +++ b/runtime/vk_exec_probe.c @@ -966,6 +966,8 @@ int probe_vkexec(void) { layouts_equal = 0; main_tid = plat_thread_id(); const GfxBackend *b = &gfx_vulkan_backend; + CHECK(vk_exec_tfr_check(), "a target noted into a full set of the target history did not take that set's oldest way"); + printf("probe-vkexec: target history part passed (a new target replaces the oldest way of its own set)\n"); uint64_t heap = 0; CHECK(mem_set_heap_size(16ull << 20, &heap) == 0 && heap, "SetHeapSize 16 MiB"); // Out-of-memory waits (oom.c): the first two staging buffers, the first texture image and the first draw-data chunk