Repository navigation
Conversation
mamcjr#534, held 2B-2 & 40 FPS validation
edeb35e to
ea24f43
Compare
|
Rebased cleanly onto
Re-verified on exact commit
|
mamcjr
left a comment
There was a problem hiding this comment.
Thanks! Off Mali r49+ nothing changes (g_vk.pipe_cache_ctrl stays false), and the refactors behave like main as far as I can see.
Before merging:
- The inline budget is large, and one call can overshoot it.
vk_warm_budget_allowonly checksspent < limitbefore each call, and one meta load (file I/O, twovkCreateShaderModule, layouts) or one pipeline creation can run well past it. With the render thread at 18-20 ms on the Tab S11 at 30 fps, 10 ms on top leaves almost no headroom, and at 60 fps the budget alone is most of the frame. Could the default be 2-4 ms (your first prototype used 2), or scale with the frame target? And could you post frame-time p95/p99 inside the teleport window, not only skipped draws and 1% lows? - A partial hit wastes inline work. The inline path is entered when the vertex
.smetaexists, even if the fragment one doesn't. A new fragment variant of a cached vertex shader then costs one inline load before missing, and the work is redone bytranslate_program. Check that the fragment file exists too, or keep the loadedvi. - #534 changes what Mali r49+ users will run (classic render passes), so please re-measure this on top of it.
Minor: the LARECOMP_NO_DYN_UBO static became atomic, which is right now that compile_program_from_spirv also runs on the render thread; worth a line in the PR description.
ea24f43 to
87ba2a4
Compare
|
Rebased cleanly onto
|
|
Thanks for the update; the scaled budget and the fragment check look good. One thing before merging, now that #534 is in main: #534 added an |
87ba2a4 to
e5be41a
Compare
|
Rebased onto
Verified after the final edit (
|
|
All the points from the last review are fixed: budget by frame target, the fragment file checked first, measured on top of #534, One small change: the inline paths call Also, it now conflicts with main in The teleport window's p95 went slightly up (186 to 192 ms) while skipped draws fell 64%: that's the expected trade, and I'll say so in the release notes. With those two changes I'll merge it. |
e5be41a to
63c9e1a
Compare
|
Rebased onto
Verified on
|
…cjr#586 updates, PR mamcjr#582 close, SM-X730 restore [skip ci]
Problem
Even when
cache/spirv(*.smeta+*.spv) andcache/vk_pipelines.binare warm from an earlier session, every newly encountered(program, state)key on boot or fast-travel still goes through two asynchronous hops before its first draw can execute:get_program()unconditionally dispatches warm meta-cache loads to background threads, sop->state == 0skips the draw on frameN.schedule_pipeline_build()(whenkeep == false, i.e., normal 3D scene draws) unconditionally dispatchesvkCreateGraphicsPipelines(..., g_vk.pcache, ...)to a worker thread, skipping draws behind busy worker queues during fast-travel dissolve and world entry.Solution
Resolve warm disk-cache / driver-cache hits synchronously on the render thread within a bounded, FPS-scaled per-frame budget before falling back to async workers:
runtime/nvn/vulkan/warm_cache_fastpath.h+device.c+vk.h:vk_pipe_cache_ctrl_select()betweendevice.cand unit tests to enableVkPhysicalDeviceVulkan13Features.pipelineCreationCacheControlby default strictly on verified proprietary ARM Malir49+drivers (g_vk.api >= VK_API_VERSION_1_3 && h13.pipelineCreationCacheControl && g_vk.pcache).vk_warm_inline_default_us()(VK_WARM_INLINE_DEFAULT_30_US = 4000us at<= 30fps,VK_WARM_INLINE_DEFAULT_45_US = 3000us at31..45fps,VK_WARM_INLINE_DEFAULT_60_US = 2000us at> 45/ uncapped fps;LARECOMP_INLINE_WARM_US=Noverrides and clamps atVK_WARM_INLINE_MAX_US = 20000us,<= 0disables inline probing).exec.c(warm_inline_budget_refresh(frame)/warm_inline_target_fps()), withwarm_budget_fps_framereset invk_exec_reset().runtime/nvn/vulkan/shader_meta_cache.h+exec.c:.smetaout_maskviamw_meta_peek_out_mask()and verify fragment meta presence withmw_meta_exists("cache/spirv", fs_h1)before entering the inline SPIR-V/meta load path, eliminating wasted inline loads on cold fragment variants; reuse the precomputedfs_keyinsideprog_load_from_meta_cache().prog_load_from_meta_cache()betweenprog_fast_or_translate()(worker fallback) and bounded inline loading insideget_program().build_pipeline()aroundbuild_pipeline_ex(Pipe *pp, bool cache_only): whencache_onlyis true, passVK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT. On a cache miss (r != VK_SUCCESS, catchingVK_PIPELINE_COMPILE_REQUIREDas well as errors), destroy any stray handle and returnfalsecleanly without mutatingpp->state,retry_s,pipe_oom,LARECOMP_PIPE_FAIL_OOM,live_gpipes,stat_compiles,MG_GPIPE, or benchmark build counters, then queue the normal background worker.BP_BUILDS,BP_BUILD_NS,BP_BUILD_WAIT_NS, andvk_mgrow_add(MG_GPIPE, mg0)accurately on inlineProgandVkPipelinehits (sync_shaders(),urgent_shaders_on(),!g_vk.exec_stats, andjobs_abort/vk_exec_reset()respected; waits wrapped inWD_R_BUILD_WAIT).LARECOMP_NO_DYN_UBOenv-lookup cache incompile_program_from_spirv()from a plainstatic int off = -1tostatic _Atomic int off = -1(atomic_load_explicit/atomic_store_explicit,memory_order_relaxed) becausecompile_program_from_spirv()can now run inline on the render thread concurrently with background translation workers.tools/test_warm_cache_fastpath.c+tools/test_shader_meta_cache.c+tools/test_rt_load_upload.c+tools/test_android_runtime.ps1:exec.ctests coveringvk_pipe_cache_ctrl_select, FPS budget tiers, env overrides/clamping/whitespace,mw_meta_peek_out_maskbounds/short-read/corrupt-header handling,VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BITmiss cleanup, andBP_*/MG_GPIPEaccounting.Environment & Hardware Evidence
v0.4.12-betarebase + review fixes):87ba2a4f603b81d82bb988a62ac186ebc5e08632atopupstream/main(79ba1909f716d7761046a767651c62dbfa917ef1)#534c1a29d93+#52987ba2a4f, classic render passes default active): commit2d08bfa459fa, APK SHA-25689a7574a6cebde5713ef3eea70cd16eb69a5f3a4119b9d061e617a6c0b764288SM-X730), SoCMT6991(Dimensity 9400+), Android16(API36)Mali-G925-Immortalis MC12(driver-id 9),v1.r49p1-03bet0.f8a98b506b89b21c80a508d70abfcb3f, Vulkan1.3.2781.9.0,100%internal resolution (res_mode=10,upscaler=3),inplace_reads=1,shadows=11. First-Teleport A/B Atop
#534Classic Render Passes (30 fps->4 msTier,LARECOMP_PIPE_PREWARM=0, Identical Warm Cache Snapshot5093 .spv/14559 .smeta/67078586Bvk_pipelines.bin)pace_window_period_ms(p50 / p95 / p99 / max)vk_window_max_ms(p50 / p95 / p99 / max)render_p50vk_window_fps(min / med)TP_OFFLARECOMP_VK_NO_CACHE_CTRL=115059119933.37 / 36.88 / 38.07 / 95.4 ms39.5 / 186.4 / 219.68 / 228.0 ms19.29 ms24.1 / 29.6TP_ON_default4 mstier)5365(-64.4%)511(-57.4%)33.52 / 37.70 / 38.56 / 89.7 ms44.5 / 192.05 / 224.81 / 233.0 ms17.40 ms24.6 / 29.15TP_ON_default):[vk] no dynamic rendering (Mali r49+ default): classic render passes(1..8),[vk-cap] pipeline cache control: on (driver default),[vk] targets a draw writes, sampled by it: in place (settings).30 fpsteleport dissolve onset captures (f_022–f_042): Link and the blue Sheikah dissolve tendrils remain completely intact across dissolve onset with zero missing limbs or empty frames.2. 3-Scene Benchmark Atop
#534(B30_ON_default,frame_rate=30,4 msTier, No Env Overrides,2Clean Reboots + Exit)bench30_on_default):Proghits and 856 / 875 (97.8%) inlineVkPipelinecache hits (0 keptacross274 ms/237 msteardowns).res_mode=10,upscaler=3,inplace_reads=1):plateau(ok):29.86 fps,1% low 24.41,frame p50 / p95 / p99 = 33.335 / 33.817 / 38.520 ms,gpu p50 29.113 ms,render p50 20.674 ms,skipped_draws = 0zora-plaza(ok):30.00 fps,1% low 29.44,frame p50 / p95 / p99 = 33.330 / 33.802 / 33.913 ms,gpu p50 30.520 ms,render p50 20.020 ms,skipped_draws = 0kakariko-day(ok):19.69 fps,1% low 12.46,frame p50 / p95 / p99 = 56.473 / 70.992 / 76.340 ms,gpu p50 57.972 ms,render p50 42.885 ms,skipped_draws = 0,builds = 2(build_ns = 237847,build_wait_ns = 238384,long_frame_causes.pipeline_wait = 1)Earlier standalone v0.4.10-beta (`edeb35eb`, dynamic rendering default, `75%` res) A/B visual comparison on empty-Link teleport repro
LARECOMP_VK_CACHE_CTRL=0,f_076)edeb35ebDefault On,f_074)GPU Coverage, Zero-Overhead Guarantee & Rollback
r49p1,driver-id 9)driver default)SM-X730)r49+driver default)vk_arm_driver_major >= 49driver-id 18)LARECOMP_VK_CACHE_CTRL=1to opt in)< r49, PanVK, Xclipse, othersf13feature changeg_vk.pipe_cache_ctrlstaysfalseandf13.pipelineCreationCacheControl = VK_FALSE;get_program()andschedule_pipeline_build()take a single boolean check on cold key insertion with no extra Vulkan calls or clock reads.LARECOMP_VK_CACHE_CTRL=0orLARECOMP_VK_NO_CACHE_CTRL=1disables completely;LARECOMP_INLINE_WARM_US=Nsets a custom per-frame budget (0disables inline probing).Checks Executed (
87ba2a4f)tools/test_android_runtime.ps1onSM-X730: 9/9 native Bionic suites passed (includingtest_warm_cache_fastpathandtest_rt_load_upload), plus standalone Bionictest_shader_meta_cache.30.0.16248370):test_shader_cache.py(17),test_vulkan_compat.py(16),test_vulkan_startup.py(33),test_gpu_timing_trace.py(8),test_soft_linear.py(23 + 3 + 203).-Wall -Wextra -Werror) + NDK 30 Clang (-Werror, Android + Desktop):device.c,exec.c,test_warm_cache_fastpath.c,test_shader_meta_cache.c,test_rt_load_upload.c.workspace_check.py pr .mali/worktrees/warm-cache-pipe-fastpath --base upstream/main:PASS(commits=1, files=9, mergeable=YES).