Shaders: wave64 compute programs run in 32-lane halves on hosts of 32-lane waves #2633
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!2633
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2633"
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?
@chippy01 on GitHub · 2026-11-25 17:15 UTC · original
chippy01:shaders/wave64-in-32-lane-halves→main· +1446 −79 · 19 files · 4 commits · openThe 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 #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: #573 (banbanzhige) and the RDNA2 measurements in its thread.halves::lane_uniform), and the first-lane bug report: justrealyme (chippy01/VIctory#1), ported from fxceless/victory-fork (#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.
842b0cb) into shaders/wave64-in-32-lane-halves f60027f085@Aniseto on GitHub · 2026-11-25 17:17 UTC · original · edited 2026-11-25 17:31 UTC
Ran the new halves tests at
a7e78c1(clean PR head onmain13f91ca):System
rust-toolchain.toml), MSVC 14.44.35207, DXIL validator from the Windows SDK default path (this filter does not print its version), debug buildResults
cargo test --locked -p victory-shader --lib emit::halves_tests -- --test-threads=1 --nocapture: 5 passed, 0 failed, 0 ignored, 273 filtered out (exit 0)wave64_programs_in_halves_match_the_console_on_every_gpuprinted:NVIDIA GeForce RTX 5070 Ti (halves): 0 lanes of 64 differ from the console, andNVIDIA GeForce RTX 5070 Ti (wave64): no pipeline for 64-lane waves; skipped, twice (both adapters in the host list).What this adds
The author's hardware evidence in the thread is an Ampere RTX 3070 Ti plus an RDNA2 iGPU. This adds a Blackwell wave32 part: the GPU parity test ran here and all 64 lanes matched the console's result in the halves form, while the 64-lane form was refused by the adapter as expected. The other four halves tests also pass.
Not tested
The whole
victory-shaderlibrary (the description lists three pre-existing failures on NVIDIA),victory-gpu, the retail shader-pack census, a title run, the console compiler, release profile, Intel GPUs and native-wave64 hardware.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
25db879): relative to the head I tested (a7e78c1), the new commit only changes README.md; no shader code changed. Re-ran the same command at25db879:Same GPU output:
NVIDIA GeForce RTX 5070 Ti (halves): 0 lanes of 64 differ from the console, and the 64-lane form skipped because this adapter has no 64-lane waves.@kotekompotek on GitHub · 2026-11-25 17:49 UTC · original
Heads-up: the README hunk contains a committed merge conflict —
<<<<<<< HEAD/=======/>>>>>>> a7e78c1markers are in the diff (GPU: world + Shaders table rows). The branch needs a rebase resolving that hunk (keep the new wave64-halves text), otherwise the table renders the raw markers.The actual change —
--wave32translate flag conflicting with--cache, wave64 split halves on 32-lane hosts — looks right otherwise; CI green.@chippy01 on GitHub · 2026-11-25 17:56 UTC · original
My bad, I just fixed it
@sergiocr06 on GitHub · 2026-11-25 18:01 UTC · original
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
wave64_programs_in_halves_match_the_console_on_every_gpuchecks all three paths on one box. PR head25db879onmain13f91ca.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
victory-shader --lib:13f91ca--skip heap_direct_texture_reads_mark_their_heap_index, #2571)The 3 are the known NVIDIA failures (#1835):
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. No regression on either GPU.Note for hybrid-laptop testers:
Host::newin the test host takes the first adapter with dedicated memory. On this laptop that is the 780M (it reports a 417 MB carve-out), so a plaincargo testruns the single-adapter hardware tests on the iGPU, not the NVIDIA card. I forced the dGPU with a per-exe GPU preference (HKCU\Software\Microsoft\DirectX\UserGpuPreferences,GpuPreference=2;) and confirmed withnvidia-smithat the test process was on it.AI-assisted (Claude Code); the runs were done on my machine.
@justrealyme on GitHub · 2026-11-25 18:09 UTC · original
Tested this on an RTX 5070 Ti (driver 621.40, Windows 11). The halves tests pass here too. I found one wrong result, though:
v_readfirstlane_b32in halves reads the host wave's first lane, which is console lane 32 for the upper half. Dispatched in halves (withv_mbcntso the program has console lanes),v_readfirstlane_b32 s12, v0gives 32 in all 32 upper lanes; the console gives 0.Fix with tests: chippy01/VIctory#1 (onto this branch, rebased on
360f8aa). It keeps the first-lane read only for values proven alike across the console wave, ported from the analysis in fxceless/victory-fork, and refuses the rest with a reason. Offline over the title, 12 of 2,372 compute programs drop out with that reason; nothing else changes. On the GPU, alike values give 0 of 128 lanes wrong on the 5070 Ti and the Intel iGPU.AI-assisted (Claude Code); no game data.
@KainanP on GitHub · 2026-11-25 18:17 UTC · original
On a machine that also has a 16-lane Intel iGPU (UHD
8086:a78b,WaveLaneCount16..16),wave64_programs_in_halves_match_the_console_on_every_gpufails withIntel(R) UHD Graphics (halves): no pipeline, becauseeach_hardware()lists the iGPU and that driver refusesWaveSize(32)too. On that device the PR also keepsWaveSize(64), which is refused. On the RTX 4060 the halves form is exact (0 of 64 lanes differ). Details and table: #2220AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this.
@chippy01 on GitHub · 2026-11-25 18:37 UTC · original · edited 2026-11-25 18:59 UTC
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.
In my opinion, addressing the underlying problem at its root is a better approach than introducing workarounds to bypass its limitations.
If this PR doesn't get merged, I'll still try to pursue at least one of these approaches, applying it to whichever alternative PR gets merged.
If anyone has any ideas or suggestions, I'll be glad to listen.
@Mericas77 on GitHub · 2026-11-25 18:51 UTC · original
Tested on NVIDIA: RTX 4070 (the only adapter), driver 621.01, Windows 11, rustc 1.98.1. Head
360f8aaagainstmain13f91ca. That's an Ada card, a generation after the 3070 Ti in the description.halves_tests(--test-threads=1): 5/5 pass.wave64_programs_in_halves_match_the_console_on_every_gpuprints(halves): 0 lanes of 64 differ from the consoleand(wave64): no pipeline for 64-lane waves; skipped, which is the expected result on a 32-lane host.victory-shader --lib(with--skip heap_direct_texture_reads_mark_their_heap_index, #2571): 271 passed / 3 failed. That'smain's 266 plus the 5 new tests, and the same 3 known NVIDIA failures (a_heap_buffer_read_by_element_takes_the_views_stride,a_heap_buffer_read_where_no_buffer_view_is_reads_zeros,gathers_at_a_level_match_the_hardware).victory-gpu: 193 passed / 2 failed, the same asmain(the two 1,000,000-view heap-cap tests).No regression on Ada. No game data; the title was not run.
AI-assisted.
@TaynanGT on GitHub · 2026-11-25 20:15 UTC · original
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.
victory translate --list --pipelinesover the same four inputs as in the description,main13f91caagainst this PR360f8aa, pipelines made on the RTX 4090:mainEvery pipeline made on
main(25,347) is made here too, and 44 are new. The programs this PR refuses give their reason: 192 LDS in a one-wave group, 107 ballots, 48 lane reads across halves, 20 reductions.halves_testswith--nocapture, which lists both adapters:cargo test --release -p victory-shader --lib -- --test-threads=1, skippingmemory_tests::heap_direct_texture_reads_mark_their_heap_indexas in the description:main266 passed and 3 failed, this PR 271 passed and the same 3 failed (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).@qtLkz on GitHub · 2026-11-25 20:53 UTC · original
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
13f91ca(clean merge).cargo test -p victory-shader --lib --locked -- --test-threads=1 --skip heap_direct_texture_reads_mark_their_heap_index(The skipped test crashes the NVIDIA driver on main, #2571. The fix is in #2596 / #2587.)
All 5 new tests pass:
halves_tests::wave64_programs_in_halves_match_the_console_on_every_gpu ... okhalves_tests::a_wave64_program_reading_lanes_declares_32_lane_waves_in_halves ... okhalves_tests::reads_across_32_lane_halves_are_refused_with_their_reason ... okhalves_tests::lds_of_a_one_wave64_group_is_refused_in_halves ... okhalves_tests::the_test_program_is_what_its_comments_say ... okWhole lib: 271 passed, 3 failed, 3 ignored. The 3 failures (
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) fail the same way on plain main on this card (#2317). Nothing new from this PR.So in addition to the RTX 3070 Ti (Ampere) in the description, the halves path checks out on Ada.
AI-assisted (Claude).
@chippy01 on GitHub · 2026-11-25 20:59 UTC · original
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:
First-lane reads. Thanks @justrealyme for the report and the fix in chippy01/VIctory#1; it's folded into this commit with you as co-author.
v_readfirstlane_b32read the host wave's first lane, which for the upper half is console lane 32. Reproduced here on the RTX 3070 Ti and the Radeon iGPU: the first lane of the thread id gave 32 in lanes 32-63, where the console gives 0. The Radeon's own wave64 form gave 0. A first-lane read is now kept only for values proven the same in every lane of the console wave. The analysis gains two cases:Every other first-lane read is refused with its reason. Offline over the title, compute programs emitted go from 2,372 to 2,369. The 3 dropped read values that can really differ between halves: the cloud multiple-scattering cache, for example, reads a value joined from a branch on a per-lane compare.
DPP row masks. The row came from the host lane (0-1), so the upper half applied
row_maskbits 0-1 to console rows 2-3. Withrow_mask:0xc, lanes 32-63 kept their old value on both GPUs (32 of 64 lanes wrong); now 0 are. No program in this title uses such a mask in halves, so none of its translations change.New GPU tests:
dpp_row_masks_name_the_console_rows_on_every_gpuandfirst_lanes_kept_in_halves_match_the_console_on_every_gpu. The refusal cases are inreads_across_32_lane_halves_are_refused_with_their_reason.victory-shader --lib: 273 passed, with the same 3 NVIDIA failures asmain. Clippy (both runs) andcargo xtask policyare clean.The refused first-lane reads come back exactly once the two host waves can exchange values, which is the follow-up mentioned above.
@TaynanGT on GitHub · 2026-11-25 21:16 UTC · original
Thanks, @qtLkz, for running the five tests on the RTX 4070 Ti, and @chippy01 for the first-lane and DPP row-mask fixes. My RTX 4090 results above are from
360f8aa, before the follow-up. The 2,372 compute programs in that table are from that earlier revision.@Marvisak on GitHub · 2026-11-25 22:16 UTC · original · edited 2026-11-26 00:24 UTC
Automated triage for the maintainers.
Needs the maintainer's decision, plus one small fix. The rebase merges cleanly and CI
checkis passing. The approach is gated byemit::Options::host_wave32, which is set fromHost::wave32(D3D12_OPTIONS1, at most 32 lanes with 32 among them). It runs console wave64 compute programs as two 32-lane host waves. Reads across halves, LDS in one-wave groups, unproven first-lane reads, and tile-prone group shapes are refused with reasons inemit/lower/halves.rs. The shader cache key incrates/victory-gpu/src/shader_cache.rsnow includes the wave width. Several testers report the halves tests exact on NVIDIA Ampere/Ada/Blackwell and on RDNA2/RDNA3 (where they also match the native wave64 form).wave64_programs_in_halves_match_the_console_on_every_gpu(andevery_thread_keeps_its_own_id_in_halves_on_every_gpu) inemit/halves_tests.rsiterateHost::each_hardware(), which also lists 16-lane-only adapters. There both forms are refused and theassert!(*form == "wave64" && wave32, ...)fires, as reported in the thread on an Intel UHD iGPU. Please skip adapters where the halves form cannot be made, the same way the 64-lane form is skipped.On your reply: the third commit's refusal of group shapes a host wave may tile, and the merge of
main(using #573'sds_bpermute_b32within halves), read correctly.Generated by Claude Code
@davesousa on GitHub · 2026-11-25 23:22 UTC · original
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.
diagbuild,VICTORY_D3D12_DRED=1. The base is13f91ca+ #2319 + #1906 + #2178 (without those, this card does not get through the world on NVIDIA; #1906 is inmainnow). This PR atb15a57b; the only conflict there wasshader_cache.rsagainst #2178 (each adds a key parameter; I kept both). Cache and pipelines rebuilt for each build. These runs are of your two commits before your merge ofmain(f60027f); the conflict resolution in that merge is not covered here.Offline (
translate --cache --pipelines, same four inputs), on the base and then with this PR: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.
emit::halves_testspasses 7/7 here: (halves) 0 lanes of 64 differ from the console, and the wave64 form is skipped as expected.victory-shader --libandvictory-gpu --libshow no new failures against the base.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.
@TaynanGT on GitHub · 2026-11-25 23:23 UTC · original
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
b15a57bon the stack you listed. A matched run onf60027fwith screenshots would show whether those results held after the merge and what the nine newly running programs actually draw.@chippy01 on GitHub · 2026-11-25 23:45 UTC · original
Merged
main(842b0cb) inf60027f.main's ownds_bpermute_b32lowering from #573 already reads within the reader's half, so it replaces the halves-onlypermute_lanes. TheHosttest helpers now sit onmain's shared WARP device. Nothing measured changes.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
main's 32-lane programs.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:
groups_a_host_wave_may_tile_are_refused_in_halvesandevery_thread_keeps_its_own_id_in_halves_on_every_gpu.victory-shader --lib: 307 passed on the merged head, with the same 3 NVIDIA failures asmain.@TaynanGT on GitHub · 2026-11-25 23:53 UTC · original
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
86a16dc. A matched run of that head andb15a57bcan check whether the picture and frame times still agree after the merge and the new guard.@steven-seagull27 on GitHub · 2026-11-26 02:20 UTC · original
I tested the single-half case on
86a16dc. A 32-thread group fits entirely inside one Wave32. The guest compares the thread ID, saves and narrows EXEC, runsv_readfirstlane_b32 s12, v0, restores EXEC, and writes the scalar from all 32 threads. There is no branch or second half. The four masks select lane 0, lane 7, lane 31, or no lanes (the lane-zero fallback).36eb5f6)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
[WaveSize(64)], 32 threads per group, andtid = SV_GroupIndex, thread 7 reported an all-zeroWaveActiveBallot(tid >= 7). A directWaveReadLaneAt(100 + tid, 7)in the same shader returned 107. Changing only the group size to 64 produced ballot wordsffffff80 ffffffffand elected lane 7. A native Wave64 Radeon readback on the 32-thread fixture would help distinguish the WARP result.Test-only commit a5a1999. To run from the head of this PR:
@TaynanGT on GitHub · 2026-11-26 02:24 UTC · original
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
a5a1999for the same comparison on my 4090.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.
@steven-seagull27 on GitHub · 2026-11-26 02:35 UTC · original
@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:
In 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
100through the elected lane and107directly from lane 7. Increasing only the group size to 64 gave107both ways and 0/64 wrong. On the RTX 5080, Wave32 had zero wrong for both group sizes. The standalone test prints all adapter/width results before reporting any mismatches.@TaynanGT on GitHub · 2026-11-26 02:38 UTC · original
Thanks for putting both fixtures on
34c8e1c, @steven-seagull27. I can use that head for the 4090 check and report the actual wave width with the ballot and both reads.I'd look for whether Radeon also gets
100from the elected lane and107from lane 7 with 32 threads, then107both ways with 64. That would show whether the WARP result also reproduces on native Wave64 hardware.@TaynanGT on GitHub · 2026-11-26 02:46 UTC · original
@steven-seagull27 I ran both tests on
34c8e1c. The guest first-lane test matched all four masks on the RTX 4090 in Wave32 and on the Ryzen 9 9950X3D's integrated Radeon in Wave32 and native Wave64.For thread 7, the 4090's Wave32 ballot was
ffffff80 00000000with either group size. On the Radeon in Wave64, it wasffffff80 00000000with 32 threads andffffff80 ffffffffwith 64. In all of those runs, lane 7 was elected and both reads returned107.The built-in WARP adapter reported Wave4 and skipped Wave32 and Wave64.
@chippy01 on GitHub · 2026-11-26 09:14 UTC · original
@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.
diagbuilds,VICTORY_D3D12_DRED=1,--console series-x.b15a57bis on davesousa's stack (+ #2319 + #1906 + #2178).86a16dchas #2319 + #2178; #1906 comes with the merge.shader_cache.rskeeps both key parameters, as davesousa did. Cache and pipelines were rebuilt for each build.Offline,
translate --cache --pipelineson the same four inputs:b15a57b86a16dcb15a57breproduces davesousa's column exactly.translate --list --wave32on the same inputs, program by program:b15a57b86a16dcNo compute program changes outcome. The guard refuses two programs, both of which
b15a57balready refused for a lane mask read as data. The guard now stops them before that check. The other halves reasons have the same counts on both builds: 192 LDS, 48 lane reads across halves, 20 reductions, 17 first-lane reads. Four pixel programs change outcome:b15a57brefused them for a lane mask read as data, and they translate after the merge.In the title I couldn't get the 15-minute runs. Both builds stopped in the world, the same way:
b15a57b86a16dcOnce 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
86a16dcrefused in its run all give halves reasons; none of them is the new tile-prone-group refusal.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
b15a57b's stack. Its first boot on a fresh library hung for 28 s shortly after a library save, and the title crashed itself in "Game Init".b15a57bdoesn't have #2179, so a pipeline load waits while a save serialises the whole ~1 GB library.86a16dcgets #2179 with the merge. The hang didn't happen on every first boot. To keep the two builds alike, each got one throwaway boot on its fresh library before its run.@TaynanGT on GitHub · 2026-11-26 09:21 UTC · original
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
#797if they're in the log? The 28-second fresh-library stall also fits the save/load contention that #2179 addresses.@chippy01 on GitHub · 2026-11-26 09:48 UTC · original
@TaynanGT it's in the logs. Both builds write the same pair of lines once per run, at the cutscene (
b15a57bat 08:40:10,86a16dcat 08:52:16):0x80070057(E_INVALIDARG; "Parametro non corretto" is the Italian system text). It comes back on both tries: first with castable formats, then as a plain texture.TEXTURE2D, 2560x1440, 1 mip, 1 slice, 1 sample.format: 115isDXGI_FORMAT_B4G4R4A4_UNORMandflags: 1isD3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET.VICTORY_D3D12_DEBUG=1if you want the debug layer's own reason.That's one of the two textures in #797. The other one (
format: 86,B5G5R5A1_UNORM,flags: 5) is created in both runs now.mainmakes it without unordered access; the log line just before the refusal isno unordered access for this format: textures are made without it, their unordered views are refused format=86. So on this card only the 115 texture is still refused.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
main's lowering, not from the halves. An instruction with a scalar destination drops its EXEC guard, so under a narrowed EXECv_readfirstlane_b32reads the host wave's lane 0 on any host. #2830 fixes that onmain, and with it the halves path matches (TaynanGT's run on the 4090 and the Radeon iGPU at34c8e1c). I'll leave that fix to #2830 rather than duplicate it here.@TaynanGT on GitHub · 2026-11-26 09:50 UTC · original
Yes, please try
VICTORY_D3D12_DEBUG=1on86a16dc, @chippy01. A run to the cutscene is enough. Could you paste the debug-layer message ID and text for the plain creation of theB4G4R4A4_UNORMrender target?Thanks for checking both formats. Format 86 now creates without the UAV flag, and 115 still returns
E_INVALIDARGon the plain path. If you already have a format-support dump, could you include theD3D12_FORMAT_SUPPORT1_RENDER_TARGETbit for 115?@chippy01 on GitHub · 2026-11-26 12:56 UTC · original
@TaynanGT the debug layer can't get this title to the cutscene on this PC. With
VICTORY_D3D12_DEBUG=1,86a16dc(the same diag build and stack as the matched run) stopped in Game Init. The boot's descriptor work went several times slower than without the debug layer: a few thousand title-slot warnings per 10 s instead of 40,000-85,000. The title's own watchdog ended the run at 79 s. Its deliberate write at+0x2215c35left a crash report that saysGame State: Game Init,Frame: 0. Without the debug layer the emulator gets to that texture at 81 s.So I repeated the two calls
make_texturemakes for that texture outside the emulator, with the debug layer on. The arguments are the same: 2560x1440, 1 mip,B4G4R4A4_UNORM,ALLOW_RENDER_TARGET, default heap. The castable list is whatcastable(115)gives (formats 49-52, 54, 56-59, 68, 69, 85, 86).CreateCommittedResource3with those castable formats and a clear value in format 115E_INVALIDARG, ID 817CreateCommittedResource3with the same castable formats, no clear valueCreateCommittedResource(plain), with or without that clear valueE_INVALIDARG, ID 599ID 599 is
D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDMISCFLAGS(severityERROR, categorySTATE_CREATION):ID 817 is
D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDCLEARVALUEFORMAT: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 (
CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT)):B4G4R4A4_UNORM,Support10x008413f0,RENDER_TARGETclear0x02e4d3f0,RENDER_TARGETsetB5G5R5A1_UNORM,Support10x00e4d3f0,RENDER_TARGETset0x02e4d3f0,RENDER_TARGETsetBoth adapters report
RelaxedFormatCastingSupported. So on this card 115 can never be a render target format, but the castable texture is accepted once the clear value in 115 is left out. I haven't tested whether its render target views work in one of the castable formats.@chippy01 on GitHub · 2026-11-26 14:01 UTC · original
@TaynanGT the debug layer can't get this title to the cutscene on this PC. With
VICTORY_D3D12_DEBUG=1,86a16dc(the same diag build and stack as the matched run) stopped in Game Init. The boot's descriptor work went several times slower than without the debug layer: a few thousand title-slot warnings per 10 s instead of 40,000-85,000. The title's own watchdog ended the run at 79 s. Its deliberate write at+0x2215c35left a crash report that saysGame State: Game Init,Frame: 0. Without the debug layer the emulator gets to that texture at 81 s.So I repeated the two calls
make_texturemakes for that texture outside the emulator, with the debug layer on. The arguments are the same: 2560x1440, 1 mip,B4G4R4A4_UNORM,ALLOW_RENDER_TARGET, default heap. The castable list is whatcastable(115)gives (formats 49-52, 54, 56-59, 68, 69, 85, 86).CreateCommittedResource3with those castable formats and a clear value in format 115E_INVALIDARG, ID 817CreateCommittedResource3with the same castable formats, no clear valueCreateCommittedResource(plain), with or without that clear valueE_INVALIDARG, ID 599ID 599 is
D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDMISCFLAGS(severityERROR, categorySTATE_CREATION):ID 817 is
D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDCLEARVALUEFORMAT: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 (
CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT)):B4G4R4A4_UNORM,Support10x008413f0,RENDER_TARGETclear0x02e4d3f0,RENDER_TARGETsetB5G5R5A1_UNORM,Support10x00e4d3f0,RENDER_TARGETset0x02e4d3f0,RENDER_TARGETsetBoth adapters report
RelaxedFormatCastingSupported. So on this card 115 can never be a render target format, but the castable texture is accepted once the clear value in 115 is left out. I haven't tested whether its render target views work in one of the castable formats.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.