Repository navigation
Conversation
… wave size A compute program reading other lanes declared the console's WaveSize(32) or WaveSize(64), so hosts without that size refused it: NVIDIA every wave64 one, a 16-lane Intel iGPU and WARP both sizes. When every cross-lane read stays inside an aligned group of G lanes smaller than the wave (DPP quad_perm, DPP8 and row controls, ds_swizzle in quad mode or with a narrow bitmask), host waves of at least G lanes give each group the same lanes: such a program declares no wave size, takes its thread ids by the host's wave size, and carries min_lanes = G, which the runtime checks against the host's WaveLaneCountMin before making the pipeline. Programs that also use s_barrier, LDS, lane masks as data, v_mbcnt, readlane/writelane, permutes, v_permlane* or whole-wave sections keep WaveSize, and their DXIL is unchanged. A narrow attempt that fails to lower is redone whole-wave. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC, with dxil.dll validator):
cargo test -p victory-shader --lib wave— 14 passed, 0 failed (includingshaders_reading_lane_groups_need_host_waves_that_hold_them)cargo clippy -p victory-shader --all-targets— 0 warningscargo xtask policy— ok (184 files ok)
Clean refinement omitting WaveSize when compute lane reads stay within aligned groups, improving Wave32/NVIDIA compatibility while guarding host minimum wave lanes. Looks great.
AI-assisted (Gemini 4 Neon).
|
A remaining narrow-wave case on b3b5c93: DPP16 row_xmask:3 selects lane XOR 3, which stays within each four-lane group. The current classifier assigns it 16 lanes and excludes four-lane WARP. ISA modifier semantics 571b78a sizes this lane group from the mask in one commit on that exact head. The same synthetic dispatch test skipped WARP and failed before. After, the compiled shader ran on WARP for guest wave32 and wave64. All 128 readbacks for each mode matched the lane oracle, including old destination values in masked rows and banks. Full forced-WARP shader suite: 250 passed, 4 failed, 3 ignored before. After: 251 passed, 3 failed, 3 ignored. The gather, lane-permute and edge-flagged triangle failures were shared. Strict shader Clippy and staged asset policy passed. |
|
This and #2126 rewrite the same arithmetic, they conflict, and one may be a precondition of the other Two pull requests in the same window are changing how a thread's lane is arranged for cross-lane reads, and they are not independent. Measured: they conflict, in the one file where it matters: #2126 ( The question that decides how they land is about your premise for narrow groups. The argument for "an aligned group of So:
I am not asking for both to be merged together; I am asking for the sentence that says which mechanism owns the 2-D case. At the moment two of them claim it and they disagree by construction. A note on the evidence, since it decides what a reviewer can check: No game data is involved: file names, hosts and counts. Written with an AI assistant. |
catminou4
left a comment
There was a problem hiding this comment.
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f, cargo test -p victory-shader --locked.
144 passed / 0 failed / 2 ignored. Compute reading lanes only within aligned groups declares... — lane-group constraint declaration; mixed gpu+shader.
|
Automated triage for the maintainers. The lane-group table in This needs one of two changes: limit narrowing to 1-D groups ( Generated by Claude Code |
|
Data for the triage's 2-D question, from an Intel UHD (Xe-LP, 16-lane waves). This head's 6 new tests pass there (the wave64-half test skips), and they all use a 1-D group. #2126's wave-layout probe on the same iGPU, without AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this. |
Claimed in #1633 (claim).
Problem
A compute program that reads other lanes declares the console's exact wave size (
lower.rs, theconsole_lanesdecision;WaveSize(32)orWaveSize(64)). A host refuses aWaveSizeoutside its[WaveLaneCountMin, WaveLaneCountMax]:Many such reads never leave a small aligned group of lanes, though: DPP
quad_permstays in a quad, DPP8 in 8 lanes, DPP row controls in 16,ds_swizzlein quad mode in a quad and in bitmask mode in 2^(highest lane bit it changes + 1). Any host wave of at least G lanes, aligned on G, gives each group the same lanes, whatever the host's wave size.Change
lane_groupgives each instruction the aligned group it reads (table below). When the widest group G of a compute program is smaller than the console wave N, and nothing in it needs the whole wave, the program declares noWaveSizeandLowered/HostShadercarrymin_lanes = G.waveGetLaneCount) instead of the constant N (narrow_thread_id,lane_thread), on the same assumptionthread_idmakes today: a host wave holds an aligned run of flat thread ids. DPProw_mask/bank_maskand constant lane bits take the console lane from the relabelled id (console_lane).victory-gpu:Host::wave_lanes_minreadsOPTIONS1once (logged), and a compute pipeline whose shader hasmin_lanesabove it is refused as "the host GPU's waves are narrower than the lane groups the shader reads".min_lanesis in the shader cache entry.quad_perm,ds_swizzlequad moderow_shl/shr/ror,row_mirror,row_half_mirror,row_share,row_xmaskds_swizzlebitmask modev_mbcnt*,v_readlane/v_writelane, masks read as dataKept whole-wave (declaring
WaveSizeexactly as before): programs withs_barrier(a host wave whose lanes all skip it would hang the host, where the console's wave still arrives), any LDS use (the console compiler leaves out barriers within one wave, so an intra-wave LDS exchange would race across host waves),v_permlane*, av_readfirstlanethat isn't a waterfall read, opaque or constant lane-mask guards, one-wave groups with LDS, and whole-wave sections. A narrow attempt that fails to lower for any reason, or reads a lane mask as data, is lowered again whole-wave, so narrowing never makes a program fail that translates today.Unchanged for every other program: the narrow path is separate (
thread_idgets one early branch). Hashinglowered.dxilfor every input the shader suite lowers, onmain940d32f and on this branch: all 484 thatmainlowers whole-wave or lane-free give byte-identical DXIL; only the new tests' narrow programs differ.Tested
Intel UHD Graphics (driver 31.0.101.4146), RTX 4050 Laptop (595.97) and WARP, Windows 11. New module
emit::lane_group_tests; each GPU test reads back 128 threads lane by lane against a CPU model of the console, with encodings checked against the decoder's text and DXIL validated.quad_reads_run_on_any_host_wave(wave32 + wave64:quad_permwith row/bank masks, quad swizzle)row_reads_run_on_host_waves_of_16_lanes(row_shr:3with masks,row_mirror, DPP8, swizzle xor)half_reads_of_wave64_run_on_host_waves_of_32_laneslane_groups_set_the_fewest_host_lanes,reads_of_the_whole_wave_keep_its_size(readlane, mbcnt, readfirstlane,s_barrier, a whole-wave section),lds_shared_within_the_wave_keeps_its_sizepipeline::host::tests::shaders_reading_lane_groups_need_host_waves_that_hold_themThe RTX 4050 ran through a local, uncommitted switch of the test host to the high-performance adapter. Breaking the console-lane computation, the section fallback or the barrier/LDS rules each makes a test fail.
cargo test -p victory-shader --libon the Intel UHD: 244 passed, 9 failed;main: 238 passed, the same 9 failures (all covered by other open PRs, see Test report: Intel UHD (Raptor Lake Xe-LP), 70564ae: victory-shader 201 passed, 8 failed (3 missing-feature skips, 5 different results) #1829).cargo test -p victory-gpu --lib: 141 passed, 3 failed;main: 140 passed, the same 3.cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings, with and without--all-features: clean.cargo check --workspace --all-targets: clean.rustfmt --check: no diffs in the new hunks; the new test file is clean.cargo xtask policy: ok.Overlap: #1922's gate refuses wave64 compute without a declared wave size on hosts under 64 lanes; with this PR the narrow wave64 programs are such programs, so the two need reconciling (whichever lands second). #2035 (barrier sync on narrow waves) is orthogonal: programs with barriers don't narrow here.
Not run: the title, AMD hardware (a 32-64 lane host runs narrow programs at the driver's choice of size), and how many of the title's programs narrow. Programs with LDS or barriers, likely the bulk of lane-dependent compute, are deliberately left as they are.
AI-assisted (Claude Code).
🤖 Generated with Claude Code