Shaders: lower Wave32 compute branches that reuse lane masks as scalar data #2091
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2091
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2091"
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?
@rezioliver-collab on GitHub · 2026-11-25 04:37 UTC · original
talleyrand222:fix/wave32-compute-scalar-control→main· +1416 −303 · 11 files · 8 commits · openWhy these 40 shaders
We started with 40 RDNA 2 Wave32 compute shaders. On
main, every one stopped witha register joining a lane mask and data, read as data. At a branch or loop join, the guest could use the same scalar register as a 32-bit number and as a mask with one bit per lane. The goal was to emit DXIL for every shader in that fixed set while preserving the word that all lanes read after reconvergence. This PR emits all 40.What changed and why
The compiler keeps the complete scalar word at joins it can lower directly. For the remaining supported compute groups made up of complete Wave32 waves, it follows native scalar branches with an explicit 32-bit
EXEC. If the wave reaches a scalar write withEXEC == 0, that write still takes effect. Vector writes respect the enabled lanes. A later scalar read sees the last write reached by the wave. These rules follow AMD's wavefront execution model, §3.3 onEXEC, §4.1 on program control and theS_AND_SAVEEXEC_B32definition in §12.3. AMD RDNA 2 ISA referenceSome of these programs also read resource descriptor word zero as a number. For a buffer view, that word is the low 32 bits of its guest byte address, including the first-element offset. An image stores its base in 256-byte units, so word zero contains guest address bits 39–8. The host supplies this value when the shader reads the descriptor numerically. AMD RDNA 2 ISA, §8.1.8 table 37 and §8.2.6 table 45
Translation and validation
All four configurations use
mainat940d32f, the same archive and the Windows x64 SDK validator (dxil.dll1.8.2502.11). The last two columns cover all 25,889 matched entries.This PR gains 42 emissions (the target 40 plus two more programs) and 18 SDK passes over main, with zero losses in either set. The remaining 24 shaders in the target group use compute derivatives and pass with the validator 1.8 metadata supplied by Halfect’s separate #1065. That accounts for the 42 additional SDK passes when Wave32 is applied on top of #1065. The metadata commit has been removed from this branch. YaBulochka independently measured the standalone gain of 18 on AMD/Linux at
93685fe, before the descriptor layout revision. Independent archive runCompatibility with #2048
The host and compiler use two dwords (8 bytes) per slot in the
t1view-address table. A buffer keeps its original low/high address pair. For a view that supplies only native word zero, the first dword holds that word and bit 16 in the second identifies the entry. A buffer-pointer read of such a slot yields zero. Clearing the slot publishes two zeros.Both PRs edit
descriptor/host.rs. The linked merge of this head and #2048 (dfb8093) publishes staged descriptors and their two address words together and initializes the table from already-published slots. An RTX 5080 readback checked the value before and after flushing an image replacement and a clear. It also checked that an older queued update could not overwrite a newer direct write at the next flush. All five staging regressions from #2048 passed. Tested merge and conflict resolutionSeven hand-written Wave32 fixtures passed SDK validation and produced the expected four dwords for all 704 threads on the RTX 5080. The archive measurements cover offline translation and SDK acceptance. The GPU execution results cover the synthetic fixtures. Both workspace Clippy configurations and the upstream CI job passed. GitHub CI
Full local Windows test suite
Six tests failed in the full local run. Five also failed in the unmodified-main suite. The sixth,
a_page_list_filled_after_its_request_starts, failed intermittently on unmodified main and passed three isolated reruns of the PR test binary.AI-assisted with OpenAI Codex.
@jeremygold02 on GitHub · 2026-11-25 04:44 UTC · original
Triage verdict — Review the Wave32 work independently of #1065 (
00f14fa)Evidence
93685fe. The final commit has identical added and removed lines to @Halfect’s open #1065 across both changed files. The derivative metadata is already available as a separately reviewable change. Stack commits · #1065 patchChecks and limits
Next step
This verification was AI-assisted.
@YaBulochka on GitHub · 2026-11-25 06:42 UTC · original
AMD/Linux validation run of this stack, on the full retail dump. It is not a small win: +777 programs validate, and almost all of it comes from the last commit, not the scalar-mask ones.
Method:
victory translate shaders.rpf --validate --list, retail 1.0.2.1,x86_64-pc-windows-gnurelease under Wine, dxil.dll 1.9.2609.5. Same dump for every build.940d32f940d32f(main)93685fe(this stack without the last commit)pr2091(all five commits)So of the +777, +759 is the "validator 1.8 for compute derivatives" commit alone, and the four scalar-mask/Wave32 commits give +18. Nothing is lost in either step (validated sets grow, no program disappears from the list).
What the 777 are: the whole
RaytracingResolvefamily -standard388,ped114,prop50,normal32,rtdirectionalshadows28,trees26,weapon22,trunk12,indirect11,sr10 and the rest. On main they fail withwhich is the gradient-in-compute rejection the last commit describes; the validator gives no further detail in this path.
Two process notes, since the title only mentions scalar masks:
I did not check whether these 777 also compile in DXC or run; this is the DXIL validator count only.
@Marvisak on GitHub · 2026-11-25 10:18 UTC · original · edited 2026-11-26 01:20 UTC
Automated triage for the maintainers.
Needs work. Merging
mainfixed the conflicts; it merges cleanly and CI passes (check). The two earlier asks are still open:descriptor/host.rs::address_words/view_addressespublish a native base word withVIEW_NO_BUFFER_POINTERfor non-buffer views, andresource.rschanges too. It is a separate change to runtime state and needs its own PR and evidence, e.g. the RDNA2 ISA descriptor layout for word 0 and a readback like the one you ran with #2048.emit/lower/wave32.rs(explicitEXEC, scalar writes taking effect withEXEC == 0) with the console. A reference would do: an RDNA2 ISA citation for scalar writes underEXEC == 0, or expected values derived from that behaviour rather than from this lowering.The translation numbers (40 targets emitted, 16 validated, all 40 with #1065) are useful context. They show the modules are accepted, not that they are right.
Generated by Claude Code
@rezioliver-collab on GitHub · 2026-11-25 13:42 UTC · original
Thanks for the review, @Marvisak. We removed Halfect’s validator commit so it can land through #1065. The updated PR explains why reusing a lane mask as scalar data blocked 40 Wave32 compute shaders. This branch now emits DXIL for all 40. The SDK validator accepts 16 on this branch and all 40 with #1065 applied.
We also tested this branch together with #2048. On an RTX 5080, we verified descriptor slot reuse and clearing with the two-dword layout. Tested merge with #2048
Ready for another review.
@Capi360 on GitHub · 2026-11-25 15:02 UTC · original
Offline follow-up on RTX 3060 Ti (8 GiB, NVIDIA 616.56), Ryzen 7 5700X3D, 32 GiB RAM, Windows 11 Pro build 26200.
I tested this PR together with #1065 on a code-only integration of
940d32fwith the NVIDIA graphics compatibility changes. All five compute shaders that had produced the mixed mask/data join refusal during the preceding Series X run translated successfully. The seven syntheticemit::semantics_tests::wave32tests passed.The run produced nine intervals above 200 draws/frame (0.77 FPS average). The captures still did not show a usable scene. Windows dropped below 2 GiB of available commit and the monitor stopped the run, so this does not establish that the later GPU reset is fixed.
AI-assisted testing. Integration branch: https://github.com/Capi360/VIctory/tree/codex/rtx-3060-ti-wave32-data
@rezioliver-collab on GitHub · 2026-11-25 18:47 UTC · original
I’m on a Mac until Friday. Could someone with Windows and an RTX 5080 run the Wave32 and D3D12 checks on the updated PR head,
8bd4b17?This head includes upstream
mainat13f91caand uses its 16-byte view-address records. On macOS arm64, 158 shader tests passed, two benchmarks were ignored, and the asset-policy check passed. All the fixtures below are synthetic.Please run these with the RTX 5080 as the hardware adapter and a current x64
dxil.dllavailable for SDK validation.Please reply with your NVIDIA driver version, the seven
DXIL validatedandreadback matchedresults (704 threads total), and theD3D12 readback matched both 16-byte slotsline. The last test reads two adjacent slots back from the GPU after an image write, a clear, and reuse as a buffer. If a test skips or fails, the skip message or first error would help too. Thanks!View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.