Repository navigation
vk: cache Maxwell stage translation metadata (.smeta) beside warm SPIR-V - #482
Conversation
7759c06 to
ce13c72
Compare
|
Thanks, but one blocking issue: the |
ce13c72 to
b4e80e7
Compare
|
Addressed all three points and rebased onto
*Note: Both cold runs had identical |
…d release branch
|
Thanks, the translator id in the key and the whole-struct hash fix it. I'll merge it after #481, after checking here that an update over an old cache misses as it should. |
|
Thanks! On the POCO, over main's warm cache: the first load missed (349 misses, metadata built), from the reboot on 357 hits / 0 misses, and a second run all hits. Merging. |
Summary
Even when
cache/spirv/<hash>.spvwas warm on disk, restarting the game still routed every newly encounteredProgthrough the single-threadedtranslatorthread (maxwell_translate_bounded+translate_lock+ GLSL string emission) solely to reconstructShaderInfo,vs_uses_vid,fs_gather, and compute the.spvhash insidevk_glsl_to_spirv():.smetastage metadata cache (runtime/nvn/vulkan/shader_meta_cache.h,LARECOMP_META_CACHE=0: off):MWSMET01.smetarecords (MwMetaHdr160 B +MwMetaTex[]16 B, atomic temp-file write +_WIN32overwrite fallback + payload checksum) incache/spirv/beside.spv.mw_stage_key()computes a 128-bit key from SPH (0x50B), Maxwell instructions up tobra self, BRX jump-table constants (whenMW_TF_BRX_WINDOW && glsl && cmax < 0x10000),HEAP_BASE/HEAP_MAX, canonicalShaderKey(includinggmem_linear_lookup), and all 23translate.c/shaders.cconfiguration bits (MW_TF_*).LARECOMP_VK_NO_SPIRV_CACHE,LARECOMP_SAVE_MSL,LARECOMP_DUMP_FS,LARECOMP_SHADER_SUBST,LARECOMP_SHADER_PATCH,maxwell_dbg_code,maxwell_dbg_vs) are active.Progreconstruction (runtime/nvn/vulkan/shaders.{h,c},runtime/nvn/vulkan/exec.c):vk_shader_cache_ensure_dirs(),vk_spirv_load_cached(), andvk_glsl_to_spirv_ex().prog_fast_or_translate()runs onjobsworkers: on VS+FS.smeta+.spvhit it bypassestranslate_lockandshaderccompletely viacompile_program_from_spirv(); on miss it falls back totranslate_program(), which stores.smetaafter.spvsucceeds.pthread_oncepools,jobs_drain()/jobs_abortinvk_exec_reset()beforevkFreeMemory(gmem_mem)unmapsHEAP_BASEon Turnipmap_placed) and cachedgmem_miss_log_on()(LARECOMP_NO_GMISSread once invk_exec_init()instead of per draw).tools/test_shader_meta_cache.c):bra selftrailing padding, BRX positive/negative controls, all 23MW_TF_*bits,gmem_linear_lookup/glsl/ShaderKeyfields,ntex = 0..64round-trips, overwrite, and rejection of bad magic/version/spv_hash=0/trailing bytes/truncation/bit flips.Verification
Standalone Branch Checks (this commit)
NDK 30.0.16248370):test_vulkan_compat.py(16),test_vulkan_startup.py(33),test_shader_cache.py(17) — all passed.cc -Wall -Wextra -Werror -O2 -pthread) & Android ARM64 Bionic (SM-X730):tools/test_shader_meta_cache.c— passed.:app:assembleDebug(JDK 17):BUILD SUCCESSFULwith0warnings in modified/added files.Combined Physical-GPU Measurements (prior unified 3-feature prototype before splitting)
hateno-night(cap30,sgsr11080p, warm.spv,0Vulkan errors):Mali-G925 MC12r49p1): Adding warm.smetareduced world-entry compile wait further from1296 ms(cold.smeta) ->994 ms(4968 msbaseline,5.0xtotal) with906 / 913.smetahits (99.2%).Turnip_Gen8_V38_Patched,driver-id 18):906 / 908(99.8%).smetahits across 3-pass A/B (-82.9%exit compile wait vs baseline); post-rebase smoke verified[vk] rebootclean drain beforevkFreeMemory(gmem_mem)and452 / 452(100%).smetahits on Repeat 2.Companion Focused PRs