Work around AMD Vulkan task shader timeouts and restore cloth rendering #1747
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!1747
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/amd-gpu-rx6700xt"
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?
The RX 6700 XT can still hit driver timeouts in the native task + mesh path on Windows. A separate issue makes the cloth on some Kokiri Forest pots glow white when its color pipeline gets stuck compiling.
Changes
VK_ERROR_UNKNOWN.Experimental fallback testing
Set
RX_VK_TASK_MESH_FALLBACK=1inhookshot_env.txtto opt in on Vulkan devices that expose task shaders, mesh shaders, and buffer device addresses. The override works across GPU vendors, drivers, and operating systems, including SteamOS with RADV. Set it to0to use the native path on those devices.Validation
Follow-up to #1413. Related to #996 and #1540. Integrates #1510 and #1511.
Read through the whole diff and it hangs together. I checked the push-constant layout (capacity/vertices/indirect in/out at +16/+20/+24/+32, all under kPushSize, and the generated vertex stage gets the capacity member too), the indirect launch args (dispatch at byte 0, VkDrawIndirectCommand at byte 16 with the trailing words zeroed by the 32-byte fill), the shared per-task-group payload copy, the split of direct draws into batches with first_task carried through, and the runtime/seed/disk-stamp selection (
uses_mesh_fallback, stamp bit 4). The test in test_fallback_buffer_cleanup matches the new payload sizing (capacity 4, 2 threads gives 32 bytes). Nothing I'd block on.A few non-blocking notes:
fallback_indirect_arenais thread-local and allocates about 392 MB (384 MB records + 8 MB payload) per thread on the first GPU-counted task draw. That is fine on a 12 GB RX 6700 XT, but this path also runs on every GPU that lacks VK_EXT_mesh_shader (thedev.mesh_fallbackcase), including small-VRAM cards, and with the recorder thread now on main it can be one arena per recording thread. Might be worth sharing one arena or sizing it down if VRAM is tight, with the existing 'unavailable, using the small buffers' fallback covering allocation failure.0x5fa56485a6b07619. That is OK as a targeted fix, but it will silently stop applying if the program's key ever changes (e.g. a translation change that alters the hash). TheVK_ERROR_UNKNOWNretry is the more general safety net.RX_VK_NOOPT/task_mesh_fallbackDISABLE_OPTIMIZATION on all fallback compute pipelines is a perf trade-off on those paths. Fine given the timeouts, just worth remembering when comparing against native.Overlap: #1510/#1511/#1731 also touch the mesh/task fallback, so expect some merge friction there.
Thanks for working on this!
As you might have seen on the open issues, there is some similar GPU hangs on AMD handhelds w/ SteamOS.
Currently, the only viable solution is
RX_VK_NO_MESH=1that prevents the GPU hang, but causes missing geometry and significantly degraded performance. AddingRX_VK_PER_QUEUE_FENCES=0also fixes the flickering, making the game playable, although far from ideal.Would it be possible to expose the task/mesh compute fallback introduced in this PR through an experimental environment flag, independently of the GPU vendor/driver or OS? Some RX_VK_TASK_MESH_FALLBACK or so would be great.
I'd be happy to test it on RADV and report back on stability, rendering quality, and performance. This could potentially help other AMD handheld users facing similar issues.
Thanks for the review and for offering to test on RADV! I updated the PR to
6c07058, and it has now been merged intomainasb235c4d.The updated code uses main’s compact mesh allocator from #1511. The old 392 MiB arena was replaced by a 64 MiB records buffer plus the task payload. The update preserves the starting workgroup for direct and indirect draws, keeps main’s graphics pipeline library cache, and retains the targeted workaround for the cloth shader on AMD’s Windows Vulkan driver. I verified that the distant trees in Hyrule Field stopped flickering on my RX 6700 XT.
For SteamOS and RADV, a build from
mainthat includesb235c4dalready supportsRX_VK_TASK_MESH_FALLBACK=1. Add it tohookshot_env.txtnext toimage.binand removeRX_VK_NO_MESH=1, which skips those draws. The startup log should saytask + mesh programs use the compute fallback.For an A/B comparison, use
RX_VK_TASK_MESH_FALLBACK=0for the native path, keepRX_VK_PER_QUEUE_FENCESat the same setting in both runs, and let each mode warm its shader cache before comparing FPS. A report with the handheld model, SteamOS and RADV versions, the scene tested, andhookshot_log.txtwould help compare hangs, missing geometry, flicker, and performance.