Shaders: lane masks a traversal keeps as numbers #1883

Closed
github-bot wants to merge 1 commit from github-bot/gh-1883 into main AGit
Owner

@⁠powplusplus on GitHub · 2026-11-25 00:03 UTC · original
powplusplus:shader/traversal-lane-masks → main · +54 −5 · 2 files · 1 commits · closed without merging

The ray-tracing shadow passes keep the lanes still walking the BVH in a lane mask, and push that mask on an LDS stack as a number. On main they stop at "a register joining a lane mask and data, read as data" (a register that holds the mask on one path and a popped number on the other, read as a number) or at "a lane-mask join of an untracked mask".

In compute, with console lanes (fill_phis):

  • a mask joined with a number is the mask's number (its ballot, or mask_number for one holding lanes elsewhere), as the console holds it;
  • a number joined with masks is a mask, each lane taking its own bit;
  • an edge along which no lane reads the register (never_taken, dead_on_edge) joins any mask, as data joins already take any number there.

Results

translate --validate over shaders.rpf against 70564ae: 45 more compute programs emit and validate (2,621 to 2,666), none lost.

  • RT shadows (32): CS_RTShadowTrace32HQ and its temporal, 1/2, 1/4 and 1/8 RPP, FarOnly and tiled variants (20), CS_RTDistantShadowTrace*_Tiled (4), CS_RTDistantLODLightShadow, CS_TraceShadowRays_* (Checkerboard, Eighth, Quarter, Half, FullAdaptive), CS_RaytraceShadows_Shared, CS_LaserLightShadowRaytracing.
  • Other traversals: CS_RaytraceVBuffer_ShaderBinning and _RayBinning_ShaderBinning_Shared (with and without far), CS_ScreenProbes_TraceRays_RayBinning_BVH_Shared_ShaderBinning (2), CS_DeferredGather_Shared_Wave32, CS_ComputeClosestDepth.
  • CS_Subdivision_* (5).

Under vkd3d-proton (RTX 3080, Proton), 35 of the 45 hang pipeline creation, each created on its own with a 120 s limit; 10 create pipelines. #1885 fixes the hang (one back edge per loop header, a larger stack for pipeline threads): with both, the 35 of the 45 run so far all create pipelines, 30 of them ones that hung.

Testing

  • A VALU test: a register holds vcc on one path and a number on the other and is read after the join; hardware adapter and WARP. main refuses it.
  • cargo test -p victory-shader under Proton (RTX 3080 and WARP): 205 passed. The 5 that fail (stub_pipeline_is_created, three in semantics_tests, a_heap_buffer_read_where_no_buffer_view_is_reads_zeros) fail on main there too.
  • clippy, default and all features.
  • Not run in the title.
**@⁠powplusplus** on GitHub · 2026-11-25 00:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/1883) `powplusplus:shader/traversal-lane-masks` → `main` · +54 −5 · 2 files · 1 commits · closed without merging The ray-tracing shadow passes keep the lanes still walking the BVH in a lane mask, and push that mask on an LDS stack as a number. On main they stop at "a register joining a lane mask and data, read as data" (a register that holds the mask on one path and a popped number on the other, read as a number) or at "a lane-mask join of an untracked mask". In compute, with console lanes (`fill_phis`): - a mask joined with a number is the mask's number (its ballot, or `mask_number` for one holding lanes elsewhere), as the console holds it; - a number joined with masks is a mask, each lane taking its own bit; - an edge along which no lane reads the register (`never_taken`, `dead_on_edge`) joins any mask, as data joins already take any number there. ## Results `translate --validate` over shaders.rpf against `70564ae`: 45 more compute programs emit and validate (2,621 to 2,666), none lost. - RT shadows (32): `CS_RTShadowTrace32HQ` and its temporal, 1/2, 1/4 and 1/8 RPP, FarOnly and tiled variants (20), `CS_RTDistantShadowTrace*_Tiled` (4), `CS_RTDistantLODLightShadow`, `CS_TraceShadowRays_*` (Checkerboard, Eighth, Quarter, Half, FullAdaptive), `CS_RaytraceShadows_Shared`, `CS_LaserLightShadowRaytracing`. - Other traversals: `CS_RaytraceVBuffer_ShaderBinning` and `_RayBinning_ShaderBinning_Shared` (with and without far), `CS_ScreenProbes_TraceRays_RayBinning_BVH_Shared_ShaderBinning` (2), `CS_DeferredGather_Shared_Wave32`, `CS_ComputeClosestDepth`. - `CS_Subdivision_*` (5). Under vkd3d-proton (RTX 3080, Proton), 35 of the 45 hang pipeline creation, each created on its own with a 120 s limit; 10 create pipelines. #1885 fixes the hang (one back edge per loop header, a larger stack for pipeline threads): with both, the 35 of the 45 run so far all create pipelines, 30 of them ones that hung. ## Testing - A VALU test: a register holds `vcc` on one path and a number on the other and is read after the join; hardware adapter and WARP. main refuses it. - `cargo test -p victory-shader` under Proton (RTX 3080 and WARP): 205 passed. The 5 that fail (`stub_pipeline_is_created`, three in `semantics_tests`, `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`) fail on main there too. - clippy, default and all features. - Not run in the title.
The ray-tracing passes keep the lanes still walking the BVH in a lane
mask, and push it on an LDS stack as a number. A register that holds a
mask on one path and a popped number on the other stopped the program
when it was read as a number, and a mask join with a number coming in
stopped it too.

