perf(vk): save ~1 ms on FSR 3.1 across all GPUs by writing direct output and narrowing barriers #2085
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2085
Loading…
Reference in a new issue
No description provided.
Delete branch "Jer9/Longshot:perf/vk-fsr3-direct-output-barriers"
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?
Summary
When AMD FSR 3.1 runs on the temporal upscaler chain (
gpu/vk/vk_fsr3.cpp),fsr3::upscale()previously rendered into an internalg.outputimage and then executed afull_barrier(cmd)plus a full-resolutionRGBA16FvkCmdCopyImage(12.8–18.4 MBper frame) intof.output.image. In addition,draw_engine()andactor_motion()ingpu/vk/vk_temporal.cppemitted fourfull_barrier(cmd)calls around temporal upscaler execution.This PR:
f.output.viewdirectly intofsr3::upscale()(P_ACCUMULATE) per frame wheneverf.output.viewis valid and created withVK_IMAGE_USAGE_STORAGE_BIT, eliminating the per-framefull_barrier+vkCmdCopyImage(retaining the internalg.output+ targeted-barrier copy fallback whenf.outputis not storage-capable).full_barrier(cmd)calls ingpu/vk/vk_temporal.cpp(draw_engineandactor_motion) to explicit stage/access barriers (COMPUTE | TRANSFER | VERTEX | FRAGMENTandSHADER_READ | SHADER_WRITE | TRANSFER_READon entry soactor_motion's buffer copies and depth/geometry reads are fully synchronized), and moves DLSS's post-evaluate barrier intogpu/vk/vk_dlss.cpp.Files to read first:
gpu/vk/vk_fsr3.h,gpu/vk/vk_fsr3.cpp,gpu/vk/vk_temporal.h,gpu/vk/vk_temporal.cpp,gpu/vk/vk_dlss.cpp.Testing
Tested: Windows 11 (build 26200), AMD Ryzen AI 7 350 / AMD Radeon 860M (
1002:1114, RDNA 3.5gfx1152), Adrenalin26.10.1 (LLPC).RX_VK_PASS_TIMING=1A/B (#2084 alone vs #2084 + this PR onFSR 3.1 75%,1600x1000): verifiedrecordings_glue_msdropped from1.14 msto0.71 ms(-0.43 ms) and total GPU spans dropped from22.58 msto21.62 ms(-0.96 ms).FSR 3.1 75%(1600x1000&1920x1200) andXeSS 2.0.2 75%(1600x1000).Auto,dlss=3,resolution=0): transitioned live0 -> 4 (50% 800x500) -> 1 (100% 1600x1000) -> 0 (Auto)acrossKokiriForest_Child -> LostWood_Child -> HyruleField_Childwith camera motion;4/4reallocations succeeded, 1,200 FSR 3.1 frames drawn,0evaluation failures,0VK_ERROR_DEVICE_LOST.1600x1000(RX_VK_SHOT_FX=1,sharpness=80%) screenshots for both FSR 3.1 and XeSS 2.0.2 — identical scene, lighting, HUD, and foliage with zero sync artifacts.KokiriForest_Child -> LostWood_Child -> HyruleField_Child, 15,276 frames,0evaluation failures,0VK_ERROR_DEVICE_LOST).check_third_party.py,test_doc_anchors.py,test_utf8_paths.py,test_temporal_history.py,test_fsr3_release_frees.py,test_fsr3_math.py,test_fsr3_shader_options.py,test_dlss_native_transition.py).Still to test:
FSR 3.1,XeSS, andDLSSacross zone transitions and dynamic-resolution resizes, expecting clean frames and zero synchronization validation errors (@Beanstalkplease test FSR 3.1, XeSS, and DLSS on NVIDIA).FSR 3.1andXeSSacross zone transitions andAutoresizes, expecting clean frames and zero flicker (@Beanstalkplease test FSR 3.1 and XeSS on Intel and AMD RADV).Measurements
Verdict: Cuts
FSR 3.1recordings_glue_msby-0.43 ms(1.14 -> 0.71 ms) and total GPU spans by-0.96 ms(22.58 -> 21.62 ms) on top of #2084; combined with #2084, liftsFSR 3.1 75%at1600x1000by+14.4%FPS (31.61 -> 36.17 FPS,-3.99 msframe time,-2.1 msunprofiled GPU time).Setup: Windows 11 26200, AMD Radeon 860M (
1002:1114), Adrenalin26.10.1 (LLPC);KokiriForest_Child,1600x1000docked (handheld_profile=0,ultrawide=0,vsync=2,HOS_FPS_MAX=1000,RX_VK_PRECOMPILE=0,0cold frames).3-Round Interleaved Unprofiled FPS (
mainvs this PR + #2084):89c3d21eaf704a6cFSR 3.1 75%(1600x1000, with #2084)31.61 FPS(31.64 ms,1% low 27.11,24.6 msGPU)36.17 FPS(27.65 ms,1% low 30.15,22.5 msGPU)+14.4%FPS (-2.1 msGPU)XeSS 75%(1600x1000, with #2084)32.73 FPS(30.55 ms,1% low 28.30,23.6 msGPU)35.54 FPS(28.14 ms,1% low 29.57,23.1 msGPU)+8.6%FPS (-0.5 msGPU)FSR 3.1 75%(1920x1200, 1x20s, with #2084)30.13 FPS(33.19 ms,1% low 26.92,26.7 msGPU)31.95 FPS(31.30 ms,1% low 27.64,26.0 msGPU)+6.0%FPS (-0.7 msGPU)Isolated Pass-Timing (
RX_VK_PASS_TIMING=1,FSR 3.1 75%,1600x1000, on top of #2084):d9c10742)af704a6c)recordings_glue_ms1.14 ms0.71 ms-0.43 ms(-37.7%)1600x1000)22.58 ms21.62 ms-0.96 ms447.7442.4-5.3 / frame(Rebased cleanly onto current
forge/main9dd41326with zero conflicts.)Risks
draw_engineandactor_motionbarriers affects all GPUs using temporal upscalers (FSR 3.1, XeSS, DLSS, FSR 4). Entry barriers explicitly coverCOMPUTE | TRANSFER | VERTEX | FRAGMENTandSHADER_READ | SHADER_WRITE | TRANSFER_READforactor_motion(), andvk_dlss.cppretains its post-evaluate barrier. Needs@Beanstalkverification on NVIDIA, Intel, and AMD RADV.f.outputever lacksVK_IMAGE_USAGE_STORAGE_BITor a valid view,chain_evaluate()cleanly falls back tog.output+vkCmdCopyImage.longshot_options.ini, or shader/pipeline caches.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). (All targeted unit tests pass;test_job_queue.pyskipped on Windows due to shared-consoleCTRL_C_EVENT.)main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand here, for a change that shows on screen.Assisted-by:/Co-Authored-By:trailers.Ready to merge
docs/dev/standards.md, "Hardware tiers").main, measured again or a comment says why the numbers still hold.Tested in game: Windows 11 26200, AMD Radeon 860M (1002:1114, RDNA 3.5 gfx1152), Adrenalin 26.10.1 LLPC: RX_VK_PASS_TIMING=1 verified -0.43 ms glue (1.14 -> 0.71 ms) and -0.96 ms total GPU spans on FSR 3.1 75% (1600x1000); 3-round interleaved A/B (+14.4% FSR 3.1 75% combined with PR 1, +6.0% at 1920x1200); Auto dynamic-resolution resize stress test (0 -> 50% -> 100% -> Auto across KokiriForest/LostWood/HyruleField, 4/4 reallocs, 1200 FSR 3.1 frames, 0 eval fails); matched RX_VK_SHOT_FX=1 sharpness=80 visual parity on FSR 3.1 and XeSS 2.0.2; 242s 3-zone stability tour (15,276 frames, 0 VK_ERROR_DEVICE_LOST).
RADV verification, as asked in the team chat: AMD Linux RADV on FSR 3.1 — done, parity, no artifacts.
Hardware: Fedora 45 (Linux 7.3.3), GNOME Wayland · AMD Radeon RX 5700 XT (RADV NAVI10), Mesa 26.2.6 radv · Ryzen 5 3600, 15 GB — an RDNA 1 card; the catalogue's RADV desktop coverage is an RX 9070 XT-class and an RX 580, so this fills the gap between them.
Method: your PR's commit
be4c2c16cherry-picked clean onto currentmain(the branch head carries older-base drift, so the commit itself is what was verified); built from source with the launcher's pinned toolchain; FSR 3.1 forced (RX_VK_FSR=1), output 1280x720 windowed, cap off (HOS_FPS_MAX=1000); Hyrule Field from the repo save (kokiri-start, teleport destination 1), stick-held run + full-speed camera spin, 30 s windows through the control bridge, 2 interleaved sessions per arm against currentmain.Result:
vk: AMD FSR 3.1 draws OoT's upscale: 1280x720 -> 2560x1440Not covered here: XeSS (Windows) and DLSS (NVIDIA) — named for whoever takes those. The commit itself needed no changes to build or run on RADV.