framegen: ML frame generation from the driver (opt-in, VICTORY_FIDELITYFX_FRAMEGEN=4) #376
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/lobomfz--VIctory-xmem!376
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-376"
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?
@coil111 on GitHub · 2026-12-03 21:09 UTC · original
coil111:fidelityfx-framegen-ml→main· +584 −55 · 11 files · 4 commits · merged 2026-12-04 20:01 UTCBuilds on the direct path from #253.
VICTORY_FIDELITYFX_FRAMEGEN=4uses AMD's ML frame generation (FSR Frame Generation 4.x) from the driver'samdxcffx64.dll, the same file./setup.sh fsr4already installs for FSR 4, instead of the analytical 3.1.6 generator. The visible difference is in disoccluded areas: at our low base frame rates, 3.1.6 leaves a smeared trail behind the driven car and dark, blurry screen edges when the camera turns. With ML the trail is gone. Mode 1 is unchanged, and the proxy stays the default for mode 1.How it works
VICTORY_FIDELITYFX_FRAMEGEN_DIRECTsays. The driver's own 4.0.0 swap chain is never used: it relies on driver-assisted frame pacing in the Windows display driver, and like the 3.1.7 proxy it would put a second DIRECT queue on RADV's single graphics queue.4.0.2and3.1.6, plus swap chain3.1.7. The generator is created with a version override to the 4.x id andffxCreateContextDescFrameGenerationVersionchained on. The provider that actually gets bound is read back and checked.FFX_FRAMEGENERATION_FLAG_NO_SWAPCHAIN_CONTEXT_NOTIFY, the same as 3.1.6. AMD's docs don't mention it for ML, so this was the open question. It works.PrepareV2. The title doesn't pass them to FSR, soframegen/camera.rstakes them from its fullscreen velocity pass. That pass is identified by its two shader hashes. Its 480-byte constant buffer holds the view rotation and its inverse, the camera position and the projection jitter. The buffer is read at submission throughdefer_host_read, validated (orthonormal axes and fixed projection words), and matched to the upscale by viewport == render size and projection offset ≈ FSR jitter. A frame without exactly one match isn't generated at all, so Configure → PrepareV2 → Dispatch always run together, as AMD's ML docs require. Near, far and fov come from the title's FSR dispatch. ItsviewSpaceToMetersFactorof 0 is passed as 1.0, which is how the SDK reads it anyway.FG:MLonly while ML is live andFG:DIRECTotherwise../setup.sh win11sets that once, as an opt-in step (it does nothing if the prefix already reports a build ≥ 22000). The no-4.x warning points to it.stats: fg_directgainspose/no_posecounters. After 60 upscales without a camera match, a warning says so: the shader pair was checked on one build of the title.Numbers
RX 9070 XT, Ryzen 7 9800X3D, Wine 11.22, Mesa 26.3.1, 1440p display, 3840x2160 output from 1920x1080 render, the same route each run. GPU time of the generator dispatch (GPU timestamps, median): 3.1.6 0.95 ms, ML 4.0.2 1.45 ms, so ML costs about 0.5 ms more per real frame. Real fps with FG on, medians of 1 s windows: ML 19.7 (p10–p90 14.5–24.4) vs 3.1.6 21.5 (18.3–28.3). These were single short runs with RT on, so treat the gap as noisy; the GPU time difference alone would predict ~1%. Camera matching held for 3440 of 3441 generated frames, and the generated frame count equalled the real frame count.
AMD lists ~410 MB of memory for ML FG at 4K (360 MB aliasable), so on cards that are already short on VRAM it may show up as more texture streaming fallback.
Requirements and caveats
./setup.sh fsr4and./setup.sh win11. Theamdxc64.dllshim must carry the MLFG patch (it callsUpdateFfxApiProviderExon amdxcffx64; without it the driver only lists 3.1.6)../setup.sh fsr4now prefers such a shim from an installed GE-Proton 11, Proton-EM 10.0-33+ or proton-cachyos (orPROTON=), and warns if it only finds the older one, such as Proton Experimental's.present_direct(texture or buffer allocation failing, composer draw failing) can leave a PrepareV2 without its Dispatch for that frame. The next frame resets.Testing
VICTORY_FIDELITYFX_FRAMEGEN_DIRECTisn't needed: mode 4 always uses the direct path.The log should show
generator for the upscaled frames provider="4.0.2"and(direct): on, without the proxy swap chain ... ml=true, and the HUD should showFG:ML. If you see the "4.x unavailable" warning, check./setup.sh fsr4's output for the shim warning first, then post it along with your GPU and Mesa versions.@joaowtrdev on GitHub · 2026-12-03 23:23 UTC · original
Tried
b83a373here, and mode 4 falls back to 3.1.6 because the device offers no 4.x generator, even after./setup.sh win11.Ryzen 7 5700X3D, RX 9070 XT, CachyOS, system Wine 11.22 (
USE_SYSTEM_WINE=1,/usr/bin/wine), the repo's patched Mesa and vkd3d-proton. 4K output, FSR 4 Performance (1920x1080 render). Merged on currentmaintogether with #354, #364 and #382. Run withVICTORY_FIDELITYFX_FRAMEGEN=4 LSFGVK_PROFILE=(lsfg-vk off).What I checked:
./setup.sh win11printedsetting the prefix to Windows 11. The prefix'ssystem.regthen hasCurrentBuild/CurrentBuildNumber22000,CurrentMajorVersionNumber10 andProductNameMicrosoft Windows 11. There is only one prefix, and the game runs in it.amdxcffx64.dllis the one./setup.sh fsr4fetches (thev4.1.1file, FileVersion2.3.0.2913), and the copy in the prefix'ssystem32is identical to the one indeps/fsr4/system32.The log at startup:
So the device lists
3.1.6and3.1.7only, where your description has4.0.2as well. The fallback itself works: the HUD showsFG:DIRECTand frames are generated as with mode 1.Is there anything else the driver checks besides the version? For example a build newer than 22000, or something your Wine reports and system Wine 11.22 does not. I'm glad to try another build number, run with a log switch, or test a newer commit.
@coil111 on GitHub · 2026-12-03 23:33 UTC · original
Thanks, that's very useful. I think the difference is amdxc64.dll, not the Windows version. My runs apparently used GE-Proton11-9's shim (144028 bytes, exports AmdExtD3DDevice8_CheckExtFeatureSupport), which ended up in my prefix by accident. The one ./setup.sh fsr4 installs is an older stub that only handles the FSR4 upscaler. Could you post sha256sum and size of /drive_c/windows/system32/amdxc64.dll? If it's the small stub, please try copying files/lib/wine/x86_64-windows/amdxc64.dll from GE-Proton 11-x into the prefix's system32 and run again. I'll fix setup.sh to pick the newer shim.
@coil111 on GitHub · 2026-12-03 23:55 UTC · original
ML frame generation needs a shim with the MLFG patch and ours is not that.
./setup.sh fsr4 now also searches compatibilitytools.d (newest first) and prefers a shim that has UpdateFfxApiProviderEx. It prints which file it took and warns if only the old stub is found. PROTON=/path/to/proton still overrides the search. The fallback warning and the docs now name this requirement.
It's kind of a shitty handling but since we are opt-in and its still in experimental i guess we can live with this.
Basically this means you need to have GE-Proton 11, Proton-EM 10.0-33+ or proton-cachyos installed
@joaowtrdev on GitHub · 2026-12-04 00:04 UTC · original
That was it, thanks. The shim I had was Proton Experimental's: 120286 bytes, sha256
ef82c8f92abfbb0ab5826723842715b0c7562a52501b3e95e8081cdc56e2fe62, withoutAmdExtD3DDevice8_CheckExtFeatureSupport.With
8fbbc45,./setup.sh fsr4picked the shim from CachyOS'sproton-cachyos-slrpackage (/usr/share/steam/compatibilitytools.d/proton-cachyos-slr, 145228 bytes, hasUpdateFfxApiProviderEx) with noPROTON=needed. Then mode 4 works:The HUD showed
FG:MLthe whole run. Over 358 s ofstats: fg_direct: 21.6 real and 21.6 generated per second,pose7947 andno_pose1,fg_interp_ms1.63.Same machine as before (RX 9070 XT, 4K output, FSR 4 Performance, RT on), against my usual lsfg-vk 2x on the same build and route:
long frame), per minThe trail behind the driven car is gone, the screen edges stay clean when the camera turns, and the HUD is fine. I'm not sure why the long frames halved, so take that as one run. It felt much smoother here, and I've switched to mode 4 for daily play.
@joaowtrdev on GitHub · 2026-12-04 00:37 UTC · original
A follow-up on the long frames: a second mode 4 run on the same route gave 52.8 per minute of
long frame≥ 100 ms, against 39 to 79 in my four lsfg-vk runs on this build. So the halving in my first run was mostly route noise, not mode 4. Real fps was 21.6, in line with the lsfg-vk runs, and ML stayed on for the whole run (393 s, 21.5 real and 21.5 generated per second,no_pose1). The image gain holds, and I'm staying on mode 4.@maple-quartz18 on GitHub · 2026-12-04 00:56 UTC · original
wonderful idea!
@maple-quartz18 on GitHub · 2026-12-04 01:00 UTC · original
Additional information: I inspected the fsr4.1.2-igpu-cyboman-rdna3-2026-11-22 DLL variants. Their binaries contain these version strings:
HLX FSR 4 (4.1.2)
4.1.2-exact-igpu-r3-cyboman
4.1.2-lossy-igpu-r3-cyboman
4.1.2l-exact-igpu-r3-cyboman
4.1.2l-lossy-igpu-r3-cyboman
@Luxuride on GitHub · 2026-12-04 12:03 UTC · original
This is the only PR in this batch that adds a capability rather than saving microseconds, and the direct path already shipped — so it deserves the review time. Five things before it lands.
setup.shhalf out.setup.sh:230-237runswinecfg -v win11, which changes what the whole prefix reports as Windows, for one opt-in frame-generation mode. Nothing documents how to undo it anddocs/BUILD.md:49says only "run once". As its own commit it can be reverted without taking ML with it, and the revert belongs in BUILD.md.draw.rs:5377(has("4adcfeaa24ae6450") && has("9ab96b7a002d6ac8")),draw.rs:5383(table.checked_add(8 * 4)) andframegen/camera.rs:22 BUFFER_SIZE = 480. Your own warning says so (framegen.rs:1063). That is acceptable for an opt-in mode, but the failure is silent — it degrades to real frames only.hud_tag()returns"FG:ML"onml_active() && armed(framegen.rs:404) while the present path bails out to real frames wheneverinput.poseisNone(framegen.rs:1075-1080). Gate the tag on recent pose hits, or make the miss visible.POSE/NO_POSEcounters. For something needing RDNA 4 + a Win11 prefix + a patched Proton shim, one real run's numbers in the commit message (the way #382 does it) is what a reader cannot reconstruct.ml_camera()unit test is good — keep that shape for whatever else gets added.8fbbc454c9to5dfc07d156@coil111 on GitHub · 2026-12-04 16:14 UTC · original
Thanks for the review. I pushed a reworked branch:
win11 is now its own commit (
setup: optional win11 step ...), first in the series, so it can be reverted on its own. BUILD.md now says it changes the version for the whole prefix and how to undo it (winecfg -v win10). I also checked that the step is really needed, since the shim turned out to be the cause of the earlier failure. Same machine and shim, only the prefix version changed:That's in the commit message too. The create-failure warning now names both requirements, so a Windows 10 prefix no longer leaves just a bare
code 6.Shader pair tied to one build: agreed, that's intended for an opt-in mode. It isn't silent, though. After 60 upscales without a match it logs a warning (
framegen.rs:1070) and says how to get the matching details. The HUD part was the real gap, see 3.HUD: when ML is on but the last frame had no matching camera (so it was shown as a real frame only, nothing generated), the tag now reads
FG:ML-NOCAM. With a match it staysFG:ML.Numbers: the PR description already had them (generator GPU time 0.95 vs 1.45 ms, fps p10–p90, camera matched for 3440 of 3441 frames, VRAM note), and joaowtrdev posted two more runs above. I've now put them in the feature commit's message as well.
5dfc07d156to9d833fef35@maple-quartz18 on GitHub · 2026-12-05 04:52 UTC · original
ML frame generation is amazing
@fsrajner on GitHub · 2026-12-05 10:37 UTC · original
Data point for ML frame generation (
VICTORY_FIDELITYFX_FRAMEGEN=4) on RDNA 4, measured after the merge.Setup: RX 9070 XT 16 GB, Ryzen 7 7800X3D, CachyOS, repo-patched Mesa 26.3.1 RADV + vkd3d-proton. The prefix reports Windows 11 (22000), and
amdxc64.dllcomes from proton-cachyos-slr (it hasUpdateFfxApiProviderEx). Build:main@8bf4878plus LOCKhart07'srt-7-reuse(VICTORY_HW_RT=1,_LEAN_BUILDER=1,_REUSE=1). Series X profile, 4K output with FSR 4.1.2 Quality, RT on, headless gamescope. Same intro snapshot every run, 120 s after the first A press, 2 runs per arm,VICTORY_PRESENT_TIMING=1.The log confirms the ML path:
frame generation (direct): on ... ml=true. No fallback, no errors.FRAMEGEN=4Cost on rendered frames: about 1-2 ms a frame, within noise. The number of presented frames roughly doubles.
Present pacing is bunched. This is from
interval_uson the present-timing lines, over the last 3/4 of the presents after generation armed, about 3,200 per run; both runs agree:A generated frame and the following real one usually go out about 1-5 ms apart, so the cadence on screen is not an even ~22 ms.
This was headless gamescope with no display wait, so the bunching may come from that environment rather than from the pacing logic. I haven't checked it on a real display yet.