diff --git a/nx2navi.ini.example b/nx2navi.ini.example index 2f1b76c5..9c414006 100644 --- a/nx2navi.ini.example +++ b/nx2navi.ini.example @@ -78,14 +78,15 @@ # Windows timer resolution of 1 ms for steadier frame pacing (0 = the Windows default). # timer_1ms = 1 # The thread that records the GPU work (the first to spend half a second doing it, not the one that submits first) keeps -# the highest scheduling priority (recorder_prio), and a core of its own that the process's other threads stay off -# (recorder_core: auto = with 12 or more logical processors, unless the game runs on the cache die below, 1 always, -# 0 never). That is a fast core, with both of its -# logical processors: on Windows the highest-numbered core of the fastest efficiency class; on Linux the performance -# core that clocks highest on a hybrid CPU (else the core of the highest capacity or clock), and none when fewer than -# four cores are that fast. The log names the thread and its logical processors. +# the highest scheduling priority (recorder_prio), and can get a core of its own that the process's other threads stay +# off (recorder_core: 0 = never, the default; auto = with 12 or more logical processors, unless the game runs on the +# cache die below; 1 always). That is a fast core, with both of its logical processors: on Windows the highest-numbered +# core of the fastest efficiency class; on Linux the performance core that clocks highest on a hybrid CPU (else the core +# of the highest capacity or clock), and none when fewer than four cores are that fast. The log names the thread and +# its logical processors. Default 0: on an i9-14900KF the reserved core left the woken replay thread unscheduled for +# about 200 ms roughly once a second. # recorder_prio = 1 -# recorder_core = auto +# recorder_core = 0 # Submissions handed to the GPU queue together in one call, 1 to 16 (1 = each one at once). # submit_batch = 4 # Occlusion query results are read back from the video card in batches, 0 or 1. Default: on. 0 reads each query with a diff --git a/runtime/cfg.c b/runtime/cfg.c index 8559993b..9ac007bb 100644 --- a/runtime/cfg.c +++ b/runtime/cfg.c @@ -255,7 +255,7 @@ static const CfgMeta metas[] = { {"DYN_RES", "0", "0|1", LIVE}, {"DYN_RES_TARGET", "16.7", "1..100", LIVE}, {"DYN_RES_STEP", "45", "8..600", LIVE}, // the recording thread: a core of its own (auto: with 12 or more logical processors) and the highest priority // (vk_exec.c rec_claim) - {"RECORDER_CORE", "auto", "auto|0|1", RESTART}, {"RECORDER_PRIO", "1", "0|1", RESTART}, {"REPLAY_TIME", "0", "0|1", RESTART}, {"LOCK_TIME", "0", "0|1", RESTART}, {"POOL_CREATE_BUDGET", "16", "1..4096", RESTART}, {"POOL_CREATE_MS", "6", "0..100", RESTART}, {"POOL_FINI_IDLE", "0", "0|1", RESTART}, {"FREEZE_BUDGET_US", "1000", "0..100000", RESTART}, {"POOL_LOAD_BACKLOG", "512", "0..65536", RESTART}, {"POOL_LOAD_MS", "50", "1..1000", RESTART}, + {"RECORDER_CORE", "0", "auto|0|1", RESTART}, {"RECORDER_PRIO", "1", "0|1", RESTART}, {"REPLAY_TIME", "0", "0|1", RESTART}, {"LOCK_TIME", "0", "0|1", RESTART}, {"POOL_CREATE_BUDGET", "16", "1..4096", RESTART}, {"POOL_CREATE_MS", "6", "0..100", RESTART}, {"POOL_FINI_IDLE", "0", "0|1", RESTART}, {"FREEZE_BUDGET_US", "1000", "0..100000", RESTART}, {"POOL_LOAD_BACKLOG", "512", "0..65536", RESTART}, {"POOL_LOAD_MS", "50", "1..1000", RESTART}, // held submissions handed to the queue together (vk_sync.c, submit batching) {"SUBMIT_BATCH", "4", "1..16", RESTART}, {"CACHE_DIE", "1", "0|1|ab", RESTART}, {"ONE_PER_CORE", "0", "0|1|ab", RESTART}, // perf.c cpu_placement diff --git a/runtime/vk_exec.c b/runtime/vk_exec.c index c82cc622..95584614 100644 --- a/runtime/vk_exec.c +++ b/runtime/vk_exec.c @@ -2380,10 +2380,15 @@ static const op_hdr *walk(VkExec *ex, const op_hdr *h, int depth) { // scheduler prefers it over the guest's other cores (NX2NAVI_RECORDER_PRIO=0 leaves the guest's priorities alone) and // gets a core of its own (plat_cpu_reserve): every other thread of the process, the guest's cores, the audio, the // shader and pipeline workers, is kept off it, so nothing of this process preempts the recording. That core is then -// lost to the rest, so NX2NAVI_RECORDER_CORE=auto (the default) reserves it only with 12 or more logical processors, -// and not while the process runs on the die with the largest L3 alone (perf.c cpu_placement): on a two-die X3D part -// the game's threads already have that die to themselves, and a core taken from them cost frames; 1 always, 0 never. -// Linux reserves none with fewer than four fast cores. +// lost to the rest, so NX2NAVI_RECORDER_CORE=auto reserves it only with 12 or more logical processors, and not while +// the process runs on the die with the largest L3 alone (perf.c cpu_placement): on a two-die X3D part the game's +// threads already have that die to themselves, and a core taken from them cost frames; 1 always, 0 never. Linux +// reserves none with fewer than four fast cores. +// 0 is the default: on an i9-14900KF (8 performance and 16 efficiency cores, 32 logical processors) with the replay on +// its own thread, the reserved core (logical processors 14 and 15) left the woken replay thread unscheduled for about +// 200 ms roughly once a second while the game stood in Kakariko: its queue held 40 to 50 items, its lock was free, the +// wakes had been sent and it used no CPU time, while the game waited on a fence of the work in that queue (27 frames a +// minute with a 150 ms or longer frame). With no core reserved the same minute had none. // The recording thread is not the first to call vk_exec_record: the game's main thread submits first and goes on // submitting a little at a time, while another guest thread does the work (Kokiri Forest: that thread spent 21.9 of // the 22.5 s the replay took in a minute and a half, the first one 0.5 s). The first thread to have spent @@ -2414,6 +2419,8 @@ static void rec_claim(void) { "NX2NAVI_RECORDER_CORE=0 turns it off)", n > 1 ? "s" : "", which, n, ncpu); else rt_log("vk: no core was reserved for the recording thread (too few fast cores, or the system refused it; " "NX2NAVI_RECORDER_CORE=0 stops the attempt)"); + } else { + rt_log("vk: the recording thread runs on any core (NX2NAVI_RECORDER_CORE=auto or 1 reserves one)"); } }