Describe in docs/architecture.md how the game's submitting threads take turns, and bring nvn_call_note's comment, which said the front end relied on one thread at a time, up to date.

The submit path no longer relies on one guest thread at a time: replays take turns on the submission lock, a frame's
bookkeeping at its present runs between two replays (vk_frame_owed.h), a held present goes out once and in order
(vk_present_held.h), a second submission of a recording in flight gets a clone (nvn_submit_guard.h), and held work is
asked about from a published copy (vk_evo_peek.h). docs/architecture.md section 4 gets a bullet saying so, with the
switch and the log lines; the comment above nvn_api_core.c nvn_call_note now says what holds and that an overlap line
is a count, not a fault.

Checks that passed: pass_cc_check of nvn_api_core.c.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-13 19:13:23 -05:00
parent 518185b808
commit effdbd8dc0
2 changed files with 15 additions and 3 deletions

View File

@@ -710,9 +710,11 @@ static uint64_t lod_entered, lod_issued, lod_fence[LOD_RING];
// core given up (section 2.2), or queued for the replay thread (NX2NAVI_REPLAY_ASYNC, vk_backend.c); the newest fence
// value is what QueueFenceSync records. With the queue the fence covers replay and GPU, so the LOD guard below waits
// for both.
// NX2NAVI_TRACE=perf (nvn_api.h): which threads submit and present, and whether two of these calls run at once. The
// synchronous replay's front end (vk_backend.c submit_sync, vk_be_present's held present, nvn_submits_in_frame) takes
// no lock of its own, so it relies on one thread at a time; this tells a run whether that holds.
// NX2NAVI_TRACE=perf (nvn_api.h): which threads submit and present, and whether two of these calls run at once, which
// happens in play (at area changes). With the replay on the submitting threads they take turns where it matters:
// replays on the submission lock (vk_sync.c sub_lock), a frame's bookkeeping at its present between two replays
// (vk_frame_owed.h), a held present put out by one thread and in order (vk_present_held.h), and a second submission of
// a recording in flight on a clone of its own (nvn_submit_guard.h). An overlap line counts; it is not a fault.
void nvn_call_note(int present, uintptr_t q, int enter) {
if (!(rt_trace & RT_TRACE_PERF)) return;
static volatile int32_t inside;