NVIDIA (wave32) host fixes: CBV clamp, loose-LDS fallback, scalar ops #799
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/fxceless--victory-fork!799
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-799"
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?
@Massive-Adrian on GitHub · 2026-11-25 08:17 UTC · original
Massive-Adrian:fix/nvidia-wave32→main· +122 −8 · 4 files · 1 commits · openFound while running on an RTX 3080 (32-lane waves, no wave64).
VICTORY_WAVE_LDS_LOOSE=0turns it off): console wave64 programs that read and write LDS inside one lane-branch region were refused outright by a 32-lane host, which dropped every dispatch. Approximate; last resort.s_pack_{ll,lh,hh}_b32_b16;s_bfm_b32and thes_mov_b6432-bit literal as constant sources; the thread-group info SGPR (as Mesa'stg_size); f64 wave sums kept per host wave in local mode.VICTORY_SCC_LOCAL_ANY=1(opt-in, off by default): lets two more wave64 programs run, but showed artifacts in our runs.Testing (RTX 3080, 8-minute runs, same shader cache warm-up)
a26859fa26859f+ this PRWithout these fixes
a26859fremoves the device (a >64 KiB CBV) and never reaches the world. victory-shader and victory-gpu unit tests pass; clippy adds no warnings.https://claude.ai/code/session_01HULsNt1E1LEXFjQkDyX27G
- Clamp constant buffer views to 64 KiB (D3D12's limit): larger title views made invalid views that removed NVIDIA's device (0x887A0001). - Loose-LDS fallback (VICTORY_WAVE_LDS_LOOSE=0 turns it off): console wave64 programs that read and write LDS inside one lane-branch region are no longer refused by a 32-lane host (approximate, last resort). - Translator: s_pack_{ll,lh,hh}_b32_b16, s_bfm_b32 and the 32-bit literal of s_mov_b64 as constant sources, the thread-group info SGPR (as Mesa's tg_size), and f64 wave sums kept per host wave in local mode. - VICTORY_SCC_LOCAL_ANY=1 (opt-in): SCC of a mask operation taken from the host wave's own answer in local-any mode. Tested on an RTX 3080: victory-shader and victory-gpu unit tests pass. Claude-Session: https://claude.ai/code/session_01HULsNt1E1LEXFjQkDyX27G@HLVM04 on GitHub · 2026-11-25 08:34 UTC · original
Tested on an RTX 5070 Ti (wave32 only), NVIDIA 616.64, with this PR merged onto
9376fd6+ #798 + #783. Series S profile, scripted Enter input, about 4.5 minutes into the first gameplay scene. One run per setting.9376fd6+ #798)VICTORY_WAVE_LDS_LOOSE=002384a60fda6f2d0,2cc4c197ee29e291,2da4beb386509b77,369cbe906ea72764and6b82bc7d22016cb5.VICTORY_WAVE_LDS_LOOSE=0, the same scene is sharp again, and the smear is not present without this PR either.VICTORY_SCC_LOCAL_ANY, until it is known which one is wrong.@HLVM04 on GitHub · 2026-11-25 09:02 UTC · original
Correction to my comment above: the "smear" is most likely right, not a regression.
I bisected the five pipelines with
VICTORY_SKIP_PIPELINES. The effect comes from2da4beb386509b77alone; the other four (02384a60fda6f2d0,2cc4c197ee29e291,369cbe906ea72764,6b82bc7d22016cb5) change nothing visible in this scene.A PIX capture of that frame at full resolution shows an even ripple pattern with the wire mesh inside it: textured wired glass in the window. Before this PR the pass was refused on wave32, so the glass was never drawn and the window looked clear.
What may still be off is the edge. Where the character's hair overlaps the window, its bright rim is distorted as if it were behind the glass. That could be the approximate LDS ordering, or something unrelated; I can't tell which yet.
So on this card the loose-LDS fallback is a net gain here. Sorry for the noise.
@MamaLeVrai on GitHub · 2026-11-25 10:20 UTC · original
Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head
09b95caintomain9376fd6in a throwaway tree (no conflict).cargo clippy --workspace --all-targets --locked -- -D warningsfails with exactly the errorsmainitself has on this machine (placed_filler_twinsnever used,depth_writtennever read, invictory-gpu); with--all-featuresit fails with the same number of errors asmain(4). This PR adds none and removes none.cargo test --workspace --locked: second run 540 passed, 0 failed, 10 ignored (mainalone: 540 passed, 0 failed, 10 ignored). In the first full run one test failed,crash::tests::memory_at_names_what_an_access_hitinvictory-loader(crash.rs:716, expected text "reserved, never committed"); the second full run passed (540). It is not in a file this PR changes as far as I can see, and I could not reproduce it: 12 runs ofcargo test -p victory-loader --libon this PR's tree and 15 onmainalone all passed. A guess, unchecked: it reads the state of memory at an address while other tests of the full run allocate and free memory. The title was not run, so this says nothing about in-game effect. No game data.AI-assisted (Claude Code); no game data.
@grosterr on GitHub · 2026-11-25 12:37 UTC · original
Test report on an RTX 3060 12 GB (Ampere, 32-lane waves only), NVIDIA driver 621.40 (32.0.16.2140), Ryzen 7 5700X, 32 GB, Windows 11 Pro 26300, Rust 1.98.1, release build. AI-assisted testing (Claude Code); the runs and the observations are mine.
Tree: #770's stack at
28b74a9(on9376fd6), plus this PR's head09b95camerged in (no conflict). Shader cache warmed offline withVICTORY_HOST_WAVE=32 VICTORY_VIEW_LIMIT=999999(and the switch below, since it is part of the cache key). Same save, same prologue room, ~8 minutes in the world per run;VICTORY_LEVELS_ON_DEMAND=1in both.VICTORY_WAVE_LDS_LOOSE0(fallback off)An earlier run on
a26859f(no #770 stack, no #799, same switch and room) also had smooth gradients, with GPU ~105 ms. Both runs were stable: no device loss, no errors. With the fallback off, the host refuses 7 compute programs, as without this PR.So on this card the approximate loose-LDS fallback costs about +45 % GPU time and visibly changes the picture. The CBV clamp and the scalar-op parts look fine here. Would it make sense to keep the fallback off by default (or limit it to the programs it is known to be right for) until it is exact? I can rerun with any switch or pipeline skip list if that helps. #854's paired form looks like the exact alternative; I plan to measure it on this card next.
@SantannaCarlos on GitHub · 2026-11-25 12:42 UTC · original
Tested on an RTX 4070 (32-lane waves):
f133e35efed2a48anow translates and runs, and costs nothing measurable. Most of this PR's extra GPU time comes from369cbe906ea72764(GpuParticleUpdate:CS_Visibility), about 30 ms of GPU time a frame.Setup:
9376fd6+ #834, without and with this PR's head09b95ca(no conflict in the merge).Offline (
VICTORY_HOST_WAVE=32 victory translate --validate --pipelines, onlyf133e35efed2a48a):9376fd6it still stops at "a constant lane mask in a half-wave".f133e35efed2a48aiscascadeshadows_rendering:CS_ShadowRenderTiledCascadesAlphaCBPPPC, the only program the prologue uses that does not translate on main.6b82bc7d22016cb5(vfx_triangleClip:CS_CollectTriangles_Meshlets) translated by this PR fails the DXIL validator with "Total Thread Group Shared Memory storage is 32900, exceeded 32768". In the title the driver still builds it.f133e35e,02384a60,2cc4c197,2da4beb3,369cbe90,6b82bc7d) in the exact form, and all six validate,6b82bc7d22016cb5included (same offline check, head0751197).In the title:
9376fd6+ #834 (3 runs)f133e35e, untranslated)VICTORY_SKIP_PIPELINES),f133e35efed2a48aonly (3 runs)2da4beb386509b772cc4c197ee29e29102384a60fda6f2d0369cbe906ea727646b82bc7d22016cb5Runs of the same tree differ by up to ~15 ms of GPU time (90 to 101 for
9376fd6+ #834; 85 to 105 forf133e35efed2a48aonly). Skipping369cbe906ea72764is the only single skip that moves the GPU time by more than that: about 30 ms. The other four together account for the rest, up to ~20 ms, which is within reach of the noise. #500 describes369cbe906ea72764as a 1x1x1 dispatch next to the structure builder's stages, so 30 ms for it looks like a loop that runs much longer in this form than on the console. That is a guess; I did not time the dispatch itself. It fits grosterr's +45 % on the RTX 3060 above: here most of the extra time is this one program. I did not compare gradients for the banding grosterr reports.The four still refused are
5dc3b25986622949and6f225b641c5b0708(water_shading:CS_TransmissionVolumetrics_Tiled*),ce3f0432a08f1d35(PS_WindshieldWiperMask) and the meshf5e50eb2108c425b. Nothing new is refused.What changes on screen:
f133e35efed2a48aalone changes nothing we could pin down in the window shot. The bright, blotchy hair in the back-lit shot looks the same with and without it. The square patches on the hair match what JFIREonFIRE traced in #62 to the tiled shadow family in the deep-skips form, which goes away withVICTORY_WAVE_DEEP_SKIPS=0.f133e35efed2a48a(and 0 of 5 with it), the whole room is lit in the window shot (left wall at luma ~38 against ~5), as if the sun came through the walls. That matches the walls that come and go with the view race: Ym1r1710 reports in #62 that they go missing again withVICTORY_VIEW_GUARD=0. Too few runs here to say more.@SantannaCarlos on GitHub · 2026-11-25 13:14 UTC · original
Correction to my guess above: with #854's exact paired form,
369cbe906ea72764costs the same here (GPU 145 → 109 ms a frame when it is skipped), so the ~30 ms is that program's own cost on this card, not this PR's approximation. Numbers in #854.@EgoraWyn on GitHub · 2026-11-25 14:41 UTC · original
Test report from an RTX 3060 Laptop 6 GB (Series S profile, title build 1.0.2.1, Windows 11).
Applied on our tree. Compute pipelines the driver refused with
E_INVALIDARGwent from six to two. The two that survive here are the same pair already reported above on a 4070, andf133e35efed2a48atranslates and runs, as reported there too — so this is a 6 GB confirmation of what the thread already has, not a new count.What may be new is where the two survivors fail. In our tree they fail in
scc_some: withVICTORY_SCC_LOCAL_ANYunset the local-wave retry gives up, the 64-lane form is returned, and the driver rejects it. So the refusal of exactly those two follows from that gate rather than from the loose-LDS path. We have not switched the variable on, so we make no claim about the artifacts the PR body mentions.Caveats, so the numbers are not read for more than they are: one run, the shader cache was cold, so no frame-rate claim of any kind; and our tree keeps
lds_meetingsin a separate module, so one hunk of this PR was re-applied by hand rather than merged.Written with Claude Code (model claude-opus-5).
@m335671 on GitHub · 2026-11-25 17:53 UTC · original
Tested on an RTX 4070 (32-lane waves): on current
main, this PR brings up 25 of the 27 compute pipelines the driver refuses, and they run in the title. It runs without a device loss, but the window glass in the first room renders very differently, and the frame costs about 15 % more.Setup
main3973179, thenmainwith this PR's head09b95camerged in. The merge was clean.Offline, with
VICTORY_HOST_MAX_WAVE=32 victory translate --list --pipelinesover the title's whole shader pack:main3973179main+ this PRmain+ this PR,VICTORY_WAVE_LDS_LOOSE=02da4beb386509b77(CS_AlphTransmissionPrefilterMip) and the four that #158's strict rule leaves out (02384a60fda6f2d0,2cc4c197ee29e291,369cbe906ea72764,6b82bc7d22016cb5). The one that doesn't need the fallback isf133e35efed2a48a(CS_ShadowRenderTiledCascadesAlphaCBPPPC).water_shading:CS_TransmissionVolumetrics_*programs (5dc3b25986622949,6f225b641c5b0708,a10179ab7eda0dc3).maincreates is lost.In the title (diagnostics build, prewarmed cache, from the checkpoint to the first room, then idle;
VICTORY_INDIRECT_WINDOW=1 VICTORY_LEVELS_ON_DEMAND=1 VICTORY_JOIN_PARTS=1 VICTORY_BACK_OWN_VIEW=1 VICTORY_COPY_PLAIN=1 VICTORY_LATE_WAIT=3 VICTORY_CAPTURE_WORLD_EVERY=64; means once settled):mainmain+ this PR5dc3b25986622949loggedhost pipeline refused.main, now looks like rippled, frosted glass, and the yard behind it is blurred. That fits the transmission programs now running. I can't tell whether it matches the console, or whether the loose fallback gets them slightly wrong. A capture from a 64-lane card (where they run natively) of the same window would settle it.Not tested: other scenes, other GPUs,
VICTORY_SCC_LOCAL_ANY=1.AI use: the runs were done on my machine. Claude Code (Claude Opus 5.5) built and ran them, compared the outputs and wrote this comment.
@m335671 on GitHub · 2026-11-25 22:49 UTC · original
A follow-up from the same RTX 4070 (32-lane): with the loose fallback off, this PR still brings up the cascaded-shadow program, and the window glass stays sharp.
Tree:
maind510ee4+ #1093 + #1096 + this PR (09b95ca), diagnostics build, from the checkpoint to the first room, then idle.VICTORY_WAVE_LDS_LOOSE=0, withVICTORY_INDIRECT_WINDOW=1 VICTORY_LEVELS_ON_DEMAND=1 VICTORY_JOIN_PARTS=1 VICTORY_BACK_OWN_VIEW=1 VICTORY_COPY_PLAIN=1 VICTORY_INDIRECT_GATHER=1 VICTORY_CARD_REHASH_RUNS=1 VICTORY_TEXTURE_NO_WAIT=1 VICTORY_AMBIENT=0.6. Means once settled.3973179, no ambient, no gather)VICTORY_WAVE_LDS_LOOSE=0f133e35efed2a48a(CS_ShadowRenderTiledCascadesAlphaCBPPPC) is translated, created and bound in the title, and the shadows on the player's shoulder look better to us. It's the only one of the 25 that doesn't need the fallback, and it's also one that the title uses in this room.water_shadingones. No device removal.CS_AlphTransmissionPrefilterMip), not from the rest of the PR.A suggestion, if it helps: the non-fallback part (the translator ops,
tg_size, the CBV clamp, and so this shadow program) may be worth taking on its own, with the loose LDS form off by default until someone compares the glass with a 64-lane card.AI use: the runs were done on my machine. Claude Code (Claude Opus 5.5) built and ran them, compared the outputs and wrote this comment.
@Dathinel on GitHub · 2026-11-26 01:11 UTC · original
Test report from a 4 GB 32-lane card, with this PR merged onto current
main.Machine / tree. RTX 3050 Laptop 4 GB (32-lane waves), Ryzen 7 7435HS,
--console series-s.maina183ea2+ #1081 + #798 + #1002 + #592 + #156 + this PR. Diagnostics build, run 253 switch set +VICTORY_TEXTURE_BUDGET_MB=1536. One run of 425 s: menus, opening cutscene, about three minutes in the first gameplay scene (the room with the window).The merge. It conflicts with
mainnow, in three files. How I resolved them, in case it saves someone time (branch:Dathinel/victory-forkrtx3050-4gb-loose-lds, merge commit4a11834):descriptor/host.rs(2 hunks): keptmain'sconstant_view_size(the clamp is inmainsince #911 / #1206) and dropped this PR'scbv_sizeandMAX_CBV_BYTES, which were then unused.emit/lower.rs:mainnow lets an LDS read+write region through when it only raises flags (lds_flag_region); I kept that and added this PR's loose form after it:if !(flags_on && lds_flag_region(..)) && !LDS_LOOSE.get() { return None; }.emit/mod.rs: keptmain'sVICTORY_WAVE_WIDE=lastblock and put the loose-LDS forms after it.cargo checkclean for both crates; the threeldsunit tests ofvictory-shaderpass. I did not run the whole test suite.Compute pipelines refused by the host in the run (debug-layer reason in earlier runs: wave lane count 64 on a 32-lane device):
02384a60fda6f2d02da4beb386509b77369cbe906ea727645dc3b259866229496b82bc7d22016cb56f225b641c5b07085dc3b259866229496f225b641c5b070802384a60fda6f2d02da4beb386509b77369cbe906ea727646b82bc7d22016cb5So 4 of the 6 are built here. That matches the #953 comment from the RTX 5070 Ti (which built those four plus
2cc4c197ee29e291, already made here by other means).Picture. The window in that room now shows the textured glass that the #953 comment ties to
2da4beb386509b77; before, the user of this machine saw a checkerboard pattern and frame-to-frame changes in what is seen through that window. In a burst of 8 screen captures 200 ms apart (each a new frame at this frame rate), two consecutive captures differ in the character's hair and almost nowhere inside the window. I have no burst from before this PR to put a number against, so the "before" is the user's observation, not a measurement. No screenshots attached, by this repository's rule.Frame. Median 169.9 ms over the 34 frame-log lines with more than 2,500 draws (about 4,430 draws); earlier runs of the same scene on nearby trees: 150 to 206 ms. Not a controlled comparison. No device loss.
Not tested.
VICTORY_WAVE_LDS_LOOSE=0on the same tree as a control;VICTORY_SCC_LOCAL_ANY=1; whether the other three programs' output is right (only that their pipelines are made); anything outside this one scene; the Series X profile.AI-assisted (Claude Code); merged, built, run and read on the machine above.
@Dathinel on GitHub · 2026-11-26 01:25 UTC · original
A control and a caution to add to my report above, same machine and tree (
4a11834+ a full-screen switch), two more runs of the same scene.Control,
VICTORY_WAVE_LDS_LOOSE=0(320 s): the six compute pipelines are refused again, as before the PR. So the four that are built are this PR's loose form and nothing else in the tree.Change between consecutive frames (mean absolute difference between screen captures 200 ms apart, 0 to 255, bursts of 8 in the window scene): about 1.2 to 1.9 with the loose form on (one run, windowed), 2.8 to 5.8 with it off (one run, full screen). The two runs differ in window mode, so take the ratio loosely; the direction agrees with what the user of this machine saw (less flicker in what is seen through the window with the PR).
Caution: the picture washes out with the loose form on. In both runs with it on, what is seen through the window is much brighter and paler than with it off, and in the second run the whole world frame went almost white about a minute into the scene (captures at 280 s; the frame log still shows about 4,350 draws a frame, no error line, no device loss). With
VICTORY_WAVE_LDS_LOOSE=0the same scene has normal exposure and a clear view through the window. I have not yet found which of the four programs does it (02384a60fda6f2d0,2da4beb386509b77,369cbe906ea72764,6b82bc7d22016cb5); I will bisect withVICTORY_SKIP_PIPELINESand report here. Until then I would not call the loose form safe as a default on this card, even though it removes the refusals.AI-assisted (Claude Code).
@Dathinel on GitHub · 2026-11-26 02:52 UTC · original
Bisection of the wash-out I reported above: not conclusive yet, and I should say so rather than leave the caution standing as it was.
Tree now
mainad54207+ the same PRs + this one; same machine, full screen, 330 s each, loose form on, withVICTORY_SKIP_PIPELINES:02384a60fda6f2d0,2da4beb386509b77369cbe906ea72764,6b82bc7d22016cb5369cbe906ea72764,6b82bc7d22016cb502384a60fda6f2d0,2da4beb386509b77So neither half washes the picture out by itself. Either it takes one program from each half, or it does not happen on every run, or the 25 commits of
mainbetween my runs changed it. I have not yet repeated the run with all four built on this newer tree, nor run one configuration twice to see how much this scene varies from run to run; those are the next two runs. Until then, read my caution as "seen in two runs of one tree with all four built", not as a property of this PR.One more thing these runs showed that is not about this PR: whether the player character is lit or a dark silhouette in that scene differed between my runs of today in a way I cannot tie to any switch, which is why I want the run-to-run check before saying more.
AI-assisted (Claude Code).
@Dathinel on GitHub · 2026-11-26 04:40 UTC · original
Thank you, that settles what I could not: the lit-or-dark character here is the same run-to-run variance, not something my runs can attribute to a switch, and I withdraw any reading of them that way. I will score a fixed frame with
VICTORY_DUMP_TARGETS=1+VICTORY_CAPTURE_FRAMESand several runs a side before saying anything more about this PR's picture, including the wash-out, which I saw in two runs with all four programs built and in neither half of the bisection. What stands from the 4 GB card is only the count: with the loose form 4 of the 6 refused compute pipelines are made (5dc3b25986622949and6f225b641c5b0708stay refused), and withVICTORY_WAVE_LDS_LOOSE=0all six are refused again.AI-assisted (Claude Code).
@HLVM04 on GitHub · 2026-11-26 02:56 UTC · original · edited 2026-11-26 06:20 UTC
On the lit-vs-dark player character: we see the same run-to-run variance on an RTX 5070 Ti (Series S, our stack with this PR's loose-LDS form on). Over many runs her neck was lit in roughly half of them whatever we changed, so single A/B runs can't settle it.
What made our runs comparable: we stopped judging by screenshots and score each run by her neck in the G-buffer albedo dump at a fixed frame (
VICTORY_DUMP_TARGETS=1;VICTORY_CAPTURE_FRAMES=3000). Frames are counted bypresented()+1, and only targets first used in a listed frame are saved, so list 2-3 consecutive frame numbers to get a whole frame. Even then we needed several runs per side; for example 4 of 6 lit vs 2 of 6 lit for one change was not significant.With
VICTORY_VIEW_GUARD=0faces go black, so on our card the dark skin is stale memory rather than a shader failure, which would fit it not following any one switch here.Correction (2026-11-26): the 1280x720 target we called "albedo" above (format 28, where skin shows blue) is not the base colour. It looks like a material/skin mask: in one run the neck was blue there while the real base colour, render target 0 (1280x720, format 27, the first of the 6 G-buffer targets), was dark at the neck. So the lit/black tallies above were scored on the wrong target and may be off. RT0 is the one to judge (skin tone at the neck; a large plaster wall is also light grey in good runs and dark in bad ones). The hero's skin is drawn by pixel shader b36c288fccc767b0 (found by skipping shaders with
VICTORY_SKIP_PIPELINES).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.