Repository navigation
Conversation
|
Ran the new halves tests at System
Results
What this adds Not tested AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used. Update (25/11, after the head moved to Same GPU output: |
a7e78c1 to
25db879
Compare
|
Heads-up: the README hunk contains a committed merge conflict — The actual change — |
…-lane waves What was wrong: a console wave64 compute program that needs the console's lanes (cross-lane reads, masks as numbers, LDS one wave shares) declares WaveSize(64). NVIDIA and Intel run waves of 32 lanes at most (WaveLaneCountMax 32) and refuse it: on an RTX 3070 Ti (driver 32.0.16.2124) the debug layer gives "Shader wants wave lane count of 64 but maximum wave lane count for device is 32" (id 622), and every such pipeline is refused with E_INVALIDARG. A Series S run to the loading screen refused 100 compute pipelines, 95 of them for this. What changed: on such a host, a wave64 program that needs the console's lanes is translated for waves of 32 (`emit::Options::host_wave32`; `emit::lower::halves`). The thread relabelling gives each host wave a 32-aligned run of thread ids, so host wave 2w + h is console wave w's lanes 32h..32h + 31. What a lane reads within its half is exact: DPP rows, ds_swizzle, and ds_bpermute_b32, which the console's wave64 permutes within each half on its own (RDNA2 ISA; measured in Marvisak#573). A lane's bit of a mask held as a number, v_writelane_b32 and v_mbcnt take the console lane. Reads across the halves have no host form and are refused where they are lowered, with a reason that names the host: ballots (masks read as data), v_readlane_b32 of a lane that may be in the other half, whole-wave reductions and prefix sums; one a program never uses costs nothing (the lowering's retry with the value missing). A group of 33 to 64 threads with LDS, which the console compiler orders without barriers as one wave, is refused too. v_readfirstlane_b32 reads the host wave's first lane, as it already does in every program without console lanes (marked as that shortcut). victory-gpu asks the device once (OPTIONS1) and translates for it; the shader cache keys on it, so entries made for 64-lane hosts are not read. `victory translate --wave32` translates for such a host offline; with --pipelines it follows the GPU that makes them. Approach after DexNom's fork (DexNom/Victory 5f4c3df: the host's wave width and the relabelling into halves) and Marvisak#2176 (n-romanovich: the setting in the cache key); here the setting is a translation option, and cross-half reads are refused at the sites that make them instead of by instruction name, which keeps programs whose crossing value is unused. Evidence, `translate --list --pipelines` over shaders.rpf, the executable, XboxBvhBuilder.dll and the FidelityFX DLL, RTX 3070 Ti: | | main 67e8ae1 | this | |---|---|---| | compute programs emitted | 2,733 | 2,372 | | compute pipelines made | 2,328 | 2,372 | | refused by the driver | 405 | 0 | No program that made a pipeline on main fails to now (25,347 pipelines, all kept). In the title (Series S mode, diagnostics build, to the loading screen, 2.5 min): no pipeline refused, against 100 on main; the 113 programs that do not translate say why (51 LDS, the rest mostly ballots). The 44 new ones include the depth pyramids (occlusion), the sky and atmosphere gathers (scattering_transmittance_system), shader binning and the mipmap generators. The 361 still refused now say why: 192 LDS in a one-wave group, 107 ballots, 48 lane reads across halves, 20 reductions (those need an exchange between the two host waves, a change of its own). Tests (halves_tests): one wave64 program (DPP, ds_swizzle, ds_bpermute, v_mbcnt, v_writelane to lane 40, a constant mask's high dword) runs on every hardware adapter, in halves and, where the adapter has 64-lane waves, as one wave64: all 64 lanes give the console's results on the RTX 3070 Ti (halves) and the Radeon iGPU of a Ryzen 9 7900X (RDNA2: halves and wave64). The refusals and the LDS rule each have an offline test; the hand-encoded words are checked against the disassembler. Found on the way, not changed here: a wave64 mask built by two s_mov_b32 (low and high dword written apart) reads its low dword for all 64 lanes (`Lower::pair_high` looks for the high dword in the instruction that wrote the low one); the same with and without this change, on AMD's own wave64 too. Co-Authored-By: Claude Opus 5.5
25db879 to
360f8aa
Compare
My bad, I just fixed it |
|
Ran the halves tests on a machine that has both kinds of host, a 32-lane NVIDIA dGPU and an RDNA3 iGPU with native wave64, so System: RTX 5060 Laptop GPU 8 GB (Blackwell, driver 610.47) + Radeon 780M (RDNA3 iGPU, driver 32.0.31018.1), Ryzen 7 260, 32 GB, Windows 11 build 26300, Rust 1.98.1, debug build, validator from Windows SDK 10.0.26100. Full
The 3 are the known NVIDIA failures (#1835): Note for hybrid-laptop testers: AI-assisted (Claude Code); the runs were done on my machine. |
|
Tested this on an RTX 5070 Ti (driver 621.40, Windows 11). The halves tests pass here too. I found one wrong result, though: Fix with tests: chippy01#1 (onto this branch, rebased on AI-assisted (Claude Code); no game data. |
|
On a machine that also has a 16-lane Intel iGPU (UHD AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this. |
|
If this PR gets merged, I'll follow up by working on a way to implement Selective Cross-Wave Communication or, alternatively, a Hybrid Wave64 (32 physical + 32 virtual lanes) approach. The goal would be to allow the compiler to correctly execute instructions that require communication between lanes 0–31 and lanes 32–63. |
|
Tested on NVIDIA: RTX 4070 (the only adapter), driver 621.01, Windows 11, rustc 1.98.1. Head
No regression on Ada. No game data; the title was not run. AI-assisted. |
|
Independent run on another machine: Ryzen 9 9950X3D with an RTX 4090 (driver 32.0.16.2140) and the CPU's Radeon iGPU (RDNA2, driver 32.0.21045.29003), Windows 11 26H2.
Every pipeline made on
|
|
Tested on NVIDIA Ada, a 32-lane-only host: RTX 4070 Ti, driver 621.01, Windows 11 Pro build 26300, Rust 1.98.1 pinned, this PR merged onto main
All 5 new tests pass:
Whole lib: 271 passed, 3 failed, 3 ignored. The 3 failures ( So in addition to the RTX 3070 Ti (Ampere) in the description, the halves path checks out on Ada. AI-assisted (Claude). |
…sole wave What was wrong: two results in halves were wrong in the upper host wave (console lanes 32-63). Measured before this change on an RTX 3070 Ti (driver 32.0.16.2124) and the Radeon iGPU of a Ryzen 9 7900X (RDNA2), 32 of 64 lanes wrong on both, while the Radeon's own wave64 form gave the console's results: - v_readfirstlane_b32 read the host wave's first lane, which in the upper half is console lane 32 or later: a first-lane read of the thread id gave 32 in lanes 32-63, the console 0 (reported on Marvisak#2633 by justrealyme). - A DPP row mask was applied by the host lane's row, 0 or 1: with row_mask:0xc, lanes 32-63 (the console's rows 2 and 3) kept their old value instead of taking the DPP result. What changed: - A first-lane read in halves is kept for a value proven the same in every lane of the console wave (halves::lane_uniform: values made from scalars, constants and such values, under conditions that are themselves alike; LDS reads, and buffer loads through a scalar descriptor, at alike addresses; the thread id shifted past the console wave) and in groups of 32 threads or fewer, which one host wave holds whole. Any other is refused with its reason; one nothing uses costs nothing. The analysis is justrealyme's (#1), ported from fxceless/victory-fork (Marvisak#497 there). Added here: buffer loads (a typed buffer's element the compiler loads with a vector load, then reads the first lane of), the dwords a waterfall loop reads (each lane's own, so not alike), and the small-group exception. - DPP row masks take the row from the console lane. - The GPU tests share one dispatch helper. Evidence, translate --list --wave32 over shaders.rpf, the executable, XboxBvhBuilder.dll and the FidelityFX DLL: compute programs emitted 2,372 -> 2,369. The 3 no longer emitted read the first lane of a value the analysis cannot show is alike (scattering_transmittance_system's cloud multiple-scattering cache: a value joined from a branch on a per-lane compare; two ptx_prerender light-atlas programs: a select on a mask made from EXEC, in a loop), so in halves they could compute per-half values. 14 programs refused before give this reason first now; no other outcome changes. The analysis as #1 has it refuses 12: the small-group exception keeps 5 of them, buffer loads 4. No program of the title uses a DPP row mask other than 0xF in halves, so that fix changes none of its translations. Tests (emit::halves_tests): - dpp_row_masks_name_the_console_rows_on_every_gpu (new): row_mask:0xc; 0 of 64 lanes differ on both GPUs (32 before). - first_lanes_kept_in_halves_match_the_console_on_every_gpu (new): the thread id's first lane in a group of 32 and l >> 6 in a group of 128; 0 lanes differ on both GPUs. - reads_across_32_lane_halves_are_refused_with_their_reason: the thread id's first lane is refused in a group of 64 and kept in a group of 32; an unused one costs nothing; a buffer dword loaded at an offset alike in every lane is kept, at the thread id's offset refused. - the_test_programs_are_what_their_comments_say: every hand-encoded program checked against the disassembler. Checks: cargo clippy --workspace --all-targets --locked -- -D warnings, and with --all-features: clean. cargo xtask policy: ok. cargo test -p victory-shader --lib -- --test-threads=1: 273 passed, 3 failed, the same 3 as on main on this NVIDIA machine (two stride_tests, gathers_at_a_level_match_the_hardware); heap_direct_texture_reads_mark_their_heap_index skipped as before. lower.rs is 495,122 bytes. Co-Authored-By: justrealyme <82029927+justrealyme@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Pushed a second commit with two fixes. Both were wrong results in the upper host wave (console lanes 32-63), and both now have tests:
New GPU tests: The refused first-lane reads come back exactly once the two host waves can exchange values, which is the follow-up mentioned above. |
|
Automated triage for the maintainers. Needs the maintainer's decision, plus one small fix. The rebase merges cleanly and CI
On your reply: the third commit's refusal of group shapes a host wave may tile, and the merge of Generated by Claude Code |
Conflicts resolved: - emit/lower.rs: ds_bpermute_b32 takes main's lowering (Marvisak#573: within the reader's own 32-lane half, the half's base from the host lane), which in halves is the host wave itself, so halves::permute_lanes, which did that for halves alone, is gone. Lowered keeps both sides' test fields (wave_size, and main's uses_lane_index and has_half_wave_mask). - emit/host.rs: main's Host::new (one shared WARP device, the warp field). Host::each_hardware and create_device share one SM 6.6 check, the sm66 function. - apps/victory/src/main.rs: --wave32 beside main's non-zero --jobs. - README.md: main's "GPU: world" row, this branch's "Shaders" row. For main's new code: host_wave32: false in four new tests' lower::Parts and in one emit::Options; victory-gpu takes its shader host by Host::from_device, as main now has it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
First run in the world with this PR, on the same Ampere card as the description: RTX 3070 Ti 8 GB, driver 621.40, Windows 11 26200, 32 GB RAM. Offline (
In the title, two 15-minute runs from the start screen through the world and the intro cutscene, one per build. The script stopped both; neither had a device removal:
The 170 dropped here all give a reason. The ones I could classify: 76 for LDS one console wave64 shares without barriers, 18 for lane masks or lane reads across halves, 11 for reductions over both halves, 7 for first-lane reads of values that may differ between the halves. I did not compare images, so this says nothing yet about whether the 9 programs that run now draw correctly. AI-assisted (Claude Code); the runs are on my machine. |
|
Thanks for running this in-game, @davesousa. The drop from 170 host refusals to zero on the 3070 Ti lines up with what I saw offline on the 4090. The median world frame time barely moved, even with fewer slow submissions. Your numbers give us a baseline for |
What was wrong: the thread relabelling gives a thread the flat id of its host wave's first lane, rounded down to 32, plus its host lane. That is a bijection only while every host wave holds a 32-aligned run of flat ids. Hosts fill the waves of a group of several rows with tiles when its rows are 32 threads wide or more. A wave then holds a 16 x 2 tile, two waves round down to the same base, and two threads share every id while half the ids go unused. Measured in halves with a program that stores 1 at its own id, on an RTX 3070 Ti (driver 32.0.16.2124) and the Radeon iGPU of a Ryzen 9 7900X (RDNA2): - 32x2, 32x8, 64x4, 32x32 and 32x2x2 groups store half their ids, on both; - 8x4, 4x4, 8x8, 16x2, 16x4, 8x16, 16x16, 4x4x4, 2x2x16, 8x8x4 and one-row groups store all of them. Marvisak#2126 (0xkn0wh3r3) measured the same tiling on an RTX 5070 Ti, and for rows 24, 12 and 10 threads wide too, for main's 32-lane programs. What changed: halves refuse a group of several rows whose rows are 32 threads wide or more or not a power of two wide, with its reason (`halves::halves_tiles`). halves.rs and halves_tests.rs are rustfmt-clean. Evidence: translate --list --wave32 over shaders.rpf, the executable, XboxBvhBuilder.dll and the FidelityFX DLL, on main 842b0cb merged: no emitted program changes (2,369); with --pipelines on the RTX 3070 Ti, 2,369 compute pipelines are made, none refused by the driver. The title's programs in halves that translate are in groups of 8x8, 8x4, 4x4 or one row. Its programs in groups of 32x2, 32x32 or 6x6 were refused already; 2 of them (GpuParticleEmit's water emitters) now give this reason first, the rest the one-wave LDS reason. The exchanges planned next would otherwise have run them wrongly. Tests (emit::halves_tests): - groups_a_host_wave_may_tile_are_refused_in_halves: 32x2, 64x4, 32x2x2 and 6x6 are refused; 8x8, 16x2, 4x4x4 and 64x1 translate. - every_thread_keeps_its_own_id_in_halves_on_every_gpu: 8x8, 16x2, 4x4x4 and 64x1 store every id on both GPUs, in halves and (on the Radeon) as one wave64. Found on the way, not changed here: under main's rounding to 64, the Radeon's own wave64 stores 128 of a 64x4 group's 256 ids (32-wide groups are laid out in rows there). Marvisak#2126's per-wave tickets cover that too; once it lands, halves can take their ids from it and drop this refusal. Checks: cargo clippy --workspace --all-targets --locked -- -D warnings, and with --all-features: clean. cargo xtask policy: ok. cargo test -p victory-shader --lib -- --test-threads=1: 307 passed, 3 failed, the same 3 as on main on this NVIDIA machine; heap_direct_texture_reads_mark_their_heap_index skipped as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged Then pushed a third commit: halves now refuse group shapes that a 32-lane host wave may tile. The relabelling gives a thread the first flat id of its host wave, rounded down to 32, plus its host lane. That is right only while every host wave holds a run of consecutive ids. I ran a program in halves that stores 1 at its own id, on the RTX 3070 Ti and the Radeon iGPU. 32x2, 32x8, 64x4, 32x32 and 32x2x2 groups store half their ids on both GPUs, because the host gives a wave a 16x2 tile of the group. 8x4, 4x4, 8x8, 16x2, 16x4, 8x16, 16x16, 4x4x4, 2x2x16, 8x8x4 and one-row groups store all of them. #2126 found the same tiling on an RTX 5070 Ti for No program the title translates in halves uses such a group; they are 8x8, 8x4, 4x4 or one row, so 2,369 are still emitted. Its 32x2, 32x32 and 6x6 programs were refused already, and they would have run wrongly once the exchanges arrive. When #2126's per-wave tickets land, halves can take its ids from them and drop this refusal. New tests: |
|
Thanks for testing those group shapes on both adapters, @chippy01. The store-at-own-ID test shows where the flat-ID assumption breaks: a 16×2 tile crosses rows, and the wider groups lose half their writes. The unchanged count of 2,369 gives us a reference for |
|
I tested the single-half case on
Both Wave32 runs returned zero for the lane-7 and lane-31 masks before #2830. The two PR heads merge cleanly. Windows' built-in WARP advertises Wave4 only here and skipped both requested widths. I also compiled a standalone HLSL shader with DXC to check the remaining WARP result. With Test-only commit a5a1999. To run from the head of this PR: git fetch https://github.com/steven-seagull27/VIctory.git codex/pr2633-masked-first-lane
git cherry-pick a5a1999
cargo test -p victory-shader --lib first_lane_of_a_small_group_respects_guest_exec -- --nocapture |
|
Thanks for the minimal repro, @steven-seagull27. The 32-thread fixture reproduces the lane 7 and 31 failures within a single half, and both Wave32 runs go from 64 wrong dwords to zero with #2830. I can use I'd still like to see a native Wave64 Radeon run of the 32-thread fixture, especially whether the ballot is zero when the direct lane read returns 107. |
|
@TaynanGT I put both comparisons on one branch at 34c8e1c. It contains this PR, #2830 and the guest fixture, plus a separate HLSL shader compiled by the Windows SDK's PC DXC. It prints the actual adapter, selected wave width, ballot words, elected read, and direct read from lane 7. @zed6000 Thanks for the native Wave64 result on #1737. If your 7900 XTX is available for this one, could you post the Radeon lines for the 32-thread group and the 64-thread control? From an existing clone, the following creates a separate worktree: git fetch https://github.com/steven-seagull27/VIctory.git codex/pr2633-radeon-comparison
git worktree add --detach ../victory-2633-radeon FETCH_HEAD
cd ../victory-2633-radeon
cargo test -p victory-shader --lib first_lane_of_a_small_group_respects_guest_exec -- --nocapture
cargo test -p victory-shader --lib native_ballot_in_a_partial_wave -- --ignored --nocaptureIn the standalone test on WARP 1.0.22, 25 of the 32 threads had their own predicate missing from the Wave64 ballot. Thread 7 read |
|
Thanks for putting both fixtures on I'd look for whether Radeon also gets |
|
@steven-seagull27 I ran both tests on
For thread 7, the 4090's Wave32 ballot was The built-in WARP adapter reported Wave4 and skipped Wave32 and Wave64. |
…ounter A console program whose code reads other lanes runs in host waves of the console's size, and its threads were relabelled so that each console lane is its host lane: the flat id of the wave's first lane, rounded down to the wave size, plus the host lane. That is a bijection only while every host wave holds a run of flat ids. Hosts fill the waves of a group of several rows with tiles when its rows are 32 threads wide or more, or not a power of two wide: two waves then round to the same base, two threads share every id, and half the ids go unused. On the RTX 4070 Ti here a 32 x 2 group stored 32 of its 64 ids that way (the new card test, without the change). Such a group now takes its waves' bases from an LDS counter, as the programs run in halves and the paired form already did (wave_base): every thread zeroes it, the group meets once, each wave's first lane adds a wave. Only for groups of whole waves; a group with a part-filled wave keeps the old relabelling. Over the title's archive no program is in such a group today (counted with a temporary log line): no translation changes. The paired form was checked for upstream's two defects as well: its host group is one row and its bases come from the counter (no tiling), and its first-lane read takes the lower lane first, the upper only when no lower lane is in EXEC (the paired v_readfirstlane in lower.rs), as the console. From Marvisak/VIctory PR Marvisak#2633 (86a16dc, "in halves, a group a 32-lane host wave may tile is refused", measured on an RTX 3070 Ti and RDNA2; Marvisak#2126 for rows 24, 12 and 10 wide on an RTX 5070 Ti). Here relabelled by the counter instead of refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@TaynanGT here is the matched comparison. Same card as davesousa's, an RTX 3070 Ti 8 GB, but on driver 621.24 (theirs was 621.40). Ryzen 9 7900X, 32 GB RAM, Windows 11 26200, TDR delay at the default 2 s. Offline,
No compute program changes outcome. The guard refuses two programs, both of which In the title I couldn't get the 15-minute runs. Both builds stopped in the world, the same way:
Once the world loaded, the emulator's working set reached 20-22 GB, VRAM sat at 7.0-7.2 of 8 GB, and about 1 GB of RAM was left. Frames took seconds each (up to 15 s). Then no frame came for about a minute, and the title's own crash handler ended it ("Game Running" in its report). Both builds did this, even with most apps closed, so I read it as a limit of this machine rather than of either commit. The page file and the game data are both on a nearly full QLC SSD. davesousa's runs got through 15 minutes with the same card and RAM. Frame times from these runs aren't meaningful. In the part both runs covered, no program ran on one build and was dropped on the other. The 43 programs The captures can't answer the picture question on NVIDIA yet. In both builds the world frames show only the cutscene's subtitles and letterboxing over a flat background. Both runs log the same host refusal of a 2560x1440 texture (#797), which looks like the scene target. One more thing about |
|
Thanks for running both builds, @chippy01. The 2,369 compute programs on each build answer my question about the guard. It rejects the same two programs earlier, and the merge gets four more pixel programs through translation. The picture and frame-time comparison is still open. Both runs hit the same 2560×1440 texture refusal and ended before 15 minutes. Could you share the HRESULT and the format and flags for texture |
|
@TaynanGT it's in the logs. Both builds write the same pair of lines once per run, at the cutscene (
That's one of the two textures in #797. The other one ( On the 28 s stall: agreed, that's the save/load contention #2179 removes. It's why each build got one throwaway boot before its measured run. @steven-seagull27 thanks for the masked first-lane fixture. The wrong lanes come from |
|
Yes, please try Thanks for checking both formats. Format 86 now creates without the UAV flag, and 115 still returns |
|
@TaynanGT the debug layer can't get this title to the cutscene on this PC. With So I repeated the two calls
ID 599 is ID 817 is In the runs the castable try failed as well. Outside the emulator it only fails with a clear value in format 115, so the title most likely passes one. The emulator then falls back to the plain creation, which fails with 599. Format support (
Both adapters report |
1 similar comment
|
@TaynanGT the debug layer can't get this title to the cutscene on this PC. With So I repeated the two calls
ID 599 is ID 817 is In the runs the castable try failed as well. Outside the emulator it only fails with a clear value in format 115, so the title most likely passes one. The emulator then falls back to the plain creation, which fails with 599. Format support (
Both adapters report |
The problem
A console wave64 compute program that needs the console's lanes (cross-lane reads, masks read as numbers, LDS one wave shares) declares
WaveSize(64). NVIDIA and Intel run waves of at most 32 lanes (WaveLaneCountMax32) and refuse it. On an RTX 3070 Ti the debug layer says:and the pipeline is refused with
E_INVALIDARG. A Series S run to the loading screen refused 100 compute pipelines; 95 of them were for this reason.The change
On such a host, a wave64 program that needs the console's lanes is translated for waves of 32 ("halves",
emit::lower::halves, set byemit::Options::host_wave32):2w + hholds lanes32h..32h + 31of console wavew.ds_swizzle, andds_bpermute_b32, which the console's wave64 permutes within each half on its own (RDNA2 ISA; measured on RDNA2 in Shaders: scope wave64 ds_bpermute_b32 to 32-lane halves #573). A lane's bit of a mask held as a number,v_writelane_b32,v_mbcntand the row a DPP row mask names take the console lane, so lane 32 tests bit 0 of the high dword and is in row 2.v_readlane_b32of a lane that may be in the other half, and whole-wave reductions and prefix sums. Each refusal gives a reason that names the host. A crossing value the program never uses costs nothing (the lowering's retry with the value missing), so a program is refused only when it really needs the read.v_readfirstlane_b32reads the host wave's first lane, which in the upper half is console lane 32 or later. It is kept for a value proven the same in every lane of the console wave (halves::lane_uniform: what the console compiler reads first lanes for) and in groups of 32 threads or fewer, which one host wave holds whole. Any other first-lane read is refused with its reason.victory-gpuasks the device once (D3D12_OPTIONS1) and translates for it. The shader cache keys on it, so entries made for 64-lane hosts are never read on a 32-lane one, or the other way round.victory translate --wave32translates for such a host offline; with--pipelinesit follows the GPU that makes them.New code lives in
emit/lower/halves.rs(lower.rsstays at 494 KB, under the policy's 512 KiB cap).Evidence
victory translate --list --pipelinesovershaders.rpf, the executable,XboxBvhBuilder.dllandamd_fidelityfx_upscaler_xbox.dllon an RTX 3070 Ti (driver 32.0.16.2124), Windows 11:67e8ae1main842b0cbmerged (f60027f) and the third commit: 2,369 compute programs emitted and 2,369 pipelines made, none refused by the driver; vertex/pixel 14,258 and mesh 8,765 (main's own changes add four vertex/pixel programs).depth_pyramid:*, occlusion), the sky and atmosphere gathers (scattering_transmittance_system:*, the sky radiance cache),shader_binning_utils, the mipmap generators and fire/particle lighting.maindeclaresWaveSize(64)and this driver refuses, so no pipeline made onmainis lost.In the title (Series S mode, diagnostics build, to the loading screen, 2.5 min): no pipeline refused (main: 100). The 113 programs that do not translate give their reason (51 LDS, most of the rest ballots).
Tests
emit::halves_tests(new):wave64_programs_in_halves_match_the_console_on_every_gpu: one wave64 program (DPP,ds_swizzle,ds_bpermute,v_mbcnt,v_writelaneto lane 40, a constant mask's high dword) runs on every hardware adapter: in halves everywhere, and as one wave64 where the adapter has 64-lane waves. All 64 lanes give the console's results on:reads_across_32_lane_halves_are_refused_with_their_reason,lds_of_a_one_wave64_group_is_refused_in_halves,a_wave64_program_reading_lanes_declares_32_lane_waves_in_halves: offline.dpp_row_masks_name_the_console_rows_on_every_gpu:row_mask:0xc(rows 2 and 3, lanes 32-63). Before the fix in this PR's second commit, lanes 32-63 kept their old value in halves on both GPUs (32 of 64 wrong).first_lanes_kept_in_halves_match_the_console_on_every_gpu: the thread id's first lane in a group of 32, andl >> 6in a group of 128 (one value per console wave). Before that fix, the thread id's first lane in a group of 64 gave 32 in lanes 32-63 on both GPUs (the console gives 0); it is refused now.groups_a_host_wave_may_tile_are_refused_in_halves(offline) andevery_thread_keeps_its_own_id_in_halves_on_every_gpu: 32x2, 64x4, 32x2x2 and 6x6 groups are refused; 8x8, 16x2, 4x4x4 and 64x1 store every thread's id on both GPUs, in halves and (Radeon) as one wave64.the_test_programs_are_what_their_comments_say: the hand-encoded words checked against the disassembler.shader_cache::tests::the_key_covers_translator_encoding_and_settingsnow covers the wave width.emit::host::Host::each_hardware(test host) lists every hardware adapter, so a test can compare GPUs of different wave widths on one machine.Checks:
cargo clippy --workspace --all-targets --locked -- -D warningsand the same with--all-features: clean.cargo xtask policy: ok.cargo test -p victory-shader --lib -- --test-threads=1: 307 passed, 3 failed (onmain842b0cbmerged); main67e8ae1: 266 passed, the same 3 failed on this NVIDIA machine (stride_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).memory_tests::heap_direct_texture_reads_mark_their_heap_indexcrashes the test process (access violation) on main here too, so it was skipped in both runs.victory-gpu:dynamic_slots_are_held_until_releasedandlists_share_a_table_and_copies_keep_their_viewsfail on main and here alike (the 1,000,000-view heap cap, #1835).Related pull requests
This overlaps #189, #192, #233, #1960 and #2176 (wave64 on 32-lane hosts) and #578 (refusing them). It differs in two ways: cross-half reads are refused at the site that makes them, with a reason, instead of by instruction name (programs whose crossing value is unused still translate), and halves are checked against the console's own wave64 on an RDNA2 adapter in the same test. The cache-key idea is #2176's (n-romanovich). It does not change
ds_bpermute_b32for 64-lane hosts, which is #573's.Credits
5f4c3df,set_host_max_wave), which credits the victory-world-runtime line (ZSlayerHQ and contributors). Here it is written anew on main as a translation option.ds_bpermute_b32within halves: Shaders: scope wave64 ds_bpermute_b32 to 32-lane halves #573 (banbanzhige) and the RDNA2 measurements in its thread.halves::lane_uniform), and the first-lane bug report: justrealyme (Shaders: in halves, a first lane is read only of a value alike in both halves chippy01/VIctory#1), ported from fxceless/victory-fork (GPU: keep what shaders may write by page, in reused page buffers #497 there).Found on the way, not changed here
A wave64 mask built by two
s_mov_b32(low and high dword written apart) reads its low dword for all 64 lanes:Lower::pair_highlooks for the high dword in the instruction that wrote the low one. The test shows it the same way on AMD's own wave64 and in halves, so it is not this change's.AI-assisted (Co-authored by Claude Opus 5.5 Max) and measured on my own machine.