In compute, with console lanes:
- a mask joined with a number is the mask's number, the console's own;
- a number joined with masks is a mask, each lane taking its bit;
- an edge along which no lane reads the register (one the compiler
  reuses) joins any mask, as it already joins any number.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:47:33 +00:00
Author
Owner

@⁠zed6000 on GitHub · 2026-11-25 04:23 UTC · original

Measured offline on the title's shaders (the method in #1247): merged onto main 940d32f (a clean merge) and compared program by program (victory translate --validate --list, shaders.rpf 1.0.2.1, dxil.dll 1.8.2502).

+21 programs, 0 lost. On main they failed with "a register joining a lane mask and data, read as data" (16 of the 40 still failing for that reason) and "a lane-mask join of an untracked mask" (5). It also merges cleanly together with #1989, #1065 and #1971: the four together give +1,683 programs and 0 lost, and cargo test -p victory-shader --lib passes (252/0) on an RX 7900 XTX. Offline counts only; no program names or data.

**@⁠zed6000** on GitHub · 2026-11-25 04:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/1883#issuecomment-7152801118) Measured offline on the title's shaders (the method in #1247): merged onto main `940d32f` (a clean merge) and compared program by program (`victory translate --validate --list`, `shaders.rpf` 1.0.2.1, dxil.dll 1.8.2502). **+21 programs, 0 lost.** On main they failed with "a register joining a lane mask and data, read as data" (16 of the 40 still failing for that reason) and "a lane-mask join of an untracked mask" (5). It also merges cleanly together with #1989, #1065 and #1971: the four together give +1,683 programs and 0 lost, and `cargo test -p victory-shader --lib` passes (252/0) on an RX 7900 XTX. Offline counts only; no program names or data.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-25 04:47 UTC · original

An independent offline count, with one addition to @⁠zed6000's: what the programs this PR does not finish stop at next, and the result together with #2027.

Method: victory translate <shaders.rpf> --validate --list --jobs 6, release builds, Windows SDK 10.0.26100.0 dxil.dll, compared program by program (25,889 programs). CPU only; nothing was run on a GPU or in the title.

build not validated change against main
main 940d32f 1,971
+ this PR (a31d8cc, clean merge) 1,950 +21 compute, 0 lost
+ this PR + #2027 (34d0b4e, clean merge of both) 1,191 +780 compute, 0 lost

The 40 programs main refuses with a register joining a lane mask and data, read as data:

  • With this PR all 40 emit. 16 validate. The other 24 (the 20 CS_RTShadowTrace32HQ / TemporalHQ variants, with and without _Tiled and FarOnly, and CS_TraceShadowRays_Eighth, _Quarter, _Half, _FullAdaptive) then fail the validator with Entry function performs some operation that is incompatible with the shader stage, which is #2027's class, not this PR's.
  • With #2027 as well, all 40 validate. So the two together finish this class; neither does alone.

