Repository navigation
vk: prioritize synchronous shader/pipeline builds and drain workers on reset - #481
Merged
Merged
Conversation
This was referenced Nov 17, 2026
Propinbo
added a commit
to Propinbo/BOTWRecompAndroid
that referenced
this pull request
Nov 17, 2026
Propinbo
force-pushed
the
feat/urgent-shader-builds
branch
from
November 17, 2026 19:47
c1b10cc to
eaec823
Compare
Propinbo
added a commit
to Propinbo/BOTWRecompAndroid
that referenced
this pull request
Nov 17, 2026
…rebases, PR mamcjr#485 async slots, Mali perf ABBA & release rollout
Owner
|
Thanks! The drain on reset fixes a real problem (workers reading the heap across its free), and I see no deadlock in the new waits. Two things before merging:
I'll test the in-place reboot and the benchmark scenes (many reboots) here. Since the numbers in the PR come from the combined prototype, an A/B of this change alone (frame time when a |
Propinbo
force-pushed
the
feat/urgent-shader-builds
branch
from
November 17, 2026 22:57
eaec823 to
e8fac0f
Compare
Contributor
Author
|
Rebased onto
#482 is now rebased on top of |
Propinbo
added a commit
to Propinbo/BOTWRecompAndroid
that referenced
this pull request
Nov 17, 2026
…ew fixes, Mali A/B & stress validation, and release APK update
Owner
|
Thanks, the watchdog markers are in and the A/B is convincing (cold cache 6190 to 4025 ms of shader waits, the worst single wait 388 to 78 ms). I'll run the in-place reboot and the benchmark scenes here and merge. |
Propinbo
added a commit
to Propinbo/BOTWRecompAndroid
that referenced
this pull request
Nov 20, 2026
…erged), grass triage parked, Master Plan & device scope
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On Android (especially Mali where driver
vkCreateGraphicsPipelinesis slow andVK_EXT_graphics_pipeline_libraryis unavailable), synchronous draws (keep == true: persistent targets, one-off passes, and no-depth passes) could stall behind dozens of backgroundkeep == falseshader translations/pipeline builds and polledusleep(200)inwait_built():runtime/nvn/vulkan/job_queue.h,LARECOMP_URGENT_SHADERS, default1on Android,0on desktop):MwJobintoruntime/nvn/vulkan/job_queue.hwithmw_job_push(..., urgent),mw_job_pop_active,mw_job_finish, andmw_job_steal.keep == true)Progbuilds are pushed to the head oftjobs/jobsand escalate in-flight non-urgentProgs sotranslate_program()also head-enqueuescompile_program().runtime/nvn/vulkan/exec.c):usleep(200)polling withbuild_done_condbroadcasts fromsignal_build_done()/finish_active_job().wait_built_job()runs for a synchronous draw, it steals and executes the matching queuedProg(g_inline_steal) orPipeon the waiting render thread instead of sleeping behind unrelated async work; synchronous new/evictedPipebuilds callbuild_pipeline_urgent()inline.BP_BUILD_WAIT_NS,BENCH_BUILD(), andBP_REBUILDSaccurately (abort checks run beforeBENCH_BUILD()), and logs[vk] shader-build (reboot|exit)counters (vk.h,device.c).pthread_oncepool init & clean reboot drain (vk_exec_reset()):static bool startedwithpthread_once+pthread_detachand falls back inline if job allocation fails.jobs_drain()withjobs_abort+ active job tracking at the start ofvk_exec_reset()so in-flight translators/workers finish cleanly beforevkFreeMemory(gmem_mem)unmapsHEAP_BASEon Turnipmap_placed.tools/test_shader_job_queue.c):mw_job_steal, LIFO urgent vs FIFO ordering, active idle detection, and a 600-item multi-threaded worker + stealer + two-queue forwarding race test.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_job_queue.c— passed.tools/test_android_runtime.ps1onSM-X730):6/6passed.:app:assembleDebug(JDK 17):BUILD SUCCESSFULwith0warnings in modified/added files.Combined Physical-GPU Measurements (prior unified 3-feature prototype before splitting)
.smetametadata cache andVK_EXT_vertex_input_dynamic_state) onhateno-night(cap30,sgsr11080p, warm.spv,0Vulkan errors):Mali-G925 MC12r49p1): World-entry (frame >= 480) compile wait dropped4968 -> 1296 ms(with.smetacold) ->994 ms(5.0x, warm.smeta), exit[vk] shader-buildmax wait dropped1351.32 -> 45.57 ms.Turnip_Gen8_V38_Patched,driver-id 18): Exit wait dropped738.17 -> 126.40 ms(-82.9%), max wait94.21 -> 5.62 ms(16.8x); post-rebase smoke verified[vk] reboot: 467 programs, 854 pipelines and 19 compute programs freed (0 kept)cleanly drained beforevkFreeMemory(gmem_mem).Companion Focused PRs