Shaders: descriptors chosen by uniform trees of joins and selects #2342

Open
github-bot wants to merge 3 commits from github-bot/gh-2342 into main AGit
Owner

@⁠RomainKH on GitHub · 2026-11-25 11:08 UTC · original
RomainKH:shader/uniform-descriptor-trees → main · +449 −108 · 5 files · 3 commits · open

Rebased on current main (63bcca4) after the triage. #1012's recursive heap index is now on main (59c78bb, 54ab406), so its commit is gone from here. The HEAP_VIEWS - 1 clamp moved to its own PR, #2558. This branch is stacked on it: the first two commits are #2558's, the last is this PR's own. NEW-118 in #1633.

On current main, no program of this title is refused with a descriptor chosen by control flow or a descriptor chosen by a condition. r4tedx's offline census (842b0cb, 64-lane target) gives 24,850 validated programs with and without this branch: none lost, none gained. So on this title the value is #2558's clamps. The shapes below are for programs that reach them in other titles or compiler versions.

Change (last commit)

  • uniform_heap_index (nested joins of loads, #1012) also takes SCC selects, so either may hold the other: a select on an edge into a join, a join on an arm of a select.
  • A join at a loop header: its back edge is not lowered yet when the header is. Its phi goes to pending_descriptors, and fill_phis fills it once every predecessor has a tail. An edge no lane takes brings 0, as on main.
  • view_stride takes the same trees. On main a structured read through a join is refused with a structured buffer of unknown stride.
  • An SCC select between two immediate samplers samples with both, as the join of two already does (sampler_choices).
  • A tree with a leaf that a waterfall loop reads per lane gets a non-uniform handle.
  • Fits main's one handle per join (850b66f): a join at the top still gets its handle made and kept at the join.
  • Layout: lower.rs is within a few KiB of the repository's 512 KiB limit on a file. uniform_heap_index and its two new helpers (fill_descriptor_phi, waterfall_leaf) move to a child module, emit/lower/trees.rs, and the tests join #2558's in emit/lower/tests/descriptors.rs. lower.rs ends at 520,473 bytes, slightly less than on main.

Testing

Synthetic GFX10 programs in emit/lower/tests/descriptors.rs:

Test main Here
nested_uniform_phis_and_selects_choose_descriptors (a select inside nested joins; raw and structured read) a descriptor chosen by control flow lowers, uniform handle
a_descriptor_phi_at_a_loop_header_lowers_its_back_edge (raw and structured read) a descriptor chosen by control flow lowers, uniform handle
an_immediate_sampler_selected_by_scc_samples_with_both a descriptor chosen by a condition lowers, two samplers
  • With view_stride left as on main, the structured variants fail with a structured buffer of unknown stride.
  • DXIL validation (the triage's question about the loop-header case): each test validates its DXIL with dxil.dll through validate (#2558's first commit). Where CI is set, a validator that does not load fails the test instead of skipping it. So this PR's green Windows CI run is the confirmation that the loop-header DXIL validates. Before, DenRakEiw had run the earlier head on Windows 11 with an RTX 5090 and WARP (26/26 lowering tests).
  • macOS arm64, Rust 1.98.1: cargo test -p victory-shader --locked --lib gives 176 passed, 0 failed, 2 ignored. rustfmt reports nothing new on the changed lines.
  • Not run: victory translate --validate on the title's files (I have none).

AI-assisted (Claude Code).

🤖 Generated with Claude Code

**@⁠RomainKH** on GitHub · 2026-11-25 11:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/2342) `RomainKH:shader/uniform-descriptor-trees` → `main` · +449 −108 · 5 files · 3 commits · open Rebased on current `main` (`63bcca4`) after the triage. #1012's recursive heap index is now on `main` (59c78bb, 54ab406), so its commit is gone from here. The `HEAP_VIEWS - 1` clamp moved to its own PR, #2558. This branch is stacked on it: the first two commits are #2558's, the last is this PR's own. NEW-118 in #1633. On current `main`, no program of this title is refused with `a descriptor chosen by control flow` or `a descriptor chosen by a condition`. r4tedx's offline census (`842b0cb`, 64-lane target) gives 24,850 validated programs with and without this branch: none lost, none gained. So on this title the value is #2558's clamps. The shapes below are for programs that reach them in other titles or compiler versions. ## Change (last commit) - `uniform_heap_index` (nested joins of loads, #1012) also takes SCC selects, so either may hold the other: a select on an edge into a join, a join on an arm of a select. - **A join at a loop header:** its back edge is not lowered yet when the header is. Its phi goes to `pending_descriptors`, and `fill_phis` fills it once every predecessor has a tail. An edge no lane takes brings 0, as on `main`. - `view_stride` takes the same trees. On `main` a structured read through a join is refused with `a structured buffer of unknown stride`. - An SCC select between two immediate samplers samples with both, as the join of two already does (`sampler_choices`). - A tree with a leaf that a waterfall loop reads per lane gets a non-uniform handle. - Fits `main`'s one handle per join (850b66f): a join at the top still gets its handle made and kept at the join. - **Layout:** `lower.rs` is within a few KiB of the repository's 512 KiB limit on a file. `uniform_heap_index` and its two new helpers (`fill_descriptor_phi`, `waterfall_leaf`) move to a child module, `emit/lower/trees.rs`, and the tests join #2558's in `emit/lower/tests/descriptors.rs`. `lower.rs` ends at 520,473 bytes, slightly less than on `main`. ## Testing Synthetic GFX10 programs in `emit/lower/tests/descriptors.rs`: | Test | `main` | Here | |---|---|---| | `nested_uniform_phis_and_selects_choose_descriptors` (a select inside nested joins; raw and structured read) | `a descriptor chosen by control flow` | lowers, uniform handle | | `a_descriptor_phi_at_a_loop_header_lowers_its_back_edge` (raw and structured read) | `a descriptor chosen by control flow` | lowers, uniform handle | | `an_immediate_sampler_selected_by_scc_samples_with_both` | `a descriptor chosen by a condition` | lowers, two samplers | - With `view_stride` left as on `main`, the structured variants fail with `a structured buffer of unknown stride`. - **DXIL validation (the triage's question about the loop-header case):** each test validates its DXIL with `dxil.dll` through `validate` (#2558's first commit). Where `CI` is set, a validator that does not load fails the test instead of skipping it. So this PR's green Windows CI run is the confirmation that the loop-header DXIL validates. Before, DenRakEiw had run the earlier head on Windows 11 with an RTX 5090 and WARP (26/26 lowering tests). - macOS arm64, Rust 1.98.1: `cargo test -p victory-shader --locked --lib` gives 176 passed, 0 failed, 2 ignored. rustfmt reports nothing new on the changed lines. - **Not run:** `victory translate --validate` on the title's files (I have none). AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Three tests in `emit/lower.rs` (from ff47463, 54ab406 and 850b66f) called
the Windows-only `validator` module without a `cfg`, so the shader crate's
tests no longer built on Linux or macOS (E0433). They now call `validate`,
which validates where `dxil.dll` is and does nothing off Windows.

