WIP: perf(vk): enable storage table loop and mesh optimizer on AMD RDNA 4 #1308
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!1308
Loading…
Reference in a new issue
No description provided.
Delete branch "gmourao/Longshot:perf/vk-rdna4-table-loop-mesh-opt"
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: perf · Risk: low · Tested on: Windows 11, AMD Radeon RX 9060 XT (isolated in-game run + unit/C++ checks on
d79a0580; awaiting interleaved 2+2mainvsPRruns) · Needs: Windows, RDNA 4 / RDNA 2; Linux, RDNA 4 (RADV)Why
On AMD RDNA 4 GPUs running AMD's proprietary Windows driver (LLPC), unrolled storage buffer lookup tables in global-memory access helpers generate huge SPIR-V shaders (>100k instructions), and Task/Mesh pipelines are built with
VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BITby default. Enabling the storage table loop and the driver's mesh shader optimizer specifically on AMD RDNA 4 (RX 9/GFX12) avoids those slow unoptimized paths while leaving GCN, RDNA 1-3, RADV, Intel, NVIDIA, and compute fallback behavior unchanged.What changed
Added an RDNA 4 detection helper and scoped both
global_table_loop(on AMD proprietary) and the defaultmesh_optflag inbuild_graphics()to RDNA 4 GPUs, preserving environment variable overrides, compute fallback policy, and existing test-extraction boundaries.is_rdna4()ingpu/vk/vk_internal.hmatches AMD (0x1002) devices whosedeviceNamecontainsRX 9orGFX12(matchingauto_profile()ingpu/vk/vk_main.cpp).table_loop_wanted()ingpu/vk/vk_coopmat.cppnow takesbool rdna4and defaults to enabled onVK_DRIVER_ID_INTEL_OPEN_SOURCE_MESAorrdna4 && driver == VK_DRIVER_ID_AMD_PROPRIETARY(requiringdynamic_indexing, withRX_VK_GM_LOOPoverride intact).build_graphics()ingpu/vk/vk_draw.cppcomputesmesh_optinline (self-contained fortests/test_fallback_pipeline_state.py), defaulting totrueon RDNA 4 whenRX_VK_MESH_OPTis unset or empty while preservingVK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BITon GCN and RDNA 1-3 and leavingfallback_compute_pipelines()unchanged frommain.tests/test_global_table_loop.pyandtests/test_radv_mesh_optimizer.py(both keepingRUN_ALL_ARGS = ["--cxx", "{cxx}"]for real C++ compilation/execution) to verifyis_rdna4()+ RDNA 4 defaults, GCN/RDNA 1-3/RADV/NVIDIA/Intel preservation, andRX_VK_GM_LOOP/RX_VK_MESH_OPToverrides.Measurements
Verdict: isolated in-game smoke run on
this PR @ d79a0580(with zero env overrides) confirmedstorage buffer tables searched in loopsactive automatically and0unoptimized task/mesh logs (96 >300-present windows: 185.2 avg / 230.3 median FPS; 98 GPU time windows: 1.82 ms avg / 0.40 ms median); interleaved 2+2 runs againstmain @ e41de662still pending.Baseline: single-session isolated reference on
this PR @ d79a0580(first cold cache rebuild run, zerolongshot_env.txt) vs earliernightly-316-a0be15b3(3e664cdd) baseline; replace the pending 2+2 median cells with interleaved runs onmain @ e41de662vsthis PR @ d79a0580before removingWIP:.Hardware: Windows 11, AMD Radeon RX 9060 XT (16 GB, driver 26.10.1 LLPC, id 1002:7590), 16 logical CPUs, 32 GB RAM
Scene: gameplay benchmark / save run (1280x720 swapchain, FSR 4 Quality, >300 presents log windows)
Method:
longshot_log.txtFPS/GPU time summaries (>300 presentsandGPU timelines); 2 interleaved runs each onmainandthis PR(median) needed to finalizeHow to reproduce: launch with default environment (no
RX_VK_GM_LOOPorRX_VK_MESH_OPToverrides) after initial shader cache warm-upe41de662d79a0580nightly-316ref: 87.0 / 60.0]nightly-316ref: 7.11 / 8.60]nightly-316ref: 9.9]Flags and settings
No new flags added; changes the default on AMD RDNA 4 for two existing environment switches.
RX_VK_GM_LOOPDontUnrollloopRX_VK_MESH_OPTDISABLE_OPTIMIZATION_BITon RDNA 4 Task/Mesh shadersTesting
Tested: on
this PR @ d79a0580(Windows 11,clang++.exe): 13/13 targeted C++ and Python checks passed (test_fallback_pipeline_state,test_quick_pipelines,test_utf8_paths,test_amd_subgroup_profiles,test_driver_faults,test_vendor_fixes,test_fallback_size_policy,test_radv_mesh_optimizer,test_global_table_loop,test_doc_anchors,test_mesh_fallback,test_mesh_fallback_failed_once,test_intel_quick_compute);scripts/check_third_party.pypassed;longshot_vk.dllbuilt cleanly (llvm-mingw,0 failed). Isolated in-game run on RX 9060 XT (zerolongshot_env.txt) verifiedstorage buffer tables searched in loopsactive,0unoptimized task/mesh fallback logs, 185.2 avg / 230.3 median FPS, 1.82 ms avg / 0.40 ms median GPU time, and 0 render-thread catch-ups. The 3 unrelated Windowsclang++failures seen in an earlier--changed mainrun (test_fsr_uniform_ownership.py,test_replay_write_order.py,test_vk_occlusion_queries.py) were directly reproduced (0 passed, 3 failed) on unmodifiedmain @ e41de662.Not tested: interleaved 2+2 warm benchmark against
main @ e41de662, full Linux build/suite, RDNA 4 on Linux RADV, and RDNA 2 regression check.Must be tested:
main @ e41de662vsthis PR @ d79a0580in the same scene with default settings (noRX_VK_GM_LOOPorRX_VK_MESH_OPToverrides), expectingstorage buffer tables searched in loops, no unoptimized Task/Mesh fallback log, higher FPS, and lower GPU frame time (Test Farm: @Beanstalk Please compare this PR against maine41de662on Windows with an AMD Radeon RX 9000-series GPU and proprietary driver using default settings without RX_VK_GM_LOOP or RX_VK_MESH_OPT overrides, warm up then run main/PR/main/PR in the same scene and report frame-time, FPS and preparation results)VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BITto remain active and no device lost (Test Farm: @Beanstalk Please test on Windows with an AMD RX 6000 / RDNA 2 GPU on proprietary drivers in Kokiri Forest, confirming the log still printstask and mesh programs built without the driver's optimizerand no device lost occurs)radv): runtests/run_all.pyand a gameplay smoke test, expecting unchanged behavior and all tests passing (Test Farm: @Beanstalk Please test on Linux with RADV by runningpython -I -B tests/run_all.pyand a gameplay smoke test)Risks
What could break: an AMD RDNA 4 driver regression with optimized Task/Mesh pipelines or dynamically indexed SSBO tables.
Turning it off: set
RX_VK_GM_LOOP=0andRX_VK_MESH_OPT=0, or revert the commit.Compatibility:
global_table_loopis part oftranslator_stamp(), so on AMD RDNA 4 proprietary drivers the first launch after updating invalidates and rebuildslongshot_programs.binandlongshot_vk_pipelines.binonce; all other GPUs keep existing caches untouched.Checklist
Everyone
type(scope): description) of the status line's type.can't be run by hand is in Testing's Not testable by hand, with why.
main @ e41de662vsthis PR @ d79a0580; keep WIP until measured locally or on Test Farm)in Risks. Not ticked yet: The main-versus-PR comparison is still pending, and the first-launch cache rebuild cost is named but not measured.
main.python -I -B tests/run_all.pypasses (13 targeted checks passed ond79a0580and 3 unrelated failures from earlier--changed mainreproduced onmain @ e41de662; full Windows/Linux suite run pending before removingWIP:).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
tests/that reads changed source updated in this PR, not weakened.llvm-mingwWindows build andtest_utf8_paths.pypassed; Linux build untested locally and requested on Test Farm)Tested in game: Windows 11, AMD Radeon RX 9060 XT (26.10.1): default env (no overrides), storage buffer tables searched in loops active, 0 unoptimized mesh logs, 185.2 avg / 230.3 med FPS, 1.82 ms avg / 0.40 ms med GPU
@Beanstalk Please compare this PR against main
e41de662on Windows with an AMD Radeon RX 9000-series GPU and proprietary driver using default settings without RX_VK_GM_LOOP or RX_VK_MESH_OPT overrides, warm up then run main/PR/main/PR in the same scene and report frame-time, FPS and preparation results@gmourao only members of
BigBeanscan start the farm. One of them can approve this request by reacting 👍 to it or to this comment.Brought up to the ready-for-review standard (#1454): the checklist's Everyone list has two new boxes, added here from what this PR's description and comments show (please check they match what you know).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.