WIP: fix(vk): a pipeline is drawn only with the program object it was built from #1297
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
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1297
Loading…
Reference in a new issue
No description provided.
Delete branch "TrashPanda/Longshot:fix/pipe-by-program"
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: medium · Tested on: Linux, game-free only · Needs: NVIDIA, Lake Hylia, in the game
Why
A pipeline's key names its program by code and variant hash, and two program objects can share both. The draw then ran one program's shaders under the other's layout, descriptors and constants. With the scene's lit programs a light loop read garbage for its count and the GPU never finished the draw: the picture stopped, then the device was lost, near water on NVIDIA. Hookshot reproduced it at Lake Hylia, six runs of six, and none with this fix.
Ported from Hookshot
65e2cb91(NotRexed, from pixl27's8b1e96ad):git.notrexed.dev/Hookshot/Hookshot@65e2cb91d2The tracker was searched for
RX_VK_PIPE_BY_PROGRAMand "pipe by program": no pull request or issue is this fix. Nearby Lake Hylia reports (#317, #1193) are other crashes.How to reproduce
Seen on: Hookshot's report: NVIDIA, Lake Hylia. Not yet run on Longshot.
Settings and switches: defaults (
RX_VK_PIPE_BY_PROGRAMunset, so the fix is on).Steps: play at Lake Hylia, near the water, several times.
Expected: the picture keeps drawing.
Actual: on Hookshot's main, the device was lost, six runs of six. Longshot main still shares a pipeline by key alone, which is the same cause.
What changed
A pipeline is drawn only with the program object it was built from. A draw whose object differs gets a pipeline of its own.
RX_VK_PIPE_BY_PROGRAM=0shares by the key alone, as before.PipeEntryingpu/vk/vk_draw.cppkeeps the program object.graphics_pipelinerefuses an entry built for a different object.pipeline_keep_readystores that object, and only that object takes the kept pipeline (vk_pipelines.h,vk_programs.cpp, the precompile).tests/test_pipe_by_program.pyreads those sites.tests/precompile_pipeline_cleanup_test.cppforward-declaresProgramso the cut still compiles.RX_VK_PIPE_BY_PROGRAMindocs/development.md.Measurements
Verdict: the game-free check fails before the fix and passes here. Nothing in the game has been measured. The upstream Lake Hylia count (6/6 device lost, 0/6 with the fix) is Hookshot's, not a Longshot run.
Hardware: Linux, no GPU run.
Scene: none.
Method:
python -I -B tests/test_pipe_by_program.pyon the test commit and on this head.How to reproduce: check out
ccff9189(the test alone, on mainf88e6e3a) and run the command; then this head.f88e6e3aplus the test @ccff918929406ea9tests/test_pipe_by_program.pyRemoving the
progfield and putting it back was checked on the earlier base: the test failed for that reason, then passed. The rebase ontof88e6e3adid not change those lines.tests/test_precompile_pipeline_cleanup.pyandtests/test_quick_pipelines.pypass here. They compile thePipeEntrycut. The fulltests/run_all.pyhas not been run.Flags and settings
One switch, on unless set off.
RX_VK_PIPE_BY_PROGRAM=0=0is the old sharingTesting
Tested: Linux, game-free.
tests/test_pipe_by_program.pyfails on the test commit and passes on29406ea9. The precompile-cleanup and quick-pipeline cuts compile and pass.Not tested: the game, any GPU, Windows, a full
tests/run_all.py. This PC is not running the game. Opened with--forcebecause Joey asked, so the Test Farm can run Lake Hylia.Must be tested:
vk: pipeline ... was made for another program objectmeans the fix took the new path.RX_VK_PIPE_BY_PROGRAM=0is the comparison if the picture looks wrong. Test Farm: @Beanstalk NVIDIA, Lake Hylia, near the water, several runs, expecting no device loss.Risks
What could break: a draw can build a second pipeline when two program objects share a key. A wrong match would change which shaders run, or spend extra pipelines. The fast path already keyed its one-draw cache by the program object's address; this is the shared cache.
Turning it off:
RX_VK_PIPE_BY_PROGRAM=0.Compatibility: nothing in saves or options. A pipeline made for a second object is not written into the noted list (its key holds an address).
MKWVK_API_VERSIONis unchanged.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 yet. The three checks named above passed.third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.mainand passing here.tests/that reads changed source updated in this PR, not weakened.@Beanstalk NVIDIA, Lake Hylia, near the water, several runs. Expect the picture to keep drawing and no device loss. A log line "vk: pipeline ... was made for another program object" means this fix took the new path. RX_VK_PIPE_BY_PROGRAM=0 is the old sharing if the picture looks wrong. Not run in the game yet; Joey asked for this pull request so the farm can take that run.
@TrashPanda only members of
BigBeanscan start the farm. One of them can approve this request by reacting 👍 to it or to this comment.Possibly related, for context:
Beanstalk test farm
Commit
29406ea· tier reviewed · approved by futondestroyer (👍 on TrashPanda's request) · dashboardWhat will be tested · AI plan (
gpt-6.1-terra)On NVIDIA, three runs per build will teleport to Lake Hylia and exercise the water area. The plan compares pictures and frame times with main, checks that frames continue presenting, and fails on device loss, crashes, major frame-time regressions, or large visual differences. The new-path log line will be recorded if it appears, but its absence will not fail the test because the collision may not occur. The game runs take approximately 40 minutes per tester.
Done (started 01:54 UTC, last report 03:52 UTC). Comment
@Beanstalkto run it again.NVIDIA GeForce RTX 4070, 621.1.0; 2: linux+nvidia+nvidia-proprietary+dgpuNVIDIA GeForce RTX 3080 Ti, 620.70.6Measurements · nvidia
Verdict: fail on nvidia (2/1 report):
lake-water crash;lake-water screenshot.max_difffailed.Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu
NVIDIA GeForce RTX 4070, 621.1.013th Gen Intel(R) Core(TM) i7-13700F, 32 GB RAM; 2: linux+nvidia+nvidia-proprietary+dgpuNVIDIA GeForce RTX 3080 Ti, 620.70.6AMD Ryzen 9 3900X 12-Core Processor, 48 GB RAMScene: lake-water, from a new save; each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); lake-water: 3 game starts a side, water 30 s after 5 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)f88e6e329406eaFlags and settings
None: the plan varied no setting, switch or build option.
Markdown for the PR description
The farm's Lake Hylia run (report 1: Windows, RTX 4070; report 2: Linux, RTX 3080 Ti), read run by run:
0xC0000005). On Linux, one PR run hung of 3 and no main run did. Neither log tail shows a device loss or the new-path linevk: pipeline ... was made for another program object.To tell those apart, the same scene with the fix off on this build would show the noise floor:
@Beanstalk NVIDIA, Lake Hylia water as before, three cells: main, this PR, and this PR with
RX_VK_PIPE_BY_PROGRAM=0. If the PR with the switch off differs from main as much as the PR does, the picture difference is the scene's, not this fix's. Count crashes and hangs per cell, and record whether the linevk: pipeline ... was made for another program objectappears.@TrashPanda only members of
BigBeanscan start the farm. One of them can approve this request by reacting 👍 to it or to this comment.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.