The 5 programs at a lane-mask join of an untracked mask that this PR clears are in the +21; one program is left at that reason after both PRs.

Not checked here: the value a joined mask reads on a GPU (the PR's own VALU test covers that; I ran no test), and pipeline creation.

A local copy of the title's shader archive was used for these counts, offline; only counts, program names and refusal reasons are given. AI-assisted.

**@⁠r4tedx** on GitHub · 2026-11-25 04:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/1883#issuecomment-7153163177) An independent offline count, with one addition to @⁠zed6000's: what the programs this PR does not finish stop at next, and the result together with #2027. Method: `victory translate <shaders.rpf> --validate --list --jobs 6`, release builds, Windows SDK 10.0.26100.0 `dxil.dll`, compared program by program (25,889 programs). CPU only; nothing was run on a GPU or in the title. | build | not validated | change against `main` | |---|---|---| | `main` `940d32f` | 1,971 | | | + this PR (`a31d8cc`, clean merge) | 1,950 | +21 compute, 0 lost | | + this PR + #2027 (`34d0b4e`, clean merge of both) | 1,191 | +780 compute, 0 lost | The 40 programs `main` refuses with `a register joining a lane mask and data, read as data`: - With this PR all 40 emit. 16 validate. The other 24 (the 20 `CS_RTShadowTrace32HQ` / `TemporalHQ` variants, with and without `_Tiled` and `FarOnly`, and `CS_TraceShadowRays_Eighth`, `_Quarter`, `_Half`, `_FullAdaptive`) then fail the validator with `Entry function performs some operation that is incompatible with the shader stage`, which is #2027's class, not this PR's. - With #2027 as well, all 40 validate. So the two together finish this class; neither does alone. The 5 programs at `a lane-mask join of an untracked mask` that this PR clears are in the +21; one program is left at that reason after both PRs. Not checked here: the value a joined mask reads on a GPU (the PR's own VALU test covers that; I ran no test), and pipeline creation. A local copy of the title's shader archive was used for these counts, offline; only counts, program names and refusal reasons are given. AI-assisted.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 08:16 UTC · original · edited 2026-11-25 15:59 UTC

Automated triage for the maintainers.

This pull request no longer merges cleanly into main (conflicts in crates/victory-shader/src/emit/lower.rs). It will be reviewed once it is rebased onto the current main. The earlier verdict (merge candidate) was for an older state of main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 08:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/1883#issuecomment-7156823148) · edited 2026-11-25 15:59 UTC <!-- victory-triage v1 head=a31d8ccbd051e278e54688e4b452c8bb54820187 verdict=needs-rebase at=2026-11-25T16:07:30Z --> Automated triage for the maintainers. This pull request no longer merges cleanly into `main` (conflicts in `crates/victory-shader/src/emit/lower.rs`). It will be reviewed once it is rebased onto the current `main`. The earlier verdict (merge candidate) was for an older state of `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
github-bot closed this pull request 2026-11-26 11:39:58 +00:00
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 02:17 UTC · original · approved these changes

Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f69b, cargo test -p victory-shader --locked.

144 passed / 0 failed / 2 ignored. Lane masks kept as numbers through traversal — extends the masks-as-data work (#1788); no regressions.

**@⁠catminou4** on GitHub · 2026-11-25 02:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/1883#pullrequestreview-6050697931) · **approved these changes** Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f69b, `cargo test -p victory-shader --locked`. 144 passed / 0 failed / 2 ignored. Lane masks kept as numbers through traversal — extends the masks-as-data work (#1788); no regressions.
Author
Owner

@⁠powplusplus on GitHub · 2026-11-26 11:37 UTC · original

Closing as superseded by e8e9f0c and 4a3166e on main, which cover this with stricter uniform_join / no_mask_lane_on_edge guards.

**@⁠powplusplus** on GitHub · 2026-11-26 11:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/1883#issuecomment-7190961724) Closing as superseded by `e8e9f0c` and `4a3166e` on `main`, which cover this with stricter `uniform_join` / `no_mask_lane_on_edge` guards.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1883
No description provided.