Preserve guest-wave shader state and reclaim idle host memory under pressure #479
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!479
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-479"
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?
@JoeY54 on GitHub · 2026-11-27 23:14 UTC · original
JoeY54:fix/shader-memory-correctness→main· +800 −61 · 12 files · 4 commits · openStandalone first-lane reads, inactive WRITELANE destinations and loop-carried masks can produce incorrect synthetic readbacks. After a submission spike, idle host lists and fetch buffers also retain peak capacity under memory pressure. This adds guest-wave state corrections and pressure-only reclamation with synthetic regression coverage.
Integrated upstream main
64d4931b3dd90305134512b805fc98f04119fb6e; latest tested sourceb2a3dabad7daf0e7ba3943a0ace2515e487c25dd.Existing prerequisites, original authors retained: #108; #112 including #111; #116 including #70; #71; #73; #425. Several were closed without merging; that is not represented as author approval. Most of the aggregate diff is their oracle/benchmark and prerequisite work. The report pins every head and separates our new commits. Newly landed upstream allocator/prelude and shader changes are retained; the pressure path reuses upstream's idle-age helper. No competing CI implementation is introduced.
New work preserves guest-wave first-lane reads, single-wave divergent state, inactive WRITELANE updates and mask phis through uniform loops. Under pressure it retires old GPU-complete lists while retaining recent lists and a warm reserve, and shrinks oversized fetch buffers between completed copy/merge operations after a two-second cooldown.
VICTORY_IDLE_RECLAIM=0is a diagnostic opt-out. Branch-state helpers are extracted to satisfy the existing source-size policy.Current validation: Windows 11, RTX 5090 / driver 621.24, Rust 1.98.1; original synthetic fixtures and serial/exclusive GPU tests.
Sanitized report with exact revisions, commands, controls and limitations.
Strict joins, legacy denormal expectations, unsupported instructions and broader multi-wave behavior retain the documented limitations. The newly landed optional allocator-trimming switch has not had a separate completed compatibility run. No real-game validation, new binary/table data, private management history or raw machine logs are included.
AI-assisted by OpenAI Codex; submitted by JoeY54.
s_min_{i,u}32 and s_max_{i,u}32 set SCC when S0 is chosen (S0 < S1 for min, S0 > S1 for max). The lowering returned no SCC, so the generic D != 0 was used: s_cselect or s_cbranch_scc after a min/max took the wrong side whenever the result was nonzero but S1 was chosen (or zero with S0 chosen). Marvisak/VIctory's lowering already does this. v_readlane_b32 and v_writelane_b32 take the lane from S1[4:0] (wave32) or S1[5:0] (wave64). A select past the wave read 0 or wrote no lane here; it now wraps as on the console. Lanes that are host lanes (pixel/vertex programs with a computed lane) are unchanged. Both were found by differential testing of the translator against an independent RDNA2 interpreter on the GPU. Ported from avatarmanz/VIctory-7900XTX#404. No version bump here: the shader cache is keyed by the build. Co-Authored-By: Claude Opus 5.5 <[email protected]>A console wave64 compute program that runs as two host waves of 32 ("halves") numbers its lanes through console_thread (thread_id does). console_lane and lane_bit still read the host lane index unless exchange is set. A 64-bit mask read as a number, such as a select on an SGPR pair, then gave lanes 32-63 the bits of the low dword: their host lane is 0-31, so the test `lane < 32` always picked the low dword. Use the console lane in both places when halves is set, as exchange already does.8fc2254; keep both new ir.rs tests 82ae878ae5@JoeY54 on GitHub · 2026-11-28 03:37 UTC · original
Merged current
main(8fc2254) into this branch as82ae878, so the PR merges cleanly again. Also fixed the two Clippy lintsmain's own CI stops on, ina7b233d.One conflict, in
crates/victory-shader/src/ir.rs. This branch (6f4813c) andmain(a12e0ae) each added a test at the same spot afterbuild_words(). Both tests are kept as they were, and the non-test changes merge unchanged:lane_wrapped_fields()and the 256-entryusedtable inunspill.mainalready contains #108 (c1d8179) and #425 (9b712a6), with the same changes as this branch's245cb85and7331b07. Those merge to nothing, so the remaining diff againstmainis this PR's own work plus the two lint fixes below: 16 files, +3830/−32.One interaction to point out:
main's newemit()retry without the loop step now wraps this PR's scalar-split logic, which runs insideemit_once(). Some wave64 compute loop programs may translate on the first try and never reach the retry.main's CI is red at8fc2254, in its Clippy step.--keep-goingshows two lints, both from recentmaincommits:clippy::some_filterinvictory-hlegameinput.rs(frome68f48a), now(i < scripted_keys).then_some(vk), which is the same value becausevkhas no side effects; andclippy::let_and_returnin avictory-shadertest helper (fromfeb90ad).main's third finding, theshadow.rsturns % 16, was alreadyis_multiple_ofon this branch.Checks on
a7b233d(RTX 5090, Windows, toolchain 1.98.1):cargo clippy --workspace --all-targets --locked -- -D warnings: passcargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passcargo test --workspace --locked -- --test-threads=1: 1133 passed, 0 failed, 53 ignored.victory-shaderalone: 303 passed, 6 ignored. The nested HLE child run is not counted.Not rerun: the all-features test suite, the ignored oracle fuzzing and memory-bench runs, and the D3D12 debug layer.
AI-assisted (Claude Code).
d4b5d51into fix/shader-memory-correctness bbb31d9876f9dfb76into fix/shader-memory-correctness efcd38d1dd568c5e5into fix/shader-memory-correctness a1bf7b0f27@trustno1-coder on GitHub · 2026-11-29 08:27 UTC · original
A note on this one: an earlier version was merged for v2026.11.29.01 and then taken back out before the release. Together with other pull requests merged at the same time, its shader-translator changes (compares in lane branches, scalars across lane-divergent branches, lane wrapping) made trees and foliage flicker and vanish in play; the same build with the translator from before this PR did not. The revert is
a1fe8350on main. Nothing is wrong with the PR on its own (it was clean alone), so it stays open and we will bring it back once the interaction is understood. Thank you for the work.github-bot referenced this pull request2026-11-29 12:10:51 +00:00
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.