Idea: Steal Lichii's Fix for Mesh Shaders for RDNA3/RDNA4 GPUs on Linux #1285
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#1285
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 idea
Someone finally got to the root of why the mesh shaders crash on RDNA3/RDNA4 GPUs on Linux, even though those GPUs support mesh shaders: A buggy driver expects that mesh shaders will always read the mesh grid size, but OOTs translated shaders never do. Hence the crash. It can be trivially fixed by always declaring and reading the grid size. See: https://github.com/zortos293/Lichii/pull/1203
With this fix, the compute fallback is no longer necessary for RDNA3/RDNA4 GPUs on Linux.
Anything else
Litchii does this: https://github.com/zortos293/Lichii/pull/1203
Possibly related, for context:
Claiming this on Linux (Fedora 45, Mesa RADV 26.3.1, AMD Radeon RX 9070 XT / RDNA 4, Ryzen 5 5600X). Initial probe of
RX_VK_MESH_SHADERS=nativeran cleanly across Hyrule Field, Kokiri Forest, Market, and Lake Hylia with -40% cold shader prep (254.8 -> 153.2 s), ~1 GB less private RAM, and -4 to -10% GPU time, though CPU-bound Market FPS was ~3% lower. Investigating that CPU overhead and testing GPU-bound scaling next before implementing theBuiltIn::NumWorkgroupsworkaround and RADV policy change.We tested native
VK_EXT_mesh_shader(RX_VK_MESH_FALLBACK=0) vs compute mesh fallback (RX_VK_MESH_FALLBACK=1) on Linux RADV RDNA 4 and tracked down both theNumWorkgroupsfix and the CPU/GPU performance behavior.Setup
DP-1)main@a2dc53851. Lichii
#1203(NumWorkgroups) FixOpened a focused PR (#2338) with Lichii
#1203'sspv::BuiltIn::NumWorkgroupsworkaround for nativeStage::Meshshaders + a game-free SPIR-V regression test (tests/global_load_16_ir.cpp, validated withspirv-val --target-env vulkan1.3 --uniform-buffer-standard-layout). RADV's default mesh mode is kept unchanged there so maintainers can decide on flipping defaults once#2291lands.2. Paired A/B Measurements on RX 9070 XT (RADV Mesa 26.3.1)
On
mainalone, native mesh shaders trailed compute fallback on both scenes (kokiri-forest-13.6%,castle-gate-9.3%). Testing alongside#2291(descriptor / SPIR-V improvements) + Task/Meshc2bank caching flippedkokiri-forestto a win and cut GPU frame time substantially on both scenes:RX_VK_MESH_FALLBACK=1)RX_VK_MESH_FALLBACK=0)kokiri-forest(67% res,main)kokiri-forest(67% res, w/#2291+ bank cache)castle-gate(1440p,main)castle-gate(1440p, w/#2291+ bank cache, stock tuning)castle-gate(1440p, w/#2291+ bank cache,PART_MIN=360 PART_MAX=1024 GPU_CLOCK=peak)Memory & precompile wins with Native Mesh:
~1.0 GBlower (6.5 GBWS /0.96 GBprivate vs7.5 GBWS /1.95 GBprivate).153.2 svs254.8 s).3. Root Cause of the Remaining CPU-Bound Gap in
castle-gate(-5.1%/+0.67 ms)CPU profiling (
HOS_PROFILE=1/ speedscope) showed thatmkw_vk_replaydraw/descwork is now equal or slightly faster on Native (7.49 / 3.01 msvs7.82 / 3.13 ms). The entire remaining+0.67 msgap is insidemkw_vk_recorderpart_submit -> submit_or_retry(vkQueueSubmit2):162 µs/part(2.17 s / 10 s,21.5%CPU;libdrm_amdgpu.so.13.1%,libdrm.so.23.1%)90 µs/part(1.21 s / 10 s,11.7%CPU;libdrm_amdgpu< 0.1%,libdrm0.6%)Because RADV splits command buffers containing Task shaders across two hardware rings (GFX + ACE compute), every
vkQueueSubmit2pays twoDRM_IOCTL_AMDGPU_CSioctls plus ACE↔GFX syncobj synchronization. Reducing parts per frame from18.7 -> 11.9(RX_VK_PART_MIN=360 RX_VK_PART_MAX=1024) broughtparts' ends and submitsdown to2.25 ms/framevs Compute's1.59 ms/frame(+0.66 ms/frame), accounting for 100% of the+0.67 msmedian delta on this 5600X.Takeaway
kokiri-forestonce#2291lands).castle-gateon a 5600X), RADV's dual-ring Task+Mesh submission overhead still costs~0.67 ms/frame(~5%) unless part count per frame is reduced further.c2/ per-stagepointer_table()bank caching cleanup.