Shaders: wave64 compute as one host wave of two lanes per thread; heap buffer descriptors read as numbers #2011
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!2011
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2011"
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?
@JurajSimicevic on GitHub · 2026-11-29 07:13 UTC · original
JurajSimicevic:idea-a/two-slots→main· +2647 −16 · 11 files · 4 commits · closed without mergingOn hosts with 32-lane waves (NVIDIA), a console wave64 compute program either runs as two host waves that meet at group barriers or, where no such form translates, as two independent half-waves (approximate). If neither works, it is refused and its dispatches are dropped. This PR adds an exact form that needs no barriers: two slots.
How it works
crates/victory-shader/src/two_slots.rsrewrites the machine code of a wave64 compute program whose thread group is whole console waves (64-1024 threads) into an equivalent wave32 program. Host thread h runs console lanes h and 32+h. The rest of the translator then sees an ordinary wave32 program.s_movonly, so SCC is untouched. Runs of VGPR-only instructions share one swap.It is tried after the existing barrier forms and before anything approximate.
VICTORY_TWO_SLOTS=0turns it off; the switch is part of the shader cache key.Supporting changes in lowering:
countedare off.s_wqmis exact via quad reads.Also: buffers picked from the heap and read as numbers
Five compute programs (the shadow-ray tracer among them) pick a buffer descriptor from the resource heap by a computed index and read its dwords only as numbers. Before this PR they were refused ("a descriptor read only as data"). The host's per-slot table (
SLOT_STRIDES) now also holds the first three V# dwords of each buffer view (SLOT_BUFFER_WORDS: address, high bits with stride, records). All five now translate. A program that reads dword 3 is still refused.Results (game build 1.0.2.1, RTX 5080,
translatewithVICTORY_HOST_MAX_WAVE=32)emit/two_slots_tests.rs) run on the card and check the console's results. They cover lane branches and loops, LDS across slots without a barrier, readfirstlane with slot 0 empty, mask-as-number, 2-D and multi-wave groups, bpermute, writelane, wqm, code tables, and far jumps. An f16 tree sum matches bit for bit withVICTORY_F16_NEAREST=1. The full suite passes (366 + host descriptor tests).-Preload):Known issues
cargo xtask policyflagsemit/lower.rsfor size. The file was already over the 640 KB limit before this PR (667 KB -> 673 KB).-Preloadavoids it.AI-assisted.
🤖 Generated with Claude Code
Five of the game's compute programs (the shadow-ray tracer among them) pick a buffer's descriptor from the resource heap by an index they compute and read its dwords only as numbers: the buffer's address and records, to reach it by address. They did not translate ("a descriptor read only as data"), so their dispatches were dropped. The host's table by view heap slot (SLOT_STRIDES) now holds, past the strides, four dwords a slot: a buffer view's first three dwords as the console's buffer descriptor has them (SLOT_BUFFER_WORDS: the title address, its high bits with the stride, the records), written with the view. Such a program reads them by the slot it computes. A program that reads the fourth dword (format and channel selects, which the host does not keep) is still refused. All five now translate. Co-Authored-By: Claude Opus 5.5 <[email protected]>@ArturoWolff on GitHub · 2026-11-29 07:30 UTC · original · edited 2026-11-29 08:16 UTC
Independent game-free validation of the original PR head
f49427e2115852ebf1ce7f01d18f7cfb76069041(clean detached checkout, not rebased onto current main). Thank you for the synthetic fixtures.Host: desktop RTX 4060 8 GB, 16 GB RAM, Linux, NVIDIA 620.73.04, GE-Proton11-14 / vkd3d-proton 3.2.0 (
cae8353ed7959c4+). Rust 1.98.1, locked MSVC release shader-library test executable. No game files mounted.VICTORY_F16_NEAREST=1as in the PR description.emit::two_slots_tests::with--nocapture --test-threads=1: 18 passed, 0 failed, 0 ignored, 356 filtered out; 26.87 s. All 18 distinct test names were present, and Windows child and outer supervisor exited 0. I checked the complete console output for the shared helper’s explicitnot rundiagnostic on device/pipeline initialization failure; there were zero such lines. The runtime enumerated the physical RTX 4060 and llvmpipe, logged software-driver exclusion, and emitted 53 vkd3d initialization records. No host guard or kernel fault occurred.This supports the GPU readback assertions in the provided direct-rewrite synthetic fixtures on a second NVIDIA generation under Proton. It does not establish that the complete production selection path, numeric buffer-descriptor changes, optional DXIL validator, or every title shader has been exercised. Nor does it resolve the reported large-pipeline allocation failure, prove correct gameplay, or demonstrate an FPS gain. The unmerged head still needs integration qualification against current main.
Integration follow-up (compile-only): I also made an isolated, uncommitted merge of the exact PR head onto
e1f2eb60492d94dd0230606b453ba82b34e1b98d. Git reported two conflicts, inshader_cache.rsandemit/mod.rs. The resolution preserved main's existing cache switches and fallback/selection machinery and included the new switch/export. Both locked offline MSVC release library test builds (victory-shaderandvictory-gpu,--no-run) completed successfully. No integrated executable was run.There are still integration questions before I would consider this candidate for execution: partial-dispatch/counting semantics, production route-selection tests, complete descriptor metadata lifecycle coverage, and the unconditional extra 32 MiB metadata table per non-sampler heap. The two-slots switch controls selection, not all independent changes in the PR, so switch-off alone is not an isolated A/B of the complete diff. Is a current-main rebase or separation of the shader rewrite from the descriptor extension planned? These are review concerns, not demonstrated runtime failures on the merged build. The original 18/18 fixture result above remains valid for the pinned original head only.
Narrow integration follow-up: The first three commits, through
60c7fbaf6eb481af9eb78fb1574f8bc6a1af95d1, can be integrated separately from the last descriptor-extension commit. In an isolated uncommitted candidate on the same maine1f2eb6, I retained the current cache keys, added the new key, and conservatively excluded counted-dispatch cases from the new rewrite route pending a complete partial-group correctness contract. The original counted lowering remains available. A native synthetic eligibility regression failed before this change and both the refusal and matched ordinary acceptance cases passed after it (2/2).The narrow candidate's both library test builds also completed. On the same RTX 4060/GE-Proton11-14 setup as above, the byte-identical 18 incoming direct-rewrite fixtures returned 18 passed, 0 failed, 0 ignored, 405 filtered out, 26.82 s, no
not runmarkers, child/outer exit 0, 53 SM 6.6 initialization records and software-driver exclusion. No game files mounted or guard/kernel fault. This verifies that the direct synthetic outputs survived our narrow integration; it is not a test of the full PR, the complete production selection path, switch-off equivalence, optional validator, or actual gameplay. I am retaining this as a diagnostic candidate, not recommending deployment yet.Production selector follow-up (synthetic, CPU-only): Added an isolated integration test using three authored wave-OR fixtures through the ordinary public shader-emission path, with a host wave size of 32. Three native tests passed; separately ran six candidate and three baseline fresh-process comparisons. The noncounted SCC case selected the new form and emitted a 32×1×1 group instead of the baseline's 64×1×1 (the positive assertion deliberately failed on main). The case already handled by the earlier exact route retained the identical emitted record. The counted case declined the new rewrite and retained its original fallback and dispatch-count binding. Complete emitted
HostShaderrecords matched exact main for all three inputs when the new switch was off. The MSVC test executable also compiled, but was not executed. These checks qualify selection and limited switch-off parity, not the numerical correctness of the existing counted fallback, all independently changed lowering paths, cache isolation, or in-game rendering. No gameplay performance claim.AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol High).
@JurajSimicevic on GitHub · 2026-11-29 09:54 UTC · original
Thanks for the independent run on a 4060 under Proton and for the trial merge, that's very helpful.
I'm out of my AI usage budget until Thursday, so I can't act on this before then. Plan for Thursday:
VICTORY_TWO_SLOTS=0is a clean A/B of the first);AI-assisted.
@JurajSimicevic on GitHub · 2026-11-29 10:18 UTC · original
Closing: main already has
fold.rs(8f0a0c24, landed the day before this PR), the same two-lanes-per-host-lane approach. It covers more: VGPRs past 255, and descriptors read as data. Measured on the game's shaders with a 32-lane host, current main leaves 4 approximate and 1 refused wave64 compute program, against 5 and 2 here, and tracks resources for all programs. This branch was built on a base 1420 commits old; my mistake for not rebasing before opening it.Thanks @ArturoWolff for the independent run and the trial merge.
AI-assisted.
Pull request closed