diff options
| author | Zack <zmasi21@gmail.com> | 2026-11-28 20:37:00 -0800 |
|---|---|---|
| committer | Zack <zmasi21@gmail.com> | 2026-11-28 20:37:00 -0800 |
| commit | e10e9d007e3a727a475ed0963531685d44a517f5 (patch) | |
| tree | afbf19d82ae8f60386d1a9b50817785991fbc1f2 /runtime/src/xma2_decoder.cpp | |
| parent | ef329958483832297acb53e68be94b439e88a90e (diff) | |
d3d12/shader: paired Wave64 exactness, LDS coverage, and loop convergence
Fixes six Wave64-on-Wave32 translation and lowering gaps across
`d3d12/crates/leonida-shader/src/emit/{mod.rs, wave.rs, paired.rs, lower.rs}`:
1. Host half-wave loop convergence & natural-loop region tracking:
- Default `LEONIDA_LOOPS_WAVE` to `1` when unset (`0` opts out) so Wave64
compute shaders on 32-lane hosts keep each host half-wave converged
across per-lane loops before post-loop ballots, exchanges, and
first-lane reads (`CS_TransmissionVolumetrics_GenerateTiles` and tile
classifiers; after trustno1-coder/VIctory-NVIDIA 64d4931, GPL-3.0).
- Teach `lower::lane_regions` (`all_lane_blocks`, `branches_around`) to
include natural-loop bodies exited per lane so loop headers, mid-loop
breaks, and latches are never misclassified as executed by every lane on
subsequent iterations, while reconverged post-dominating blocks after a
single-exit loop remain wave-converged.
2. Fixed-lane provenance in whole-wave sections (`wave.rs`, `paired.rs`,
`lower.rs`):
- Track source lane provenance in `Sym::Own(Value, u32)` and emit
`Shape::Lane(Value, u32)` when a whole-wave section broadcasts a fixed
console lane (`v_readlane_b32` into SGPR or copied VGPR) instead of
collapsing to each lane's own value (`Shape::Value`).
- Lower `Shape::Lane` across lower/upper paired halves in `paired_shape`
and via `console_lane_read` with half-wave and full-wave convergence
checks in `Lower::shape` (after edsuuu/VI-BR-PORT cf3394b and
TaynanGT/Vice-Tay 5e588e8, GPL-3.0).
3. Paired `v_readlane_b32` parity with `Lower::valu` (`paired.rs`):
- Handle `Resources::restored_lanes` (uniform scalars parked in scratch
VGPRs clobbered by unmodelled whole-wave instructions) and post-section
`Section::reads` before general cross-lane shuffles in `paired_cross`.
4. Bounds-checked multi-dword, strided-64, and sub-dword paired LDS
(`paired.rs`):
- Extend `supports_paired_lds` and `paired_lds` to `_b64`/`_b96`/`_b128`,
`ds_read2`/`ds_write2` (`_b32`/`_b64`), `ds_read2st64`/`ds_write2st64`
(`_b32`/`_b64`), and sub-dword `_u8`/`_i8`/`_u16`/`_i16`/`_b8`/`_b16`
(including `_d16` and `_d16_hi`), using `Rmw::And` + `Rmw::Or` for
sub-dword writes so paired halves sharing an LDS dword never clobber
each other, and guarding every dword index by `index < dwords` (after
TaynanGT/Vice-Tay 5e588e8 and fxceless/victory-fork, GPL-3.0).
5. Spilled & thread-counted (`USER_DISPATCH_THREADS_X`) paired compute
programs (`mod.rs`, `paired.rs`, `lower.rs`):
- Allow spilled Wave64 compute programs in `emit::paired` and decouple the
`BeforeWide` `paired` fallback from the 2-D `tile` gate so refused 1-D
Wave64 groups with divergent cross-half LDS regions are rescued cleanly.
- Compute per-half `partial_active` masks in `Lower::run(counted = true)`
against console group width `cs.threads[0]` without early-exiting host
threads needed at LDS barriers, swap `partial_active` in `swap_lanes`,
and apply `partial_active` / `launched` / `memory_guard` across
`mask_dword`, `scc_some`, `wave_wide`, `paired_f64_constant_sum`, and
`paired_cross`.
Verification (Windows 11 + NVIDIA GeForce RTX 3090 D3D12 & WARP):
- `cargo test --manifest-path d3d12/Cargo.toml -p leonida-shader --lib paired_tests -- --test-threads=4`: 20/20 passed (6 new Red->Green hardware + unit tests).
- `cargo test --manifest-path d3d12/Cargo.toml -p leonida-shader -- --test-threads=4`: 359 passed, 0 failed.
- `cargo clippy --manifest-path d3d12/Cargo.toml -p leonida-shader --all-targets`: 0 warnings on touched code.
- `python -I scripts/check_no_game_data.py`: 0 issues.
AI-assisted.
Diffstat (limited to 'runtime/src/xma2_decoder.cpp')
0 files changed, 0 insertions, 0 deletions