AMD (RX 6600) fixes for Ocarina of Time: GPU hang, fog flicker, exposure #430
Closed
YunaraDebugs wants to merge 1 commit from
amd-fixes into main
pull from: amd-fixes
merge into: MagicBeanDev:main
MagicBeanDev:main
MagicBeanDev:github/pr/2893
MagicBeanDev:github/pr/2890
MagicBeanDev:github/pr/2887
MagicBeanDev:github/pr/2878
MagicBeanDev:github/pr/2875
MagicBeanDev:github/pr/2874
MagicBeanDev:github/pr/2873
MagicBeanDev:github/pr/2871
MagicBeanDev:github/pr/2756
MagicBeanDev:github/pr/2897
MagicBeanDev:github/pr/2896
MagicBeanDev:github/pr/2718
MagicBeanDev:github/pr/2842
MagicBeanDev:github/pr/2691
MagicBeanDev:github/pr/2895
MagicBeanDev:github/pr/2743
MagicBeanDev:github/pr/2765
MagicBeanDev:github/pr/2708
MagicBeanDev:github/pr/2732
MagicBeanDev:github/pr/2755
MagicBeanDev:github/pr/2817
MagicBeanDev:github/pr/2876
MagicBeanDev:release-please--branches--main
MagicBeanDev:release-please--branches--main--release-notes
MagicBeanDev:github/pr/2778
MagicBeanDev:github/pr/2888
MagicBeanDev:github/pr/2866
MagicBeanDev:github/pr/2877
MagicBeanDev:github/pr/2800
MagicBeanDev:github/pr/2829
MagicBeanDev:github/pr/2850
MagicBeanDev:github/pr/2889
MagicBeanDev:github/pr/2882
MagicBeanDev:github/pr/2860
MagicBeanDev:github/pr/2849
MagicBeanDev:github/pr/2886
MagicBeanDev:github/pr/2794
MagicBeanDev:github/pr/2840
MagicBeanDev:github/pr/2830
MagicBeanDev:github/pr/2834
MagicBeanDev:github/pr/2719
MagicBeanDev:github/pr/2742
MagicBeanDev:github/pr/2741
MagicBeanDev:github/pr/2820
MagicBeanDev:github/pr/2771
MagicBeanDev:github/pr/2859
MagicBeanDev:github/pr/2858
MagicBeanDev:github/pr/2823
MagicBeanDev:github/pr/2757
MagicBeanDev:github/pr/2769
MagicBeanDev:github/pr/2844
MagicBeanDev:github/pr/2843
MagicBeanDev:github/pr/2673
MagicBeanDev:github/pr/2855
MagicBeanDev:github/pr/2739
MagicBeanDev:github/pr/2807
MagicBeanDev:github/pr/2851
MagicBeanDev:github/pr/2789
MagicBeanDev:github/pr/2814
MagicBeanDev:github/pr/2818
MagicBeanDev:github/pr/2774
MagicBeanDev:github/pr/2772
MagicBeanDev:github/pr/2750
MagicBeanDev:github/pr/2786
MagicBeanDev:github/pr/2785
MagicBeanDev:github/pr/2782
MagicBeanDev:github/pr/2779
MagicBeanDev:github/pr/2775
MagicBeanDev:github/pr/2706
MagicBeanDev:github/pr/2766
MagicBeanDev:github/pr/2747
MagicBeanDev:github/pr/2759
MagicBeanDev:github/pr/2745
MagicBeanDev:github/pr/2740
MagicBeanDev:github/pr/2733
MagicBeanDev:github/pr/2725
MagicBeanDev:github/pr/2727
MagicBeanDev:github/pr/2728
MagicBeanDev:github/pr/2729
MagicBeanDev:github/pr/2721
MagicBeanDev:github/pr/2722
MagicBeanDev:github/pr/2715
MagicBeanDev:github/pr/2714
MagicBeanDev:github/pr/2707
MagicBeanDev:github/pr/2703
MagicBeanDev:github/pr/2705
MagicBeanDev:github/pr/2697
MagicBeanDev:github/pr/2679
MagicBeanDev:github/pr/2676
MagicBeanDev:github/pr/2669
MagicBeanDev:docs/what-hookshot-connects-to
MagicBeanDev:fix/hdr-encode-test
MagicBeanDev:fix/main-tests
MagicBeanDev:fix/play-cache-files
MagicBeanDev:perf/game-barrier-order
MagicBeanDev:feat/heap-lazy
MagicBeanDev:feat/texture-detail
MagicBeanDev:perf/astc-opaque-bc1
MagicBeanDev:fix/fs-dir-lock
MagicBeanDev:fix/framegen-native-kept
MagicBeanDev:fix/update-no-downgrade
MagicBeanDev:port/k10-gcn-f16-mirrors
MagicBeanDev:fix/framegen-mult-cap
MagicBeanDev:chore/release-as-2.1.1
MagicBeanDev:perf/pcache-load-switch
MagicBeanDev:fix/prepare-progress-log
MagicBeanDev:fix/update-closes-stale-game
MagicBeanDev:fix/hdr-scaled-sampled
MagicBeanDev:perf/first-start-preset
MagicBeanDev:perf/zero-upload
MagicBeanDev:fix/vcore-escape-2s
MagicBeanDev:test/fake-gh-atomic
MagicBeanDev:perf/batch-idle-flush
MagicBeanDev:test/finish-stub-a
MagicBeanDev:chore/record-2.1.0
MagicBeanDev:fix/main-red-tests
MagicBeanDev:fix/test-display-startup-driver-cache
MagicBeanDev:feat/mesh-shader-mode
MagicBeanDev:fix/menu-probes-at-startup
MagicBeanDev:fix/fps-counter-classic
MagicBeanDev:fix/test-log-batch-flake
MagicBeanDev:fix/narrow-screen-hud
MagicBeanDev:ci/prereleases
MagicBeanDev:release/v2.0.15
MagicBeanDev:hotfix/v2.0.15
MagicBeanDev:fix/present-ahead-replay
MagicBeanDev:release/v2.0.13
MagicBeanDev:fix/bracket-paths-2013
MagicBeanDev:fix/hdr-overlays-2013
MagicBeanDev:fix/fps-counter-scale-2013
MagicBeanDev:fix/stick-seen-at-rest
MagicBeanDev:hotfix/menu-fits-screen
MagicBeanDev:fix/f1-always-opens-menu
MagicBeanDev:fix/ini-keep-lines
MagicBeanDev:claude/cranky-pike-7cf247
MagicBeanDev:perf/texture-answer-flat
MagicBeanDev:fix/stamp-test-modules
MagicBeanDev:fix/appimage-fonts
MagicBeanDev:fix/display-awake
MagicBeanDev:release/v2.0.12
MagicBeanDev:fix/discord-windows
MagicBeanDev:rc/v2.0.12-tests
MagicBeanDev:fix/dlss-keep-feature
MagicBeanDev:rc/v2.0.12
MagicBeanDev:button-icons
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
autorelease: pending
autorelease: tagged
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
github_actions
Pull requests that update GitHub Actions code
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
question
Further information is requested
testing wanted
wontfix
This will not be worked on
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!430
Loading…
Reference in a new issue
No description provided.
Delete branch "amd-fixes"
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?
Fixes for Ocarina of Time on AMD, tested on an RX 6600 (Windows, driver 0x800161) in Kokiri Forest. Each change has an env switch that turns it off.
GPU hang one to four minutes into Kokiri (device lost)
On the RX 6600, the task and mesh programs of the foliage culling hung the GPU when the driver's optimizer built them. AMD buffer markers showed a different one stuck first each time (918adef1afaa39d4, 6f9142def3b6a978...). Runs with them built without the optimizer never hung, ours and upstream's with
RX_VK_NOOPT=1. On AMD, task and mesh pipelines are now built withDISABLE_OPTIMIZATION; everything else keeps the optimizer.RX_VK_MESH_OPT=1: as before.Fog flickering in Kokiri's light: the exposure meter
#296 made readbacks wait for their write-back, but the meter still read 2x or 0 about every two seconds. The CPU's reset to 0 landed in guest memory after the next submission had synced its mirror, so the GPU added onto the old sum. Small readback ranges (≤ 16 KB) whose write-backs stay on the queue are now copied from guest memory into the mirror at the start of each submission, last of the uploads. Logging the meter at the same spot for 20 s gave 9 bad reads before and 0 after.
RX_VK_NO_RB_REFRESH=1: off.One-frame ground-fog dips
In sync mode, a texture or program release made while queues are stopped at a wait forced the stopped work on at once (drain 1, about 1,000 times a session). That work then ran before what it waits for, and the ground fog came out thinner for a frame, about every 13th frame. Releases made while queues are stopped are now kept until the stopped work goes on, at its wait, a present or
hold_ms. The title and menu text stayed correct with this.RX_VK_RELEASE_DRAIN=1: as before.Driver optimizer per pipeline
AMD's compiler fails some pipelines with the optimizer (-13 on 5fa56485a6b07619) and takes minutes over others. Each pipeline now builds with the optimizer on a below-normal thread, with a budget (
RX_VK_OPT_BUDGET_MS, 1500). If it fails or runs out of time, a build without the optimizer is used, and a late optimized one replaces it.hookshot_noopt.txtbeside the exe remembers the slow and failed ones, so later starts skip the optimizer for those. The prepare_run compute warm-up uses the same path, so a slow optimizer build no longer holds the start.Write-backs by DMA
Mirror → guest write-backs go through a staging ring on a transfer-only queue, which is AMD's SDMA engine. On the RX 6600 this cut GPU time from 18.2 to 14.0 ms per frame in Kokiri. Every reader of guest memory waits for copies over its range: mirror syncs, mirror make/free, guest bindings, texel views, texture flushes and the page table's first fill.
RX_VK_WB_DMA=0: off.Diagnostics
RX_VK_CHECKPOINTS=1: AMD buffer markers around draws and dispatches. A device lost lists what was done, under way and not reached, with each program's stages.RX_VK_LOG_READBACK_FILE=<path>: logs every readback while that file exists.Not tested: NVIDIA, Linux, and AMD cards other than the RX 6600. The DMA, readback-refresh and release changes apply to all GPUs. The optimizer race and the per-stage warp profile (
RX_VK_WARP_WIDE=1, off by default) are also in this change.🤖 Generated with Claude Code
hopefully this gets merged
borderline unplayable for people that have rx 6600
Tested on an RTX 4080 / Windows 11 / Ryzen 9 7900X:
main4cfa08fwith this PR merged, warm caches, Kokiri Forest standing still, 60 sRX_VK_FRAMELOGper run, windowed 1280x720, frame generation off. One run per build, plus two runs of plainmain.main(2 runs)main+ #430No regression on NVIDIA: same fps range, no white frames, no device lost. Plain
mainbarely flickers on this card, so this only shows the PR does no harm here; the AMD-specific parts can't be judged on this GPU.Thank you, this was very useful. Three parts are ported into main by hand and shipped in https://github.com/NotRexed/Hookshot/releases/tag/ultrawide, each with your env switch and credit: the readback refresh for the exposure meter (it reduced one-frame lighting flicker here too, on an RTX 3060), task/mesh pipelines without the optimizer on AMD, and holding releases while queues are stopped. The DMA write-backs, the per-pipeline optimizer race and the warp profile are not in yet (they conflict with main now and are untested on NVIDIA); if you'd like them in, a rebased PR with just those would be great.