fix(vk): the shader preparation's bar counts the compute programs at their cost, and leaves the prediction out on Most #1618
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1618
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:fix/prepare-bar"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type: fix · Risk: low · Tested on: Linux, RTX 3090 (on main before #1567) · Needs: a re-run on current main; Windows Intel Arc; Mesa Intel
TL;DR
During a build, the launcher's "Prepare shaders" row could sit at 0% for many minutes, then start moving. The game prepares its slowest shaders first but counted each as one small step, so the bar barely moved while they ran. This PR counts each shader by roughly what it costs and drops a step the default setting never runs from the total. On an RTX 3090 from a cold cache, main sat at 0.0% for 4 minutes and first reached 1% at 291 s; with this change it reached 1% at 94 s and 10% at 173 s.
Breakdown
--prepare-shadersruns (main and this change) on an RTX 3090 before the rebase onto #1567, plus a new game-free test.Why
Players report the build's "Prepare shaders" step stuck at 0% for a long time, then progressing. The Intel Arc A730 report in #1522 showed it at 0% after 43:09. The game itself was busy the whole time: it prepares the compute programs first (each with up to 64 variants compiled by the driver), and those counted for almost nothing on the bar.
How to reproduce
Seen on: Windows, Intel Arc A730 (#1522); reproduced on Linux, RTX 3090, NVIDIA 620.70.06
Settings and switches: defaults (Compile shaders: Most)
Steps: build the game in the launcher with an empty shader cache, or run
longshot --prepare-shaders --compile-shaders mostwith the program cache moved aside and a new driver shader cache folderExpected: the Prepare shaders % moves from the start
Actual: it stays at 0% while the compute programs are compiled, then moves once the graphics programs start
What changed
The shader programs' part of the bar is now counted in "programs' worth" instead of one per program. The count shown stays "N / 38,809 shaders" and reaches the total only when all the work is done.
PrepareWorkingpu/vk/vk_progress.h: the programs' count with each program at its cost. A graphics program is its 3 translations; a compute program the driver compiles adds 45 more (15 graphics programs' worth).prepare_runingpu/vk/vk_draw.cppreportswork_of.done(work)instead ofdone / 3. Each compiled variant moves the count, up to its program's share. After #1567 only compute programs the compute plan compiles count at that cost (as many as the plan names); the rest are translated only. The pass apart (Mesa's Intel) fills that same share instead of restarting part 0 with a count of its own, which had held the bar still.warm_computes_aparttakes astd::functionfor that.gpu/vk/vk_main.cpp: both starts (--prepare-shadersand the start-up screen) skip the prediction's part of the bar on Most before the programs run. Before, its guess (half again the programs) shrank their share, and the bar jumped once they were done.gpu/vk/vk_shader.cppis deliberately untouched: it is part of the shader stamp, and changing it would make every player prepare again.Measurements
Verdict: on main (before #1567) the Prepare shaders % stayed at 0.0% for the first 4 minutes of a 369 s programs' part. With this change it moved from the start and reached 1% three times sooner. Both runs predate the rebase onto #1567.
Hardware: CachyOS (kernel 7.3.3), NVIDIA GeForce RTX 3090 (620.70.06), AMD Ryzen 9 7900X (24 threads), 32 GB
Scene: the shader preparation, no game scene
Method:
longshot --prepare-shaders --compile-shaders most(12 workers) from two dev runtimes of one base (310e7c9d), each with its program cache moved aside and an empty NVIDIA shader cache folder,RX_VK_PREPARE_AGAIN=1. The@@progresslines are exactly the launcher's Prepare shaders %; I timestamped them and stopped each run 15 s after the programs' part ended. One run each, through the job queue in shared mode (a timing comparison was not the point, and the totals differ with the PC's other load).How to reproduce: as above, with
scripts/dev_build.py packof main and of this branch on the same base7daafa7aSince #1567, Most compiles only the listed compute programs, so main's stall on Most is likely shorter than measured here. On All, and on the Arc in #1522, every compute program still compiles. Records:
docs/tested/2026-11-18-prepare-bar-humanbean-main-before01.mdand...-pr-after01.md.Flags and settings
None
Testing
Tested: on the RTX 3090 above, one cold
--prepare-shadersrun each of main and this change (as committed before the rebase onto #1567). Both prepared the same 38,809 programs and 9,927 compute variants; with the change the bar moved from the start. Both the main pack and this branch's pack built cleanly (renderer and game).Not tested: the rebased version (on #1567) has not been compiled or run. The rebase moved the weighting to count only the compute programs the plan compiles, and resolved a conflict in
prepare_run's pass apart.python -I -B tests/run_all.pywas not run on this PC, including the newtests/test_prepare_work.pyand the updatedtests/test_compute_warm_apart.py; CI runs them. The pass apart (Mesa's Intel) and the start-up screen's bar were not run.Must be tested:
--prepare-shaders --compile-shaders mostA/B, expecting the bar to move from the start here and the run to finish (by hand, or Test Farm:@Beanstalka cold shader preparation, comparing how the Prepare shaders % moves over time)@Beanstalk windows intel, a cold build's Prepare shaders %)--prepare-shaders, expecting the bar to keep moving during "the compute pipelines of N compute programs compiled for the driver's cache" (Test Farm:@Beanstalk linux intel)Risks
What could break: only the numbers the bar reports. A wrong weight makes it move unevenly or jump at the end of the programs' part (for example when the plan names keys this seed lacks); it never goes back and is not full before the work is done.
warm_computes_apartnow takes astd::function.Turning it off: revert the commit
Compatibility: Nothing changes: no caches, stamp, options or
MKWVK_API_VERSIONchange.Issues
See #1522 (its Arc A730 "Prepare shaders at 0% after 43:09" is this bug; the issue also covers a slow Steam Deck build and "Loading pipelines 100%", which this does not fix)
Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named). (not run on this PC)third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.docs/tested/for each new measured run (format indocs/tested-configurations.md).mainand passing here. (added; not run here)tests/that reads changed source updated in this PR, not weakened.🤖 Generated with Claude Code
Tested in game: Linux (CachyOS, kernel 7.3.3), RTX 3090, NVIDIA 620.70.06, Ryzen 9 7900X: one cold longshot --prepare-shaders --compile-shaders most each of main
7daafa7aand this change (9bc63f6a, before the rebase onto #1567), from two runtimes of one base with the program cache moved aside and an empty driver shader cache. Same work in both (38,809 programs, 9,927 compute variants). The @@progress the launcher shows: main 0.0% for the first 4 min, 1% first at 291 s; this change 1% at 94 s, 10% at 173 s. The rebased version has not been run.Possibly related, for context:
WIP: fix(vk): the shader preparation's bar counts the compute programs at their cost, and leaves the prediction out on Mostto fix(vk): the shader preparation's bar counts the compute programs at their cost, and leaves the prediction out on Most