Repository navigation
nvn/vulkan: add opt-in graphics pipeline prewarming during save loads (#294) - #475
Conversation
…e prewarming) [skip ci]
|
Thanks! It's safe while off. A few things before merging:
After that I'll do an on/off A/B on the Adreno 830. Stutter numbers on and off from your side would help too. |
56716f0 to
6454ccc
Compare
|
Thanks for the review — I have rebased
Verification (
Matched cold-
Note on the single-scene Mali result: because only |
…mamcjr#436/mamcjr#475 updated [skip ci]
|
Thanks, all three are done: the 11 languages, |
|
Thanks! Tested on the POCO F7 Ultra (Adreno 830, Turnip), Plateau benchmark from a copy of a save, two repeats each: with the option off, the same GPU times as main; with LARECOMP_PIPE_PREWARM=1, "loaded 256 recorded pipelines", 6 queued while loading, no errors, the same times. Merging. |
Summary
Adds opt-in loading-screen graphics pipeline prewarming (#294), disabled by default (
Video > Pipeline prewarming (experimental)inbotwrecompandroid.ini, orLARECOMP_PIPE_PREWARM=1/0).While playing in the 3D world, unique graphics pipeline keys belonging to already-compiled shader programs (
Prog.pw_id) are deduplicated and stored in a bounded binary profile (cache/pipeline-prewarm.bin, up to256entries by default or1..512viaLARECOMP_PIPE_PREWARM_MAX). On subsequent save loads or fast-travel/reload transitions, once a matchingProgreachesstate == 1inprog_cachewhile shader workers and the translator thread are idle, at most one prewarmPipeat a time is queued intopipe_cachewithout delaying loading-screen shader work or erodingpipe_keep()headroom on Mali/low-RAM devices.Changes (
17files onmain26da3fa, commit6454ccc)runtime/settings.h,runtime/settings.c,runtime/ui/menu.mm,runtime/ui/i18n_*.inc(11locales):bool pipe_prewarm(defaultfalse),pipe_prewarm = 0/1INI persistence,settings_reset_defaults(),Video > Pipeline prewarming (experimental)toggle (no issue number in help text), and translations in all11i18n_*.incfiles (de,es,fr,it,ja,ko,nl,pt,ru,zh-Hans,zh-Hant).runtime/nvn/vulkan/pipeline_prewarm.inc&runtime/nvn/vulkan/exec.c:prewarm_enabled()checks a cached env override and atomic setting read before any hashing, allocation, or file I/O).PwProgId(vs_h,fs_h,key_h,nv,nf) incompile_program()right before freeing SPIR-V buffers and publishingstate.cache/pipeline-prewarm.binagainst a64-byte header (BOTWPW01magic, version,baked_size,vk_flags,g_game_version,vendorID,deviceID,driverVersion,pipelineCacheUUID, payload hash), strict per-field ranges (ncolor, power-of-twosamples,used_streams, vertex attribute bindings,topo_class,PipeFxbounds), and duplicate rejection; flushes atomically via.tmp+renameevery10 sin-world, at loading transitions, and onvk_exec_reset().jobs_active/jobs_workers/tjobs_activesoenqueue_job(..., idle_only=true)never competes with active shader work, probespipe_cacheread-only (pw_cache_find) before insertion so busy rejections never leaveNULLslots, enforcesPW_HEADROOM = 256whenpipe_keep() > 0, clearspw_pendinginpipe_free(), and records first-draw ready hits ([vk] pipeline prewarming: ... ready_at_first_draw ...) with fallback rebuild onstate == 2.PipeKeyhash collisions non-blockingly viaprewarm_resolve_collision()(skips the draw whilepp->state == 0instead of sleeping on the render thread; destroys any builtVkPipeline, updateslive_gpipes, and rebuilds oncepp->state != 0).pipeline_prewarm.incviapw_reset_frame = renderer_present_count()inprewarm_reset()instead of clearing globalg_scene_frameinvk_exec_reset().tools/test_pipeline_prewarm.c:PW_HEADROOMguards, first-draw ready hits + failure rebuild, non-blocking hash collision handling, andpw_reset_frameisolation.Verification
test_vulkan_compat.py(16),test_vulkan_startup.py(33),test_shader_cache.py(17), and UTF-8 / key parity check across all11i18n_*.incfiles:PASS.SM-X730):tools/test_pipeline_prewarm.c(-Wall -Wextra -Werror):PASS.tools/test_android_runtime.ps1(6/6:test_kernel_affinity,test_bc_shadow,test_buffer_copy,test_nvn_lifetime,test_object_cache,test_benchmark_trace):PASS..\gradlew.bat :app:assembleDebug(JDK 17):BUILD SUCCESSFUL.SM-X730matched cold-vk_pipelines.binABBAstutter check (Mali-G925-Immortalis MC12v1.r49p1-03bet0, BOTW1.9.0Recompiled,hateno-night,30 fpscap, warm3,047SPIR-V, identical256-recordcache/pipeline-prewarm.bin186,432B,warmup_s=0,calm_s=0,window_s=12):load_s605–608frames,arrive..drain)world_build_wait_ms>50ms/>100ms/max_ms353–356frames)fps/1% lowp99/max/over_50msOFF_1off20.4 s04203.8 ms(1211builds)22/10/1938.2 ms29.36/23.6640.49/43.78/0ON_1on20.1 s63457.8 ms(1228builds)25/13/2040.7 ms29.36/17.1938.58/111.73/1ON_2on20.4 s53447.6 ms(1229builds)27/14/1878.4 ms29.34/24.5340.09/41.08/0OFF_2off20.6 s04305.2 ms(1202builds)23/14/1916.7 ms29.58/24.8939.06/41.73/0(With
pipe_prewarm = 0and no env override,0[vk] pipeline prewarming:lines are logged andcache/pipeline-prewarm.binSHA-256 stays unchanged.)