Repository navigation
Conversation
Reuse the divergent-loop fixture in 48-thread groups and check all lane outputs against a CPU reference. This covers the trailing 16-thread wave from Marvisak#1498. AI-assisted.
r4tedx
left a comment
There was a problem hiding this comment.
Thanks for the 48-thread case. The expected values check out: with Victory's contiguous Wave32 layout each group stores 32 copies of 32 then 16 copies of 16 at group * 48 + thread, so three groups give 144 values, matching the CPU reference and the readback size. cargo check/clippy -p victory-shader --tests, rustfmt and git diff --check against c734600 all pass.
Two changes before I take it in:
- Honor software-only mode before opening a device. The new case goes through
adapters()andHost::on(), which enumerate and open hardware adapters; theVICTORY_WARPcheck lives inHost::new(), which this path bypasses. Please add an early skip whenVICTORY_WARP=1for the hardware-only tests in this module, soVICTORY_WARP=1 cargo test -p victory-shader split_testsnever touches a hardware adapter (split_tests.rs~1351,host.rs~101). - Require a positive Wave32 result.
Host::target()returnsTarget::ANYwhen the feature query fails or WaveOps is unavailable, andANY.runs(32)istrue, so on such an adapter the test reaches pipeline creation and panics. Gate it on a successful query that reports WaveOps and a wave-size range containing 32 (split_tests.rs~1363,host.rs~168).
Verification note: on WARP (forced through Host::new(true) in a scratch copy) the reported range was 4..=4, so the new 48-thread dispatch was skipped and its early return counted as ok; the 31 existing cases that fail on WARP fail the same way on the base. The new case is therefore unverified on hardware from our side. Synthetic test only; no title data used.
AI-assisted.
Skip hardware enumeration in split tests when VICTORY_WARP=1. Require an explicit D3D12 wave-operation range containing 32 for the partial-wave fixture, while retaining the permissive target fallback for existing callers. AI-assisted.
|
Thanks for the review. Both changes are in
In normal hardware mode the RTX 2080 SUPER (driver 621.01) returned all 144 expected values across three groups, with 32 for the first 32 lanes and 16 for the trailing 16 in each group. The full shader suite passed 165 tests with one ignored. Shader-test Clippy, formatting for both edited files, These are synthetic checks. I exercised the positive Wave32 path on the RTX. The failed-query path was verified by code inspection. Game behavior and frame rate remain unmeasured. AI-assisted. |
r4tedx
left a comment
There was a problem hiding this comment.
Thanks for d96a6cb. Both requested changes are in:
hardware_adapters()returns no adapters whenVICTORY_WARP=1, before any DXGI enumeration, and all six hardware loops insplit_tests.rsnow go through it, so a WARP-only run no longer creates a hardware device.- The partial Wave32 case is gated on
Host::reported_target(), which isNoneunless the device reports wave operations, soTarget::ANYno longer lets it run without a reported 32-lane wave.target()keeps its old behaviour for other callers.
Two optional notes:
- The comment at the gate says WARP can miscount a partial wave, but WARP never reaches that loop because
adapters()filters out software adapters. It may read better as "skipped where the device reports no 32-lane wave". - On a device reporting 32..64, asserting
wave_size(&cs.dxil) == Some(32)(asin_half_lane_reads_match_the_console_on_every_adapterdoes) would confirm the case runs as a native Wave32.
Neither blocks this. Approving the code; not merged yet. Reviewed by reading the code only: no tests were run here and no title data was used.
AI-assisted.
Problem
A Wave32 shader that assembles an exit mask across a divergent loop could count only the bit its own thread observed. The fork already fixes that by using console control flow for joined masks that are read as numbers. This PR extends the existing Wave32 fixture to cover a 48-thread group, where all 32 threads in the first wave must return 32 and all 16 in the trailing wave must return 16. The change is test-only.
Hardware verification
Windows 11, GeForce RTX 2080 SUPER (driver 621.01, Wave32), three groups per case, synthetic code only. Both revisions passed DXIL validation. The CPU reference checks every lane after GPU readback.
05c7cbbc734600The old translation returned 1 throughout. A separate DXC
cs_6_6control used[WaveSize(32)],[numthreads(48,1,1)], and a bounded 48-iteration sum ofWaveActiveCountBits(lane == i), withlanefromSV_GroupIndex. It returned 32 and 16 as expected on all 144 reads with the same dispatch and readback harness on both revisions.The shader crate suite reported 165 passed, zero failed, and one ignored. The new test uses adapters that can run native Wave32 and needs no compiler at runtime. The earlier WARP partial-wave result remains inconclusive. Game behavior and frame rate were unmeasured.
Refs Marvisak#1498. Thanks to r4tedx for the broadened joined-mask implementation and existing Wave32 fixture, and to andrewpozdnakov7-jpg for identifying the partial-wave hardware check.
AI-assisted.