Shaders: emulate Wave64 compute shaders on Wave32 and narrower hosts #189
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!189
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-189"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@alfycs on GitHub · 2026-11-24 01:16 UTC · original
alfycs:feat/wave64-compute-emulation→main· +5067 −609 · 19 files · 19 commits · openProblem
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@ifBars on GitHub · 2026-11-24 01:24 UTC · original
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
v_readfirstlane in divergent control flowat 0x1d0. This probe measured pipeline creation only.@AKA0GHOST on GitHub · 2026-11-24 01:29 UTC · original
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
wave64_testspass on the hardware. I also added two lane-order probes: one console wave in 64×1×1, 8×8×1 and 4×4×4 groups, and four console waves in 256×1×1, 16×16×1 and 8×8×4 groups. The ballot count across halves andv_readlaneof lane 50 come out right in both Wave32 and Emulate modes. So the(waveReadLaneFirst(flat) & !31) + lanemapping holds on Blackwell, 3-D groups included.World run (
VICTORY_D3D12_DRED=1), compared with an earlier run of main + #20 + #55 (a slightly older main, plus a local render-target view guard):E_INVALIDARG)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
v_readfirstlane in divergent control flow(about 50) ora cross-lane wave operation in divergent control flow(about 38). That makes more dropped dispatches than before.Likely cause: in
Wave32mode,need_emu = console_lanes || !sections.is_empty() || has_non_uniform_firstlane. On main, wave64 programs whose only lane use is a whole-wave section or av_readfirstlaneof a non-uniform value get noWaveSizeand run on host waves. A waterfall loop'sreadfirstlaneis likely still correct per 32-lane wave. This PR pulls those programs into the split form, and where the ops sit in divergent flow the check refuses the whole shader. Suggestion: refuse in divergent flow only whenconsole_lanesis set. For programs split only because of sections or a non-uniform firstlane, fall back to the host-wave lowering (or retry without the split) instead of failing.The world hang itself is unchanged with or without this PR.
AI-assisted (Claude Code); no game files attached.
@DaviTostes on GitHub · 2026-11-24 01:30 UTC · original
Tested
d0fd9bfon Arch Linux x86_64, rustc 1.98.1: pass.cargo test -p victory-shader: 61 passed, 0 failed (2 test binaries), including the {adds} test{'s' if adds != 1 else ''} this PR adds.victory-gpuE0425.No game data used.
@dpalacios69 on GitHub · 2026-11-24 01:41 UTC · original
Validated PR #189 (
d0fd9bf, clean mergeable againstmaind2a4bae) on a 32-lane NVIDIA Turing GPU under Linux + Wine + vkd3d-proton (AI-assisted).Environment
wine-11.21 (Staging)+vkd3d-proton 3.1.0(4522cc1a8b1347f) + DXVK DXGI2.7.1x86_64-pc-windows-msvc(--release)Results
cargo test --release -p victory-shader --target x86_64-pc-windows-msvc: 82 passed, 2 failed, 0 ignoredemit::wave64_tests::*tests PASS on real 32-lane hardware, including all 9emit::wave64_tests::gpu::*GPU execution tests (gpu_128_threads_cross_block_ballot_and_constant_mask,gpu_128_threads_ds_swizzle_and_dpp_row_mask,gpu_128_threads_readlane_writelane_spills_and_firstlane,gpu_64_threads_lockstep_lds_without_s_barrier,gpu_32_threads_wave32_fast_path_with_high_lane_spills,gpu_96_threads_partial_virtual_wave,gpu_128_threads_whole_wave_active_and_prefix,gpu_128_threads_uniform_loop_cross_half_ballot,gpu_64_threads_mbcnt_ballot_and_high_ff1).emit::tests::stub_pipeline_is_created— baseline vkd3d-proton behavior (zero digest accepted).emit::host::tests::recommended_wave64_mode_matches_device_capabilities— panicked atcrates/victory-shader/src/emit/host.rs:1465(left: Wave32,right: Emulate). Under Wine + DXVK,EnumWarpAdapteris not supported and falls back to returning the first hardware adapter (DxgiFactory::EnumWarpAdapter: WARP not supported, returning first hardware adapter), soHost::new(true)opens the hardware GTX 1660 SUPER (Wave32) instead of a software WARP adapter. CheckingDXGI_ADAPTER_FLAG_SOFTWAREinHost::new(true)(asvictory-gpu/src/host.rsdoes) would avoid this false failure on Wine/DXVK.cargo test --release -p victory-gpu --target x86_64-pc-windows-msvc: 40 passed, 3 failed, 1 ignored (matchesmaind2a4baebaseline:indirect::tests::argument_clamp_builds,pipeline::library::tests::a_rejected_blob_gives_an_empty_library,resource::tests::buffer_data_reaches_the_host_texture)cargo xtask policy: PASS (asset policy: 152 files ok)Summary
All 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:
recommended_wave64_mode_matches_device_capabilitiesassumesEnumWarpAdapteronly returns a software adapter, which fails under Wine/DXVK's hardware fallback.No game data used.
@Vyral1978 on GitHub · 2026-11-24 01:56 UTC · original
Tested
d0fd9bfon Ampere, in the title up to the world. Pipeline refusals go away; the world hang stays, as in #71.Setup: RTX 3070 8 GB (Ampere, 32-lane waves only), driver 610.88, i7-12700, 32 GB, Windows 11 26300. Release build of
maind2a4bae+ this PR, plus #40, #55, #74 and a local render-target-view guard (the one described in #71). #54 is not included: it conflicts with this PR inlower.rsandmod.rs, and this PR covers the same small-group case. Own 1.0.2.1 copy, two runs (cold, then warm shader cache).Tests:
cargo test --release -p victory-gpu -p victory-shaderpasses on this card, including all GPUwave64_tests(64, 96 and 128 threads, cross-half ballots, readlane/writelane, DPP row masks, the 32-thread fast path).In the title:
d2a4bae+ #40/#54/#55/#74wave64_mode=Wave320x80070057)0x8007000E, out of memory)0x887A00060x887A0006slow host submissionWorld 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
d2a4bae, 69 are now rejected at translation instead and about 41 build. The new translation failures (unique programs) are mostly this PR's own guards:v_readfirstlane in divergent control flow is not supported: 77 (0 before)a cross-lane wave operation in divergent control flow is not supported: 51 (0 before)a lane mask holding lanes elsewhere read as data is not supported: +37So 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).
@ifBars on GitHub · 2026-11-24 02:08 UTC · original
I ran the 128-thread
gpu_128_threads_ds_swizzle_and_dpp_row_masktest from this branch on Windows 10 using Agility SDK 620 and app-local Microsoft WARP 1.0.22. In the Wave32 path, WARP removed its software device. The test passes with a small change in DPP row shifts.For the first lane of a row,
row_shr:1subtracts one before theinsidepredicate gets applied. The lowerer still issues the lane read for that edge. Selecting the lane's own index wheninsideis false before the shuffle avoids passing an out-of-range source and preserves the existingbound_ctrland write-mask behavior. All 128 outputs matched the synthetic reference afterward. WARP also reports support for native Wave64 on this version, so the test expectation that every software adapter selects Emulate needs to follow the advertised capabilities.Causeway change. This was software-only. Gameplay and hardware-driver effects remain unmeasured. AI-assisted testing.
@Kam471 on GitHub · 2026-11-24 02:10 UTC · original
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.
@tanishq-dubey on GitHub · 2026-11-24 02:10 UTC · original
Independent synthetic test of head
d0fd9bf4b9a2b63d303e692c82c9fc8669642cc2on Linux x86_64 with an RTX 5090 (NVIDIA 620.70.06), Wine 11.22, vkd3d-proton 3.2.0 and DXVK 3.1.1. Cross-built the Windowsvictory-shadertest binary and ranwave64_tests --nocapture --test-threads=1: 14 passed, 0 failed. The native-wave64 rejection messages on the 32-wide adapter were expected by the tests.Wine/DXVK reported that
EnumWarpAdapterreturned a hardware adapter, so this is not an independent WARP result. DXIL validator use was not separately confirmed. No game files used in these tests. AI-assisted.@miniongk on GitHub · 2026-11-24 02:12 UTC · original
Tested head
d0fd9bfon Windows 11 26300, RTX 5080 (32-lane), driver 621.24, with a local 1.0.2.1 copy.cargo test --workspace: 279 passed, 0 failed, 4 ignored.wave64_mode=Wave32.main.DXGI_ERROR_DEVICE_HUNGafter a compute submission; 450 shader translation attempts remained unsupported, many reported as cross-lane wave operations in divergent control flow.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).
@Raxstreams on GitHub · 2026-11-24 02:27 UTC · original
Tested the PR head at
d0fd9bfwith 96 distinct compute shaders whose DXIL validated but whose D3D12 compute pipelines were refused on an RTX 3080 Ti. On this PR alone, 33/96 passed both validation and pipeline creation, including all three depth-pyramid shaders. Five more created a pipeline but failed DXIL validation. Of the 58 that did not emit, 30 reported a cross-lane operation in divergent control flow, 26 reported read-first-lane in divergent control flow, and two reported byte/half LDS writes. This was an offline test of pipeline creation.@r4tedx on GitHub · 2026-11-24 02:45 UTC · original
Test report on a machine with a 32-lane and a 64-lane adapter.
Tested
d0fd9bf, translating withTranslateOptions { wave64: host.recommended_wave64_mode() }:Wave32on the RTX 5070,Nativeon the Radeon.split_tests.rsplus two more), each lane's output checked against the console's result, five runs each with identical results:Wave32)Native)ds_swizzlexor 16 + DPProw_mirror, 64 and 128 threadss_bcnt1of lanes below 40, 64, 48 and 32 threadsv_readlane 40row_mask:0x3v_readfirstlane(all lanes active)s_barrier: every lane writes dword t, lanes below 20 then read dword t + 40v_readlane 10inside a branch only lanes below 20 takev_readlane 40in each iterationmain(#225)The two refusals are
a cross-lane read in divergent control flow, as the description says. Onmainthe RTX 5070 creates no pipeline for any of these programs, so every exact cell in its column is new. ForcingWave32andEmulateon the Radeon gives the RTX 5070 column there too.cargo test -p victory-shader: 84 passed, 0 failed. One caveat: the first of 15 runs of the suite hung (thewave64_tests::gpuandvalu_testsGPU tests still running after 10 minutes) and was killed. Other GPU tests were running on the same machine at the time, it did not happen again in 14 further runs, and I have no cause, so treat it as an observation, not a finding.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.
@noxite-four-life on GitHub · 2026-11-24 02:59 UTC · original
Tested on a real RTX 5070 Laptop GPU (32-lane) with a GTA VI dump. With this PR applied (on
main+ #205 + #334), the host logsWave64 compute lowering mode selected wave64_mode=Wave32and theCreateComputeShader: wave lane count of 64 … maximum … is 32rejections drop from 112 to 0 — every previously-refused compute PSO now creates (the "compute pipelines refused" from #71). The title progresses further into the world.The world still doesn't render yet, but for a different reason now: ~395 compute shaders still fail translation on divergent lane ops (
v_readfirstlane/ cross-lane wave op /select on an untracked maskin divergent control flow — looks like #320's territory), plus some vertex/pixel/mesh gaps. The Wave64 size rejection this PR fixes is fully resolved on real NVIDIA hardware. Thanks!@marquezinii on GitHub · 2026-11-24 04:33 UTC · original
Reviewed
d0fd9bfand ran it on an NVIDIA RTX 5070 (32..32, driver 621.24), Windows 11, with the SDK'sdxil.dllvalidating:cargo test -p victory-shaderpasses (84, all 14wave64_tests). A synthetic case with only lanes 32..63 active (s_bcnt1/s_ff1over 64 lanes, emulatedv_readfirstlanepicking lane 32,v_readlaneof lane 40) is exact on the GPU and on WARP in bothWave32andEmulate.One case now runs and gives wrong results where
mainrefused the pipeline: a single console wave (group of 64, nos_barrier) whose LDS write and read sit in different exec-masked blocks. Lanes 32..63 writelds[tid]in one block, lanes 0..31 readlds[tid + 32]in the next. On the console that is one wave in lockstep, so the read sees the write. Here the two host waves are not ordered:need_lds_barriersonly puts a barrier before an LDS instruction in a block every thread reaches and outside a guard, so neither LDS access in this pattern gets one, and the join blocks between them have no LDS instruction.20 dispatches per cell, lanes 0..31 compared with the expected values:
Wave32EmulateWave32/EmulateNative(as onmain)tid < 32readslds[tid + 32]The second row only passes on the hardware by timing.
gpu_64_threads_lockstep_lds_without_s_barriercovers the case where the accesses are in blocks every thread reaches, not this one. Either refusing such a program when its LDS cannot be fenced, or placing the barrier at the join after a divergent region that writes LDS, would keep it from silently returning stale data.The synthetic program (hand-assembled GFX10, uses the helpers in
wave64_tests.rs)Expected for lane
t < 32:t + 39(plain) or the loop's value fort + 32(v = t + 39; 4096 times v = mul_u24(40503, v) + 1); lanes 32..63 store 7.Two smaller points:
v_readfirstlaneof a value that is uniform across the group still goes through the LDS exchange when the program reads other lanes anywhere (self.console_lanes || non_uniform), so inside a branch it refuses the whole shader ("v_readfirstlane in divergent control flow"), e.g.if (tid < 40) s = readfirstlane(sgpr_copy)in a 64-thread group.emulated_readfirstlanewith no active lane in either half returns the upper host wave's pick or stale scratch, where the ISA returns lane 0.Not covered: the title (no game data here).
@r4tedx on GitHub · 2026-11-24 05:46 UTC · original
A data point on @marquezinii's masked-block LDS pattern from the other form (#439's console flow), since it says something about where the barrier has to go. Not a claim on this PR.
I assembled the same two programs for #439's test harness, plus a third with the same masks and no branch around either access (
s_and_saveexec/ds_write/s_or exec, then the same around the read). They arelds_written_and_read_in_different_masked_blocksata32c177. RTX 5070 (32..32, driver 621.24, a group of 64 as two 32-lane waves) and a Radeon iGPU (32..64, one wave), Windows 11, each module throughdxil.dllfirst, 2 groups per dispatch, 20 runs per cell on the RTX:tid < 32readslds[tid + 32]What I take from it:
Synthetic programs only, hand-assembled; no title data. I have not run this PR's or the leaf's code on these programs. AI-assisted (Claude Code).
@oeirughrepuiohg on GitHub · 2026-11-24 06:48 UTC · original
Linux/NVIDIA A/B for the wave64 PRs, same scripted route into the world, 240 s each.
Setup: RTX 4070 Ti 12 GB (driver 620.70.06), Fedora 45 (kernel 7.3), Proton Experimental wine-11.0 with a copy of Proton's
default_pfx, vkd3d-proton from GE-Proton11-14 (cae8353e), Series X mode. Base =d2a4bae+ #177 + #454 + #151 + #222 + #542, diag build,VICTORY_NO_WATCHDOG=1.vkAllocateMemory0xc0000005 in a Unix call at ~11.9/12.3 GB VRAMLinux note for #222 / #340: Fedora 45's
wine-alsa/wine-pulseaudio11.21 packages ship only the unix.sohalves, no PEwinealsa.drv/winepulse.drv, so the audio assert fires even with them installed. Proton's wine with a copy of itsdefault_pfxplus an ALSA device (a hintedtype nulldefault works when no host audio is wanted) avoids it.AI-assisted (Claude Code). No game data attached.
@slint6614-dev on GitHub · 2026-11-24 08:02 UTC · original
AMD hardware check, Windows 11, Adrenalin driver: RX 9070 (RDNA4, 32-64 lane waves) and Ryzen 9600X iGPU (RDNA2, gfx1036).
cargo test -p victory-shader --releasewith each GPU as the hardware device: 84 passed, 0 failed on both. All ninewave64_tests::gpu::*ran on the AMD device in bothEmulateand forcedWave32modes and matched the expected output, so the 32-lane path is checked on real RDNA2/RDNA4 hardware too, not only on NVIDIA/WARP.victory translate --validate --pipelineson the RX 9070 against main1f858b0: identical to main (VS/PS 12272 emitted / 12172 validated / 12272 pipelines, CS 1693/1670/1693, MS 8191/8129/8191), as expected on a host with native 64-lane waves.@Hiiva on GitHub · 2026-11-24 10:27 UTC · original
A WARP-specific follow-up to this stack: this machine reports four host lanes, so native console wave32 programs also need the portable path. They previously kept WaveSize(32) and were refused by WARP even after wave64 programs were handled.
The extension at
github.com/Hiiva/VIctory@6aa72a6uses the source wave width (32 or 64) for shared-memory exchange, ballot indexing, lane wrapping, spills and LDS ordering. Four focused readback tests pass on the verified Microsoft software adapter (min=max4), with CPU lowering/resource checks and all-target clippy. The existing wave64 tests still pass. This is in the current integration branch; no game assets are included.Related fixes in that branch retain the source EXEC mask for firstlane, including the small Wave32 fast path and empty-EXEC lane-zero behavior. A separate portable console-flow follow-up is being tested for the remaining divergent single-wave cases. These tests establish the covered operations, not playable world rendering.
@elamriz on GitHub · 2026-11-24 11:22 UTC · original · edited 2026-11-24 11:41 UTC
Independent Windows WARP test on
ffe310ewithd0fd9bfapplied locally. WARP reports min/max wave lanes4/4. The diagnostics runs used WARP, D3D12 Debug and DRED, with a fresh cache per run and the same scripted input in an offline AppContainer.ffe310e0x887A0005d0fd9bf, run 10xC0000005d0fd9bf, run 20x887A0005These are message counts, which vary with how far the run gets. Compute shader
13dfdd3b1136e407, the first wave64 refusal on the baseline, appeared in submitted work in both patched runs. Device removal still reproduced once with no 64→4 messages.The remaining wave32 refusal agrees with Hiiva’s follow-up. I also isolated it without title files using the helpers in
wave64_tests.rs: emitv_mbcnt_lo_u32_b32(1, NEG_ONE, inline_u(0)),emit_uav_store(&mut code, 1, 0)andS_ENDPGMin a[32, 1, 1]group, setprogram.wave64 = false, and useemit_csinEmulatemode. Withd0fd9bf, PSV still declares(32, 32). The root signature succeeds andCreateComputePipelineStaterejects the shader. Successful pipeline creation and exact readback of0..31would give this case a simple check on the portable wave32 path. I have yet to run the follow-up commit.AI-assisted testing and reporting. No raw logs or title files attached.
Follow-up on
6aa72a6— I ran the syntheticv_mbcnt_locase with 64 threads. InEmulatemode on 4-lane WARP it created the PSO and read back0..31twice, as expected for two independent guest wave32s. To exercise both adapters, I locally changed the test helper’s expected native failure to checksupports_wave32()for wave32 guests andsupports_wave64()for wave64 guests. The helper otherwise incorrectly expects native wave32 creation to fail on a 32-lane hardware adapter. With the harness corrected, the existinggpu_native_wave32_lane_semanticspasses on WARP inEmulatemode but shows a separate readback mismatch on the 32-lane hardware adapter inWave32mode. This follow-up was synthetic only.In-title A/B for
6aa72a6— I ran the exact commit and its immediate parenta2e1a1ein the same offline Windows WARP setup, with a fresh cache per run. The parent logged 69 wave32→4 messages and exited with0x887A0005. Both6aa72a6runs had zero wave-size messages and zero host pipeline refusals. Both stopped at the same title-side null write (0xC0000005). This confirms the wave32 pipeline fix in-title. The cause of the null write is still open.Crash follow-up — The faulting instruction in both patched runs writes to literal address zero. This is an explicit trap in the title code. The failing condition upstream is still unknown.
Watchdog and sampled stacks — The two title fault sites match #454. Across three earlier watchdog exits the saved register state is consistent with the 30-tick no-progress branch. In a separate
6aa72a6run with the watchdog still enabled, three scheduled samples (105, 115 and 125 s) foundtitle-mainin the same polling routine, in the 1 ms sleep or the next call, with the same title caller in all samples. WARP workers were active in the stack dump. That run had zero wave-size messages and ended through D3D12 device removal after a seven-list submission, with empty DRED breadcrumbs. The sampled wait is repeatable within this run, but the data does not identify a particular stalled dispatch.@NuraadGit on GitHub · 2026-11-24 12:21 UTC · original
A follow-up on
d0fd9bfthat removes the most common Wave32 refusal in the world:v_readfirstlane in divergent control flow.Branch: NuraadGit:shaders/wave32-divergent-readfirstlane, one commit (
7425674) on this PR's head, +48/-4 with a test.What it changes. Inside divergent control flow the two 32-lane halves can't meet at a barrier, so
emulated_readfirstlanerefuses. InWave64Mode::Wave32, each half now reads its own first active lane instead:waveActiveBallotof the active lanes, first bit,waveReadLaneAt. That's the same code the uniform path already uses forpicked, minus the LDS exchange, so no barrier is emitted inside the branch and nothing can hang.Emulatestill refuses.Why it's sound in practice:
v_readfirstlanefor.v_cmp_eqmatches its own lanes, and the loop runs until both halves are empty.shortcut:.Test:
divergent_readfirstlane_reads_its_halfs_first_lane_on_wave32(inwave64_tests.rs, modelled ondivergent_cross_half_ballot_is_rejected_instead_of_hanging). It translates on Wave32 and still errors on Emulate, and it fails without the change. All 16wave64tests pass.Measured in the world (RTX 2080, 8-minute runs, no DRED):
v_readfirstlane in divergent control flowThe build was JMAN730's fork + #493 + this PR + #206 + #667 +
MIN_DYNAMIC = 1 << 18(#747) + the render-target guard from my comment on #55, atVICTORY_SHADER_LOOP_LIMIT=32. The 3D scene is still black on this card: the G-buffer and its packed attribute targets now hold most of the first playable area, but the lighting chain doesn't show yet. So I can't yet claim the fallback gives correct pixels, only that those programs now translate and run without hanging.The next Wave32 reasons in the same world run, by count of programs:
a lane mask holding lanes elsewhere read as data(93),a cross-lane wave operation in divergent control flow(75, fromexchange_two_halves), anda lane-mask join of an untracked mask(13).AI-assisted (Claude Code): the change, test, builds and runs were automated. The hardware, title copy and runs are the user's.
@erickbobd on GitHub · 2026-11-24 05:12 UTC · original · edited 2026-11-24 12:49 UTC
Following marquezinii's synthetic LDS report, I reproduced stale readbacks on exact
d0fd9bfand prepared a cooperative leaf: c60f2b4 (parent is this PR's head).It fences single-console-wave LDS regions at proven group-uniform joins/exits. Regions with multiple LDS accesses and no safe checkpoint are refused conservatively, including accesses in sibling arms. The native path remains as before. Related alternatives on other stacks: #192 and #439.
Identical synthetic fixtures and readback harness, 20 dispatches per case and mode:
d0fd9bfThe two separated writer cases account for all 80/80 wrong RTX readbacks before the fix. Cases also cover a uniform writer, same-block EXEC guards, and a delayed writer. WARP does not support Wave32 here. DXIL inspection confirms 0→2 group-sync LDS barriers in the separated-write cases; the same-block case already had a fence between its store and load.
Permanent LDS tests: 7 passed (including hardware/WARP readbacks); other CPU tests: 46 passed. SDK DXIL validation,
cargo clippy -p victory-shader --all-targets -- -D warnings, formatting and asset policy pass. Single-wave synthetic coverage only; gameplay and multi-wave groups remain unverified. No game data or performance measurements.AI-assisted (Codex). Windows 11 25H2 26200.9974, RTX 5070 Ti / NVIDIA 617.14, Rust 1.98.1, Windows SDK 10.0.26100.0 validator.
A focused follow-up PR is now open directly against @alfycs's branch: https://github.com/alfycs/VIctory/pull/1 (one new commit, two files).
@alfycs on GitHub · 2026-11-24 13:21 UTC · original
Rebased onto
origin/main(ffe310e) and updated tob472733addressing the test reports and follow-up fixes from everyone here:alfycs/VIctory#1from @erickbobd, following @marquezinii's report and checking @r4tedx's same-block EXEC guard pattern): fence single-console-wave LDS regions at proven group-uniform joins/exits and reject unfenceable divergent regions conservatively; uniform blocks already place barriers before guarded LDS accesses. Verified on RTX 3070 Ti + WARP (gpu_single_wave_lds_regions_are_ordered).v_readfirstlane_b32in divergent flow & emptyEXEC(@AKA0GHOST, @NuraadGit, @marquezinii):Wave32, divergent non-uniformv_readfirstlanenow reads each 32-lane half's first active lane without an LDS barrier (covering waterfall loops and removing the main divergent refusal;Emulatestill rejects it).compute_uniformityso unguardedv_mov_b32copies from uniform sources propagateval_uniform;v_readfirstlaneof group-uniform values now passes directly in divergent branches on bothWave32andEmulate.emulated_readfirstlanewhenEXEC == 0so bothWave32andEmulatereturn lane 0's value rather than half 1's lane 0 or0(gpu_64_threads_empty_exec_readfirstlane_returns_lane0).srcwithinsidebeforeread_lane/exchange_64indppso out-of-row lanes (0 - 1onrow_shr:1) never pass invalid lane indices towaveReadLaneAt.shader::emit::host::Host::new(true)now verifiesDXGI_ADAPTER_FLAG_SOFTWARE(matchingvictory-gpu) for Wine/DXVK,recommended_wave64_mode_matches_device_capabilitieschecks queried adapter capabilities instead of hardcodingEmulatefor WARP, andwave64_tests::gputakesvalu_tests::ONE_AT_A_TIME.Re-verified after rebase + edits (
cargo test --workspace --locked: 365 passed, 0 failed, 6 ignored;VICTORY_WARP=1 cargo test -p victory-shader wave64_tests: 22 passed;cargo xtask policy: 155 files ok). Thank you all for the thorough hardware/Wine/WARP reports and PRs!@Sil3ntGam3r on GitHub · 2026-11-24 13:39 UTC · original
Title run on an RTX 3070 8 GB (driver 621.14, Windows 11 26300) with
b472733applied on top of my test build: mainffe310e+ #89 #493 #483 #189 (d0fd9bf) #206 #469 #454 #704 #688 #352 #346 #489 #709 #650 #571, andMIN_DYNAMIC = 1 << 18as in #747. Diag build, DRED, loop limit 32; same cache and input as the run just before it withoutb472733.v_readfirstlane in divergent control flow: 91 programs refused before, 0 withb472733. Six of the programs dropped most in the world now translate and run:269b802f878c24e1,4a05640ec16718ad,da1656ad2910e4c7,d3d595d35a4ee7bb,9b885ee6fdda77f5,d3e44e754b3eb6aa. (b6df66af105d8b2dnow stops at a 64-bit image atomic.)LDS accesses without a uniform LDS fence in split wave64. They include the two dropped most often in the world,caa78b8ca62bc3d6(about 178/frame) and28918b7150a7aad5(about 82/frame), which before stopped atbuffer_load_ushort; the fence check now comes first for them.(AI-assisted test run.)
@Sil3ntGam3r on GitHub · 2026-11-24 13:41 UTC · original
Follow-up to my run above (same build,
b472733applied, RTX 3070): the four instance-culling compute programs @timorjay checks on #439 are all refused here.b472733fdd56d97a806bcca(props)a cross-lane wave operation in divergent control flow(at0x724)17af15c4015cb4b6(props)a cross-lane wave operation in divergent control flow(at0x2ab4)55679a0547649d0b(trees, 512 B LDS)LDS accesses without a uniform LDS fence in split wave64(at0x2e80)89d08e561897d4e5(trees, 512 B LDS)LDS accesses without a uniform LDS fence in split wave64(at0x2a18)On #439 (
c153b21, which includes #233) with #704, timorjay reports all four emitting a 32-lane module that validates and gets a D3D12 compute pipeline on an RTX 5090 D. In my runs with this PR, character geometry reaches the G-buffer while props and buildings don't, which would fit these four being refused. That's an inference, not something I've measured directly. Since they're the programs that pick which world instances get drawn, they may be worth prioritising for the split path.(AI-assisted.)
@alfycs on GitHub · 2026-11-24 13:47 UTC · original
@Sil3ntGam3r Thanks for testing
b472733right away! Thev_readfirstlanedrop (91 -> 0) is great to see.Just pushed
c047885on top ofb472733to fix two false positives inplan_lds_fences:total_threads <= 32inWave32: groups of<= 32threads run inside a single native 32-lane wave, so they no longer enterneed_lds_barriers/plan_lds_fences.ds_read*chains/loops in divergent code:plan_lds_fencespreviously treated everyFields::Dsop identically, rejecting multiple pureds_read*instructions in a divergent branch or loop even when nods_write/ atomic exists in that region. Separatingds_is_writelets divergent read-only regions pass while still rejecting RAW/WAW/WAR pairs (divergent_multiple_lds_reads_without_writes_succeed).For the 4 instance-culling shaders (
fdd56d97,17af15c4hitting divergentexchange_two_halves, and55679a05,89d08e56if they perform divergent LDS writes/atomics + reads): true cross-half execution inside divergent branches requires lockstep/console-flow execution (as in#233/#439), which stays outside the split-barrier model here.@alfycs on GitHub · 2026-11-24 14:01 UTC · original
For @Kam471 and anyone testing Wave64 mesh shaders alongside this PR (see #778): pushed a stacked follow-up branch
alfycs/VIctory@feat/wave64-mesh-emulation(b3671c8on top ofc047885).It extends portable 64-lane LDS emulation (
Wave64Mode::Emulate+MaskData::Console, noWaveSize) toStageIo::MsWave64 mesh programs when they use masks read as data (s_bcnt1/s_ff1/v_mbcnt),v_readlane/v_writelane, non-quad swizzles/DPP, wave reductions, or non-uniformv_readfirstlane(with per-half fallback in divergentWave32), verified with Windows SDKdxil.dlland live 128-threadDispatchMeshGPU tests on RTX 3070 Ti and WARP (27/27wave64_tests, 370 workspace tests passing).@erLCoder on GitHub · 2026-11-24 14:38 UTC · original
@alfycs Wave64 rebase check on GTX 1660 Ti.
I reproduced the old conflict with
git merge-treeon #189d0fd9bfand mainffe310e; Git reports conflicts inemit/mod.rsandresource.rs. Current #189 headc047885descends fromffe310evia64dee8b,b472733, andc047885, so it fast-forwards. I used the updated head as-is. Inemit/mod.rs, main still structures the program before per-lane descriptor tracking and passes the Wave64 option toemit_with. Inresource.rs, structured control flow remains available to the descriptor tracer and the spill resolver is reused. The waterfall test module remains registered.On Windows 10 22H2, GTX 1660 Ti, NVIDIA 581.42 and Agility SDK 1.620.2, the test required physical NVIDIA LUID
00000000:00017c52and 32–32 wave lanes. A module sample confirmed the local D3D12Core.dll. All 23 Wave64 tests passed, including 11 hardware tests comparing exact per-lane readbacks in both Wave32 and Emulate modes. These cover cross-half ballot and lane reads, partial waves, SGPR spills, DPP, empty EXEC and LDS ordering. All five upstream waterfall tests passed with the hardware path active. Their WARP subcases skipped because SM 6.6 WARP was unavailable.One semantic limitation remains in
emulated_readfirstlane. In divergent control flow on Wave32, a non-uniformv_readfirstlanecan select the first active lane of each half. If both halves are active and their first values differ, the upper half can observe a different value from the Wave64 first active lane. Divergent cross-half operations and LDS hazards without a safe uniform fence can also be refused. Exact support for the general divergent case needs a separate algorithm change and a two-active-halves regression case.The prologue reproduces the four instance-culling refusals discussed earlier on
c047885with #493, #206 and #638 head99b6afc.fdd56d97and17af15c4stop on divergent cross-lane operations.55679a05and89d08e56stop on LDS access without a uniform fence. Character geometry appeared in the diagnostic target. That visual result alone cannot identify which missing draws these refusals caused.Testing and report were assisted by OpenAI Codex (GPT-6).
@bittertea0323 on GitHub · 2026-11-24 15:06 UTC · original
Real-title feedback: it clears the pipeline refusals outright, with two costs worth knowing
Measured on a 4070 SUPER / Windows 10 build that carries
#729(Agility) +#89core + this branch, Series X,diag profile, same host for both trees.
The gain is exactly what the PR promises. Every compute pipeline the title asked for was being refused:
host pipeline refused (E_INVALIDARG)host root signature refusedSo
CreateComputePipelineStateno longer rejects wave64 compute on this 32-lane host. That part is clean.Cost 1 — 26 new translator failures on the offline corpus (26,084 programs): 14 × "LDS accesses without a
uniform LDS fence in split wave64" and 12 × "a cross-lane wave operation in divergent control flow". Those
programs used to translate (to code that would have been refused at PSO creation, so this may be a fair trade)
— but it means emission counts measured with #189 are not comparable with counts measured without it, and it
would help if the PR body said so.
Cost 2 — and this is the one that matters here: the world stops drawing. Comparing 2560×1440 world draws
(the title's six-target world pass) at the same load stage:
ffe310e+ #729 + #89With #189 the run reaches far more presented frames (1500–3200 vs ~1400) and no pipeline is refused any more,
but the world pass never executes again — the title appears to stall earlier in its load, before the first world
draw. Our best guess is a fence/barrier semantic difference from the emulation (the title waiting on something
that never completes), but we have not proven it, and it could equally be an interaction with the other
branches on our tree.
Not measured: which of the four changes on our tree is responsible — we have not bisected #189 alone against the
rest. If you can run the same 232-vs-0 comparison on a tree with #189 only, that would settle it quickly.
@bittertea0323 on GitHub · 2026-11-24 15:22 UTC · original
Wave32 is chosen on NVIDIA and does not renumber lanes: the world never draws. Emulate does.
Measured on a 4070 SUPER (32-lane only) with
#729+ our diag build, Series X, three runs of the samebinary, differing only in
VICTORY_WAVE64_EMULATE:Wave32(whatrecommended_wave64_modepicks on NVIDIA)Emulate(forced)#189removes theE_INVALIDARGonCreateComputePipelineStatein both modes — 97 refusals → 0.The PSO half of the problem is solved either way. What differs is behaviour:
Wave32: a wave64 program is emitted withWaveSize(32)and runs as two host waves, but lanenumbering is not remapped. Anything crossing lanes (ballot,
readfirstlane, LDS exchange, DPP)computes on the wrong lanes. GTA VI's world load is almost entirely such compute (meshlet culling,
light and shadow passes), so the title's own gating never passes and the world pass is never
submitted: a steady 10 draws/frame for the whole run, with no error to explain it.
Emulate: the same programs run with the emulation scratch and lane remapping, and the worldpass executes — 1600–1863 draws/frame at 0.8 fps (1066–1281 ms/frame), with 196–203 pipelines still
being compiled at any moment, which is what the
dropped … (N being made)counters show.Two suggestions, in order of expected value:
recommended_wave64_modeprefersWave32whenever the device reports wave32 support. For a wave64title that is the wrong default: it makes PSOs legal while producing wrong results, which is the
most expensive failure mode to debug — we lost hours chasing descriptor and mesh bugs that were
this. Prefer
Emulatefor wave64 programs, or at minimum log loudly that the cheap mode is in use.Wave32may still be right for programs that provably never cross lanes; detecting that wouldrecover much of Emulate's cost for the rest.
Not measured: whether the 196–203 in-flight pipelines are a throughput limit or a per-program cost;
and whether the remaining
droppeddraws are purely "pipeline not ready" or partly the indirect path(#255's rectangle/indirect gap), since 1200–1738 indirect draws are also counted as dropped.
@alfycs on GitHub · 2026-11-24 15:23 UTC · original · edited 2026-11-24 15:26 UTC
Thanks
@erLCoderand@bittertea0323for the hardware tests, corpus deltas, and theWave32vsEmulatecomparison onc047885.On
emulated_readfirstlanein divergent control flow (@erLCoder)We audited
emulated_readfirstlaneincrates/victory-shader/src/emit/lower.rs: your analysis is right for the case where both 32-lane halves are active in divergent control flow with differing first active lane values. InWave32, independent hardware warps cannot meet atbarrier(1 | 8)inside divergent flow without deadlocking, so commitb472733used the per-half fallback inWave32(covered bydivergent_readfirstlane_reads_its_halfs_first_lane_on_wave32) while keepingShaderError::UnsupportedinEmulate.On
Cost 1(+26 refusals) andWave32vsEmulate(@bittertea0323)Cost 1): We updated the PR description with a Trade-offs & Known Limitations section documenting that clearing97 -> 0CreateComputePipelineStateE_INVALIDARGrejections came with+26offline translator refusals on the 26,084-program corpus (14×"LDS accesses without a uniform LDS fence in split wave64"and12×"a cross-lane wave operation in divergent control flow").Wave32(10 draws) vsEmulate(1600–1863 draws): Saw your follow-up measurement confirming it is specificallyWave32vsEmulateon the same binary rather than#940/mip-drop. Looking at every branch whereWave32diverges fromEmulateinlower.rs:emulated_readfirstlane(Wave32allows divergent per-half reads, whereasEmulaterefuses)ds_swizzle_b32/DPP(Wave32useswaveReadLaneAtwithout checking divergence, whereasEmulateusesexchange_64and refuses divergent cross-lane reads)<= 32-thread shaders (Wave32runs natively withoutemulating_wave64(), wherewaveReadLaneFirstdoes not apply an instructionguard)Emulatealready leaves shaders with!need_emu(!console_lanes && sections.is_empty() && !has_non_uniform_firstlane) as native (wave_size = Nonewithout scratch LDS exchange). We are reviewing whether to defaultrecommended_wave64_modeon< 64-lane hosts toEmulate(keepingWave32opt-in viaVICTORY_WAVE64_EMULATE=wave32) and tightenWave32's divergent checks.@alfycs on GitHub · 2026-11-24 15:30 UTC · original
Pushed
54b333fto switchrecommended_wave64_mode(in bothvictory-shader::emit::hostandvictory-gpu::host) to default< 64-lane hosts toWave64Mode::Emulateinstead ofWave64Mode::Wave32, addressing@bittertea0323'sWave32(10 draws) vsEmulate(1600–1863 draws) finding and@erLCoder's divergentemulated_readfirstlaneconcern on the default path.!need_emu) still remain native (wave_size = None, zero scratch LDS) underEmulate.Wave32remains opt-in viaVICTORY_WAVE64_EMULATE=wave32(and tested inwave64_tests).54b333f:cargo xtask policy(155 files ok),cargo clippy --workspace --all-targets --locked -- -D warnings -A deprecated(0 errors/warnings),victory-shaderwave64tests (26/26on hardware and26/26withVICTORY_WARP=1), andvictory-gpu(50 passed, 0 failed, 1 ignored).@Sil3ntGam3r on GitHub · 2026-11-24 15:30 UTC · original
@bittertea0323 A data point for your 232-vs-0 question: on my tree, the world pass runs with #189.
Tree: RTX 3070 8 GB, driver 621.14, Windows 11 (26300), Series X mode, diag build. Main
ffe310e+ #89 #493 #483 #189 (d0fd9bfwithb472733applied) #206 #469 #454 #704 #688 #352 #346 #489 #709 (with #294) #650 #571, and in the second run also #431 and #876's change. No #729 and no #940.What I measured: a local diagnostics view that presents the render target most draws went to since the last present, limited to 8-bit RGBA targets at least 1280 wide. In two runs it switched to a 2560×1440 target as the title entered the world, with 2042 and 2088 draws into that one target in that frame.
This isn't the same count as yours: it's draws into one target, not your six-target pass. But it does show that #189 on its own doesn't keep the title from reaching the world pass here. The difference from your tree is #729 and #940 (plus mip-drop), which mine doesn't have, so those would be the first to bisect.
(AI-assisted test run.)
@yuruiwang233 on GitHub · 2026-11-24 15:37 UTC · original
Independent run: 144 passed, with a DXIL validator loaded
Not the author. Applied this PR's diff on
mainffe310e; it applies cleanly. Machine: Windows 11 26300, Ryzen 9 7940HX, RTX 4060 Laptop GPU (D3D12 wave range 32..32, driver 32.0.16.1714) with a Radeon 610M iGPU (32..64) also present. Rust 1.98.1,x86_64-pc-windows-gnu(MinGW, not MSVC), so this is not CI parity.cargo test -p victory-shader --lib: 144 passed, 0 failed, 1 ignored, run serially.wave64_testspass: thegpu::*ones dispatch on the default device (the 4060) in bothWave32andEmulate, and on WARP, and the lane results are as expected.Microsoft.Direct3D.DXCNuGet package (dxil.dll 1.8.2505.32; itsDxcCreateInstanceexport loads) and setVICTORY_DXIL. With it active the same 144 pass, so every module these tests emit validates before it is dispatched.Not verified: no game files, so no title run and no
--host-lanescensus; the Radeon was not used as a 64-lane reference here, since these tests take the default device and WARP; nothing about world rendering.@Sil3ntGam3r on GitHub · 2026-11-24 15:58 UTC · original
@alfycs a title run with
54b333f, and a correction to my comment above: those two runs were in Wave32 mode (the log sayswave64_mode=Wave32), the default on NVIDIA before54b333f.Same tree as in that comment, now with
c047885and54b333fon top (cherry-picked afterb472733); all 410 tests pass. RTX 3070, driver 621.14, Series X. The log confirmswave64_mode=Emulate.b472733)54b333f)fdd56d97a806bcca(at0x724) and17af15c4015cb4b6(at0x2ab4): "a 64-lane wave ballot in divergent control flow" (in Wave32, "a cross-lane wave operation in divergent control flow").55679a0547649d0b(at0x2e80) and89d08e561897d4e5(at0x2a18): the LDS fence, in both modes.v_readfirstlanerefusals are the ones you describe keeping as Unsupported in Emulate. So on this title Emulate trades Wave32's per-half first lane for a refusal, and the net count goes up by 51.This doesn't contradict @bittertea0323's 10 vs 1600–1863 draws: my Wave32 runs reached the world pass too, so whatever stalls their Wave32 run doesn't happen on my tree. On the #439 stack the same four programs translate and scenery reaches the G-buffer, so for this title the divergent ballot and LDS-fence cases in those four look like what keeps the world empty on this path.
(AI-assisted test run.)
@N7z on GitHub · 2026-11-24 16:03 UTC · original
Ran this PR's tests (
54b333f) next to #439 and #734's branch on an RTX 4060 Laptop: all 144 pass on the NVIDIA GPU, the 26wave64_testsincluded. Comparison and coverage table in #1132.Two things about the harness:
Host::new(false)creates the device on adapter 0. On a hybrid laptop that is the iGPU, so without a local change these tests ran on the Intel UHD here, not the RTX 4060. Choosing the adapter withIDXGIFactory6::EnumAdapterByGpuPreference(0, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE)would default to the discrete GPU. This is onmaintoo, so not this PR's doing, but it matters for anyone reporting results for a 32-lane GPU from a laptop.wave64_tests::with_hostskeepsHost::new(..).ok()andrun_on_hostsskipsNonewithcontinue. Where device creation fails, the GPU tests pass without running anything and print nothing. A line on stderr, or a failure when neither host exists, would make that visible.@NuraadGit on GitHub · 2026-11-24 16:16 UTC · original
@alfycs @bittertea0323 On the new
Emulatedefault: on an RTX 2080 the world pass runs inWave32, in every world run I have with it. That matches @Sil3ntGam3r's 3070.RTX 2080, driver 616.56, Series X. The log says
wave64_mode=Wave32. Headd0fd9bf; from the third row on also my divergentv_readfirstlanefallback (7425674, the one you took) and a similar local one for reductions. Medians over the second half of each world run:d2a4bae+ #493 + #189 + #206 (21-min run)No device removal in any of these runs, and from the second row on the G-buffer gets scene geometry. I haven't run
Emulate.On "Wave32 doesn't renumber lanes": it does, also at
54b333f. Inensure_wave_idsthe thread id is(waveReadLaneFirst(flattenedThreadIdInGroup) & !31) + waveGetLaneIndex(), and the console lane is that& 63. This assumes that the first lanes of a group's two waves come from different blocks of 32 flattened ids.Emulatedoesn't need that, because it usesflattenedThreadIdInGroupdirectly. If a driver packs the threads of a group another way, both waves can get the same base and collide. XCL measured exactly that on an RTX 5070 Ti for an 8x8x4 group, and it would explain why Wave32 works on Turing and Ampere but not on @bittertea0323's 4070 SUPER.To test it, here's a branch on this PR's head
54b333f: NuraadGit:shaders/wave32-claim-lanes (27e9259, +70/-8).gpu_8x8x4_threads_each_console_lane_oncestores each thread's console lane (v_mbcntover all lanes) at its flattened id from v0..v2. It passes on my 2080 with or without the change.On a card that packs 3-D groups differently, the test's Wave32 case should fail with only the test file applied (without the
lower.rschange) and pass with the whole branch. If it does, a title run with the branch andVICTORY_WAVE64_EMULATE=wave32should get the world drawing in Wave32 there too. All 27wave64tests pass, and clippy is clean.On "10 draws/frame for the whole run": a run still in the menus looks like that too. On a fresh profile, Enter alone can stay on the legal screen (@Peppacodes reports this in #841). The log tells them apart: here the
first bindof17af15c4015cb4b6and of pixel4f4ec7b16673362fcomes at world entry.What the default costs here: before
7425674, 98 compute programs were refused for divergentv_readfirstlane, and ~1,450 draws and dispatches were dropped per frame. After it, 0 and ~850.Emulatestill refuses that case, and Sil3ntGam3r's new numbers go the same way (0 → 73, and 471 → 522 programs in total). I'd decide the default on the lane check above rather than on the draw count alone.AI-assisted (Claude Code): the runs and log analysis were automated. The hardware, title copy and runs are the user's.
@Yaekai on GitHub · 2026-11-24 16:27 UTC · original
Independent verification on Windows 11 + NVIDIA RTX 3070 (Ampere, Wave32, Rust 1.98.1) at head
54b333f:cargo test -p victory-shader --lib -- --skip valu_tests --skip waterfall_tests: 126 passed, 0 failed.cargo clippy -p victory-shader -- -D warnings: 0 warnings.1.0.2.1,--console series-s):WaveSize(64)host pipeline refused (0x80070057)errors dropped from dozens to 0, and the world stayed stable for 19+ minutes with no regressions. Huge win for Wave32 NVIDIA GPUs!@Ctrl-Alt-Haze on GitHub · 2026-11-24 16:51 UTC · original
Re-verified updated head
54b333fon Windows 11, RTX 5070 Ti (Blackwell Wave32, driver32.0.16.2135) + WARP (VICTORY_D3D12_DEBUG=1), dxil.dll1.8.2502.11, Rust1.98.1, againstupstream/main(ffe310eb):ffe310eb.cargo xtask policy:155 files ok; bothclippychecks (--all-targetsdefault and--all-features) pass.cargo test --workspace --locked: 366 passed, 0 failed, 6 ignored.victory-shader --features host(VICTORY_D3D12_DEBUG=1, RTX 5070 Ti &VICTORY_WARP=1): 144 passed, 0 failed, 1 ignored (0 D3D12 debug errors/warnings; allwave64_testshardware tests pass under defaultEmulate).victory-gpu --features diagnostics(VICTORY_D3D12_DEBUG=1, RTX 5070 Ti &VICTORY_D3D12_WARP=1): 53 passed, 0 failed, 1 ignored (0 D3D12 debug errors/warnings).54b333fstill show the 4 culling compute shaders blocked by divergent ballot / non-uniform LDS fence checks that#439/#233handle.AI-assisted verification on local RTX 5070 Ti + WARP; no game data.
@alessiodeia on GitHub · 2026-11-24 17:14 UTC · original
@alfycs, a regression to check at
54b333finEmulate, from a 30-minute title run on an RTX 2070 SUPER (Turing, 32..32). Full A/B against #439 is in #1132.eeed82b877b44b5fno longer translates:LDS exceeding 32 KiB with wave64 emulation is not supported. It is a 1024-thread compute program that already uses the whole 32 KiB: per-thread slots at LDS0x2008,0x5000,0x6000and0x7000for a tree reduction withs_barrier. On the base without this PR it translates, and with #984 andfix/unaligned-buffer-srvit runs cleanly. It is the pass from the cross-vendor world hang in #71/#778, so dropping it changes the world's compute results. Its wave-level lane ops arev_readfirstlaneands_*_b64exec masks around a per-lane loop. It might not need the emulation scratch at all if programs whose lane ops are only first-lane reads of uniform values bypassed it.v_readfirstlane in divergent control flow. All 57 are usable with #439 atbf0f951on the same base. I haven't runWave32mode.Base for both runs:
mainffe310e+ #493 #587 #282 #876 #67 #490 #464 #984 +fix/unaligned-buffer-srv+ #840/#916 fork branches. Diag build, Series X, DRED, no device removal in either run.AI-assisted (Claude Code). No game data attached.
@bvtterbroot on GitHub · 2026-11-24 17:54 UTC · original
AMD check at
54b333f(baseffe310e), on an RDNA3 and an RDNA2 GPU:run_caseswith a local adapter-selection patch that is not part of this PR. WARP runs in each pass as well.cargo test -p victory-shader -p victory-gpu --locked: 194 passed, 0 failed, 2 ignored, on both GPUs. That includes its 24 new tests (divergent_cross_half_ballot_is_rejected_instead_of_hanging,divergent_early_return_taints_subsequent_blocks,divergent_lds_without_a_uniform_fence_is_rejected,divergent_multiple_lds_reads_without_writes_succeed,divergent_readfirstlane_reads_its_halfs_first_lane_on_wave32,divergent_uniform_readfirstlane_succeeds_without_barrier, ...).Synthetic tests only, no game files. Tested with AI assistance (Claude Code).
@justlovett0 on GitHub · 2026-11-24 18:12 UTC · original
Verified on RTX 3080 10 GB / Windows 10 21H2 (19044.7846) / driver 621.24 (32.0.16.2124).
Stacked on main
ffe310e+ #175 (Agility) + #994 + #747 + #302/#193/#704/#309/#953/#1067 + #986/#1260/#1267 (copy-storm) + #1254 + #1276.Translation: with
VICTORY_WAVE64_EMULATE=emulate(also the mode auto-selected on this wave32 host), the wave64 compute refusals go 119 → 0 ("console wave64 lanes on a host without 64-lane waves"). Re-census of the captured runtime containers: 490/558 computes emit (88%), up from ~313/381 before emulation.Stability (the headline): the world ran ~9 minutes with 0 device removals, user-controlled, killed while still running. Without #189 the same stack TDRs at ~3.5 min (
DXGI_ERROR_DEVICE_HUNG, 28-list submission, no breadcrumbs). This supports the theory that the dropped wave64 computes leave culling/indirect data unproduced, so a later compute runs on garbage and loops until the GPU resets.Cost: emulation overhead — ~91 MB copies/frame, 1700–2500 ms/frame (vs ~1300–1800 ms without). G-buffer geometry renders (textureless flat debug colours via
VICTORY_SHOW_TARGET/VICTORY_DEBUG_PS); the final lit image is still black (the XboxBvhBuilder "address in an SGPR that is no root parameter" computes are still refused).Contrast with #233: the lane-split hung early on this hardware (pre-cutscene TDR ~96 s + an nvgpucomp64 AV); emulation is stable. Emulation looks like the safer wave64 path on NVIDIA.
AI use: Qwen Code. All measurements from local runs; visual confirmations by the user. No game data posted.
DXGI_ERROR_DEVICE_HUNG/0x887A0004/0x887A0006#1440@dragoso on GitHub · 2026-11-24 18:23 UTC · original
In-game A/B on an RTX 5060 Ti (32-lane, 16 GB): #189 takes the refused compute pipelines from 117 to 0, but 36 compute shaders that
maintranslates are now refused. No game data in this comment: counts, shader hashes and offsets only.Setup
--features diagnostics:mainatffe310e, and this PR's head54b333f(based directly onffe310e)VICTORY_CACHE_DIRfor each build,VICTORY_KEYS=60:Enter,90:Enterto pass the account picker, 7-minute capResults
mainffe310e54b333f0x80070057)0x887A0006)Restricted to the 1,976 shaders seen in both runs:
142 unusable on
mainbecome usable with #189: 31 of the 117 refused pipelines' shaders, plus 111 thatmaindid not translate.The other 84 refused shaders are now refused at translation instead of at PSO creation:
36 regress (usable on
main, unusable with #189):v_readfirstlane in divergent control flow is not supported, fromemulated_readfirstlane(lower.rs:1482), which refuses whenever the block is divergent and the mode is notWave32a lane mask from a carry is not supportedThey are all compute shaders. On
main, they built a PSO withoutWaveSize(64). So they ran on the host's 32-lane wave, possibly with the wrong first lane for lanes 32-63, but they ran.The 36 regressing shaders (hash, offset)
World
Neither build survives the world. Both reach it and are removed with
0x887A0006(no breadcrumbs). #189 lasts 1:13 in the world, against 1:37 onmain, and enters it later. The later entry is likely because it translates more programs on a cold cache. One run each, so I would not read anything into the timing.Suggestion
In
Emulatemode,emulated_readfirstlanerefuses every divergent block. When the source is uniform, the value is its own answer and no cross-lane read is needed, so that case could pass through. That may cover some of these 35 shaders; I have not checked which. If not, keepingmain's lowering for them would at least avoid the regression.AI-assisted (Claude Code); everything was run on our machine.
DXGI_ERROR_DEVICE_HUNG/0x887A0004/0x887A0006#1440@cyudev on GitHub · 2026-11-24 18:45 UTC · original
First test on NVIDIA (RTX 3060 Ti): reaches the world, PR #189 works on 32-lane waves
Machine: Windows 11 (build 26200), NVIDIA GeForce RTX 3060 Ti (driver 621.24), Intel i5-12600KF, 16 GB RAM.
Tested:
mainatffe310e, then PR #189 (54b333f) with the NVIDIA patch below on top. Release builds,VICTORY_LOG=info.Summary
maincrashes.logNo TDR on entering the world on this GPU, unlike the README's warning for real GPUs.
1. PR #189 on a 32-lane host
On
main, 112 compute pipelines are refused (host pipeline refused error=E_INVALIDARG). They carry WaveSize(64), which NVIDIA does not support. With PR #189 none are refused. The shader GPU tests (cargo test -p victory-shader, includingwave64_tests) pass on this GPU: 144 passed, 0 failed.What still does not translate in the first world scene (571 shaders: 500 compute, 36 pixel, 31 mesh, 4 vertex), by converter error:
The two Wave64-emulation rows (65 shaders) are specific to 32-lane hosts.
2. NVIDIA-specific host refusals (patch: #1523)
title slot past the host heapnever fired, up to and including the first world scene.no host texture): B5G5R5A1 (86) with RT|UAV and B4G4R4A4 (115) with RT.CheckFeatureSupporton this GPU reports:3. World loading from a hard disk looks like a hang
With the game on a 7200 rpm HDD, the world loading screen sat for more than 5 minutes after
story000/data/ttdb/vfx/ttdb_vfx.ttpfwith no newfile openedlines. That looked like a hang.A stack dump showed all 16 DirectStorage workers inside
seek_read. The disk did ~1 MB/s, at 140 reads/s and 500% busy, while sequential reads of the same disk run at ~110 MB/s. Moving the game to a SATA SSD brought the load to ~30 s.It might help to mention SSD in the README requirements. Fewer workers on rotational media would also help, as would logging read progress during long loads (only opens are logged today).
@0xcheems on GitHub · 2026-11-24 19:05 UTC · original
AMD RDNA 3.5 under Proton: with this PR the world freezes in the auto-selected
Nativemode;wave32andemulaterun through. In-title, bisected.AI use: runs driven and logs summarised with Claude Code (Claude Fable 5.2, then Claude Opus 5.5) on my machine. Own copy of 1.0.2.1. No game data here: counts and hashes only.
Setup: Ryzen AI MAX+ 395, Radeon 8060S (Strix Halo, RDNA 3.5, unified memory, 32 GB); NixOS, kernel 7.1.5, Mesa 26.1.5 RADV; Proton Experimental
experimental-11.0-20261112, vkd3d-proton 3.2.0. Diag builds cross-built with cargo-xwin, Series X,VICTORY_NO_WATCHDOG=1,VICTORY_KEYSinto the world, 8 to 10 minute runs. The tree is LooperSalty/victoryanyxboxx/stable(9a9eab0), which carries this PR as merged at about 09:43 UTC today. This GPU reports 32..64 lanes, so the PR logswave64_mode=Native.Bisect (first-parent merges of that branch, one PR each):
stable,essai"Stop" is either a freeze (log ends, one title thread spins at 100 % of a core, every other thread sleeps, memory steady with 4 to 6 GB free, no kernel GPU line) or, twice, the title's null write at
+0x2215c35once its own hang check fires (builds without #454).Mode switch, full
stablebuild, one 10-minute run each:VICTORY_WAVE64_EMULATENative)emulatering gfx_0.0.0 timeout, device removedwave32wave32refuses 143 of them, mostlyv_readfirstlane in divergent control flow(102 warning lines) anda cross-lane wave operation in divergent control flow(53).VICTORY_SKIP_WAVE64=compute,mesh,vertex,pixelwithNative(121 distinct Wave64 shaders skipped) still froze, at frame 2 078. So inNativemode the hang does not seem to come from the Wave64 programs themselves, but from something else this PR changes on that path. I could not isolate further: reverting onlyresource.rsdoes not build against the newlower.rs.So on this AMD/Linux host,
Nativeis the one mode that hangs, while the tree without this PR (also native Wave64 on this GPU) does not. I can run a specific branch, switch or skip list if that helps narrow it.@dragoso on GitHub · 2026-11-24 19:19 UTC · original
Correction to my comment above: on an RTX 5060 Ti, #189 nets −43 host pipelines (+94, −137), not +142. Counts only; no shader names or dumps.
My in-game comparison counted a shader as fixed when it simply didn't fail in the #189 run. That includes shaders whose pipeline was never requested before the device was removed. With positive evidence on both sides (a host pipeline actually created), the in-game numbers are:
mainand fails with #189.The deterministic version:
victory translate --validate --pipelines --listovershaders.rpf(retail 1.0.2.1, 26,084 programs). A program counts only when its D3D12 pipeline is created on this GPU (32-lane, driver 32.0.16.1742).mainffe310e54b333fmainat PSO creation with0x80070057.mainbuilds:So the divergent
v_readfirstlanerefusal inemulated_readfirstlanecosts more than the PR gains on this host: 132 lost plus 40 blocked. Fixing it would turn the net positive.AI-assisted (Claude Code); everything was run on our machine.
@EduBertozzi on GitHub · 2026-11-24 19:51 UTC · original
Hardware data point for the case this PR targets, a 32-lane host: GTX 1060 6 GB (Pascal,
WaveLaneCountMin/Max32/32), Windows 10 22H2 19045, driver 32.0.15.8266, Agility 1.620.2 via #486. I merged54b333fontomainffe310eand rancargo test -p victory-shader --lib: 144 passed, 0 failed (mainalone: 120), so all 24 tests this PR adds pass on hardware that has no native 64-lane waves.For comparison, #587 and #578 on the same machine: 120 / 0 each, the same as
main. Neither addsvictory-shadertests of its own.AI-assisted (Claude Code).
@wildheathen on GitHub · 2026-11-24 18:46 UTC · original · edited 2026-11-24 20:56 UTC
Whole-dump offline count on an RTX 5080 (32..32): at
54b333f,Wave32keeps every compute programEmulatekeeps, plus 158 more. This extends @dragoso's in-game A/B above: that covered the shaders one 7-minute run met, this covers every compute program in the dump.Setup
victory translate --validate --pipelines --listover the retail dump's shaders (2,682 compute programs), on mainffe310eand on this PR's head54b333f. Release builds, each in its own target dir.translateusesHost::recommended_wave64_mode(), which picksEmulateon this GPU. To get theWave32row I patchedtranslate.rslocally to take the mode from an environment variable. That patch isn't part of the PR, and the lowering is unchanged.Compute programs that end up with a host pipeline
ffe310e0x80070057)Emulate(default here)Wave32Emulate⊂Wave32: no program gets a pipeline inEmulateand not inWave32. 158 do the reverse.Emulateloses against main:v_readfirstlane in divergent control flow, fromemulated_readfirstlane(lower.rs:1482). This is the same family as dragoso's 35. InEmulate,need_emuturns on when the only reason is a non-uniformv_readfirstlane(has_non_uniform_firstlane), even whenconsole_lanesis false and there are no sections. The same function then refuses thatv_readfirstlanewhen it sits in a divergent block. Main gave all 132 a pipeline withoutWaveSize(64).a lane mask from a carry.LDS exceeding 32 KiB with wave64 emulation.Emulateand inWave32alike.Wave32also refuses with the "wave64 emulation" message, because it adds ballot dwords on top of an LDS that is already full.What this suggests
On 32-lane hosts, default to(Edited: a world run says no, see the update below.) At this headWave32instead ofEmulate.Wave32is strictly better on this dump: +115 programs against main and −2, whereEmulateis −43 net. IfEmulateis kept for correctness reasons I'm not seeing, then for programs whose only trigger ishas_non_uniform_firstlane(noconsole_lanes, no sections), falling back to main's lowering would avoid the 132 (see the follow-up below: this exact version breaks a correctness test, and main's lowering ofd3e44e754b3eb6aahangs on a 4090).Caveats
Wave32lowering's own tests (wave64_tests) pass on this machine. Clippy is clean;cargo test -p victory-shader -p victory-gpu: 194 passed, 0 failed.VICTORY_WAVE64_EMULATE=wave32, so a world A/B ofEmulateagainstWave32is the next thing I can run on the 5080 if it helps.No game data, shader bytes or shader names here; counts come from a local dump.
Update:
Wave32in the world hangs on one of the programs it recoversEdited after posting. @dragoso has since got the same offline numbers on a 5060 Ti (+94 / −137). In-game runs on the same RTX 5080, unattended (diag build,
VICTORY_D3D12_DRED=1, fresh copy of one save,VICTORY_KEYS, 480 s cap). #189 is merged onto #578fb7facdso the wave64 mesh hang (#778) doesn't end the run first:Emulate(auto)v_readfirstlane)VICTORY_WAVE64_EMULATE=wave32v_readfirstlane)DRED for the
Wave32run stops at a computeDispatch, command 97 of 293,dispatch 44x1x1 [compute d3e44e754b3eb6aa], in a run of dispatches of that one program.d3e44e754b3eb6aais in @dragoso's list of 36:Emulaterefuses it for the divergentv_readfirstlane, andWave32translates it. Its pipeline is created, and then it hangs the GPU.So the offline "
Wave32⊇Emulate" above only counts pipelines that get created. At least one of the programsWave32adds doesn't terminate on this GPU. One run, so I'm not claiming more than that. The divergent-v_readfirstlanerefusal looks like it's protecting against a real hang, at least ford3e44e754b3eb6aa. Fixing it properly, as dragoso suggests, beats switching modes.Follow-up run: the same
Wave32tree withVICTORY_SHADER_LOOP_LIMIT=4096ran 396 s in the world with no removal and no slow submission at all.d3e44e754b3eb6aawas bound and ran under the cap. So theWave32hang is a translated loop that doesn't end. Structure only, fromshader-info --disasm: the program is 64 threads per group with no LDS and no barrier. It has twov_readfirstlane_b32, one at0x104underv_cmpx_lt_u32 exec, v0, v1, and two loops whose exits test 64-bitexecmasks (back edges at0x47cand0xe94). InWave32, the divergent one takes the shortcut inemulated_readfirstlanewhere each 32-lane half reads its own first active lane. The code's own comment says that's exact only for uniform values or inside a waterfall loop. My guess is that this program is neither case, but I haven't traced which loop runs away.Main's lowering of the same program: card-dependent. On this 5080, in the plain-main runs (no #578),
d3e44e754b3eb6aagets a host pipeline and runs ~90 s, until the unrelated mesh hang ends the run. It never shows up in a slow submission, in two runs. But @Yorivel's 4090 run (in the comment after this one) shows main's lowering of it not terminating (device removed 18 s after its pipeline, even with a 1024 loop cap). So main's per-host-wave first lane isn't safe for this program either. It only happened not to hang here.Two local prototypes (not pushed), measured the same way:
has_non_uniform_firstlane(if console_lanes || !sections.is_empty()in theEmulatebranch). Offline it's +98 / −0 against main. But it failsgpu_64_threads_empty_exec_readfirstlane_returns_lane0: the upper half gets 39 where the console gives 7, because main's lowering reads the host wave's first lane, not the 64-lane wave's. So that one is wrong, and it's main's bug too.emulated_readfirstlaneinEmulate, use the host wave's first active lane (waveReadLaneFirst) for a divergent non-uniformv_readfirstlaneinstead of refusing. That's 8 lines:EmulateWave32Emulate+ prototype 2cargo test -p victory-shader -p victory-gpu: 196 passed. The one failure isdivergent_readfirstlane_reads_its_halfs_first_lane_on_wave32, which asserts thatEmulaterefuses this case, so it fails by design. The empty-EXEC GPU test passes.readfirstlanerefusals (91 before), 4.7 fps.d3e44e754b3eb6aagets a pipeline and runs for 23 s, with no slow submission. Then the run ends on the known wave64 mesh hang (DispatchMesh, mesh51ff151f75cd5759), not ond3e44e754b3eb6aa. InWave32it hung on that program 43 s after its pipeline, so 23 s is suggestive and not proof.d3e44e754b3eb6aahangs on a 4090. So prototype 2 recovers 110 programs, but at least one of them can hang depending on the card. Refusing it, asEmulatedoes today, is the safer default. I'm posting the numbers so the trade-off is visible, not as a recommendation. Exact 64-lane semantics would need the LDS exchange, which can't run in divergent flow.AI-assisted (Claude Code).
@Bullet18x on GitHub · 2026-11-24 20:06 UTC · original
RTX 5090 (32-lane waves), driver 621.40, Windows 11 Pro 10.0.28000, head
54b333fonffe310e.Tests:
cargo test -p victory-shader --locked: 143 passed, 1 failed, 1 ignored:emit::wave64_tests::gpu::gpu_128_threads_ds_swizzle_and_dpp_row_mask(wave64_tests.rs:831):ds_swizzle_dpp_rowmask (Wave32, warp=true) output mismatch. The first 20 outputs match; from index 20 on, values differ (e.g. got 2818070 / 2424855 where 2555926 / 2686999 was expected).warp=true), so it may depend on this Windows Insider build's WARP (10.0.28000); the GTX 1060 / Windows 10 19045 run above passes all 144.In the title (diag build, warm cache, default adapter): with Emulate as the default on this 32-lane GPU,
host pipeline refused ... 0x80070057drops from 114–138 per run onmainto 0.shader does not translaterises from 424 to 535 (476 compute; most common errors: a select on an untracked lane mask, a lane mask holding lanes …,v_readfirstlanein divergent code, a descriptor read only …). The world is still reached and the run still ends inDXGI_ERROR_DEVICE_HUNG, here after ~15 s in the world instead of 35–100 s onmain; one run, so not conclusive. Other experiments on this machine: #1586.AI use: Claude Code (Claude Opus 5.5) built, ran and summarised; I checked it.
@omeyasawant on GitHub · 2026-11-24 20:39 UTC · original
Independent Windows test run of PR head
54b333fc5c2793bd5b7cd539f11fa4e326c5fb0d, on mainffe310e.Hardware installed: Intel i7-14700K, 192 GiB RAM, RTX 5090 (driver 32.0.16.1088), Intel UHD 770 (32.0.101.7088). Windows 11 Pro 10.0.26200, Rust 1.98.1 MSVC, DXC x64 validator 1.9.2609.5 via
VICTORY_DXIL.cargo test -p victory-shader --locked -- wave64 --test-threads=1: 26 passed, 0 failed, 0 ignored.cargo test --workspace --locked -- --test-threads=1: 366 passed, 0 failed, 6 ignored.cargo build --profile diag -p victory --features diagnostics --locked: passed.The test host chooses its default D3D12 adapter and WARP. I did not independently record the hardware adapter chosen by those synthetic tests, so the hardware inventory above must not be read as proof that every GPU test executed on the RTX 5090. Optional tests can return early without their sample/compiler inputs.
A local diagnostic title run selected
wave64_mode=Emulate; this is not a verified gameplay result. Further runtime experiments add #967 for explicit RTX 5090 selection and the texture-resource commit from #1630. Those integrations are not an isolated end-to-end evaluation of this PR, and I am not attributing their rendering results to wave64 emulation alone.No game data, captures or shader dumps attached.
AI assistance: OpenAI Codex ran tests and drafted this report at the account owner's request. Exact runtime model identifier unavailable.
@Yorivel on GitHub · 2026-11-24 20:49 UTC · original
RTX 4090 (32-lane waves, driver 32.0.16.2124), Windows 11 26300, title 1.0.2.1, diag build,
VICTORY_D3D12_DRED=1,VICTORY_SHADER_LOOP_LIMIT=1024. Tree:mainffe310e+ #493 (c48b240) + #32, without #578, so main's lowering ofd3e44e754b3eb6aaruns.On the open point above: main's lowering of
d3e44e754b3eb6aadoes not terminate in the world on this card. The world reached about 2,100 draws/frame at 1.1–1.6 fps. The program's pipeline finished building 46 s in, and 18 s later the device was removed (0x887A0006) after a single 5,023 ms submission. DRED: one list, stopped atcommand 395 of 702. The only dispatch between its barriers (commands 295..407) wascommand 296: dispatch 136x1x1 [compute d3e44e754b3eb6aa]. No page fault reported.One run. It fits the #71 row where this program hangs with mesh skipped.
AI-assisted test report.
@steven-seagull27 on GitHub · 2026-11-24 21:27 UTC · original
@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
20 + 19 = 39and21 + 20 = 41. This identifies which output differed in the combined shader. Running the operations separately on build 28000 would tell us whether the shift also fails on its own.I ran the original 128-lane test and two new single-operation tests at PR head
54b333fon Windows 11 build26300.10075. All 128 lanes matched in each test, in every mode listed. Each WARP version ran in five fresh processes, with the RTX 5080 tested alongside it.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
54b333f. There’s also a downloadable patch.From your checkout of this PR at
54b333f, using the same WARP setup as in your report:That command runs exactly the three tests. If the mismatch reproduces, could you share which test names fail for
(Wave32, warp=true)and the actual and expected values at the first differing lane?@meqsedus on GitHub · 2026-11-24 22:09 UTC · original
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
VICTORY_CACHE_DIR.VICTORY_D3D12_DRED=1 VICTORY_GPU_TIMING=1VICTORY_SHADER_LOOP_LIMIT=4096DRED (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
[mesh c962201cddbdd7dd, pixel 57a27c5e2e1d62a9], plus some[mesh 857b2e13c9cc107f, pixel 63051e97862e7dad]. Earlier crashes had other mesh pipelines in the failing submission, so I don't think it is one specific shader.Takeaways:
I haven't found which shader yet. Happy to bisect with
VICTORY_SKIP_PIPELINESor run other builds if useful.@MrEjecutor on GitHub · 2026-11-24 22:21 UTC · original
RTX 5060 Ti (32-lane waves), offline over the retail shaders: the default
Emulatemode leaves 43 fewer working compute pipelines thanmain;Wave32gives 115 more; every programEmulatehandles,Wave32handles tooTested
54b333f(this PR alone onmainffe310e), withvictory translate <game dir> --validate --pipelines --liston an RTX 5060 Ti (driver 621.24, Windows 11 26200, Rust 1.100). "Working" below means the compute program translated, validated, and its host pipeline was created on this card.mainmainffe310eEmulate)Wave32modeWhat
Emulateloses (working onmain, refused here): 132 withv_readfirstlane in divergent control flow(emulated_readfirstlanerefuses it unless the mode isWave32), 3 witha lane mask from a carry, 2 withLDS exceeding 32 KiB with wave64 emulation. The families includesr_denoising(10),indirect_diffuse_lighting(7),WaterSimMgr(7),smh_accessory(6),ambient_map(5),water_shading(5).Per program, the set that works with
Emulateis a subset of the one that works withWave32(0 programs work only withEmulate; 158 only withWave32). So a per-program fallback,Emulatefirst andWave32only for a program the emulation refuses, would keepEmulatewherever it applies and reach the same 1,236.The same numbers come out of #1589 at
d83d4f8against the stack under it (ca601f0): 1,652 → 1,609 working compute pipelines (+97, −140, 135 of themv_readfirstlane in divergent control flow). So it is this PR's default, not the bundle's merge.Caveat: this counts what translates and builds, not what runs correctly. The comment in
host.rssaysWave32has divergent and cross-half miscompilations, and I have not checked any of these programs' output. To countWave32offline I changed one line locally inapps/victory/src/translate.rsso it honoursVICTORY_WAVE64_EMULATE=wave32(the runtime already does, throughshader_cache.rs); that change is not proposed here.Not tested: the title with either mode; AMD (native wave64, unaffected); #1589's newer head
60fa5d7.AI use: Claude Code (Claude Opus 5.5) built, measured and wrote this; checked by mrejecutor.
@Marvisak on GitHub · 2026-11-25 00:20 UTC · original · edited 2026-11-26 01:19 UTC
Automated triage for the maintainers.
Needs work. Rebased; it merges cleanly and CI passes (
check). Thanks also to moe-miau for the in-game port. Two earlier asks are still open:crates/victory-shader/src/emit/lower.rsand the newemit/lower/wave64.rsstart with a UTF-8 BOM. Many existing comments inlower.rsare rewritten as mojibake (×becomes×,→becomes→,2πbecomes2Ï€, e.g. "Block × 4096", "32 × 32-bit product"). Please drop the BOMs and keepmain's comment text unchanged.v_readfirstlane_b32inEmulate.wave64.rs::emulated_readfirstlanenow returnshost_wave_readfirstlanethere, the first active lane of the host wave (as small as 4 lanes on WARP), instead of refusing. That is right only when the value is uniform across the active lanes. Please either show it holds for the title's shaders (e.g. the refusal/translation counts plus a check of the affected programs), or keep refusing the divergent case inEmulate.With those two fixed, the rest (the
Wave64Modeselection inshader_cache.rs/host.rs, the split-wave lowering, the tests) can be reviewed on its merits.Generated by Claude Code
@moe-miau on GitHub · 2026-11-25 00:30 UTC · original
#189 carried onto
main70564ae, with in-game results on an RTX 4070 SUPER@alfycs, since
mainmoved by 28 commits last night, this PR conflicts ingpu/host.rs,gpu/shader_cache.rs,emit/mod.rs,emit/valu_tests.rsandemit/lower.rs(9 hunks). I carried it onto70564ae. Use it or ignore it as you like:moe-miau/VIctory@port/wave64-on-70564ae, one commit9958eb9with you as the author. Its message lists each resolution.How the conflicts were resolved
mod.rs:optionsgoes into main's newpartsclosure, so both of its lowering attempts (with and without killed helper lanes) get it.shader_cache.rs: main's redesigned cache (refusals stored, from-disk flag) with your mode byte in the key andVICTORY_WAVE64_EMULATE.host.rs: main's multiply-add fusing check and your mode selection both run.lower.rs:find_sectionsgives way to yourcompute_sections(main had not changed its body).mask_dwordkeeps your emulated path, and the native path takes main's newmask_numberfor a mask holding lanes elsewhere. The high dword is zeroed forWave32with 32 threads or fewer, as you do for ballots.helpers_readquad path.ds_bpermute_b32stays ahead of your check on the title's own LDS size.Op::AddHadded toapply_wave_op.Shape::Halfrefused in a split 64-lane wave, since its host wave operation would only cover one half.One harness change was needed. After the merge, all 11
wave64_tests::gputests removed the device on NVIDIA. The DXIL of your emulation was identical before and after (checked withdxc -dumpbin). The only difference was main's new view-stride table: every heap buffer read now goes through root SRVt255, andrun_on_hostspassed no roots, so the shader read an unbound root view. The port binds a stride table for the raw UAV in heap slot 0. With that, all 26 wave64 tests pass on the RTX 4070 SUPER, the 11 GPU ones included. On your original head onffe310ethey also pass here.I added one test,
gpu_8x8x4_threads_console_lanes_follow_the_flat_thread_index. XCL's notes on the same technique (docs/wave64-on-wave32.md) report that an RTX 5070 Ti does not form its 32-lane waves from consecutive flat thread indices for an 8×8×4 group, which would break the(waveReadLaneFirst(flat) & !31) + laneIndexmapping. The test checksv_mbcntagainstflat % 64for an 8×8×4 group. It passes in both modes on the RTX 4070 SUPER, so it is a guard for other GPUs, not a reproduction.CI-equivalent checks on the branch: both clippy configurations are clean, and
cargo xtask policypasses. Incargo test --workspace, 5 tests fail, the same 5 that fail on plain70564aeon this card: the two NVIDIA heap-cap tests (#1770 covers them) and three host-GPU shader tests.In-game. Setup:
70564ae+ this port + #968 (needed on NVIDIA to get past the #1753 removal at 32 s).VICTORY_KEYSpressing Enter into the intro cutscene (from about 90 s).70564ae+ #968 (no port)Emulate(default on this GPU)0x887A0006at 224 sVICTORY_WAVE64_EMULATE=wave320x887A0006at 271 swave320x887A0006at 203 sThe 3D picture stays black in all of them. Two points:
Wave32beatsEmulateon coverage here too: 43 split-wave refusals against 77. That agrees with the offline counts above. On this evidence I'd makeWave32the default on 32-lane hosts.VICTORY_D3D12_DRED=1 VICTORY_GPU_TIMING=1, the slowest single command isdispatch 16x16x16 [compute 00167d58cc5a78d7]at about 7 s. That is the same with the port (6.9 s) and without it (7.2 s), and that baseline also timed out under the timing overhead.dispatch 128x64x1 [compute 42683eebec081520](1.5 s) and indirect mesh draws (about 1.2 s each).VICTORY_SHADER_LOOP_LIMIT=1024makes cutscene frames about ten times faster (about 1.1 fps against 0.1 fps).VICTORY_SKIP_PIPELINESon the shader DRED named (f607780aa8e502d0, indirect) does not prevent the removal.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.
@MrEjecutor on GitHub · 2026-11-25 01:27 UTC · original
The port onto
70564aeon Blackwell (RTX 5060 Ti): all 27 wave64 tests pass, the 8x8x4 lane-order one included; in the title it trades 394 host refusals for 458 more programs that do not translate, and the world hang is unchangedTested @moe-miau's port (
port/wave64-on-70564ae,9958eb9) merged onto70564ae+ #1775 + #1800 (those two only get this card past the boot, see #1800), against the same stack without the port.Setup: RTX 5060 Ti 16 GB (Blackwell, 32-lane waves), driver 621.24; Intel Core Ultra 5 225F; 32 GB; Windows 11 26200; Rust 1.100; Series X profile.
Unit tests (
cargo test -p victory-shader --lib -- wave64, hardware adapter then WARP): 27 passed, 0 failed, the 12wave64_tests::gpuones included.gpu_8x8x4_threads_console_lanes_follow_the_flat_thread_indexpasses here, so on this Blackwell card and driver the lanes of an 8x8x4 group do follow the flat thread index.Warm-up (
translate --cache --pipelines, pipelines of the shader pack skipped, by reason):In the title (diag build,
VICTORY_D3D12_DRED=1, same scripted input, one run each, each after its own warm-up):0x887A0006)0x887A0006)Of the 173, the emulation's own refusals are 150:
v_readfirstlane in divergent control flow66,LDS accesses without a uniform LDS fence in split wave6443,a 64-lane wave ballot in divergent control flow35,a wave reduction in divergent control flow6. That is the same pattern as my offline count on the old base above.The hang does not move: both runs have the same kind of series of submissions of about 5.65 s (5,647 to 5,655 ms with the port, 5,655 to 5,720 ms and one of 5,333 ms without; that steadiness looks like a loop running to its limit rather than GPU load), and both end in
DEVICE_HUNGwith twonvlddmkmresets. So on this card the 64-lane programs the host refuses are not what hangs the world; that matches the loop-limit runs reported above on the RTX 3050 Ti.Not tested:
VICTORY_WAVE64_EMULATE=wave32; a lowerVICTORY_SHADER_LOOP_LIMITwith the port; currentmain(this is70564ae); more than one run each.AI use: Claude Code built, ran and wrote this; checked by mrejecutor. No game data attached.
@fuzeofficlal on GitHub · 2026-11-25 04:08 UTC · original
Audited and hardware-tested
#189(54b333f) across NVIDIA GeForce RTX 5090, AMD Radeon(TM) Graphics (RDNA2), and D3D12 WARP (dxil.dllvalidated), and pushed a four-commit follow-up series onfuzeofficlal:fix/m2-189-whole-wave-sections(bd77535..1263964) covering three real edge cases hit in 64-lane compute reductions:bd77535): Instructions already lowered insidewave::sectionsdo not need per-VGPR Wave32 cross-half LDS scratch slots; excludingin_sectionsinstructions prevents falselds_overflowrejections when the title's compute group already uses most of the 32 KiB LDS budget.8b9d76f): Guardv_readfirstlane_b32writeback inside whole-wave sections so half-1 simulation does not overwrite the scalar result elected from the first active lane across all 64 lanes, and tighten section boundary eligibility.WaveSize(64)inNativemode for non-uniformv_readfirstlane_b32inStageIo::Cs(e6d9e8f): Non-waterfall, non-uniformv_readfirstlane_b32in compute programs setsconsole_lanes = truesoNativemode emits[WaveSize(64)]instead of silently running at host Wave32 width, while leavingStageIo::Ms,StageIo::Vs, andStageIo::Pshost-wave semantics untouched.saveexecregression coverage (1263964): 34/34wave64_testspass on RTX 5090, AMD Radeon Graphics, and WARP (including[4, 1, 1]multi-workgroup 64-lane float reductions, non-power-of-two tail waves, 3-level nesteds_cbranch_execz + s_andn2_saveexec_b64 + v_readfirstlane_b32, and VS/PS/MS stage checks).@bittertea0323 on GitHub · 2026-11-25 04:40 UTC · original
Thanks for taking it as the default — that is the right trade, and the
!need_emucarve-out (native, zero scratchLDS) is better than what I would have written.
One thing to put in front of the next tester, because it will otherwise be read as a new regression:
Emulateiscorrect but slow, and its cost is now the default path. Numbers from our host (RTX 4070 SUPER 12 GB, 32-lane,
Windows 10, Series X,
VICTORY_TEXTURE_MIP_DROP=1, #729 + #737 + #940 + #352 + four local fixes):Wave32EmulateSo a correct-default run looks like a title that boots, holds 30 fps through the menus, then drops to ~1 fps the
moment the world pass starts, with a few hundred pipelines building. If the troubleshooting notes say "about 1 fps
in the world is expected on a 32-lane host until the pipeline library is warm", it saves someone a bisect.
Two related numbers that belong with it:
#352matters more onceEmulateis the default: with the library warm the per-run rebuild count went512 → 1 and the slowest world submission 13318 ms → 1031 ms. Without it,
Emulatespends its firstminutes compiling and the run can die before the world appears at all.
TdrLevel=0(no recovery) rather than aruntime fault — #1054. Anyone reporting a freeze with no DRED and no event should check that registry value
before anything else; with
TdrLevel=3the same workload ran 300 s and reported normally.Not measured:
Emulateon a native 64-lane host, and whether the!need_emucarve-out recovers a meaningful shareof the frame time in a real title (our runs had all classes active).
@walterwallaceson on GitHub · 2026-11-25 05:34 UTC · original
In-game on an RTX 3070 (Ampere, Windows 10):
wave32mode beats bothmainand the auto-pickedEmulate.Emulaterefuses 75 programs that run without this PR.Setup: RTX 3070 8 GB (32-lane waves, view heap capped at 1,000,000), driver 621.14, Windows 10 22H2 (19045).
main940d32f+ #463 (f47a36e, Agility SDK runtime, needed on Windows 10) + #1775 (b079909) + #1751 (4521591) + #1906 (c84cbaa) + #385 (42fd559) + #688 (39e68e2), then this PR's head9580571merged on top. Diag build,VICTORY_SHADER_LOOP_LIMIT=4096, #1968's programs W and C skipped. Three 15-minute runs, one each, on the same stack apart from this PR. Both runs with the PR logwave64_mode=Emulateat startup; the third setsVICTORY_WAVE64_EMULATE=wave32.Emulate(auto)wave32Emulate(what the PR picks on this card): no pipeline is rejected by D3D12 any more, but of the 167 that were, only 44 run; the other 123 are refused by the emulation. It also refuses 75 programs that translate and run without this PR, 72 of them withv_readfirstlane in divergent control flow. So more programs are dropped than onmain.wave32: 59 of the 167 run, 74 of those 75 run again, and nothing that runs without the PR is refused. The remaining refusals are mostlya cross-lane wave operation in divergent control flow(59) andLDS accesses without a uniform LDS fence in split wave64(50).Cost: the newly running programs are slow. 107 of the 111 slow submissions in the
wave32run contain one of them (213 of 217 withEmulate). Most are early; in the last 5 minutes the slowest was 399 ms.So on this card, defaulting 32-lane hosts to
wave32instead ofEmulatewould keep everythingmainruns and run more of what it rejects.This differs from bittertea0323's RTX 4070 SUPER, where
Wave32never submitted the world pass. Here the world pass runs in all three runs: about 3,000 draws per frame at the end of each, up to 8,763 per frame withwave32(8,449 withEmulate). Our stacks differ (we don't have #352, #729, #737 or #940; we do have #1906, #385 and #688), so the difference may come from those rather than the card. The ~1 fps world they describe matches what we see in all three modes.Merging onto current
mainconflicts in 12 files, all one clash:main(cd94d35) addedemit::Options { view_marks }in the same places this PR addsTranslateOptions { wave64 }. I made oneOptionswith both fields (TranslateOptionsas an alias), kept bothview_marksandoptionsinParts, and gave the test initializers both fields. With that,cargo test --workspacefails the same 77 tests as without this PR (the known "no SM 6.6 device" skips and one texture test that also fails onmain), and all 28wave64tests pass, the GPU ones on the RTX 3070 included.Not tested: fuzeofficlal's follow-up series; more than one run per mode; whether the scene looks different.
No game data attached. I'm testing with Claude's help, and Claude drafted this comment.
@alfycs on GitHub · 2026-11-25 10:22 UTC · original
Rebased onto
main(940d32f) and integrated @fuzeofficlal's four follow-up commits (bd77535..1263964) into39976ef:TranslateOptionsintoemit::Options(view_marks+wave64, keepingpub type TranslateOptions = Options) to resolve the conflict withcd94d35.v_readfirstlane_b32(preserving#1733'shelper_reads_own),NativeWaveSize(64)enforcement for non-uniform computev_readfirstlane_b32, and the expanded regression suite (preservingVIEW_STRIDESroot-view binding in GPU tests).Local checks on
39976ef:cargo xtask policy:asset policy: 183 files okcargo clippy --workspace --all-targets --locked -- -D warnings -A deprecated: cleancargo test -p victory-shader --locked -- wave64 --test-threads=1:37 passed; 0 failed@steven-seagull27 on GitHub · 2026-11-25 10:42 UTC · original
@alfycs, I reran the shuffle and masked-shift check on your rebased head
39976ef0. The unmodified 128-thread combined test passed. I then ran it alongside the two split fixtures and logged all 128 output words from each dispatch.Lane 20 returned shuffle 22 and masked sum 39, packed as 2,555,926. Lane 21 returned 23 and 41, packed as 2,686,999. Both RTX adapter entries enumerated by DXGI gave these results. The WARP processes verified the loaded DLL path. Built-in WARP skipped Wave32, and this fixture only requests Emulate and supported Wave32 modes.
That confirms the two operations and their combination on this Windows build after the rebase. The original reporter's build 28000 remains the open hardware/OS configuration for reproducing the differing sums.
@moe-miau on GitHub · 2026-11-25 10:54 UTC · original
39976efin-game on an RTX 4070 SUPER (Wave32 mode): the world's BVH builder programs, and two that hang once they translateSetup: RTX 4070 SUPER, driver 32.0.16.1742, Windows 11 26300. Title 1.0.2.1, Series X profile, diag build,
VICTORY_WAVE64_EMULATE=wave32. The PR's head39976efis merged ontomain940d32f+ #1775 + #1762 + #1906 + #2098. Scripted input reaches the intro cutscene at about 90 s.This head, as is: 6 minutes with no device removal. 0 pipelines refused, 126 shaders not translated.
The BVH builder. The world's ray traced pass (
f607780aa8e502d0, #1968) walks a BVH built by the programs inXboxBvhBuilder.dll. Five of them are 64-lane programs that this card refuses onmain:14394a322f6dd5c2,28918b7150a7aad5,caa78b8ca62bc3d6,e63d22c4def9ba6a,f6eb6498409ca974.14394a32,e63d22c4andf6eb6498translate and run. The acceleration structure at0xd_5f1c_0000goes from all zeros to all0xffffffff, which looks like the builder's clear pass.28918b71andcaa78b8care refused: "LDS accesses without a uniform LDS fence in split wave64" (at 0x280 and 0x298). Both write per-lane records in a divergent loop: dword24 * tid + 6 * i + k,i <= 3,k < 6. That is several writes in a row with no read, whichplan_lds_fencestreats like a write and a read.Allowing write after write. I tried relaxing
plan_lds_fencesso that only a read and a write in one unfenced divergent region conflict:moe-miau/VIctory@fix/189-lds-write-after-write(205b10a, one commit on39976ef, with a translation test and a GPU test). All five builder programs then translate, and untranslated shaders drop from 126 to 45. But in game both newly translated programs hang the GPU (0x887A0006):dispatch 18x1x1 [compute caa78b8ca62bc3d6]at 102 s (after two earlier submissions with it went through)caa78b8cskippeddispatch 563x1x1 [compute 28918b7150a7aad5]at 98 sVICTORY_SHADER_LOOP_LIMIT=256dispatch 90x1x1 [compute 28918b7150a7aad5]at 93 sWhat I checked in
28918b71's Wave32 DXIL (dxc -dumpbin):With loops capped at 256 it still hangs, so it is not a loop that never ends. I haven't found what does hang. So I'm not proposing the relaxation as is; the branch is there in case it helps reproduce. Each half writes only its own lanes' records here, so the relaxation itself should not be what corrupts data. Something in how these two programs run split seems to be.
One run per row. Counts and times only, no game data attached. AI-assisted (Claude Code); runs done on my machine.
@moe-miau on GitHub · 2026-11-25 11:17 UTC · original
Two more runs on the same machine and route,
39976ef+ my branch above (205b10a). Both still hang in the builder:dispatch 18x1x1 [compute caa78b8ca62bc3d6]at 99 s, the only command in its barrier windowVICTORY_WAVE64_EMULATE=emulatedispatch 3x1x1 [compute 28918b7150a7aad5]at 83 sSo it is not Wave32-specific. It is also not the second loop's writes past the allocation. (
28918b71writes24 * tid + 6 * s28fors28 < v10, and lanes withv10 >= 4skip the first loop but run the second; the console drops those writes.)caa78b8c's Wave32 DXIL:ret. NVIDIA'sbar.syncdoes not wait for exited threads, so that path should not deadlock.I don't have an explanation yet. This matches #2311's note that without #2118/#1960 the device hangs inside these two programs.
@aef200 on GitHub · 2026-11-25 11:41 UTC · original
Mode table from a 32-lane Ada card, as the maintainers suggested this belongs here. RTX 4060 Ti 8 GB, Windows 11 26200, native D3D12, built from this PR at
54b333fwith--features diagnostics, same scene and logging settings for all three rows:VICTORY_WAVE64_EMULATEnativewave32emulate(what auto selects here)All three reach the same later stop. So mode selection is the lever:
nativereproduces the refusals on its own, and either override clears them. The D3D12 debug layer names the cause for the native ones:That is the whole of the refusal, on this card: native-wave64 bytecode reaching
CreateComputeShader, not an allocator or root-signature problem. What I cannot tell from logs is whetherwave32andemulatediffer in dispatch results rather than in creation.A note for the rebase, also as suggested: this PR and #1076 do not stack. #189 uses
emit::translate_withwithTranslateOptions/Wave64Mode; #1076 addsemit::translate_for_waveon top ofemit_for_wave. Merging either order with-X theirsleaveslower.rscallingemulate_wave64,emu_total,emu_exchange_pairandconsole_subwaveon aLowerthat does not define them; taking onlycrates/victory-gpu/srcfrom #1076 onto #189 stops attranslate_for_wavenot found. Whichever lands first, the other needs a rebase onto its entry point.Measured numbers only; no game code in this comment.
@Auroraooy on GitHub · 2026-11-25 15:24 UTC · original
Heads-up from real RTX 2080 Ti (Turing, SM 6.5) testing on Windows 10 19045: on PR head
92778cd,cargo test -p victory-shader --locked -- wave64 --test-threads=1gives18 passed; 19 failed. All GPU tests fail before shader execution withexpected at least one SM 6.6 adapterbecauseHost::all_adapters()filters out SM 6.5 hardware and WARP.I filed the report as Marvisak/VIctory#2535 and prepared a small diagnostic patch as alfycs/VIctory#2 (targeting this PR's branch). It logs each rejected adapter and turns the empty-host panic into an explicit
SKIPPED <test>: no SM 6.6 adapter; behavior on SM 6.6 hosts is unchanged. No game data was used.@alfycs on GitHub · 2026-11-25 15:43 UTC · original
Integrated @Auroraooy's fix (
9db4e94, fromalfycs/VIctory#2) sowave64_testsskip cleanly with adapter diagnostics when no SM 6.6 adapter is present. Re-verified locally on9db4e94:cargo xtask policy(183 files ok),cargo clippy --workspace --all-targets --locked -- -D warnings -A deprecated(clean), andcargo test -p victory-shader --locked -- wave64 --test-threads=1(37 passed; 0 failed).@KevinPratap on GitHub · 2026-11-25 16:05 UTC · original
Results from an RTX 4050 Laptop GPU (32 lanes, driver 621.24, Windows 11), testing this PR on main
940d32f. The diagnostics build (--features diagnostics) was run withVICTORY_SHADER_LOOP_LIMIT=4096.cargo test -p victory-shader --release --lib: every wave64 test passes. The 8 failures are the same 8 that plain main has on this card (bvh ×3, arithmetic, heap zeros, permutes, fspx dot, 64-bit image atomics), so none are new.native2,621 (about 394 then needWaveSize(64)),emulate2,165,wave322,363. Top refusals:v_readfirstlanein divergent flow: 217 (emulate)wave32and that fallback: draws dropped as "refused" fell from about 100 to 69 per frame, and total drops from about 175 to 125. It then ran out of host memory during pipeline creation (that's main's memory use, not this PR).AI-assisted (Claude Code).
@alfycs on GitHub · 2026-11-25 16:39 UTC · original
Rebased onto
main(67e8ae1) and integrated @KevinPratap's fallback lowering fromalfycs/VIctory#3(trying the other emulation mode, thenNative, when a Wave64 lowering refuses a program).Also:
crates/victory-shader/src/emit/lower/wave64.rsto keeplower.rsunder the 512 KiBxtask policylimit.EXECguard forv_readfirstlane_b32(after889b871skippedEXECguards for scalar VALU results) so it still elects the first active lane inEXECwhile preservinga_scalar_result_needs_no_execforv_readlane_b32.Verified locally after the final edit:
cargo xtask policy:asset policy: 186 files okcargo clippy --workspace --all-targets --locked -- -D warnings -A deprecated: cleancargo test -p victory-shader --locked -- wave64 a_scalar_result_needs_no_exec --test-threads=1:38 passed; 0 failedcargo test -p victory-gpu --locked -- a_lowering_refused:1 passed; 0 failed@KainanP on GitHub · 2026-11-25 18:17 UTC · original
Emulate(no declared wave size) runs on a 16-lane Intel iGPU (UHD8086:a78b, 16..16): all 18 compute GPU tests match there. It is the only PR form that did. But thelowerings(Emulate)fallback re-declares sizes those hosts refuse. A divergentv_readfirstlanefalls back toWaveSize(32), refused on Intel and WARP. A divergent cross-half ballot falls back toWaveSize(64), refused on the RTX 4060, Intel and WARP. Separately,vs_ps_readfirstlane_host_wave_contractfails on the Intel adapter with a pixel mismatch, 2.0 where 1.0 is expected. Details and table: #2220AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this.
@alfycs on GitHub · 2026-11-25 19:30 UTC · original
Thanks for catching that! Fixed in the latest commit:
shader_cache::loweringsnow filters fallbacks using the host's D3D12WaveLaneCountMin/WaveLaneCountMax(supports_wave32/supports_wave64) recorded alongsideset_wave64_mode, soEmulatewon't fall back toWave32on 16-lane/WARP hosts or toNativeon 32-lane/16-lane/WARP hosts.v_readfirstlane_b32inEmulate: extractedhost_wave_readfirstlaneand enabled it for divergentv_readfirstlane_b32inWave64Mode::Emulateas well, so it runs directly on 16-lane and WARP hosts without needing aWave32fallback.@steven-seagull27 on GitHub · 2026-11-26 01:35 UTC · original
@alfycs @KainanP I tested the new divergent
v_readfirstlane_b32path at3e39e34with 40 executing lanes per virtual Wave64. The existingv0 < 32test does not distinguish an election in the first physical Wave32 from an election across both halves on a Wave32 adapter. Test-only commit.The 128-thread workgroup contains two guest waves. Active lanes should read group-thread ID 0 in the first guest wave and 64 in the second. Inactive lanes should retain 42. These are wrong output dwords out of 128 read back:
RTX lanes 32–39 read 32 instead of 0, and lanes 96–103 read 96 instead of 64. Built-in WARP first diverged at lane 4 and app-local WARP in
Emulatefirst diverged at lane 16. The repeated host-local election is observable in the newEmulatepath even when capability filtering has chosen a supported shader. The empty-EXEC and 128-thread swizzle/DPP controls still matched on the supported modes.The test deliberately asserts the guest result. The table comes from running each supported adapter/mode independently through the same fixture and oracle so a first failure cannot hide later cases. I'm checking whether we can elect across the guest wave before the divergent branch for this case.
@steven-seagull27 on GitHub · 2026-11-26 01:53 UTC · original
@alfycs I opened the source fix against your current branch. Stacked PR with the readback and implementation.
Across six 128-thread dispatches,
Emulatewent from 48/768 wrong to zero on RTX 5080, 312/768 to zero on built-in WARP, and 208/768 to zero on Microsoft.Warp 1.0.22. Explicit Wave32 went from 48/768 to zero on both supported adapters. The suite includes both EXEC branch directions, a high-half winner and an entirely inactive guest wave. All 35 stock Wave64 tests passed.The fix elects before the branch when the read starts the active edge and the VGPR is already available in its uniform predecessor. The separate Native Wave64 high-half control still varied on portable WARP before and after the patch. @KainanP, your Intel Wave16 result on this branch would check the one hardware width I couldn't run here.
To pick up both commits on
feat/wave64-compute-emulation:@Roybill203 on GitHub · 2026-11-24 16:17 UTC · original · reviewed
Independent test: RTX 4060 Laptop (Ada, 32..32), driver 32.0.16.2124 —
54b333fonmainffe310eThird data point for the Emulate/Wave32 question in this thread, on a laptop Ada part with the
same driver generation as @konradbeck.
Setup
mainffe310e+ this PR54b333f(soc047885included), release profile,VICTORY_LOG=victory_loader=info,victory_gpu=info.memory allocation failedbefore theworld: peak commit on this title is 41.3 GB.
(
gameinput.rs: keep the keyboard stand-in beside host XInput pads).Against
mainwithout this PR (branch92bc27b, same machine, same settings)54b333fconsole wave64 lanes …pipeline refusedhost pipeline shadershost mesh pipelinememory allocation faileddevice removedSo the PSO side is fixed here too, and
host pipelinecounts almost double. Frame time improvesfrom ~4.6 s to 616 ms at best, and the audio thread stops being starved.
Emulate vs Wave32 on
54b333f, same session settingshost pipeline shadershost mesh pipelinev_readfirstlane in divergent control flowLDS accesses without a uniform LDS fence in split wave64This differs from @bittertea0323's result on
b472733, where Wave32 stayed at 10 draws/frameand the world pass never started. On
54b333fWave32 reaches 2046 draws and the world passdoes start. The likely cause is
c047885: the divergentv_readfirstlaneshortcut drops those75 refusals to zero, which is what was holding the title's own gating shut. That commit postdates
the earlier measurement.
Wave32 then trades those 75 for 38
LDS without a uniform LDS fencerefusals plus 55a cross-lane wave operation in divergent control flow, so it is not a net win — Emulate stilldraws more (2515 vs 2046).
Shaders not translated, Emulate mode (597)
The first six are 391 of the 597 and all lane-mask semantics. The
v_readfirstlane75 is exactlythe class @NuraadGit's follow-up addresses; it lands in Wave32 but Emulate still refuses it.
Shaders not translated, Wave32 mode (510)
What it looks like
Both modes: the world pass runs, 1500–3400 draws per frame are dropped for want of a pipeline, and
the composited image is black. Frames advance at 0.3–1.6 fps, audio is smooth, subtitles and the
UI render correctly. It is no longer a stall.
How each run ended
Watchdog, not a device error. About 150 s (Emulate) and 120 s (Wave32), both at the title's own
+0x23cf683write. Nodevice removed, nomemory allocation failed, no driver exception ineither run — driver 621.24 is stable on this part, which is worth noting against the
nvwgf2umx.dllcrashes the same machine had on 566.26.Takeaways
host pipeline319 → 561.v_readfirstlanestill refuse there.c047885appears to make Wave32 viable for the world pass on this title, contrary to theearlier 10-draw report. Worth confirming on other Ada parts.
stays black until those classes land.
unstableis the only thing left on the PR from this machine's point of view: no crash, nodevice loss, no OOM.
No game data, shader bytecode or binaries are included; the numbers above are the only artifacts
kept.
Prepared with AI assistance from the local build logs and the session's own counters.
@postblink on GitHub · 2026-11-26 04:22 UTC · original
An in-game data point on Linux and NVIDIA: with this PR (
3e39e34) the wave64 refusals are gone.Setup: CachyOS (Linux 7.3.6), RTX 5080 (driver 620.73.04, 32-lane waves). GE-Proton11-14's
winerun directly, with vkd3d-proton master71cae091in the prefix.main63bcca4with #2723 and #2969, then this PR,diagbuild, retail 1.0.2.1. NoVICTORY_WAVE64_EMULATEset; the log showsWave64 compute lowering mode selected wave64_mode=Emulate.main+ #2723)host pipeline refused … (0x80070057)in a 30-minute runXidor crashThe runs reach the first playable section, and camera input moves the view. I can't tell you which effects looked wrong before, since the scene's lighting changed between the two runs. But the refusals that #1107 and #2725 describe on Windows NVIDIA hosts are all gone here too.
The only conflict carrying this onto
mainwith #2723 was two#[cfg(test)]fields inLowered(annotationsfrom #2723,lds_dwordsfrom here). Keeping both builds. I haven't run the shader tests on that combination.AI-assisted (Claude), runs and numbers from my own hardware.
@gmankab on GitHub · 2026-11-26 06:32 UTC · original · edited 2026-11-26 06:56 UTC
I tested the original Wave64 patch on the Wine-free Linux runtime with native VKD3D-Proton. Auto-selection chose software emulation on an eight-lane Lavapipe device.
During Series S loading, fixed Wave64 pipeline rejections went from 128 to zero. The 96 fixed Wave32 rejections remained. The local native test build passed 14 cases, including nine compute readback fixtures. These results cover the original patch adapted to the native runtime.
Follow-up with Wave32. I generalized the original port to keep a separate ballot and scratch region for each 32-lane wave. The fallback applies to compute shaders that already needed a fixed wave size. Matching shader identities across two Series S loading runs, two of the original 96 host-refused Wave32 shaders built a host pipeline. Eight still required Wave32 and 86 stopped during translation because their collectives were in control flow where a group barrier could not be proven safe. The previous working compute shaders in the comparison kept translating. The native shader library suite passed 94 tests, including a two-wave readback with a partial second wave and lane-select wrapping. Native test commit
I also verified the empty-EXEC lane-zero rule and a branch controlled by an emulated first-lane read on a single virtual wave. The native shader suite passed 96 tests, and the Series S loading comparison had the same translated and rejected shader sets. The remaining divergent collectives still need a different control-flow lowering, as in #233. Native first-lane commit
Tested-on: Fedora Linux 45, Intel Xeon E5-2670 v3, Mesa Lavapipe 26.2.7, native VKD3D-Proton
Assisted-by: gpt-6.2 sol xhigh
@pickles976 on GitHub · 2026-11-26 07:14 UTC · original · edited 2026-11-26 07:45 UTC
Focused Linux/NVIDIA verification of production head
3e39e34037915da6d0f10b58b2872799bd9f3ca8: 34 passed, 0 failed, 0 ignored, 5.88s; freshvictory-shadercompilation from the selected checkout took6.85s.Environment: Linux6.17, Wine11.0, RTX4060 Laptop8GiB / NVIDIA590.48.1, DXVK3.1.1, Rust1.98.1 MSVC target. Diagnostic-relaxed vkd3d-proton3.2.0
2576c0b4adfae4a+: assertions disabled, allocator/list vtable-identity checks removed with null checks retained. This is not stock-runtime certification.Only local source change: replace the
with_hostsempty-adapter skip with an assertion, so lack of GPU execution cannot pass this verification. No production changes.DXVK_CONFIG='dxgi.hideNvidiaGpu = False', NVIDIA ICD, native d3d12/dxgi DLL overrides; selected test command:Shared-target worktree switch was forced fresh by touching
crates/victory-shader/src/lib.rs; the compile line namesVIctory-pr189. Test/build scope: MemoryMax9GiB, MemorySwapMax512MiB, 180s timeout. Preflight: availableRAM12031.3MiB, GPU233MiB, available disk19.673GiB.The named NVIDIA adapter reports
wave=(true, 32..=32)and runs[Emulate, Wave32]. Native-Wave64 negative controls produce the expected[64,64]versus[32,32]rejection; emulated dispatch readback assertions pass, including partial virtual waves, cross-block ballots, LDS ordering and masked-lane cases. The helper also labels an adapterWARP; DXGI/Wine can alias that to hardware, so I am not claiming independent software-WARP coverage.Evidence:
.compat-runtime/logs/verify-pr189-wave64.log. This is the focused fixture result, not yet a title-run/FPS or full-corpus claim. The local title previously refused the same three IDs listed in #2725 (13dfdd3b1136e407,b68f0931f1f47e61,88994c3496045f51); guarded title verification is the next gate, leaving automaticEmulateselection intact rather than forcing the documented divergent-first-laneWave32compromise.Integrated title follow-through
Ported the exact owner change onto the existing local
#2945head3ed7d725f6895fe1a235eb6fa8ff2485261ca151stack, retaining its verified heap-retention fix, the GPU-write notification portion of #2112, 1080p support and read-only memory counters. Mixed integration, not a pristine #189 title run; the standalone #189 checkout lacks this lab's mode/in-place support.Before launch: combined Wave64 module34/34 (4.96s), shader-cache tests5/5 (0.03s), in-place selection8/8 (0.75s, including the three prior fail-closed pin/heap/selected-host alias gates), GPU-write alias notification1/1 (0.00s). WARP labels remain non-certifying here.
Fresh diagnostics release build41.80s. Actual100s guarded run with
VICTORY_IN_PLACE=1,VICTORY_LAB_MEMORY=1,VICTORY_WAVE64_EMULATE=auto, scheduled20s confirm. Log confirms1920x1080 title size,1280x720 window fitting, and preferred modeEmulate.All three previously refused compute IDs now translate and successfully create host pipelines:
b68f0931f1f47e61: host pipeline at07:33:01.214122Z13dfdd3b1136e407: host pipeline at07:33:01.226423Z88994c3496045f51: host pipeline at07:33:13.152490ZNo
host pipeline refusedline in this run. Ended on100s wall guard/137, not a resource stop: GPU peak3233MiB, minimum availableRAM2452.6MiB, peak scope8273.7MiB, minimum available disk19.570GiB. Last sample99.44s: scope8187.0, anon3044.3, file5088.3 including shmem4159.7MiB.Evidence prefix
.compat-runtime/logs/20261126T073143Z; build wrapper logverify-pr2945-wave64-title.log. No visual/gameplay/FPS claim: my separately scheduled capture started too late and found no client after the guarded stop. The automatic mode can also fall back to Wave32; this does not remove the documented divergent-first-lane correctness caveat. Resource ceilings and diagnostic-relaxed-vkd3d caveat are unchanged.AI use: omp, harness model
openai-codex/gpt-6-astra, ran these checks and drafted this report. No upstream code changes.Visual follow-through
Reused that same verified binary/source, unchanged settings and100s guard, with screenshot timers anchored inside the launcher. Run
20261126T073953Z: actual45/85/95s client captures all show loading artwork, not gameplay. All three compute host pipelines again created; zero host-pipeline refusals. Wall stop100s/137, GPUpeak3233MiB, minimum availableRAM2492.6MiB, peak scope8665.0MiB, minimum available disk19.488GiB. No stock-vkd3d, world-entry or FPS certification.The existing descriptor-cap issue remains:310720
title slot past the host heapwarnings. This run establishes the real-title pipeline improvement without claiming it solves loading completion. No title content attached.@MrEjecutor on GitHub · 2026-11-26 10:48 UTC · original
Data point from an RTX 5060 Ti 16 GB (Blackwell, 32-lane waves), Windows 11, driver 621.24, title 1.0.2.1, Series X profile, diag builds.
mainat63bcca4against this PR at3e39e34, same machine and settings.Offline, the whole cache (
victory translate --cache --pipelinesover the shader archive and the three title images, about 32 min each):mainThe log selects
wave64_mode=Emulate. So the refusals go away as described, but about 260 compute programs that used to reach the driver (and be refused) now stop one step earlier, at translation. Net, 135 fewer programs are unavailable.In a 900 s scripted run (same walk, both builds): programs requested and refused by the host 159 on
main, 0 with the PR; requested but not translated 6 onmain, 110 with the PR; draws dropped for want of a pipeline 760 a frame onmain, 489 with the PR (-36 %). Frame rate unchanged (1.7 and 1.8 fps median). Caveat: on this machine plainmainstayed on the loading art for the whole run in both builds, so these are programs requested while loading, not a gameplay comparison, and I have no picture comparison to offer.No device removal in any run.
Not tested: gameplay with the world drawn (a fork that reaches it would be needed), which of the ~260 newly untranslatable programs matter on screen.
AI use: runs, counts and this text were done with Claude Code.
@pickles976 on GitHub · 2026-11-26 10:57 UTC · original · edited 2026-11-26 11:00 UTC
Correction/retraction: the recovery-window comparison in this comment was posted in error and is withdrawn. The local stack referenced (
#29453ed7d725+1fc54410,#2112, this#189port) does not contain the#2121descriptor-paging code —view_pages/take_back_pages/set_page_waterare absent from it — so the reclamation probe cannot execute on that stack at all, and the quoted readback sequence had no run or log behind it. The only verified data point remains the#2121-head probe: #2121 (three null submissions after forced reclaim, one documented). Apologies for the noise; no other claim I posted in this thread is affected.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.