Repository navigation
GPU: a Wave64 lowering that refuses a program tries the other emulation, then native - #3
Closed
KevinPratap wants to merge 13 commits into
Closed
KevinPratap wants to merge 13 commits into
KevinPratap wants to merge 13 commits into
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>
alfycs
force-pushed
the
feat/wave64-compute-emulation
branch
from
November 25, 2026 16:39
9db4e94 to
e57aa16
Compare
Owner
|
Cherry-picked into |
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.
A small addition for Marvisak#189, on top of its head
9db4e94.What
shader_cache::host_shadertranslated with the one Wave64 mode the host asked for. The two emulations refuse different programs, so a program refused by the asked-for mode now tries the other emulation, thenNative. The error kept is the asked-for mode's.lowerings(mode)gives the order, and there's a unit test for it.Why
On an RTX 4050 Laptop (32 lanes, driver 621.24, Windows 11), the translate report gives these compute programs emitted (of 2,679):
nativeWaveSize(64), which the host then refuses)emulatev_readfirstlanein divergent control flow (217), LDS without a uniform fence (148), 64-lane ballot in divergent flow (76)wave32translate --cache --pipelineson the full shader pack:nativeemulatealonewave32+ this fallbackSo the fallback keeps every program
nativecould translate, and still gains the ones only one emulation handles.Testing
cargo test -p victory-gpu --lib shader_cache: 4 passed.cargo clippy -p victory-gpu --all-targets: clean.VICTORY_WAVE64_EMULATE=wave32): draws dropped as "refused" fell from about 100 to 69 per frame. Total drops fell from about 175 to 125.AI-assisted (Claude Code).
🤖 Generated with Claude Code