WIP: fix(vk): task + mesh compute fallback by default for Navi 23 on Windows, one rule for the IDs #219
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/upscaling
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/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!219
Loading…
Reference in a new issue
No description provided.
Delete branch "TrashPanda/Longshot:fix/navi23-24-mesh-fallback"
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?
Why
On Windows, AMD's RX 6600 / 6600 XT / 6650 XT (Navi 23) still draw task + mesh work through the driver's own mesh shaders, the path that loses the device on Navi 21 and 22 (https://github.com/NotRexed/Hookshot/issues/996). One RX 6600 report (Mako) lost the device on the session's first task + mesh draws, so this puts Navi 23 on the compute fallback, as Navi 21 and 22 already are. The evidence is mixed, so this stays WIP until a Windows RX 6600 run decides: another RX 6600 on the same driver played 15-20 minutes on the native path (#130). See "Two RX 6600 reports" below.
Ported from Mako, by sharkiix,
github.com/Shakoquo/Mako@c4fd465a55What changed
create_device()ingpu/vk/vk_main.cppintomesh_rule::task_mesh_fallback_default(vendor, device)ingpu/vk/mesh_mode.h(nothing of Vulkan, so a test can compile it).vk_main.cppstill asks only under#ifdef _WIN32, andRX_VK_TASK_MESH_FALLBACKandRX_VK_MESH_SHADERS=nativestill decide over it, unchanged.mesh_mode.h's comment: an included chip brings every ID that the PCI ID database or libdrm'samdgpu.idsname a card for, consumer, mobile and Pro alike (they share the chip and the driver's mesh path). Not its USB or audio functions, nor IDs neither list names a card for. Untested IDs go in with their chip, as https://github.com/NotRexed/Hookshot/pull/2215 did for the RX 6900 XT XTXH and RX 6950 XT.ea448fe7). That commit stands alone and can be dropped if you would rather keep Navi 21 as it was; the rule in the comment would then need to say "consumer and mobile".mesh_mode.handdocs/development.mdsay it is not on by default and thatRX_VK_TASK_MESH_FALLBACK=1tries it.Left out by the rule: Navi 21's 0x73a4, Navi 22's 0x73c4 and Navi 23's 0x73e4 (USB controllers); Navi 22's 0x73c3 (no model in either list) and 0x73ce (its SR-IOV function, no model); 0x73da is in neither list. Left out as Navi 24 (held): 0x743f, 0x7421, 0x7422, 0x7423, 0x7424.
tests/test_task_mesh_fallback_devices.pycompilesmesh_mode.hand checks that every listed ID is in the default for AMD only (not for NVIDIA or Intel with the same ID), and that RDNA 1, RDNA 3, the USB and unnamed IDs and all of Navi 24 stay out. It still readsvk_main.cppto check that the default is Windows-only and thatRX_VK_TASK_MESH_FALLBACKis read after it. It fails onmain(notask_mesh_fallback_default), and fails with 0x743f put back.RX_VK_TASK_MESH_FALLBACKrow indocs/development.mdnames the chips, the rule and Navi 24's opt-in. The README's AMD row now claims only what reports show: the driver lost the GPU on an RX 6700 XT, an RX 6800 XT and, in one report in Mako, an RX 6600; another RX 6600 played 15-20 minutes on the native path (issue 130); the RX 6400 and 6500 XT keep their own mesh shaders.Two RX 6600 reports
OptimizeChangeBancDrawMeshTasks1..3, then a 5 s GPU wait6125 MB used of 6317 MB allowed, textures 1849 MB against a 1260 MB budgetHow they fit together, as far as the evidence goes:
OptimizeChangeBancis the game's scene-change thread. So Mako's loss happened where VRAM and uploads peak too, the same moment as issue 130's. AMD's Windows driver gives no fault info, and "DrawMeshTasks 1..3, then a 5 s GPU wait" is the last work recorded before the timeout, not the work that faulted. Without the log there is no telling a mesh-path timeout from a paging timeout like issue 130's.gpu/vk: AMD FSR Redstone frame generation,vk_draw.cpp+290 lines, a perf monitor, the recompiler's value probe, and a second copy of the storage-buffer rule for graphics stages (task and mesh included). Mako 3.5 also turned VRAM compaction on by default. 2d5a9d65 (small read-only storage buffers copied into the recording's stream while their chunk is imported) landed two minutes before the fallback commit, and both shipped in 3.5.1. Whether the reporter's build had it is unknown. None of these is known to cause a first-draw loss, but none is ruled out either, and Longshot main has only some of them.What the fallback costs in VRAM
From
fallback_buffers_ofingpu/vk/vk_draw.cppand the constants inemit_spirv.h:(MESH_FALLBACK_HEADER_WORDS + MESH_FALLBACK_RECORD_WORDS) * 4= (8 + 16 Mi words) × 4 B = 64 MB per buffer pair. It is the same size for every program.65535 * 4B (a 256 KB map) +ceil(65535 / task threads) * payload_words * 4B.payload_wordsis the program's lines × 32 (at most 511 lines), so 128 B to 64 KB per task workgroup. At 32 task threads that is 256 KB + 2048 × (128 B to 64 KB), from about 0.5 MB up to about 128 MB. The source's own note puts it at about 6.5 MB at 800 words.RX_VK_PARALLELis off). WithRX_VK_PARALLEL=nthere are n, up to 8, each with its own set.On the default: the evidence does not show yet that Navi 23 needs it. Issue 130 points to VRAM, not the mesh path. Mako's report has no log, and it came from a different tree. My proposal: this PR stays WIP until a Windows RX 6600-class run (T-V2MY) compares main and this PR with the
vk: VRAM:status line watched.mesh_mode.h, the ID rule and the docs.Flags and settings
RX_VK_TASK_MESH_FALLBACK=0/1(existing)=1)=0turns it off for a runMeasurements
None possible: this PC has no RDNA 2 card (RTX 4070 Ti, driver 595.99.02, Linux), and the change only applies on Windows with AMD. The VRAM figures above are worked out from the source, not measured.
main:
fbd42024(2026-11-13)this PR: fix/navi23-24-mesh-fallback @
ea448fe7Hardware: none with the affected GPUs
Scene: n/a
Method: n/a. The motivating report is Mako's (by sharkiix): an RX 6600 on Windows, AMD Vulkan driver 0x800161, lost the device on the session's first task + mesh draws (
OptimizeChangeBancDrawMeshTasks1..3, then a 5 s GPU wait). The counter-report is issue 130 (quoted above).How to reproduce: on an RX 6600 / 6600 XT / 6650 XT on Windows, the same save and settings on
mainand on this PR, from a fresh start into Kokiri Forest, then the Lost Woods, Hyrule Field, Castle Town and Death Mountain Crater, 15-20 minutes each. The log'svk: task + mesh programs use the compute fallbackline says the fallback is on. Note everyvk: VRAM: N MB used of M MB allowedline and the fps.fbd42024ea448fe7Testing
Tested: game-free checks on Linux (RTX 4070 Ti, clang).
tests/test_task_mesh_fallback_devices.pypasses here. It fails onmain, and fails with 0x743f put back in the list.tests/test_mesh_mode_switch.pypasses.python3 -I -B tests/run_all.py --jobs 4(withLONGSHOT_VULKAN_HEADERSset) onea448fe7: 498 passed, 1 failed, 30 skipped. The one failure,tests/test_lift_cache.py(import lift, split_hotfails: no numpy here), also fails onmain.vk_main.cppwas not compiled here: it needswindows.h, and there is no mingw toolchain on this PC. Its change is one call intomesh_mode.h, which the test compiles with-Wall -Wextra -Werror.Not tested: not run in the game: no RDNA 2 card or Windows AMD system here. Not tested: whether the fallback stops a device lost on Navi 23, how much VRAM it takes in play, what it costs in frame rate there, and anything on Navi 21's Pro IDs.
Needs other testers:
vk: VRAM:lines and note any device lost, and compare fps with main. Expecting no device lost on the PR, VRAM under the allowance, fps within a few % of main. A clean run on main matters too: it says whether the default is needed (T-V2MY).Screenshots
Nothing on screen.
Risk and rollback
Navi 23 (and Navi 21's Pro IDs) on Windows now take the compute fallback, which can be slower, and which holds at least 64 MB more VRAM per recording thread, more as payloads grow. On an 8 GB card at the driver's limit, that can bring on issue 130's device lost sooner.
RX_VK_TASK_MESH_FALLBACK=0orRX_VK_MESH_SHADERS=nativerestores the native path for a run. Reverting the commits restores the old list. The pipeline cache's stamp already holds the mesh path, so the first start on an affected card translates the programs again.Reviewer notes
ea448fe7) is a separate commit so it can go on its own if you'd rather not widen Navi 21 here.Issues
https://github.com/NotRexed/Hookshot/issues/996; #130 (the counter-report and the VRAM risk).
Checklist
For everyone
type(scope): description).main.python -I -B tests/run_all.pyrun and passing (any failure that also fails onmainis named above).third_party/untouched (a new folder with aPROVENANCE.mdinstead).If applicable
Assisted-by:/Co-Authored-By:trailers.mainand passing here.tests/that reads changed source updated in this PR, not weakened.mesh_mode.his portable C++ the test compiles;vk_main.cpp's change is one call into it)The code change is small and correct. The ID list moves into
mesh_rule::task_mesh_fallback_default(), it is still asked for only under#ifdef _WIN32(Linux RADV is unchanged), andRX_VK_MESH_SHADERS=nativeandRX_VK_TASK_MESH_FALLBACKstill decide after it. The existingvk: task + mesh programs use the compute fallbacklog line covers the new cards. The new test compiles the header and checks AMD-only membership, which is better than the old regex. The Navi 23 and Navi 24 IDs that were added match pci-ids and amdgpu.ids.What holds it back is the evidence, not the code:
MESH_FALLBACK_RECORD_WORDS,fallback_buffers_ofingpu/vk/vk_draw.cpp), plus payloads, and grown buffers stay. So on 8 GB Navi 23 it could make issue 130's failure more likely. On 4 GB Navi 24 the cost is larger still. Please link issue 130 and say how the two reports fit together, and have the test run watch the VRAM status line.Leaving this as a comment: it is WIP, and the code needs nothing beyond point 3. Points 1 and 2 decide whether it should merge.
@ -44,0 +46,4 @@/// Windows, where AMD's driver timed out on the native task + mesh path of RDNA 2. Navi 22 first, then Navi 21: on an RX/// 6800 XT (driver 0x800161) the native path lost the device within minutes at Hyrule Castle's entrance, while the/// fallback played 25 minutes there with none. Navi 23: an RX 6600 (driver 0x800161) lost the device on the session's/// first task + mesh draws (reported in Mako by sharkiix). Navi 24 has the same RDNA 2 mesh path, not tested on its own#130 is an RX 6600 on this same driver (0x800161). It ran the native path for 15-20 minutes through several areas, then lost the device at the VRAM limit. So "first task + mesh draws" isn't universal on Navi 23, and the fallback's extra memory could make issue 130's failure more likely. Worth saying here, or at least in the PR, what tells the two reports apart.
@ -44,0 +55,4 @@case 0x73a5: // Navi 21: RX 6950 XTcase 0x73df: // Navi 22: RX 6700, 6700 XT, 6750 XT, 6750 GRE 12GBcase 0x73e0: // Navi 23: RX 6600Mcase 0x73e1: // Navi 23: Radeon Pro W6600MThe W6600M and W6600 (here and the next line) are added with no report, but the RX 6300 (0x7424, a consumer Navi 24 card) and the W6400/W6300 (0x7422/0x7423) stay out "as none reported". Use one rule for both chips: either the whole family of each chip, or only the cards someone reported on.
@ -44,0 +59,4 @@case 0x73e3: // Navi 23: Radeon Pro W6600case 0x73ef: // Navi 23: RX 6650 XTcase 0x73ff: // Navi 23: RX 6600, 6600 XT, 6600 LEcase 0x743f: // Navi 24: RX 6400, 6500 XTNavi 24 goes into the default with no report and no run ("not tested on its own"). These are 4 GB cards on PCIe x4. The fallback's records buffer is 64 MB per recording thread, plus payloads, and grown buffers stay (
fallback_buffers_of, vk_draw.cpp). That makes this the card where the fallback's memory cost hurts most. I'd hold 0x743f until a 6400/6500 XT run on Windows shows the native path loses the device there and the fallback stays playable within VRAM.6cd317195bea448fe7baWIP: fix(vk): task + mesh compute fallback by default for Navi 23 and Navi 24 on Windowsto WIP: fix(vk): task + mesh compute fallback by default for Navi 23 on Windows, one rule for the IDsThanks for the review. Rebased on main (
fbd42024); the head is nowea448fe7. Point by point:b61f1018. 0x743f is out of the default, and so is the rest of Navi 24.mesh_mode.handdocs/development.mdsay it is not on by default and thatRX_VK_TASK_MESH_FALLBACK=1tries it. The test now checks 0x743f stays out, and it fails if 0x743f is put back.vk: VRAM:lines and any device lost, and compares fps with main. The PR stays WIP until it comes back.Done in the description ("Two RX 6600 reports", "What the fallback costs in VRAM"). Issue 130 is linked there, in the README row and in
mesh_mode.h's comment. In short:OptimizeChangeBancis the scene-change thread. "DrawMeshTasks 1..3, then a 5 s wait" is the last work recorded before the timeout, not what faulted. AMD's Windows driver names nothing.gpu/vkchanges, including Redstone frame generation,vk_draw.cpp+290 lines and a second copy of the storage-buffer rule for task and mesh stages. A storage-buffer change landed two minutes before the fallback in the same 3.5.1. None is known to cause it, but none is ruled out.(8 + MESH_FALLBACK_RECORD_WORDS) * 4), plus a payload of 0.5 MB to about 128 MB at 32 task threads. That is per recording thread: one by default, up to 8 withRX_VK_PARALLEL. A bigger payload makes a new pair (another 64 MB), and the old pairs stay. Against issue 130's last status (192 MB of headroom), one pair is about 1% of the allowance and three would be all of the headroom.Plainly: the evidence doesn't yet show Navi 23 needs this default, and it can make issue 130's failure more likely. My proposal is that it stays WIP until T-V2MY decides. If main loses the device where the PR doesn't, and VRAM stays under the allowance, Navi 23 goes in. Otherwise Navi 23 becomes opt-in like Navi 24, and the PR keeps only the move to
mesh_mode.h, the ID rule and the docs.ea448fe7, stated inmesh_mode.h's comment and the description. An included chip brings every ID that pci-ids or amdgpu.ids name a card for, consumer, mobile and Pro alike. Not its USB or audio functions, nor unnamed IDs.b61f1018. It now says the RX 6600 to RX 6950 XT (Navi 21 to 23) use the fallback by default, and that the driver lost the GPU on an RX 6700 XT, an RX 6800 XT and, in one report in Mako, an RX 6600. It adds that another RX 6600 played 15-20 minutes on the native path (issue 130), and that the RX 6400 and 6500 XT keep their own mesh shaders.Done: the description, the commit messages and the comments this PR adds (
mesh_mode.h,vk_main.cpp, the test) now use https://github.com/NotRexed/Hookshot/issues/996. The first commit's message was reworded for it. That also dropped a strayCo-authored-by: Cursortrailer, which should not have been there.Line comments:
The whole family of each chip, as in point 3 (
ea448fe7).Held, in
b61f1018. All of Navi 24 is out. There is no Navi 24 request yet; one only makes sense after the Navi 23 run.Both. The comment says the Mako report has no log, that issue 130's RX 6600 played 15-20 minutes on the native path and lost the device only at the VRAM limit, and that the fallback costs VRAM of its own. The PR has the full comparison.
Tests:
python3 -I -B tests/run_all.py --jobs 4onea448fe7: 498 passed, 1 failed (test_lift_cache.py, no numpy here; it fails on main too), 30 skipped.ea448fe7ba3f85a37581Reworded the last two commits' messages only (an unwanted tool trailer removed), no code change:
b61f1018is now6fc9dbe2andea448fe7is now3f85a375. The review answer's hashes map to these.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.