Repository navigation
Conversation
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 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.
… and verify 64-thread float reduction
…c regression tests
Log every rejected adapter and WARP in Host::all_adapters(), and print SKIPPED <test>: no SM 6.6 adapter instead of panicking on an empty host list. This makes Turing/SM 6.5 machines diagnosable instead of producing identical failures.
…on, then native The two 64-lane emulations refuse different programs: Wave32 those with a cross-lane operation in divergent control flow, Emulate those with a non-uniform v_readfirstlane there. A program the asked-for lowering refuses now tries the other one, then the native lowering; the refusal reported is the asked-for one's. On an RTX 4050 Laptop (32 lanes) this takes the shader pack's pipelines the host refuses from 395 (native) to 257, with the same 307 container refusals as native. AI-assisted (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… readfirstlane in Emulate
DPP row/quad/DPP8 never leave a 32-lane half (Marvisak#1317 H-6.3 / FIND-7). Under Wave64Mode::Emulate the host wave is that half, so use host WaveReadLaneAt and host ballot instead of exchange_64 / 64-lane ballot. Keeps real cross-half ops (64-bit ballots, exchange_64 paths) refused. Co-authored-by: Matsvey Makushenka <matvey.myown@gmail.com>
Dukestar69
reviewed
Nov 26, 2026
Dukestar69
left a comment
There was a problem hiding this comment.
Tested on Windows 11 (RTX 5090 + WARP) against origin/main (63bcca4):
cargo clippy -p victory-shader -p victory-gpu -p victory --all-targets -- -D warnings: clean.cargo xtask policy: 193 files ok.cargo test -p victory-shader --lib emit::crosslane_tests:: -- --test-threads=1: 5/5 passed on RTX 5090 and WARP.cargo test -p victory-gpu --lib shader_cache:: -- --test-threads=1: 5/5 passed.cargo test -p victory-shader --lib emit::wave64_tests:: -- --test-threads=1: 34/35 passed, 1 failed:emit::wave64_tests::gpu::gpu_128_threads_ds_swizzle_and_dpp_row_maskpassed on RTX 5090 (wave=(true, 32..=32),[Emulate, Wave32]), but failed on WARP (wave=(true, 4..=4),[Emulate]):assertion `left == right` failed: ds_swizzle_dpp_rowmask (Emulate, WARP) output mismatch left[16..20]: [65554, 65555, 65552, 65553, ...] right[16..20]: [1048594, 2162707, 2293776, 2424849, ...]- Looks like
Emulatemode assumes host wave width >= 32 (or >= 16) for half-local DPP row operations, which breaks on inbox WARP (wave=(true, 4..=4)).
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #189; only the top commit belongs here. Related but separate from #3115 (that PR is the #2176 wave64-on-32-lane
cross-halfrefusal).What's wrong
Under
Wave64Mode::Emulate(#189), DPP source picks go throughexchange_64, which refuses with "a cross-lane wave operation in divergent control flow" / "a cross-lane read in divergent control flow" whenever EXEC is narrowed. DPP row/quad/DPP8 never leave a 32-lane half (#1317 H-6.3 / FIND-7), so they need no LDS barrier and should stay legal in divergent control flow. Onlyv_permlanex16, 64-widev_readlane, and 64-bit ballots really cross the halves.What the change does
crates/victory-shader/src/emit/lower.rs: in Emulate (non-mesh-quad) DPP, use host lane indices andWaveReadLaneAtinstead ofexchange_64.crates/victory-shader/src/emit/lower/wave64.rs:src_lane_active(..., half_local)uses the hostwaveActiveBallotfor half-local DPP FI=0, skipping the 64-lane ballot/barrier path.ds_swizzle/ permute paths that still need console-lane exchange keephalf_local: false.Tests
divergent_dpp_row_emits_under_wave64_emulate: divergentrow_shr:1emits under Emulate; a same-shape divergent 64-bit ballot still refuses.cargo check -p victory-shader --lockedandcargo clippy -p victory-shader --locked -- -D warningsclean on Linux.cargo test -p victory-shader --libdoes not compile on Linux on Shaders: emulate Wave64 compute shaders on Wave32 and narrower hosts #189's base (validatoriscfg(windows)); Windows CI is the gate.cargo xtask policy: 193 files ok.Asset policy
No game data used.