Add a synthetic D3D12 wave64 regression for independently looping waves #3180
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!3180
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3180"
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?
@carlosmegino on GitHub · 2026-11-26 11:20 UTC · original
carlosmegino:codex/wave64-2688-regression→main· +453 −19 · 3 files · 3 commits · openRefs #2688.
Summary
Add an opt-in, synthetic D3D12 readback test for a 128-thread group with two logical wave64s. The waves use different EXEC masks and loop counts, keep their LDS regions separate, elect lanes in opposite halves, and read the other wave's counter after a group barrier. A 64-thread group serves as the control. The CPU oracle checks seven UAVs at every logical lane and also checks their canaries.
The LDS loop is adapted from PiloteCode's GPL-3.0 fixture in fxceless/victory-fork#854. The PR adds the test and a resource-state adjustment in the test host.
Validation
On an RTX 5070 Ti, the main emitter requests a physical wave64 PSO for the 64-thread case. The 128-thread case runs but returns 0 instead of 40 in UAV 2, lane 0. The only upstream change between the tested
842b0cband this PR's base63bcca4is a README update. This draft records the expected failures so a later backend patch can demonstrate both cases turning green.With the paired backend and the separate selection fix, both group sizes matched all seven CPU outputs per lane. Canaries stayed intact and D3D12 GPU-based validation reported zero warnings or errors.
Run on a wave32 GPU with Windows Graphics Tools and the DXIL validator:
@Dukestar69 on GitHub · 2026-11-26 12:11 UTC · original · reviewed
Checked against
origin/main(63bcca4) on Windows 11 + RTX 5090:cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 192 files ok.cargo test -p victory-shader --lib wave64_group_tests::: compiles cleanly (2 ignored by default). Running with--ignoredrequires Windows Graphics Tools (D3D12GetDebugInterfacereturned0x887A002DDXGI_ERROR_SDK_COMPONENT_MISSINGon this host), so I am leaving a comment rather than an approval since the ignored GPU assertions could not be executed here.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@carlosmegino on GitHub · 2026-11-26 12:14 UTC · original
Thanks for the independent verification!
The ignored tests require Windows Graphics Tools because they enable the D3D12 debug layer and GPU-based validation.
Installing Graphics Tools under Windows Optional Features should resolve DXGI_ERROR_SDK_COMPONENT_MISSING.
I appreciate you checking the compilation, Clippy and asset policy on a separate NVIDIA system.
If you have the opportunity to run the GPU assertions on your RTX 5090, that would provide a valuable independent hardware result.
@upipibi on GitHub · 2026-11-26 20:05 UTC · original · edited 2026-11-26 20:13 UTC
Independent hardware run of the ignored tests on
827057a(main63bcca4only for the shared tests: the two ignored tests are added by this PR, so they do not exist onmainand ran on the PR head only): RTX 3070 8 GB (Ampere, wave32 only), driver 616.56, Windows 11, rustc 1.98.1, Windows Graphics Tools anddxil.dllpresent.cargo test -p victory-shader --locked --lib wave64_2688_group -- --ignored --nocapture --test-threads=1, one run:wave64_2688_group_128wave64_2688_group_64Both are the expected failures your description records on the RTX 5070 Ti: the 64-thread case's main emitter asks for a physical wave64 PSO, which a 32-lane-only driver refuses, and the 128-thread case returns 0 instead of 40. So Ampere shows the same two failures. The debug layer logged that one error and no warnings; GPU-based validation logged nothing. The non-ignored
wave64tests pass on both trees (5 each). No driver resets.AI-assisted (Claude Code, Claude Sonnet 5.5 ran the tests; Claude Opus 5.5 checked and posted).
@kilolimaVI on GitHub · 2026-11-26 21:31 UTC · original
Ran the two ignored tests on AMD: Windows 11, Radeon 780M (RDNA3), Graphics Tools installed, toolchain 1.98.1.
Both panic at
wave64_group_tests.rs:216,assert_eq!((caps.WaveLaneCountMin, caps.WaveLaneCountMax), (32, 32)): this adapter reports (32, 64), as RDNA does. So they need a 32-lane-only host (NVIDIA, Intel), which matches the ignore reason, but on an AMD card they read as failures rather than "not this host". Returning early with a note whenWaveLaneCountMax != 32would make--ignoredruns on mixed hardware clean. Before that point (debug layer, device creation) everything worked here.AI-assisted (Claude).
@fuzeofficlal on GitHub · 2026-11-26 22:08 UTC · original · requested changes
Verified on
827057a6:cargo xtask policy:192 files ok.cargo clippy --locked -p victory-shader --all-targets -- -D warnings(default and--all-features): clean.emit::wave64_group_tests:: emit::tests::underVICTORY_WARP=0andVICTORY_WARP=1: 17 passed, 0 failed, 2 ignored.(32, 32), D3D12 Graphics Tools, anddxil.dllpresent) with-- --ignored --test-threads=1 emit::wave64_group_tests::: 0 passed, 2 failed:wave64_2688_group_64(wave64_group_tests.rs:226):ID3D12Device::CreateComputeShader: Shader wants wave lane count of 64 but maximum wave lane count for device is 32.wave64_2688_group_128(wave64_group_tests.rs:251):UAV 2, thread 0got0, expected40.The
#[cfg(test)]change incrates/victory-shader/src/emit/host.rs:1706(D3D12_RESOURCE_STATE_COMMONwith implicit state promotion) looks good, and the synthetic Wave64 math/oracle is clear, but several items need attention before landing:63bcca43even on a Wave32 RTX 5090: If these are intended as a known-red regression for#2688prior to a compiler fix, the#[ignore]reason should state that explicitly rather than implying they only need a Wave32 GPU + Graphics Tools + DXIL validator.crates/victory-shader/src/emit/mod.rs:222):rustfmt --edition 2024 --checkfails becausemod wave64_group_tests;needs to be ordered alphabetically aftermod wave;.crates/victory-shader/src/emit/wave64_group_tests.rs:97, 100): The 128-thread guest issuess_barrierwithout a precedings_waitcnt lgkmcnt(0)before reading the peer wave's LDS counter, and the 64-thread path copiesv5tov7before the first explicits_waitcnt.wave64_group_tests.rs:190-220, 264): EnablingSetEnableGPUBasedValidation(true)viaOncecan trigger device removal if another test created a device first (--include-ignored),Host::new(false)respectsVICTORY_WARP=1and hard-panics on non-(32, 32)adapters instead of skipping, and running both tests withoutONE_AT_A_TIMErisks concurrent hardware dispatches.@carlosmegino on GitHub · 2026-11-26 22:27 UTC · original
@fuzeofficlal — response to observation 1 (known-red regressions), addressed in 1625d1c.
Both ignore reasons now explicitly say
known regression: fails until #2688 is fixed, followed by the hardware/tool requirements.Rechecked the original head
827057a6before editing; upstream main remains63bcca43c6a00a758510398fa43096ce7e4f7df0. With that main emitter and the revised synthetic fixture:The separate local paired-backend control is
a9ef792f6d516ee6200f4fedeb061a25153d48fd, including the masked-first-lane selection correction. I copied this PR's revised fixture into that checkout; its only API adaptation isemit_with(..., Options { wave32_only: host::wave32_only(&host.device), ..Default::default() })instead of main'semit(...). Guest instructions and CPU oracle are identical between controls. Both tests pass there: 448 and 896 lane values checked, respectively, 56 canaries each, zero D3D12 warnings/errors. This backend remains outside the PR.Hardware: Windows, RTX 5070 Ti, driver 621.01, rustc 1.98.1, wave lanes (32,32), Graphics Tools and DXIL validator available. Reproduction:
Only synthetic resources were used.
@carlosmegino on GitHub · 2026-11-26 22:27 UTC · original
@fuzeofficlal — response to observation 2 (module ordering / formatting), addressed in 1625d1c.
wave64_group_testsnow followswave; rustfmt also ordersbvh_testsbeforecensus_tests. Formatting was restricted to the PR's three existing files, with child traversal disabled:All exit 0; policy reports
192 files ok. The changes to host.rs in this follow-up are formatting only. No compiler changes or optimizations are included.@carlosmegino on GitHub · 2026-11-26 22:27 UTC · original
@fuzeofficlal — response to observation 3 (guest LDS ordering), addressed in 1625d1c.
The guest now waits with
s_waitcnt lgkmcnt(0)after counter initialization, after each atomic iteration before narrowing EXEC, after reading its own counter, between the per-lane LDS write and opposite-half read, immediately before the group barrier, and after the peer-counter read. Descriptor loads retain their waits before buffer stores. Thus the 64-thread copy consumes a completed v5, and the 128-thread peer read follows completed LDS work plus the barrier.The loop branch displacement is calculated from its label instead of hard-coded. The new CPU-only decode audit checks LDS/SMEM completion waits, barrier ordering, complete instruction boundaries, and the loop target for both group sizes:
Result: 1 passed. Both branches are at byte 92 and target byte 64: -32 bytes from the following PC, i.e. -8 dwords (
0xBF89FFF8).The CPU oracle is unchanged. The revised programs still reproduce both main defects and both pass the separate paired-backend control described above.
@carlosmegino on GitHub · 2026-11-26 22:27 UTC · original
@fuzeofficlal — response to observation 4 (GBV isolation, adapter gating, serialization), addressed in 1625d1c.
Each ignored test launches a fresh copy of its test executable with
--exact <its-own-name> --ignored --nocapture --test-threads=1. Only that test runs in the child, which enables the debug layer and GPU-based validation before its first Host/device. The parent holds the existingvalu_tests::ONE_AT_A_TIMEmutex for the child's entire lifetime. Child launch errors, nonzero exit codes, and crashes fail the parent test.The child inherits
VICTORY_WARP; device creation and feature-query errors remain failures. Only unsupported wave capabilities produce an explicitSKIP. Translation, validator loading/validation, PSO creation, dispatch/readback, canary mismatches, and D3D12 warnings/errors remain failures. A negative control withVICTORY_DXILpointing to a nonexistent DLL exits 101 in both child and parent, without a skip.Concurrent relevant-suite command (also checked with
--all-features):With WARP=0: main yields 18 passed / the 2 expected regression failures; paired control yields 20 passed. With WARP=1: both yield 20 harness passes, including 2 explicitly reported capability skips. Without
--include-ignored, both configurations yield 18 passed / 2 ignored.For completeness, the full shader suite is not clean on this host: a heap-direct texture test exits with 0xC0000005, and four other synthetic tests fail under WARP. I reproduced that individual crash and all four failures on the unmodified original PR head
827057a6. They are outside these regressions; I have kept their results separate and made no unrelated fixes.@carlosmegino on GitHub · 2026-11-26 22:27 UTC · original
@kilolimaVI — addressed your adapter-capability observation in 1625d1c.
The hard assertion is replaced by an explicit capability gate: execution requires WaveOps and exactly
(WaveLaneCountMin, WaveLaneCountMax) == (32,32). A device reporting (32,64), like your Radeon 780M, returns with aSKIPmessage containing the actual capabilities and VICTORY_WARP value. It does not attempt translation or dispatch.I verified the unsupported-device path locally with
VICTORY_WARP=1: both tests explicitly printSKIP ... WaveOps=true, lanes=(4, 4), VICTORY_WARP=Some("1"), including under--include-ignored. I do not have a (32,64) AMD adapter here, so that exact hardware case is covered by the predicate rather than a claimed AMD run.With
VICTORY_WARP=0, the RTX 5070 Ti reports (32,32) and both tests execute: they retain the expected main failures and both pass the paired backend. Initialization, translation, validation and execution errors are not turned into skips.@fuzeofficlal on GitHub · 2026-11-26 22:47 UTC · original · approved these changes
1625d1c6resolves all blockers from the previous review:crates/victory-shader/src/emit/mod.rsnow ordersbvh_tests,census_tests, andwave64_group_testsalphabetically, andrustfmt --edition 2024 --checkpasses cleanly on the modifiedhost.rsandwave64_group_tests.rsfiles.crates/victory-shader/src/emit/wave64_group_tests.rsplacesWAIT_LGKM(s_waitcnt lgkmcnt(0)) after DS/SMEM producers and right befores_barrier, covered by the newguest_lds_dependencies_and_branchesunit test.ONE_AT_A_TIME+ child-process isolation (VICTORY_WAVE64_2688_CHILD) enables GPU-based validation before first device creation and cleanly skips non-exclusively-Wave32 devices (SKIP ... lanes=(4, 4)underVICTORY_WARP=1, passing 2/2).cargo testpasses 18/18 (2 ignored) on bothVICTORY_WARP=0andVICTORY_WARP=1, and--ignoredon RTX 5090 (exclusively wave32) cleanly reproduces the tracked#2688failures (128:UAV 2/3zeroed withD3D12 warnings/errors: [];64: rejected at PSO creation for wanting Wave64 on max wave 32).Approving. (Non-blocking follow-up idea:
host::dispatchcurrently lacks a fence timeout andu64::MAXdevice-removed diagnostic check compared to the draw path.)@upipibi on GitHub · 2026-11-26 23:48 UTC · original
Independent re-run on the new head
1625d1c6(earlier run was at827057a;main63bcca43as control). RTX 3070 8 GB (Ampere, wave32 only, reports lanes (32,32)), driver 616.56, Windows 11, rustc 1.98.1, Graphics Tools anddxil.dllpresent.Gating: on this (32,32) card the new gate does not skip. Both ignored tests execute (each in its own child process, "exclusively wave32, GPU-based validation enabled before first device"), and fail as the description says. No
SKIPline appeared.Ignored tests, head, one run:
cargo test -p victory-shader --locked --lib wave64_2688_group -- --ignored --nocapture --test-threads=1wave64_2688_group_128: UAV 2 thread 0 got 0, expected 40 (128 mismatches); UAV 3 thread 0 got 0, expected 20 (128 mismatches); UAVs 0, 1, 4, 5, 6: 0 mismatches; all 8 canaries per UAV intact;D3D12 warnings/errors: []. Child exits 101, parent panics atwave64_group_tests.rs:274.wave64_2688_group_64: compute PSO "The parameter is incorrect."; debug layer: "CreateComputeShader: Shader wants wave lane count of 64 but maximum wave lane count for device is 32".test result: FAILED. 0 passed; 2 failed; 0 ignored.Non-ignored, head, 3 runs of
cargo test -p victory-shader --locked --lib wave64 -- --test-threads=1 --nocapture: eachtest result: ok. 6 passed; 0 failed; 2 ignored; 0 measured; 300 filtered out. This includesguest_lds_dependencies_and_branches(both sizes: "branch 92 -> 64 (-32 bytes from next PC), all LDS/SMEM producers waited, barrier audited"). The ignore reason now reads "known regression: fails until #2688 is fixed; requires exclusively wave32, Graphics Tools, and DXIL validator". The two existingwave64_permutes_*tests print "no pipeline for a wave of 64; skipped" and pass, as before.Control on
main63bcca43: the same ignored command runs 0 tests (they are added by the PR). Negative control: I copied the PR'swave64_group_tests.rsand itsmodline intomain(without the host.rs/mod.rs changes). It compiled with 0 errors (so there is no compile-error code to report). The two ignored tests on that tree fail identically to the head: UAV 2 thread 0 0 vs 40, UAV 3 thread 0 0 vs 20 (128 mismatches each, canaries intact, no D3D12 messages), and the 64-thread PSO rejection with the same debug-layer message. So on this card the failures come from the main emitter, not from the PR's host changes.Lib suites,
cargo test -p victory-shader --locked --lib -- --test-threads=1: on both trees the process aborts atemit::memory_tests::heap_direct_texture_reads_mark_their_heap_indexwith 0xC0000005 STATUS_ACCESS_VIOLATION (the crash you mention; it is inmaintoo). Re-run with--skip heap_direct_texture_reads_mark_their_heap_index, once each:test result: FAILED. 299 passed; 3 failed; 5 ignored; 0 measured; 1 filtered out; finished in 289.69stest result: FAILED. 298 passed; 3 failed; 3 ignored; 0 measured; 1 filtered out; finished in 356.55sstride_tests::a_heap_buffer_read_by_element_takes_the_views_stride,stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros,synthetic_tests::gathers_at_a_level_match_the_hardware. The difference (+1 passed, +2 ignored) is exactly the PR's new tests.Changed since
827057a: the 128-thread case now also reports UAV 3 (0 vs 20) mismatches, where the earlier run listed only UAV 2 (the first mismatch); the 64-thread case is unchanged; the debug layer and GPU-based validation again reported no warnings or errors beyond the PSO one; the ignored tests now run in isolated child processes; one more non-ignored test passes (6 vs 5 in thewave64filter). No driver resets.Not run: a (32,64) AMD adapter, so the SKIP path for it is untested here. No game files used.
AI-assisted (Claude Code, Claude Sonnet 5.5 ran the tests; Claude Opus 5.5 checked and posted).
@Dathinel on GitHub · 2026-11-27 02:21 UTC · original
The independent-wave fixture also exposed a useful boundary on our RTX 3050 Laptop (4 GB): try 96 threads, where the second guest wave has only its lower 32 lanes. Its second election can have empty EXEC. Seeding the expected lane-0 result with 11 makes it distinguishable from cleared memory. In an instrumented control, substituting 7 for the unwritten upper slot returned 7 instead of 11 at thread 64. The same injection passed after the translator supplied zero for the missing half.
On our fork we also extended the CPU/readback comparison to 256 threads, alternating the elected half across four guest waves and keeping each wave's LDS counter separate. Both cases passed there. This was a synthetic follow-up on a different translator revision, not a rerun of this PR head. 96-thread fixture · Four-wave fixture
Thanks for documenting the explicit guest LDS waits and the isolated validation process in the updated fixture. AI-assisted hardware investigation.
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.