Where tests run in CI (`CI` set, as on GitHub's runners) a validator that
does not load fails the test instead of skipping the check, so a green run
means the DXIL was validated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`view_stride` and `view_addresses` read the view-stride table and the view
addresses, root SRVs with no bounds of their own, at a heap index taken
from data, without clamping it as `heap_handle` and `buffer_guard` do. An
index past the table read whatever memory follows it. Both now clamp the
index to `HEAP_VIEWS` - 1 first (`clamp_view_index`, which `buffer_guard`
now uses too).

The host's view-address buffer had 16 bytes per title slot only, fewer
than `HEAP_VIEWS` (about 1.2 million against 2^21 for this title), so even
a clamped index could read past it. It now covers the larger of the two,
as the view-stride table already does; the slots past the title's read 0.

Test: a structured read through a heap descriptor clamps once more than a
raw one (the stride lookup), and reading a descriptor's dwords 0 and 1 as
data clamps twice. Without the clamps it fails (3 against 4).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A descriptor every lane shares can reach its use through a tree of joins
and SCC selects: a select on an edge into a join, a join on an arm of a
select, or a join at a loop header whose back edge is lowered after the
body. `uniform_heap_index`, which took nested joins of loads (#1012), now
also takes selects, so either may hold the other. A loop header's phi goes
to `pending_descriptors` and `fill_phis` fills it once every predecessor
has a tail; an edge no lane takes brings 0, as before.

`view_stride` takes the same trees, so a structured read through one gets
its stride; it refused a join ("a structured buffer of unknown stride").
An SCC select between two immediate samplers samples with both, as a join
of two already does. A tree with a leaf that a waterfall loop reads per
lane gets a non-uniform handle.

Tests, synthetic GFX10 programs, each validated by dxil.dll where it runs
(required in CI): a select inside nested joins and a descriptor phi at a
loop header, each with a raw and a structured read, and an immediate
sampler chosen by SCC. On `main` they are refused with "a descriptor chosen
by control flow" / "... by a condition".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:02:51 +00:00
Author
Owner

@⁠RomainKH on GitHub · 2026-11-25 14:26 UTC · original

A data point for whoever weighs this PR: the offline census posted in #2045 (main 940d32f + #1936, the whole shader archive, official dxil.dll) now has 1 program refused with a descriptor chosen by control flow. #1012's A/B had 40 before the recent merges. So on this title the shapes added here unblock at most a handful of programs today. Most of the value is the HEAP_VIEWS - 1 clamp on the VIEW_STRIDES and view-address reads, and not refusing these shapes when other titles or compiler versions produce them.

On macOS, this branch merges cleanly with #2324, #2388, #2046 and #2078 together, and cargo test -p victory-shader --locked passes on the merge (158 passed, 0 failed). #1847 conflicts only on test functions added at the same spot at the end of lower.rs; keeping both sides resolves it.

AI-assisted (Claude Code).

**@⁠RomainKH** on GitHub · 2026-11-25 14:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/2342#issuecomment-7165280286) A data point for whoever weighs this PR: the offline census posted in #2045 (`main` `940d32f` + #1936, the whole shader archive, official `dxil.dll`) now has **1** program refused with `a descriptor chosen by control flow`. #1012's A/B had 40 before the recent merges. So on this title the shapes added here unblock at most a handful of programs today. Most of the value is the `HEAP_VIEWS - 1` clamp on the `VIEW_STRIDES` and view-address reads, and not refusing these shapes when other titles or compiler versions produce them. On macOS, this branch merges cleanly with #2324, #2388, #2046 and #2078 together, and `cargo test -p victory-shader --locked` passes on the merge (158 passed, 0 failed). #1847 conflicts only on test functions added at the same spot at the end of `lower.rs`; keeping both sides resolves it. AI-assisted (Claude Code).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 15:27 UTC · original · edited 2026-11-25 22:18 UTC

Automated triage for the maintainers.

Needs rebase. This PR no longer merges cleanly into main: main has moved since the last triage, and the branch now conflicts in crates/victory-gpu/src/descriptor/host.rs and crates/victory-shader/src/emit/lower.rs. It will be reviewed again once it is rebased onto current main.

Previous verdict for this head: merge candidate.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 15:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/2342#issuecomment-7166869780) · edited 2026-11-25 22:18 UTC <!-- victory-triage v1 head=278a49df250713614c335a3afa445e602de062c7 verdict=needs-rebase at=2026-11-25T22:21:30Z --> Automated triage for the maintainers. **Needs rebase.** This PR no longer merges cleanly into `main`: `main` has moved since the last triage, and the branch now conflicts in `crates/victory-gpu/src/descriptor/host.rs` and `crates/victory-shader/src/emit/lower.rs`. It will be reviewed again once it is rebased onto current `main`. Previous verdict for this head: merge candidate. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠RomainKH on GitHub · 2026-11-25 16:00 UTC · original

Thanks for the triage. I've done the three things it asked for:

  • Own commit only. Rebased on main (67e8ae1). #1012's recursive index is on main now (59c78bb, 54ab406), so its commit is gone from here. The last commit is this PR's work, ported onto main's one handle per join (850b66f).
  • The clamp is its own PR: #2558. While splitting it out I found that the clamp alone was not enough for the view addresses. The host's buffer had one entry per title slot (about 1.2 million), fewer than HEAP_VIEWS, so a clamped index could still read past it. #2558 sizes that buffer as the view-stride table already is. This PR is stacked on #2558 for now.
  • DXIL on Windows. The lowering tests validate through a helper that fails when CI is set and dxil.dll does not load, instead of skipping. This PR's run on 278a49d is green, with a_descriptor_phi_at_a_loop_header_lowers_its_back_edge and the other new tests passing on windows-latest, so their DXIL validated. That helper also fixes three tests on main that called the Windows-only validator without a cfg and no longer built on Linux or macOS.

AI-assisted (Claude Code).

**@⁠RomainKH** on GitHub · 2026-11-25 16:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/2342#issuecomment-7167512424) Thanks for the triage. I've done the three things it asked for: - **Own commit only.** Rebased on `main` (`67e8ae1`). #1012's recursive index is on `main` now (59c78bb, 54ab406), so its commit is gone from here. The last commit is this PR's work, ported onto `main`'s one handle per join (850b66f). - **The clamp is its own PR: #2558.** While splitting it out I found that the clamp alone was not enough for the view addresses. The host's buffer had one entry per title slot (about 1.2 million), fewer than `HEAP_VIEWS`, so a clamped index could still read past it. #2558 sizes that buffer as the view-stride table already is. This PR is stacked on #2558 for now. - **DXIL on Windows.** The lowering tests validate through a helper that fails when `CI` is set and `dxil.dll` does not load, instead of skipping. This PR's run on `278a49d` is green, with `a_descriptor_phi_at_a_loop_header_lowers_its_back_edge` and the other new tests passing on `windows-latest`, so their DXIL validated. That helper also fixes three tests on `main` that called the Windows-only validator without a `cfg` and no longer built on Linux or macOS. AI-assisted (Claude Code).
Author
Owner

@⁠Slay326 on GitHub · 2026-11-25 16:25 UTC · original · edited 2026-11-25 16:36 UTC

Correction (thanks, RomainKH): the strip fix comes from #1012's recursive heap index, which is on main since 54ab406. My base was 940d32f, from before it landed, and this PR carried #1012 along. So this run credits #1012 / 54ab406, not the shapes this PR adds on top.

Hardware test on an RTX 3070 (it includes #1012). RTX 3070 (8 GB, 32-lane waves), Windows 11, Series X mode, 480 s runs into the world of Grand Theft Auto VI 1.0.2.1. Local test branch: main 940d32f plus #1906, #1890, #1883, #1962, #1779, #1763, #1762, a page-mark guard like #2167 and the memory PRs #2129, #2180, #1873, #1969, #2161.

Before: indirect_diffuse_lighting:CS_ScreenProbes_ActivateRays (39f0e9ae) did not translate ("a descriptor chosen by control flow"), and the screen-probe chain after it (CS_FinalGather, CS_ScreenProbes_TemporalResolve, sr_denoising:CS_BilateralBlur) ran without it; the bottom of the screen showed blocky pixel strips.

With this PR (merged with #2366, #158, #2324, #2363, #2348, #1014): the program translates, and most of the blocky strips are gone; a few small blocks remain near the bottom edge. 480 s run, no device removal, world median 1.9 fps. Merge note on top of #1962: four conflicts in lower.rs; I took this PR's descriptor trees and kept #1962's heap-use marks and the heap cap in buffer_guard (clamp through heap_views()). victory-shader 270 passed, 0 failed.

AI-assisted.

**@⁠Slay326** on GitHub · 2026-11-25 16:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/2342#issuecomment-7167956797) · edited 2026-11-25 16:36 UTC Correction (thanks, RomainKH): the strip fix comes from #1012's recursive heap index, which is on `main` since 54ab406. My base was `940d32f`, from before it landed, and this PR carried #1012 along. So this run credits #1012 / 54ab406, not the shapes this PR adds on top. Hardware test on an RTX 3070 (it includes #1012). RTX 3070 (8 GB, 32-lane waves), Windows 11, Series X mode, 480 s runs into the world of Grand Theft Auto VI 1.0.2.1. Local test branch: main 940d32f plus #1906, #1890, #1883, #1962, #1779, #1763, #1762, a page-mark guard like #2167 and the memory PRs #2129, #2180, #1873, #1969, #2161. **Before:** `indirect_diffuse_lighting:CS_ScreenProbes_ActivateRays` (`39f0e9ae`) did not translate ("a descriptor chosen by control flow"), and the screen-probe chain after it (`CS_FinalGather`, `CS_ScreenProbes_TemporalResolve`, `sr_denoising:CS_BilateralBlur`) ran without it; the bottom of the screen showed blocky pixel strips. **With this PR** (merged with #2366, #158, #2324, #2363, #2348, #1014): the program translates, and most of the blocky strips are gone; a few small blocks remain near the bottom edge. 480 s run, no device removal, world median 1.9 fps. Merge note on top of #1962: four conflicts in `lower.rs`; I took this PR's descriptor trees and kept #1962's heap-use marks and the heap cap in `buffer_guard` (clamp through `heap_views()`). `victory-shader` 270 passed, 0 failed. AI-assisted.
Author
Owner

@⁠RomainKH on GitHub · 2026-11-25 16:32 UTC · original

Thanks for the run. One correction so this PR doesn't get credit it hasn't earned: CS_ScreenProbes_ActivateRays (39f0e9ae) is the program that #1012's recursive heap index lets through. That index is on main since 54ab406, whose message names this program. Your base was 940d32f, from before it landed. So on current main the program should translate without this PR, and the fix for the strips belongs to #1012 / 54ab406.

What this PR adds on top of main is the shapes #1012 does not take: a select inside a join, a join at a loop header, a structured read through a join, and an SCC select of two immediate samplers. On current main they cover about one program of this title, as the PR body says.

On your merge note: if #1962's heap_views() cap lands, #2558's clamp_view_index should take the same cap as buffer_guard. It shares the helper, so it is a one-line change there.

AI-assisted (Claude Code).

**@⁠RomainKH** on GitHub · 2026-11-25 16:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/2342#issuecomment-7168136013) Thanks for the run. One correction so this PR doesn't get credit it hasn't earned: `CS_ScreenProbes_ActivateRays` (`39f0e9ae`) is the program that #1012's recursive heap index lets through. That index is on `main` since 54ab406, whose message names this program. Your base was `940d32f`, from before it landed. So on current `main` the program should translate without this PR, and the fix for the strips belongs to #1012 / 54ab406. What this PR adds on top of `main` is the shapes #1012 does not take: a select inside a join, a join at a loop header, a structured read through a join, and an SCC select of two immediate samplers. On current `main` they cover about one program of this title, as the PR body says. On your merge note: if #1962's `heap_views()` cap lands, #2558's `clamp_view_index` should take the same cap as `buffer_guard`. It shares the helper, so it is a one-line change there. AI-assisted (Claude Code).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-26 07:07 UTC · original

Thanks for the rebase. The new head (278a49df, on 67e8ae1: the test helper, the clamps, the joins) covers what my earlier branch offered, plus the view-address buffer sized to HEAP_VIEWS, so please disregard shader/2342-on-1012. It conflicts with current main (842b0cb) in two files:

  • lower.rs, test side only: main added uses_lane_index and has_half_wave_mask to Lowered and two ds_bpermute tests at the place where the validate helper goes. Keeping both sides is enough.
  • descriptor/host.rs: main's #1906 (2bba7921) sizes the view addresses to the title's slots plus the dynamic ones (address_slots). This PR sizes them to the larger of the title's count and HEAP_VIEWS. Both are needed, so the size is address_slots().max(HEAP_VIEWS). #1906's test view_addresses_cover_tables_made_afresh then fails (address_at(end): Some(0) against None), because it asserts that the buffer ends right after the last dynamic slot. With this PR, the slots past it up to HEAP_VIEWS exist and read 0. The test needs to check that instead. In the copy below it does, in one extra commit of mine: the entries past the dynamic slots read 0 and are not written, and there is no entry past HEAP_VIEWS. Its mark past the buffer's end is written only where the allocation has room. At HEAP_VIEWS × 16 bytes (32 MiB) the buffer fills its allocation, so the old "room for the mark" assertion would fail.

A rebased copy with both resolutions, your three commits under your authorship, plus that test change: r4tedx/VIctory shader/2342-on-842b (b5d6cf7d). It is offered only as a reference for the conflict resolution.

Census (main 842b0cb, 64-lane target): 24,850 → 24,850 validated, 0 lost, 0 gained. On main no program stops at "a descriptor chosen by control flow" or "a descriptor chosen by a condition". So on current main the value of this PR is the clamps before the unbounded VIEW_STRIDES and view-address reads, plus the shapes for other titles and compiler versions. The new tests pass on Windows with dxil.dll present, so their DXIL is validated.

Tests (WARP), on the rebased copy: victory-shader lib 301 passed, 4 failed, the same 4 that fail on main on this machine's WARP. victory-gpu descriptor tests: 22 passed, 0 failed, including view_addresses_cover_tables_made_afresh as changed below. Clippy (victory-shader and victory-gpu, with and without --features diagnostics): clean.

The unit tests are synthetic. Local title data was used offline for the census: a translation of the title's shader pack, with only counts and refusal reasons reported.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-26 07:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/2342#issuecomment-7185120464) Thanks for the rebase. The new head (`278a49df`, on `67e8ae1`: the test helper, the clamps, the joins) covers what my earlier branch offered, plus the view-address buffer sized to `HEAP_VIEWS`, so please disregard `shader/2342-on-1012`. It conflicts with current `main` (`842b0cb`) in two files: - `lower.rs`, test side only: `main` added `uses_lane_index` and `has_half_wave_mask` to `Lowered` and two `ds_bpermute` tests at the place where the `validate` helper goes. Keeping both sides is enough. - `descriptor/host.rs`: `main`'s #1906 (`2bba7921`) sizes the view addresses to the title's slots plus the dynamic ones (`address_slots`). This PR sizes them to the larger of the title's count and `HEAP_VIEWS`. Both are needed, so the size is `address_slots().max(HEAP_VIEWS)`. #1906's test `view_addresses_cover_tables_made_afresh` then fails (`address_at(end)`: `Some(0)` against `None`), because it asserts that the buffer ends right after the last dynamic slot. With this PR, the slots past it up to `HEAP_VIEWS` exist and read 0. The test needs to check that instead. In the copy below it does, in one extra commit of mine: the entries past the dynamic slots read 0 and are not written, and there is no entry past `HEAP_VIEWS`. Its mark past the buffer's end is written only where the allocation has room. At `HEAP_VIEWS` × 16 bytes (32 MiB) the buffer fills its allocation, so the old "room for the mark" assertion would fail. A rebased copy with both resolutions, your three commits under your authorship, plus that test change: r4tedx/VIctory `shader/2342-on-842b` (`b5d6cf7d`). It is offered only as a reference for the conflict resolution. **Census** (`main` `842b0cb`, 64-lane target): 24,850 → 24,850 validated, 0 lost, 0 gained. On `main` no program stops at "a descriptor chosen by control flow" or "a descriptor chosen by a condition". So on current `main` the value of this PR is the clamps before the unbounded `VIEW_STRIDES` and view-address reads, plus the shapes for other titles and compiler versions. The new tests pass on Windows with `dxil.dll` present, so their DXIL is validated. Tests (WARP), on the rebased copy: `victory-shader` lib 301 passed, 4 failed, the same 4 that fail on `main` on this machine's WARP. `victory-gpu` `descriptor` tests: 22 passed, 0 failed, including `view_addresses_cover_tables_made_afresh` as changed below. Clippy (`victory-shader` and `victory-gpu`, with and without `--features diagnostics`): clean. The unit tests are synthetic. Local title data was used offline for the census: a translation of the title's shader pack, with only counts and refusal reasons reported. AI-assisted
github-bot force-pushed github-bot/gh-2342 from 278a49df25 to 36c10e9c5b 2026-11-26 11:10:16 +00:00 Compare
Author
Owner

@⁠DenRakEiw on GitHub · 2026-11-25 11:26 UTC · original · approved these changes

Verified against origin/main (940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:

  • Lowering descriptors chosen by nested uniform phi/select trees and loop-header descriptor phis to unified handles cleanly extends descriptor tracking and lowering.
  • cargo test -p victory-shader emit::lower::tests: 26/26 passed on RTX 5090, 26/26 passed on WARP (including descriptors_joined_by_nested_control_flow_lower_to_one_uniform_handle, an_immediate_sampler_selected_by_scc_samples_with_both, a_descriptor_phi_at_a_loop_header_lowers_its_back_edge, nested_uniform_phis_and_selects_choose_descriptors, and view_stride_and_view_addresses_clamp_heap_indices).
  • cargo clippy -p victory-shader --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 183 files ok.

AI-assisted (Gemini 4 Neon).

**@⁠DenRakEiw** on GitHub · 2026-11-25 11:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/2342#pullrequestreview-6056761794) · **approved these changes** Verified against `origin/main` (`940d32f`) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP: - Lowering descriptors chosen by nested uniform phi/select trees and loop-header descriptor phis to unified handles cleanly extends descriptor tracking and lowering. - `cargo test -p victory-shader emit::lower::tests`: 26/26 passed on RTX 5090, 26/26 passed on WARP (including `descriptors_joined_by_nested_control_flow_lower_to_one_uniform_handle`, `an_immediate_sampler_selected_by_scc_samples_with_both`, `a_descriptor_phi_at_a_loop_header_lowers_its_back_edge`, `nested_uniform_phis_and_selects_choose_descriptors`, and `view_stride_and_view_addresses_clamp_heap_indices`). - `cargo clippy -p victory-shader --all-targets -- -D warnings`: 0 warnings. - `cargo xtask policy`: 183 files ok. AI-assisted (Gemini 4 Neon).
Author
Owner

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

Tested locally: merged into main 940d32f69b, cargo test -p victory-shader --locked on macOS arm64 — 149 passed, 0 failed, 2 ignored (Windows-gated hardware execution tests not run here). Approving — descriptors chosen by uniform trees of joins and selects, +5 tests.

**@⁠catminou4** on GitHub · 2026-11-25 11:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/2342#pullrequestreview-6057087995) · **approved these changes** Tested locally: merged into main 940d32f69b, `cargo test -p victory-shader --locked` on macOS arm64 — 149 passed, 0 failed, 2 ignored (Windows-gated hardware execution tests not run here). Approving — descriptors chosen by uniform trees of joins and selects, +5 tests.
Author
Owner

@⁠RomainKH on GitHub · 2026-11-26 09:52 UTC · original · edited 2026-11-26 10:01 UTC

Thanks @⁠r4tedx. Rebased onto main 63bcca4: #2558 is at eb0dae2, this PR's own commit at 36c10e9. The resolutions are the same as in your copy:

  • both sets of Lowered fields are kept;
  • the view addresses are sized to address_slots().max(HEAP_VIEWS).

For #1906's test I used fixed checks rather than the conditional mark. Its end is at most 4 + 2^18, always below HEAP_VIEWS, and at 32 MiB the mark branch would never run. Details are on #2558, where you are credited as co-author. Following brainbudt's review, the entries past the dynamic slots are now also cleared when the buffer is made.

I updated the description with your census: on this title the value is #2558's clamps, and the shapes are for programs that reach them elsewhere.

Edit: the first push failed the CI asset policy (lower.rs over the 512 KiB file limit). The tree functions now live in emit/lower/trees.rs and the tests in emit/lower/tests/descriptors.rs, so lower.rs ends slightly smaller than on main; see Layout in the description.

AI-assisted (Claude Code).

**@⁠RomainKH** on GitHub · 2026-11-26 09:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/2342#issuecomment-7188594527) · edited 2026-11-26 10:01 UTC Thanks @⁠r4tedx. Rebased onto `main` `63bcca4`: #2558 is at `eb0dae2`, this PR's own commit at `36c10e9`. The resolutions are the same as in your copy: - both sets of `Lowered` fields are kept; - the view addresses are sized to `address_slots().max(HEAP_VIEWS)`. For #1906's test I used fixed checks rather than the conditional mark. Its `end` is at most 4 + 2^18, always below `HEAP_VIEWS`, and at 32 MiB the mark branch would never run. Details are on #2558, where you are credited as co-author. Following brainbudt's review, the entries past the dynamic slots are now also cleared when the buffer is made. I updated the description with your census: on this title the value is #2558's clamps, and the shapes are for programs that reach them elsewhere. **Edit:** the first push failed the CI asset policy (`lower.rs` over the 512 KiB file limit). The tree functions now live in `emit/lower/trees.rs` and the tests in `emit/lower/tests/descriptors.rs`, so `lower.rs` ends slightly smaller than on `main`; see *Layout* in the description. AI-assisted (Claude Code).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-26 09:55 UTC · original

Thanks @⁠RomainKH. The failing check on both rebased heads is the size rule in cargo xtask policy (policy::tests::repository_passes_policy), not a test of the change itself:

  • #2342 0b4d54c: POLICY: crates/victory-shader/src/emit/lower.rs: 534151 bytes exceeds the 524288-byte limit (run 45795880975)
  • #2558 8e11f47: the same rule at 524,406 bytes (run 45795878641), so it is over the limit by 118 bytes

On main 63bcca4 the file is 520,563 bytes, which leaves about 3.7 KB. main already has an emit/lower/ module directory (bvh.rs). Moving a self-contained part of the new code, or its tests, into a file there should bring both heads under the limit without changing behaviour.

I took these numbers from the CI logs and the GitHub contents API. I ran nothing locally and used no game data.

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-26 09:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/2342#issuecomment-7188665038) Thanks @⁠RomainKH. The failing `check` on both rebased heads is the size rule in `cargo xtask policy` (`policy::tests::repository_passes_policy`), not a test of the change itself: - #2342 `0b4d54c`: `POLICY: crates/victory-shader/src/emit/lower.rs: 534151 bytes exceeds the 524288-byte limit` ([run 45795880975](https://github.com/Marvisak/VIctory/actions/runs/45795880975/job/139826266771)) - #2558 `8e11f47`: the same rule at 524,406 bytes ([run 45795878641](https://github.com/Marvisak/VIctory/actions/runs/45795878641)), so it is over the limit by 118 bytes On `main` `63bcca4` the file is 520,563 bytes, which leaves about 3.7 KB. `main` already has an `emit/lower/` module directory (`bvh.rs`). Moving a self-contained part of the new code, or its tests, into a file there should bring both heads under the limit without changing behaviour. I took these numbers from the CI logs and the GitHub contents API. I ran nothing locally and used no game data. AI-assisted (Claude Code).
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2342/head:github-bot/gh-2342'
git switch 'github-bot/gh-2342'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2342'
git switch 'github-bot/gh-2342'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2342'
git switch 'github-bot/gh-2342'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2342'
git switch 'main'
git merge --squash 'github-bot/gh-2342'
git switch 'main'
git merge --ff-only 'github-bot/gh-2342'
git switch 'main'
git merge 'github-bot/gh-2342'
git push origin 'main'
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!2342
No description provided.