mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-25 22:15:57 +00:00
host_checkpoint is on by default: a thread asked to give its virtual core to a better one gives it up when it returns from a host call or SVC to game code, so an interrupt refused inside a port function no longer leaves the core held until the next SVC or interrupt; on machine A (7900X, 4 cores, islands) the frame went from 13.71 to 13.04 ms over 5 clean runs each
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3087e9fe27
commit
59f14012c1
3 files changed
+10
-5
No files matched your search
+3
-2
@@ -107,7 +107,7 @@ static const struct { const char *key, *section; } sections[] = {
|
||||
{"BIND_RIGHT", "input"}, {"BIND_DOWN", "input"}, {"BIND_LSTICK_LEFT", "input"}, {"BIND_LSTICK_UP", "input"},
|
||||
{"BIND_LSTICK_RIGHT", "input"}, {"BIND_LSTICK_DOWN", "input"}, {"BIND_RSTICK_LEFT", "input"},
|
||||
{"BIND_RSTICK_UP", "input"}, {"BIND_RSTICK_RIGHT", "input"}, {"BIND_RSTICK_DOWN", "input"}, {"BIND_SHAKE", "input"},
|
||||
{"ASYNC_PREEMPT", "performance"}, {"REPLAY_ASYNC", "performance"}, {"REPLAY_WORKERS", "performance"}, {"FREE_CORES", "performance"},
|
||||
{"ASYNC_PREEMPT", "performance"}, {"HOST_CHECKPOINT", "performance"}, {"REPLAY_ASYNC", "performance"}, {"REPLAY_WORKERS", "performance"}, {"FREE_CORES", "performance"},
|
||||
{"TIMER_1MS", "performance"}, {"PIPE_WAIT", "performance"}, {"PIPE_SKIP", "performance"},
|
||||
{"BARRIER_MERGE", "performance"}, {"LIB_PREBUILD", "performance"}, {"LIB_PREBUILD_THREADS", "performance"}, {"PIPE_PREBUILD", "performance"},
|
||||
{"PREWARM_XLATE", "performance"}, {"GPL", "performance"}, {"ASTC", "performance"}, {"MEMORY", "performance"},
|
||||
@@ -216,7 +216,8 @@ static const CfgMeta metas[] = {
|
||||
{"DISCORD_APP_ID", "1567232599846293504", NULL, LIVE},
|
||||
{"DISCORD_IMAGE", "totk_512x512", NULL, LIVE},
|
||||
// Advanced: scheduling
|
||||
{"ASYNC_PREEMPT", "1", "0|1|2", RESTART}, {"REPLAY_ASYNC", "0", "0|1", RESTART},
|
||||
{"ASYNC_PREEMPT", "1", "0|1|2", RESTART}, {"HOST_CHECKPOINT", "1", "0|1", RESTART},
|
||||
{"REPLAY_ASYNC", "0", "0|1", RESTART},
|
||||
{"REPLAY_WORKERS", "0", "0..16", RESTART}, {"REPLAY_CHUNKS", "0", "0..64", RESTART},
|
||||
{"REPLAY_CHUNK_DRAWS", "128", "1..100000", RESTART}, {"REPLAY_STATE_CHECK", "0", "0|1", RESTART},
|
||||
{"REPLAY_SKEW_US", "0", "0..100000", RESTART},
|
||||
|
||||
+2
-3
@@ -389,7 +389,7 @@ static int core_allowed(const RtThread *t, int c) { return (int)((t->mask >> c)
|
||||
// inheritance and the preemption disable without interrupting owners.
|
||||
#define AP_FIRST_NS 250000ull // the waiter spins this long before the first interruption (most waits end sooner)
|
||||
#define AP_GAP_NS 1000000ull // and interrupts the same owner at most this often
|
||||
// TOTK_AP_FIRST_US replaces AP_FIRST_NS (10..1000 us). TOTK_HOST_CHECKPOINT=1: an owner with a pending preempt request
|
||||
// TOTK_AP_FIRST_US replaces AP_FIRST_NS (10..1000 us). TOTK_HOST_CHECKPOINT (on by default): an owner with a pending preempt request
|
||||
// that returns from a host call or SVC to game code gives its core up there (kern_host_left), as at its next SVC or
|
||||
// indirect call, instead of running on until one or until a waiter interrupts it.
|
||||
static uint64_t g_ap_first_ns = AP_FIRST_NS;
|
||||
@@ -413,8 +413,7 @@ static void ap_init(void) {
|
||||
long long us = atoll(f);
|
||||
g_ap_first_ns = (uint64_t)(us < 10 ? 10 : us > 1000 ? 1000 : us) * 1000;
|
||||
}
|
||||
const char *hc = cfg_get("TOTK_HOST_CHECKPOINT");
|
||||
g_host_cp = hc && !strcmp(hc, "1");
|
||||
g_host_cp = cfg_bool("TOTK_HOST_CHECKPOINT");
|
||||
if (g_ap) {
|
||||
RtModule m[16];
|
||||
int n = rt_linked_modules(m, 16);
|
||||
|
||||
@@ -53,6 +53,11 @@
|
||||
# A thread waiting for a virtual core interrupts the owner when it runs game code: 1 = on, 2 = priority inheritance
|
||||
# without the interrupt, 0 = off (the old scheduling).
|
||||
# async_preempt = 1
|
||||
# With async_preempt on, a thread asked to give its virtual core to a better one gives it up as soon as it returns
|
||||
# from a port function (graphics, memory, files) to game code, instead of at its next system call or interrupt; an
|
||||
# interrupt that lands inside a port function is refused. 0 or 1. Default: on. On a Ryzen 9 7900X with 4 cores the
|
||||
# frame on the sky islands was about 5% shorter.
|
||||
# host_checkpoint = 1
|
||||
# Replay NVN submissions on their own thread, at most one frame behind the game, 0 or 1. Default: off. Helps where the
|
||||
# game waits for the GPU; adds up to a frame of latency.
|
||||
# replay_async = 0
|
||||
|
||||
Reference in new issue
Block a user