Repository navigation
Conversation
|
Tested d0fd9bf on Windows 10, RTX 3060 Ti, driver 610.88, with Agility SDK 620 exports added to the probe executable for this OS. I used four locally held compute shaders from first-story loading, including three large-group programs previously rejected by CreateComputePipelineState. On the build with #54 only the small-group program created a pipeline. With this change, three of the four passed the Windows SDK DXIL validator and created native D3D12 compute pipelines. Two previously refused large-group shaders now work at pipeline creation. The remaining program (02384a60fda6f2d0) returned the translator diagnostic |
|
Tested on an RTX 5070 (Blackwell, 12 GB, driver 621.14, 32-lane waves only), Windows 11, diag build of d0fd9bf (main d2a4bae + this PR), own 1.0.2.1 copy. Synthetic tests: all 14 World run (
Matching by hash: of the 88 refused before, 35 now build and 53 no longer translate. 107 shaders that translated and built before now fail with Likely cause: in The world hang itself is unchanged with or without this PR. AI-assisted (Claude Code); no game files attached. |
|
Tested
No game data used. |
|
Validated PR #189 ( Environment
Results
SummaryAll 14 Wave64 translation and GPU execution tests pass on NVIDIA GTX 1660 SUPER (Wave32) under Wine 11.21 + vkd3d-proton 3.1.0. One minor test-harness issue: No game data used. |
|
Tested Setup: RTX 3070 8 GB (Ampere, 32-lane waves only), driver 610.88, i7-12700, 32 GB, Windows 11 26300. Release build of Tests: In the title:
World time varies between 40 s and 2 min 20 s from run to run on this machine without any change, so I read the difference in world time as noise. Where the refusals went: of the 111 programs refused on
So on this title a large share of the wave64 compute programs still does not run on a 32-lane host, now as dropped dispatches instead of refused pipelines. That matches what others reported in #71: refusals are not what hangs the world. No game files, captures or logs attached. AI-assisted (Claude Code). |
|
I ran the 128-thread For the first lane of a row, Causeway change. This was software-only. Gameplay and hardware-driver effects remain unmeasured. AI-assisted testing. |
|
Data point from an RTX 5070 Ti (D3D12 wave range 32..32), diag build, retail title:
So #189 fixes the compute half of the wave64 problem; mesh needs the same two-halves-per-console-wave emulation through groupshared memory. No game data attached, only the header flag, instruction names and counts. |
|
Independent synthetic test of head Wine/DXVK reported that |
|
Tested head
So this improves the Wave64 path here but does not by itself close #97. Menus and first-boot rendering remained stable. Only counts and error classes are shared. AI-assisted (Kimi Code). |
|
Tested the PR head at |
|
Test report on a machine with a 32-lane and a 64-lane adapter. Tested
The two refusals are
The two refused programs are the kind #233 / #320 run in their console flow (both halves take every branch together, so an exchange inside a divergent branch or loop is reached by both). The approaches fit together: this PR's exchanges for what the whole group reaches, including groups of several console waves, LDS and reductions, which #233 does not do; the console flow for exchanges in divergent code. Not tested: the LDS case is exact in five runs with two groups, which does not rule out a race; release build; the title (no game files used). AI-assisted. |
|
Tested on a real RTX 5070 Laptop GPU (32-lane) with a GTA VI dump. With this PR applied (on The world still doesn't render yet, but for a different reason now: ~395 compute shaders still fail translation on divergent lane ops ( |
A wave64 program split over two 32-lane waves took the DPP row index from the host lane, so the upper half (console rows 2 and 3) read row_mask bits 0 and 1. The row now comes from the console lane there. New test: v_mov_b32_dpp with row_mask:0x3 writes lanes 0 to 31 only, exact on an RTX 5070 (split) and a Radeon iGPU (native). Found in review against #189 and #192, which both get this right. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A wave64 program split over two 32-lane waves took the DPP row index from the host lane, so the upper half (console rows 2 and 3) read row_mask bits 0 and 1. The row now comes from the console lane there. New test: v_mov_b32_dpp with row_mask:0x3 writes lanes 0 to 31 only, exact on an RTX 5070 (split) and a Radeon iGPU (native). Found in review against Marvisak#189 and Marvisak#192, which both get this right. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@Bullet18x, both examples from your WARP Wave32 report on Windows build 28000 point to the masked DPP shift-and-add. The combined shader packs the XOR-2 shuffle into the low 16 bits and the shifted sum into the high 16 bits, so we can check each half of the words you posted.
Both lanes are in an enabled 16-lane row. The expected sums are I ran the original 128-lane test and two new single-operation tests at PR head
Rerun on the affected machine. I kept the original combined test and added one shader for each operation. The test commit is directly on top of From your checkout of this PR at git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr189-lane-checks
git cherry-pick 99135ba50a2392b3e7e444ea03625306e2efaa37
cargo test -p victory-shader --lib --locked -- gpu_128_threads_ds_swizzle gpu_128_threads_dpp_row_shr_mask_a --nocapture --test-threads=1That command runs exactly the three tests. If the mismatch reproduces, could you share which test names fail for |
|
Tested this PR (54b333f) on NVIDIA: the world hangs come from translated shader loops running to the loop limit. Setup: Windows 11, RTX 3050 Ti Laptop (4 GB, driver 32.0.16.2140), i7-11800H, 32 GB RAM. Each run used its own fresh
DRED (diagnostics run): there was no page fault, so the GPU hung rather than faulted. The list stopped at command 82 of 135 (op 42). Commands 79..133 are mesh draws, mostly Takeaways:
I haven't found which shader yet. Happy to bisect with |
|
RTX 5060 Ti (32-lane waves), offline over the retail shaders: the default Tested
What Per program, the set that works with The same numbers come out of #1589 at Caveat: this counts what translates and builds, not what runs correctly. The comment in Not tested: the title with either mode; AMD (native wave64, unaffected); #1589's newer head AI use: Claude Code (Claude Opus 5.5) built, measured and wrote this; checked by mrejecutor. |
|
Automated triage for the maintainers. Needs rebase. This PR does not merge cleanly into current The content has not been reviewed yet; it will be once the branch is rebased onto Generated by Claude Code |
54b333f to
cde7bff
Compare
…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 #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>
|
#189 carried onto @alfycs, since
How the conflicts were resolved
One harness change was needed. After the merge, all 11 I added one test, CI-equivalent checks on the branch: both clippy configurations are clean, and In-game. Setup:
The 3D picture stays black in all of them. Two points:
These are single runs per build, with no debug layer and no cache warm-up. Counts and times only, no game data. AI-assisted (Claude Code); runs done on my machine. |
cde7bff to
d3cd1cb
Compare
…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 #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>
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).
…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 #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.
d3cd1cb to
9580571
Compare
Problem
Wave64 compute shaders that rely on lane layout (
console_lanesor single-wave LDS) currently emitWaveSize(64)(PSV0min/max = 64). On 32-lane GPUs (NVIDIA/Intel) and narrower hosts such as WARP (WaveLaneCountMin = 4), D3D12 rejects these PSOs inCreateComputePipelineStatewithE_INVALIDARG(0x80070057).Related to #71, #85, #97, #3.
Summary of Changes
victory-shader::emit):Wave64Mode(Native,Wave32,Emulate),TranslateOptions,translate_with, andemit_with. Defaulttranslate/emitkeepWave64Mode::Native.Host::supports_wave32andHost::recommended_wave64_modeinemit::host, and checkedDXGI_ADAPTER_FLAG_SOFTWAREinHost::new(true)for WARP environments.victory-shader::resource):index_valuesand addedspilled_sgprsso constant-lanev_readlane_b32reads fromv_writelane_b32(including spills to lanes>= 32in<= 32-thread groups) resolve directly to their scalar values or constants.victory-shader::emit::lower):Wave64Mode::Wave32:<= 32threads: runs inside one native 32-lane wave with zero scratch LDS or cross-half barriers, resolving SGPR spills, zeroing the high ballot dword, and supporting<= 32-thread LDS accesses directly.> 32threads: emitsWaveSize(32)when wave emulation is needed and maps each virtual 64-lane wave onto two aligned 32-lane host waves ((waveReadLaneFirst(flattenedThreadIdInGroup) & !31) + waveGetLaneIndex()).ds_swizzle_b32,DPP(with out-of-range lane indices clamped viainsideandrow_maskindexed by 64-laneconsole_lane),v_mbcnt_*,v_writelane_b32, andlane_bitexecute without cross-half barriers; 64-lane ballots,Shape::Active/Shape::Prefix, uniform-block non-uniformv_readfirstlane_b32(with empty-EXECfallback to lane0), and unresolvedv_readlane_b32exchange through disjoint scratch LDS slots (handling partial virtual waves and enforcing the 32 KiB / 8192-dword TGSM limit).Wave64Mode::Emulate:wave_size = Nonewithout settingflags::WAVE_OPS, usingflattenedThreadIdInGroup+ TGSM +barrier(1 | 8)for ballots (atomicOr), tree reductions (Shape::Active), Hillis-Steele scans (Shape::Prefix),v_readlane_b32,v_readfirstlane_b32(atomicMin, with lane0fallback when empty),ds_swizzle_b32, andDPP.compute_postdoms) + group-uniformity analysis (compute_uniformity, preservingval_uniformacross unguardedv_mov_b32) ensures barriers are never emitted inside divergent control flow or insidebegin_guardedblocks; unsafe divergent cross-half operations fail cleanly withShaderError::Unsupported.preemit_masks), and per-instruction ballots/guards are materialized before operand evaluation (materialize_masks).32 < threads <= 64(Wave32) or1 < threads <= 64(Emulate) accessing LDS (has_lds_mem),plan_lds_fencesinserts group-uniformbarrier(1 | 8)checkpoints at uniform joins/exits (lds_fences.enter/lds_fences.leave), permits multiple divergent pure LDS reads, and refuses unfenceable divergent LDS write/read or write/write conflicts cleanly (LDS accesses without a uniform LDS fence in split wave64).victory-gpu,apps/victory):victory-gpu::Hostqueries D3D12 wave capabilities on open (recommended_wave64_mode) and updatesshader_cache: native 64-lane hosts useWave64Mode::Native, while< 64-lane hosts (including 32-lane NVIDIA/Intel GPUs and WARP) default toWave64Mode::Emulate(which still leaves non-lane-dependent shaders native without scratch LDS, while avoidingWave32divergent/cross-half miscompilations).VICTORY_WAVE64_EMULATE=auto|wave32|1|0remains available as an override (with the mode byte included in cache keys).victory translate --pipelinespasses the host's recommendedWave64Modeviaemit_with.crates/victory-shader/src/emit/wave64_tests.rs):Wave32andEmulate, plus host capability andNativePSO rejection checks).Trade-offs & Known Limitations
Wave64Mode::Native: BecauseNativeemitsWaveSize(64)DXIL that passes translation even when a Wave32 host rejects it inCreateComputePipelineState(E_INVALIDARG), enablingWave32/Emulatereplaces unsafe split-wave barriers/hazards with explicitShaderError::Unsupportedrefusals. On the 26,084-program corpus tested by@bittertea0323, hostCreateComputePipelineStatecompute rejections dropped from97to0, while offline translation reported+26refusals (14×"LDS accesses without a uniform LDS fence in split wave64"and12×"a cross-lane wave operation in divergent control flow"). Translator refusal totals before and after this PR are therefore not directly comparable without accounting for PSO rejections.v_readfirstlane_b32in divergent control flow (Wave32): Because separate 32-lane hardware warps cannot enter a group barrier inside divergent control flow without risking a GPU deadlock,emulated_readfirstlaneinWave32returns each half's own first active lane whendivergent(Emulaterefuses). This is exact when the value is uniform across active lanes or in half-local waterfall iteration, but if both halves are active in divergent control flow with differing first active lane values, the upper half (32..63) observes its own first active lane rather than the lower half's (0..31) as on Wave64.Verification
On Windows (
feat/wave64-compute-emulation@54b333f):cargo xtask policy:155 files okcargo clippy --workspace --all-targets --locked -- -D warnings -A deprecated: 0 errors, 0 warningscargo test -p victory-shader --locked -- wave64 --test-threads=1: 26 passed, 0 failed (including live GPU execution tests)cargo test -p victory-gpu --locked -- --test-threads=1: 50 passed, 0 failed, 1 ignoredVICTORY_WARP=1 cargo test -p victory-shader --locked -- wave64 --test-threads=1: 26 passed, 0 failed