Repository navigation
Shaders: lower Wave32 compute branches that reuse lane masks as scalar data - #2091
rezioliver-collab wants to merge 8 commits into
Conversation
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC, with dxil.dll validator):
cargo test -p victory-shader --lib wave32— passed on RTX 5090 hardware + WARPcargo test -p victory-shader --lib emit::memory_tests::— 3 passed, 0 failedcargo test -p victory-gpu --lib descriptor_base_word_tracks_the_guest_view_address— passedcargo clippy -p victory-shader -p victory-gpu --all-targets— 0 warningscargo xtask policy— ok (184 files ok)
Clean Wave32 compute branch scalar mask preservation and guest view base word tracking across victory-shader and victory-gpu. Looks great.
AI-assisted (Gemini 4 Neon).
|
Triage verdict — Review the Wave32 work independently of #1065 ( Evidence
Checks and limits
Next step
This verification was AI-assisted. |
catminou4
left a comment
There was a problem hiding this comment.
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f, cargo test -p victory-shader --locked.
144 passed / 0 failed / 2 ignored. Scalar mask words preserved across Wave32 compute branches — mask-word liveness fix; mixed gpu+shader, gpu half Windows-only.
|
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:
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 which 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. |
…nt 2D mip loads, Win11 timer opt-out Translator (tools/rdna2spirv.py) - ubiquitarianism/leonida#1585 (whoalin1, GPL-3.0): the low-16 mask of every int-derived value merged into a preserved 16-bit half is OpBitFieldUExtract (base 0, count 16), not OpBitwiseAnd & 0xFFFF, which NVIDIA's compiler miscompiles (the kept high half corrupted). Six sites: VOP3 16-bit integer results, mad_i16/u16, min/max/med3, signed cvt_i16_f16 / cvt_norm_i16_f16, signed saturate_int16. Two tests that pinned the old shape updated; new tests/semantic/test_nv_and16_extract.py (shape census + interpreter values, negative control; fails on the previous translator). - ubiquitarianism/leonida#1572 (tedin7, GPL-3.0), refined: 2D image_load_mip with glc reads the coherent storage view for mip 0; any other mip takes the sampled fetch at that level instead of upstream's zero-fill, which is only right for a single-level T#. Other dims and tfe/lwe stay Unsupported. CoherentMipLoad tests + spirv-val on four forms; design.md row updated. Decoder (tools/rdna2_decode.py + native port) - ubiquitarianism/leonida#1525 / #1524 (GPL-3.0): inline constants 240..248 on 16-bit integer operands decode to their binary16 patterns (LLVM printImmediateInt16), so the translator no longer reads f32 bits there; ds_condxchg32 keeps one offset; ds_swizzle omits offset 0 and prints ROTATE/FFT as LLVM does. Ported to tools/rdna2_decode_native (tables passed through the blob, _src_is_int16 added to the fingerprint). Runtime (runtime/src/main.cpp) - FVF-07, after ThatRecompDev/five-star-recomp@344f05b (GPL-3.0): ScopedTimerResolution also opts out of Windows 11 timer-resolution throttling (PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION) and hands it back to the system with timeEndPeriod. Guard only: Marvisak/VIctory#2091's Wave32 scalar-mask fix is already how this translator works (EXEC is a per-lane flag, scalar ops unmasked, wave-uniform branches); tests/semantic/test_wave32_scalar_mask_branches.py pins it. Skipped: ubiquitarianism/leonida#742 (XMem view coalescing). Natively it saves about 230 ms once at startup (99,776 per-page views 233 ms vs 4 MiB views 4 ms), but every partial unmap would then tear down up to 63 neighbouring pages, including GPU host-pointer imports and pages under in-flight I/O. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Automated triage for the maintainers. Needs work. Merging
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 |
00f14fa to
20ed9d4
Compare
|
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. |
Port Marvisak/VIctory#2091 as one descriptor ABI change, keeping retry-on-use for placed textures under pressure and the existing early-depth and descriptor-table behavior. Keep GPU address records at two words with a native-base tag for non-buffer views. Co-authored-by: rezioliver-collab <256438629+rezioliver-collab@users.noreply.github.com>
|
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 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 |
Resolve the descriptor and shader conflicts against the four-dword view-address table. Preserve the original Wave32 history and publish the tree tested on macOS arm64.
|
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, This head includes upstream Please run these with the RTX 5080 as the hardware adapter and a current x64 cargo test -p victory-shader --lib --locked wave32_ -- --nocapture --test-threads=1
cargo test -p victory-shader --lib --locked title_memory_is_read_and_written_at_computed_addresses -- --nocapture --test-threads=1
cargo test -p victory-gpu --lib --locked a_reused_title_slot_publishes_the_native_base_word -- --nocapture --test-threads=1Please reply with your NVIDIA driver version, the seven |
Keep dynamic 16-byte descriptor records and native EXEC source selection for Wave32 DPP. Preserve the Wave64 and partial-group test coverage, and split DPP lowering to stay within the repository file-size limit.
Why 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.