diff --git a/docs/architecture.md b/docs/architecture.md index a8636cdf..8c5e63ef 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -116,10 +116,11 @@ keeps per-core data without locks and relies on that, so the host models it (`ru at a new state, an optimised pipeline replacing it from a background thread. A draw whose pipeline is not ready is skipped when one of its pass's targets was rendered in the previous frame, and waits otherwise. Compute pipelines are compiled outside the pipeline lock, and one compile serves every thread that needs it. The boot builds the - pipeline of every compute shader play recorded, but keeps only those of the shaders dispatched most recently - (`compute-used.bin`, `compute_keep`): the others go into the pipeline cache and are destroyed, and their first - dispatch creates them from it. A kept pipeline holds driver memory whether it is used or not, and the recorded list - grows with the play history (`runtime/vk_pipeline.c`, "compute pipelines the boot keeps"). + pipeline of every compute shader play recorded or the shader preparation listed, but keeps only those of the shaders + dispatched most recently (`compute-used.bin`, `compute_keep`): the others go into the pipeline cache and are + destroyed, and their first dispatch creates them from it. A kept pipeline holds driver memory whether it is used or + not, and the list has thousands of compute shaders a session never dispatches (`runtime/vk_pipeline.c`, "compute + pipelines the boot keeps"). - The game's tensor-core upscaler is replaced by a decode-and-scale pass (`vk_tonemap.c`); `vk_fsr.c` runs AMD FSR 1 (EASU, RCAS) on the present when the window is larger than the picture. - HDR (`vk_hdr.c`): the game tonemaps its scene into a float target, upscales it, draws the HUD into a second float diff --git a/nx2navi.ini.example b/nx2navi.ini.example index 47cf58d4..9b51914f 100644 --- a/nx2navi.ini.example +++ b/nx2navi.ini.example @@ -106,8 +106,8 @@ # lib_prebuild_threads = 2 # How many compute pipelines the start builds and keeps: those of the compute shaders the game used most recently. # Every other known one is built into the pipeline cache and released again, and made from the cache when the game -# first uses it (well under a millisecond). all: the start keeps every compute shader the game ever used, as versions up -# to 0.6.1 did; with a long play history that held more than 2 GB of video memory. 0: none are kept. +# first uses it (well under a millisecond). all: the start keeps the pipeline of every known compute shader, as +# versions up to 0.6.1 did, which held more than 2 GB of video memory. 0: none are kept. # compute_keep = 512 # 1: very large compute shaders that no cache holds are built on one background thread after the start. 0: each is # built when the game first uses it, which can hold that frame for a second or two. diff --git a/runtime/vk_memory.c b/runtime/vk_memory.c index bc55e15b..0135a0df 100644 --- a/runtime/vk_memory.c +++ b/runtime/vk_memory.c @@ -2685,9 +2685,9 @@ static void outside_watch(uint64_t frame) { // One line per boot stage (vk_pipeline.c calls it after the pipeline cache load, the shader prewarm, the recorded // pipelines and the compute pipeline prebuild): the device-local memory in use, the part of it VMA did not allocate // (outside_watch's "outside VMA": pipelines and the driver's own, before the swapchain and the upscaler exist), and the -// process's commit and working set. Subtracting two lines gives what a stage left behind: with a long play history the -// boot's compute pipelines alone held 2.3 GiB of device memory on an RTX 5090 (4,066 pipelines kept, 95 of them -// dispatched before the first village), which is what this line was added to place. +// process's commit and working set. Subtracting two lines gives what a stage left behind: on an installed copy with +// its prepared shader list the boot's compute pipelines alone held 2.3 GiB of device memory on an RTX 5090 (4,066 +// pipelines kept, 95 of them dispatched before the first village), which is what this line was added to place. void vk_mem_stage_log(const char *stage) { VkCtx *c = vk_ctx(); double proc, used, limit; diff --git a/runtime/vk_pipeline.c b/runtime/vk_pipeline.c index 1d074c89..f30c354f 100644 --- a/runtime/vk_pipeline.c +++ b/runtime/vk_pipeline.c @@ -4295,11 +4295,12 @@ static int cs_flight_remove(const GfxShader *cs) { // 1 when a dispatch waited } // ---- compute pipelines the boot keeps (compute-used.bin next to pipeline-keys.bin; NX2NAVI_COMPUTE_KEEP) -// The boot prebuild (lb_compute) used to build the pipeline of every compute shader play ever recorded and keep all of -// them for the process. A pipeline that exists holds driver memory whether or not anything dispatches it, and the list -// only grows with the play history: on an RTX 5090 (NVIDIA 621.01) a history of 4,066 compute shaders held 2.3 GiB of -// device memory and a matching share of the process's commit from the title screen on, while a boot into the first -// village dispatched 95 of them. That is memory an 8 to 12 GB card needs for textures. +// The boot prebuild (lb_compute) used to build the pipeline of every compute shader of the warm list (the ones play +// recorded and the prepared ones, shader-prepared.bin) and keep all of them for the process. A pipeline that exists +// holds driver memory whether or not anything dispatches it: on an RTX 5090 (NVIDIA 621.01) the 4,066 compute shaders +// of an installed copy's list (42,344 variants, 42,142 of them prepared) held 2.3 GiB of device memory and a matching +// share of the process's commit from the title screen on, while a boot into the first village dispatched 95 of them. +// That is memory an 8 to 12 GB card needs for textures, and a copy with prepared shaders pays it from its first boot. // So the boot keeps only the pipelines of the NX2NAVI_COMPUTE_KEEP (default 512) compute shaders dispatched most // recently, and builds every other one into the pipeline cache and destroys it at once (lb_compute keep 0): the cache // then holds it, so its first dispatch creates it without compiling, and no pipeline of an unused shader stays. On