perf(vk): the shader preparation's graphics pipelines go side by side on Intel's Arc A-series and Core Ultra GPUs #2101
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!2101
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:perf/intel-prep-side-by-side"
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?
Summary
On Intel's Arc A-series cards and the Arc iGPUs of Core Ultra laptops, Windows, the shader preparation takes hours.
The cause:
IntelDriverGate(gpu/vk/vk_internal.h) lets one thread at a time into Intel's Windows compiler. The row's Auto turns that off only on the Arc B-series (intel_compiles.h, #500). Everywhere else, every preparation worker (16 on a 20-thread laptop) queues on one mutex. That is about one CPU busy, the 8% in #2011's screenshot.Evidence that side by side works there: #1717 is the same A730M on the same driver with
RX_VK_NO_INTEL_SERIAL=1(the launcher's Side by side). It built 25,005 of 32,623 noted pipelines in 2,753 s on 16 threads, 5 to 35 a second, with no driver fault. What ended that run was memory:a C++ allocation refused (at the commit limit?), then pipelinesnot made (-3), on 16 GB.Why the gate is still needed for what it fixed: the fault it was put in for (#252: igvk64 read 0x170 on a UHD, driver 101.7088) was traced to
vkGetPipelineCacheDatarunning beside builds.pcache_fetch_lock(#190) keeps those apart on every Intel GPU on Windows, and this PR leaves that lock alone. The other reason the gate stays: four compute pipelines at once froze a PC (compute_builds_serial).What changes, only on Intel's Windows driver 101.9175 or newer with the Intel shader compiles row on Auto:
prepare_run(not in play),warm_libraries,predict_run,precompile_runandprecompile_warm. Each one is marked withIntelPrepareLane, andIntelDriverGate(ask, prepare_ok)lets a marked thread through whenintel_prepare_open()is true. Compute pipelines still take the gate (cached_compute,warm_computeand the renderer's own pipelines), and so does everything play builds.prepare_pipeline_threadsholds the pipeline steps' threads to the free memory, 768 MB per thread past 4 GB (intel_prepare_workers, the per-worker figure fromprepare_workers.h). On that 16 GB A730M this means about 6 to 10 threads instead of 16. It logsvk: preparation (<step>): Intel's compiler takes the graphics pipelines side by side on N threads of M (X MB free).RX_VK_NO_INTEL_SERIAL=0keep the preparation one at a time, as does the weak-laptop button.intel_gate_on()is false there, so the lane does nothing and the thread counts are the same.Read first:
gpu/vk/intel_compiles.h(the rule and its evidence),gpu/vk/vk_internal.h(IntelPrepareLane,intel_prepare_open,IntelDriverGate), andprepare_pipeline_threadsingpu/vk/vk_draw.cpp.Fixes #1706, fixes #2011. See #1717 (the crash at the commit limit: this lowers the thread count there, but the memory is not measured on Intel yet), #407, #1830 (the countdown display).
Testing
Tested: Linux, RTX 3090, NVIDIA 620.70.06, this PR as a pack over main's base, through the job queue: a memory tour from
kokiri-startto Kokiri Forest and Hyrule Field, in play, clean quit, no crash, and no "Intel's compiler" line (the new code is gated to Intel's Windows driver, so nothing changes here). The branch was then rebased onto current main with no conflicts; the Intel path itself needs the Test Farm.tests/test_intel_prepare_side_by_side.py(new) cuts out the real gate (vk_internal.h), the row's questions (menu/intel.cpp) and the realcached_graphicsandcached_compute(vk_draw.cpp). It compiles them with a driver stand-in that counts how many builds are inside it at once, then runs 4 threads for 12 cases: the A730M, a Core Ultra iGPU, an A770 on a newer driver, the B580, a UHD on 101.7088, an Iris Xe below 101.9175, rows 0, 1 and 2, preparation threads against play threads, and graphics against compute. It also checks 12intel_prepare_workerscounts, and that the five preparation steps are marked and their thread counts held.main, the first case fails because the A730M builds the preparation's graphics pipelines one at a time. Not run on this PC (no test suites here): CI runs it.tests/test_intel_compiler_gate.pynow expectscached_graphics's andmake_module's new second argument, andcached_computekeeps its old line. The stand-ins inprogram_cache_one_variant_test.cppandprogram_cache_cleanup_test.cpptake the second argument.gpu/vk/intel_compiles.hwithg++ -std=c++17 -Wall -Wextra -fsyntax-only. Nothing else was compiled.Still to test:
--prepare-shaders, main against this PR, twice each, interleaved. Expect the same time and noIntel's compilerline (by hand, run plan).driver faultedline, no device loss, and the game reaching play (@Beanstalk, below).Measurements
Verdict: nothing to measure on this PC (the change runs only on Intel's Windows driver); the Arc numbers come from Beanstalk. The evidence is the reporters' logs (#1717: side by side on the A730M at 5 to 35 pipelines a second over 16 threads; #2011: one at a time at 8% CPU for over 7 hours). The 3090 run should show no change, and the Arc numbers come from Beanstalk.
Setup: Linux, RTX 3090: a cold-cache
--prepare-shaders(run plan). Windows Arc A-series and Core Ultra iGPU: Beanstalk.16376e40e496ea8aRisks
guarded_graphicsorguarded_shader_moduleand left out, and is written tolongshot_driver_faults.txt. A crash inside a step leaves its.warmingmarker, and after two such crashes the step is skipped and those pipelines are built in play. To turn it off, set the row to One at a time orRX_VK_NO_INTEL_SERIAL=0, which the launcher's "One at a time" sets. A revert also undoes it.prepare_workers.h) and is not measured on Intel, so Beanstalk's peak-memory numbers should confirm it. On iGPUs memory is shared with the GPU.longshot_options.inior the caches. Play's builds are unchanged.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). (Not run on this PC by policy: CI runs it.)main, or Measurements says why there is nothing to measure. (Waiting on the 3090 run and Beanstalk.)third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here. (Written to fail onmainat its first case. Not run here: CI.)tests/that reads changed source is updated, not weakened.docs/dev/reference/switches.md"Intel's compiler on Windows",docs/user/graphics-and-controls.md.)Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
https://claude.ai/code/session_017vw8e2uxGKQxzDeQ15jjNK
https://claude.ai/code/session_017vw8e2uxGKQxzDeQ15jjNK
Tested in game: Linux, RTX 3090, NVIDIA 620.70.06, through the job queue: memory tour from kokiri-start to Kokiri Forest and Hyrule Field, in play, clean quit, no crash; no Intel line (the change is gated to Intel's Windows driver). The Intel path needs the Test Farm.
@Beanstalk On Windows with an Intel Arc A-series card (A380/A580/A750/A770 or an A730M/A770M laptop) and on a Core Ultra laptop's Arc iGPU (Meteor Lake 155H/165H or Lunar Lake), each on Intel driver 101.9175 or newer with the Intel shader compiles row on Auto: build this PR and main, and time a cold-cache shader preparation for each (empty game cache folder, Intel's shader cache cleared, launcher's Prepare shaders or
longshot.exe --prepare-shaders --compile-shaders most), main then PR then main then PR. Report the wall time, the log's "vk: prepared ... in N s" and "vk: precompile: ... in N s" lines, the "vk: preparation (...): Intel's compiler takes the graphics pipelines side by side on N threads" lines, the peak private memory, any "driver faulted", "not made (-3)" or "commit limit" lines, and whether the game then reaches Kokiri Forest and plays for 2 minutes without a crash or device loss.Beanstalk test farm · ⛔ can't be tested as asked
Commit
e496ea8· approved by HumanBean (untrusted) · dashboardNot run: the farm can't test this as asked, so nothing is built or run:
⚠️ Note: The integrated-GPU target is broader than the requested Meteor Lake and Lunar Lake models; the farm cannot enforce the requested driver version or Intel shader compiles row.
⚠️ Note: The alternative does not measure preparation-only wall time or peak private memory, and its worker-count log may be unjudged if that preparation path is not reached.
What it could test instead: The alternative plan compares normal startup and two minutes in Kokiri Forest on Windows Intel Arc A-series cards and Arc integrated GPUs. It records shader preparation time, process memory, worker-count logs and fault indicators; crashes or fault indicators fail the PR. Each target takes about 25 minutes and waits for matching hardware to come online. No tester online now matches windows+intel+dgpu+gpu-a380_a580_a730m_a750_a770_a770m, windows+intel+igpu+gpu-arc*: those targets wait for one.
A member of
BigBeanscan comment@Beanstalk <new words>to ask for something else, or@Beanstalk test it anywayto run the plan regardless.WIP: perf(vk): the shader preparation's graphics pipelines go side by side on Intel's Arc A-series and Core Ultra GPUsto perf(vk): the shader preparation's graphics pipelines go side by side on Intel's Arc A-series and Core Ultra GPUs