Repository navigation
RR runtime: free released input copies while no RR instance exists - #11
Merged
Merged
Conversation
A game that tags its Ray Reconstruction inputs every frame while RR is available but switched off makes the plugin copy each lifetime-0 input (retain_transient_state) and release the previous copy. The release is deferred until the frame that recorded the copy has run, but the deferred list was emptied only by pump(), which runs in instance create, evaluate and destroy. With no instance, nothing ran it and every released copy stayed allocated. release_transient_locked now calls pump() after deferring the release. pump() frees only resources whose frame marker the GPU has written, takes no lock of its own and calls nothing back, and the adapter entry already holds the runtime lock, as at create, evaluate and destroy. rr_test_host gets a job "tagloop <frames> <w> <h> [<limit MiB>]": one RGBA16F lifetime-0 input copied and released every frame, no instance, no evaluate, no test drain or counters, video memory measured with QueryVideoMemoryInfo. e2e.py runs it (200 frames of 1706x960) before its scenarios, with a limit of 256 MiB of growth. Reported by @j0nsh1n in #8. Fixes #8. Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21
marked this pull request as ready for review
November 13, 2026 15:31
phantoslayer21
force-pushed
the
fix/rr-release-without-instance
branch
from
November 13, 2026 15:31
faa823c to
dae0c5b
Compare
j0nsh1n
added a commit
to j0nsh1n/wronggpu
that referenced
this pull request
Nov 13, 2026
clean/linux/run_wine_tests.py runs three tests in a Wine prefix set up the way Proton sets up a game's (clean/linux/wine_env.py: vkd3d-proton d3d12 / d3d12core, DXVK dxgi, Wine's vkd3d libraries for its builtin d3dcompiler_47), with an optional self-built vkd3d-proton (--vkd3d): - interop: the existing run-tests.sh (31 tests); - rr-leak: the RR test host's tagloop job (pull request phantoslayer21#11) against a given wronggpu_runtime.dll with a synthetic RR model, with the 256 MiB limit of the Windows end-to-end test; - ags-layout: wg_ags.hlsli's WMMA and conversion helpers on fixed register values against a CPU reference of the gfx12 semantics (new: ags_layout.hlsl, ags_layout_host.cpp). run-tests.sh: -fms-extensions for clang-based MinGW (the __try in descriptor_publish.h), and WG_WINE to pick Proton's wine over a system wine64. Verified on an RX 9070 XT, RADV, GE-Proton 11-11, with a vkd3d-proton built with dxil-spirv PR #362: interop 31/31, rr-leak +37 MiB (limit 256), ags-layout 7/7. Each test fails on the bug it targets: interop 29/31 with "Unknown modifier globallycoherent" before pull request phantoslayer21#12, rr-leak +2636 MiB with a runtime from before pull request phantoslayer21#11, ags-layout at CreateComputePipelineState on stock vkd3d-proton; its comparison rejects lane-swapped and half-swapped results. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
This was referenced Nov 13, 2026
j0nsh1n
added a commit
to j0nsh1n/wronggpu
that referenced
this pull request
Nov 14, 2026
From the review of phantoslayer21#52: - README: the globallycoherent count now agrees (29 of 31, before phantoslayer21#12). The leak figures are named as one run on an RX 9070 XT, RADV, GE-Proton 11-11 and vkd3d-proton 5b1089c8 + dxil-spirv #362: +2636 MiB with a runtime built before phantoslayer21#11, +37.2 MiB with the fix. The launcher red check describes what was run (a wg-core check broken on purpose). The player advice about DLLs next to the game exe is gone, and the opening says the tests don't make Linux a supported platform. The vkd3d-proton commit named is the one tested (5b1089c8). It also says that --work/prefix is reused if it already is a Wine prefix. - ags_layout.hlsl: the FloatConversion opcode 0x1c names its source in this repository (f2h_hw in clean/rr_f/kernels/rr_fast.hlsli). - wine_env.py: mscoree / mshtml off and winemenubuilder disabled, so a new prefix shows no Mono / Gecko dialog and writes no menu entries. - run_wine_tests.py: rr-leak fails when video memory does not change at all (a stack reporting a constant CurrentUsage), and --work with a space is refused (the RR host's job file is split on spaces). Verified on main c793823 + this branch, GE-Proton 11-11 with a fresh --work: interop 31/31, rr-leak +37.2 MiB, ags-layout 7/7, launcher 73/230/186/18 checks. No new entries under ~/.local/share/applications. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jonathan Shin <85975340+j0nsh1n@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reported by @j0nsh1n in #8.
What
The RR runtime now frees released input copies while no RR instance exists.
release_transient_lockedcallspump()after deferring a release.
Why
A game that tags its Ray Reconstruction inputs every frame while RR is available but switched off makes the plugin copy
each lifetime-0 input and release the previous copy. The release waits until the frame that recorded the copy has run,
but the deferred list was emptied only by
pump(), which runs in instance create, evaluate and destroy. With noinstance, nothing ran it, so every released copy stayed allocated.
Why this is the right place:
pump()frees only resources whose frame marker the GPU has written. That is the same test as at evaluate.release_transient, holds theruntime lock, as create, evaluate and destroy do. (Not every adapter entry takes that lock: the runtime version getter,
the two describe functions and the frame-time getter don't. None of them touches the deferred list.) The kernel compile thread never takes that lock and
doesn't touch the deferred list.
evaluate's, so it still waits for the evaluate's marker. The fix doesn't change that test; it only runs it at release
time too.
recorded. This change doesn't add that assumption:
defer_releaseand evaluate already rely on it. It does now applywhen no instance exists, where nothing was freed before.
Measured (Windows, RX 9070-family card, no game)
New test-host job
tagloop: one 1706x960 RGBA16F lifetime-0 input copied and released every frame. There is noinstance, no evaluate and no test drain or counters (both of those run the pump). Video memory is read with
QueryVideoMemoryInfobefore and after.Each frame retains the new copy (
retain_transient_state, as the plugin's tag handler does), releases the previouscopy, and runs the frame's command list and waits for it. The plugin itself releases the old copy before it retains the
new one; the test does it the other way round on purpose, so that each release lands on a frame that has not run yet,
as a game's frames in flight do. In the plugin's order with a wait every frame,
defer_releasewould free each copy atonce (its marker has already run) and the loop would not show the leak.
The
tagloopjob doesn't exist on main, so the "main's runtime" rows were measured with main's runtime library and thisbranch's test host. The runtime DLL is byte-identical to the one built from main.
Testing
e2e.pynow runstagloop(200 frames) before its scenarios and fails if video memory grows by more than 256 MiB.WG_RR_COMPILE_WAIT_ALL=1, both scenarios, aliased and not) with main'sruntime and with this branch's.
results.
tagloopcopies.
pool, copies, constants) matches on all 74 evaluated frames, and the deliberately failed call leaves the state
unchanged. The CPU reference was run on this branch's output only; main's output is compared by the file comparison
above.
Not tested
taglooptest needs a GPU, so it runs locally only. CI builds the runtime and runs the CPU tests; it does not runtagloop.A run on Linux/Proton by the reporter would close that gap.
Fixes #8.