Repository navigation
[BUNDLE] Wave64 compute on 32-lane hosts: #189 merged onto the shader stack, stacked on #1511 - #1589
MamaLeVrai wants to merge 106 commits into
Conversation
Pixel programs that use the I/J VGPRs as plain values (custom interpolation, math on the weights) failed with "barycentrics read directly". They are now channels y and z of an SV_Barycentrics input (SM 6.1+, the emitter targets 6.6) declared with the interpolation mode of their kind (perspective/linear, center/centroid/sample), one element per mode (semantic index 0 and 1), with the Barycentrics shader flag and SFI0 feature. GFX10 interpolates P0 + i (P1 - P0) + j (P2 - P0) with P0 the provoking vertex, which the host's barycentrics weight as vertex 0, so i = y and j = z. The VGPRs are loaded on first use as a value, so programs that only feed them to v_interp_* declare nothing new. A console signature's own SV_Barycentrics row (D3D name 23) is parsed and reused. Pull-model barycentrics stay unsupported. SV_Barycentrics is left unpacked (no row, packing location -1), like other non-packed system values: the DXIL validator refuses it in a row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
v_interp_p1/p2 (and the f16 forms) fed with an i or j that is not the loaded input VGPR now evaluate each half as the hardware does: P0 + i (P1 - P0) for the first, the old dst + j (P2 - P0) for the second, with the vertex values read by attributeAtVertex. That needs the element declared constant, so every other interpolation of the same attribute row is weighed from its vertices with SV_Barycentrics of its mode, and flat reads stay loadInput of the provoking vertex. v_interp_mov of P10 and P20 reads P1 - P0 and P2 - P0 the same way when the program also interpolates the attribute (so the hardware holds the deltas); alone it is still refused. The translate command's tally counts Interp::Weighted as interpolated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
…us, and COM/DLL handle leaks
image_sample_d_cl was refused by name, and behind it every program hit a cube sample with explicit gradients, refused as "a cube sample with ... gradients". Both now translate to sampleGrad: - A cube's gradients on GFX10 are of the face coordinates (s, t), four addresses rather than six, so the coordinates follow at 4. They become the direction's gradients through the face's linear part of cube_direction (u = 2s - 3, v = 2t - 3; the major axis does not move), in the new cube_gradient. - `_cl`: the level-of-detail clamp follows the coordinates and is passed as sampleGrad's clamp. translate --validate on shaders.rpf: vertex/pixel 12172 -> 12197 validated; both errors are gone from the list. Not yet compared against the console's sampling at runtime. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… on divergent s_barrier
lower.rs: keep the PR's lazy barycentric VGPR inputs next to main's `Reg::S(n)` arm for uninitialized SGPRs. mod.rs: the barycentric test helper passes the structure to resource::track, which now takes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
DXIL allows at most two SV_Barycentrics input elements, one perspective
and one linear. A program reading both perspective center and centroid
I/J as values declared two perspective elements, which the validator
refuses ("There can only be up to two input attributes of
SV_Barycentrics with different perspective interpolation mode").
The second mode of the same kind is now an Unsupported reason rather
than a second element. Reusing the first element would hand centroid
reads center weights (or the reverse), which differ on edge pixels: a
silent wrong value. Before this PR such reads were refused anyway.
Test: center + centroid values are refused; centroid alone still
translates with one element.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
The ISA's special cases in its order: a NaN numerator or denominator comes back quieted, 0/0 and inf/inf give NaN, x/0 and inf/x a signed infinity, 0/x and x/inf a signed zero, otherwise |S0| with the quotient's sign. Worked on the f32 values of the f16 operands, which are exact.
The ISA's "exponent of S0 all ones -> overflow" check runs before the final |S0| case, so a NaN quotient with a finite, non-zero numerator and denominator gives sign | infinity, as measured on gfx1036 hardware. The zero, infinity and invalid checks still come first.
These write SCC, but their lowering gave no SCC value, so the generic "result is not zero" stood in. The ISA sets it otherwise: - s_min_i32/u32, s_max_i32/u32: SCC = 1 when src0 is the value chosen (src0 < src1 for min, src0 > src1 for max). - s_lshl1..4_add_u32: SCC = 1 when (src0 << n) + src1 overflows 32 bits, through bits shifted out of src0 or the add's carry. So s_min_u32(5, 3) left SCC = 1 (3 is not zero) where the hardware leaves 0, and s_lshl1_add_u32(1, 0xFFFFFFFE) left 0 where it leaves 1; an s_cselect or s_cbranch_scc after them took the wrong side.
The d16 forms of the typed buffer loads return each channel as 16 bits, two per VGPR, low half first; the decoder already sizes their data that way. The lowering only treated `buffer_` names as d16, so a tbuffer_load_format_d16_* went through the 32-bit path: the first VGPR got channel x as a 32-bit value (the f32 bits of 1.0 instead of the f16 pair (1.0, 2.0)) and the other channels were dropped. The format path now packs its channels for d16: integer formats keep their low 16 bits, the other formats become f16 (as the MUBUF d16 path converts them).
Add Wave64Mode (Native, Wave32, Emulate) and TranslateOptions so Wave64 compute shaders lower and run on 32-lane GPUs (NVIDIA/Intel) and narrower hosts such as WARP instead of failing CreateComputePipelineState with E_INVALIDARG on WaveSize(64). - Add Wave64Mode, TranslateOptions, translate_with, and emit_with while keeping translate/emit defaulting to Wave64Mode::Native. - Resolve constant-lane SGPR spills across v_writelane_b32/v_readlane_b32 via resource::spilled_sgprs. - Implement virtual 64-lane mapping for Wave32 (two aligned 32-lane waves) and portable LDS emulation without WAVE_OPS for narrower hosts, with post-dominator uniformity checks to reject cross-half barriers in divergent control flow rather than hanging. - Auto-detect host wave capabilities in victory-gpu::Host (with VICTORY_WAVE64_EMULATE override and mode byte in shader_cache keys) and in victory translate --pipelines. - Add synthetic RDNA2 compute tests (PSO validation + execution on hardware GPU and WARP).
SDATA on s_atc_probe and s_atc_probe_buffer is a 7-bit immediate, the buffer resource is four dwords, and GLC/DLC are not operands of either.
…PP, host) Incorporate verified follow-up fixes from PR Marvisak#189 reviewers and contributors: - Fence single-console-wave LDS accesses at group-uniform joins/exits and reject unfenceable divergent regions (fixes marquezinii's split-block stale LDS readback; from alfycs#1 by @erickbobd). - Allow Wave32 divergent v_readfirstlane per half without LDS barriers (fixes waterfall loops / common divergent refusals reported by @AKA0GHOST and @NuraadGit), preserve ValUniform propagation across unguarded v_mov_b32 copies for uniform v_readfirstlane in divergent branches (@marquezinii), and return lane 0 when EXEC == 0 in emulated_readfirstlane. - Clamp DPP row_shr/row_shl lane indices using inside before read_lane/exchange_64 to avoid out-of-range waveReadLaneAt on WARP 1.0.22 (@ifBars). - Verify DXGI_ADAPTER_FLAG_SOFTWARE in shader::emit::host::Host::new(true) for Wine/DXVK (@dpalacios69, @tanishq-dubey), base recommended_wave64_mode_matches_device_capabilities on queried capabilities (@ifBars), and serialize wave64 GPU tests under valu_tests::ONE_AT_A_TIME (@r4tedx). Co-authored-by: erickbobd <188809599+erickbobd@users.noreply.github.com>
Avoid false positives in plan_lds_fences on Wave32: - Skip need_lds_barriers in Wave32 when total_threads <= 32 (single native host wave). - Track reads vs writes/atomics separately in plan_lds_fences so multiple pure ds_read* instructions inside a divergent region or loop are allowed while RAW/WAW/WAR hazards remain rejected.
buffer_gl0_inv and buffer_gl1_inv name a buffer but read no descriptor, so resource tracking refused them before lowering. Skip descriptor tracking for _inv buffer instructions and lower the pair to nothing, as the existing scalar cache instructions already are. Add a synthetic full-pipeline test.
…e a buffer view A descriptor fetched from the resource heap by index has no used-resource entry, so a scalar buffer load (s_buffer_load_dword*) through it was lowered through a 64 KiB constant buffer handle. When vector buffer loads read the same descriptor, the slot holds a buffer SRV (the title made it one), and reading it through a CBV handle is a descriptor of the wrong type, which D3D12 leaves undefined. Such loads now read the slot as a raw buffer, as table SRVs already do. A descriptor also written through (a UAV) and one only scalar loads read are unchanged. In the title's shaders.rpf this changes 38,829 scalar loads in about 1,900 of 26,084 programs; emit and validation counts are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
s_buffer_load_dword* through a table's UAV took the constant buffer path: a CBV handle at the heap index of a UAV. Reading through it removes the device (WARP: "The GPU device instance has been suspended"). Such a load now reads the UAV raw, as a raw SRV is read and as vector buffer accesses read a UAV. The test writes a value to the VALU tests' raw UAV, reads it back with a scalar buffer load and stores that; it removed the WARP device before this change and passes on the hardware GPU and WARP after. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An s_load_dword* whose address is a root descriptor's, and whose result the program never uses as a descriptor, reads that buffer's data. It stopped with "a descriptor read only as data". It is now read as global loads from a root view already are: a root SRV raw, a root CBV (or a root view the used-resource list does not name) as a constant buffer. A root UAV still stops, with its own reason. Test: dwords 2 and 3 of a root SRV and of a root CBV read with one s_load_dwordx2 and stored, exact on the hardware GPU and WARP; main refuses the program. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Test report for this bundle on a 32-lane host under Linux (not a code review). Setup: Arch Linux, Wine from GE-Proton11-6 + vkd3d-proton (Proton Experimental), GTX 1660 6 GB (Turing, 32-lane waves only), NVIDIA 620.73.04, Series X mode, diagnostics build, empty shader cache, native Tree: this bundle + #1077 #1175 #523 #530 #1040 #1406 #542 #1056 #1392 #1516 #1388 #1189 #1523 (all merge cleanly except #542, a small conflict in One run into the world, to frame 2073 (about 7 minutes):
So the refusals for Compute programs that now do not translate, by reason (distinct shaders warned about in this run): a lane mask holding lanes elsewhere read as data (67), By dropped work per frame the first one is The final image is still dark at frame 2048, and the title's stop of #1323 still comes at about frame 2000-2070. Runs differ in how many shaders they reach, so the two columns are one run each, not an exact A/B. |
|
Thank you, Impre-visible: 111 compute pipelines refused by the host down to 0 on a 32-lane card is the number this PR is for, and the list of walls that remain (lane mask holding lanes elsewhere, |
|
Impre-visible: your tree is now one branch, #1638, stacked on this PR: #189 as merged here plus #1077 #1175 #523 #530 #1040 #1406 #1392 #1516 #1388 #1189 #1523 #542 (#1056 is already in #1319). Clippy (both runs) and |
|
Impre-visible: the unknown-stride wall (56 shaders in your list) has its own PR now, #1644 (#704 on #193, on top of #1511; branch I tried merging it onto your tree (#1638): 11 files and 28 conflict hunks ( AI-assisted (Claude Code); no game data. |
…on old validators
PSV0 shared one string-table copy of a repeated semantic name (TEXCOORD0
and TEXCOORD1 pointing at the same "TEXCOORD"). DXC's PSV writer writes
one copy per element, and validators before 1.8 compare PSV0 byte for
byte, so any signature repeating a name was rejected there ("Pipeline
State Validation does not match"); 1.8 compares the strings and accepted
both. Checked against dxil.dll 1.7, 1.8 and 1.9.
Validator::version() reads IDxcVersionInfo; the compute-derivative test
skips dxil.dll validation when the validator predates 1.8, which rejects
dx.valver 1.8 outright. Translated shaders never go through dxil.dll.
Reported by @alexdeliu.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
….dll is older than validator 1.8" This reverts commit 119b763.
…tic names per element, skip on validators older than 1.8) The author's head now does what the bundle's own commit did (a validator version query and the skip below 1.8), and fixes the second failing test at its cause; the bundle's commit is reverted just before this merge. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ring The shader chain moved: Marvisak#306 is at its author's new head (e3067ae), and the bundle's own validator commit is reverted. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…centrics The shader chain moved: Marvisak#306 is at its author's new head (e3067ae), and the bundle's own validator commit is reverted. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…bustness The shader chain moved: Marvisak#306 is at its author's new head (e3067ae), and the bundle's own validator commit is reverted. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The shader chain moved: Marvisak#306 is at its author's new head (e3067ae), and the bundle's own validator commit is reverted. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Automated triage for the maintainers. Closing because this pull request re-packages other open pull requests. Each of those is reviewed on its own, so a bundle cannot be merged. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution. |
A merge resolution for one PR. #189 emulates Wave64 compute shaders on 32-lane and narrower hosts. The open issues from NVIDIA owners keep hitting that wall: compute pipelines refused because the shaders ask for wave size 64 and the device maximum is 32 (#1107, #1323, #1001). This is #189 merged onto the whole shader stack (#1319, #1402, #1492, #1504, #1511), where it conflicts and fails to compile in a few places. Every head is merged unchanged onto
mainplus #1511, and the result is built and tested together.What is inside
54b333fc5Changes made while bundling
No change inside #189. Two things came up when merging it onto the stack:
emit/lower.rs: a helper that buildsPartsand callslower. Shaders: emulate Wave64 compute shaders on Wave32 and narrower hosts #189 adds anoptionsfield toParts(options: TranslateOptions::default()); another PR of the stack reformatted the closing lines of the same call. Resolution: Shaders: emulate Wave64 compute shaders on Wave32 and narrower hosts #189's field, in rustfmt's layout.cube_image_get_lod_lowersfrom Shaders: lower image_get_lod on cube textures #1004 andimage_atomics_64_bit_lower_with_typed_int64_flagfrom Shaders: lower 64-bit image atomics #305 inemit/lower.rs, andbuildinemit/root_view_tests.rsfrom Shaders: scalar loads from a root view's address read its memory #1056) buildPartswithout the newoptionsfield. Each now hasoptions: super::TranslateOptions::default(), which is what Shaders: emulate Wave64 compute shaders on Wave32 and narrower hosts #189 does in its own tests.That is all of the merge: #189 does not conflict with the stack in the lowering itself.
Left out, and why
host.rs( GPU: select high-performance D3D12 adapter and probe host caps #208's capability probe next to Shaders: emulate Wave64 compute shaders on Wave32 and narrower hosts #189'srecommended_wave64_mode) and inshader_cache.rs(Shaders: emulate Wave64 compute shaders on Wave32 and narrower hosts #189's mode byte in the cache input,input[33..], next to GPU: a shader cache that cannot keep an entry still gives its translation #358'stranslatedflag), and two tests of GPU: a shader cache that cannot keep an entry still gives its translation #358 then need the newWave64Modeargument ofcached(). The resolution is small and is in the merge commit on top of the branchbundle/allofMamaLeVrai/VIctory(clippy twice and 725 tests pass there); no bridge pull request, as the GPU bundles do not depend on this one.Verification
Windows 11, RX 6950 XT, Rust 1.98.1 (the pinned toolchain):
cargo clippy --workspace --all-targets --locked -- -D warningscargo clippy --workspace --all-targets --all-features --locked -- -D warningscargo test --workspace --lockedmain: 342 passed, 6 ignored)The title was not run, so this says nothing about in-game effect. No game data is used or committed.
Re-verify in one go
To confirm that no component PR moved since this was built, compare each
Headabove withgh pr view <n> --repo Marvisak/VIctory --json headRefOid. If one differs, the branch needs a rebuild: merge the new head in the same order.If this lands
The component heads are in the history unchanged, so each PR's commits and authorship are kept and GitHub should mark them merged. Merging them one by one instead works too, with the exceptions noted above.
AI-assisted (Claude Code); no game data.
🤖 Generated with Claude Code