Shaders: a mesh program's PSV0 counts shared memory only when it has some #2857

Open
github-bot wants to merge 1 commit from github-bot/gh-2857 into main AGit
Owner

@⁠kais7654 on GitHub · 2026-11-25 22:31 UTC · original
kais7654:shader/a-mesh-programs-lds-counts-when-it-has-some → main · +45 −5 · 2 files · 1 commits · open

A mesh program whose state declares group-shared memory its code never touches wrote the declared size into the PSV0's GroupSharedBytesUsed: DXC fills that field from the module's group-shared globals -- ours is made lazily, by lds, when its code lowers one -- and the validator's rebuilt runtime info is compared byte for byte, so the container was refused whole. The declared size is counted now only where the global is: a program that declares LDS and never touches it has none.

(#2798)

Generated by Mistral Vibe.

**@⁠kais7654** on GitHub · 2026-11-25 22:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/2857) `kais7654:shader/a-mesh-programs-lds-counts-when-it-has-some` → `main` · +45 −5 · 2 files · 1 commits · open A mesh program whose state declares group-shared memory its code never touches wrote the declared size into the PSV0's GroupSharedBytesUsed: DXC fills that field from the module's group-shared globals -- ours is made lazily, by `lds`, when its code lowers one -- and the validator's rebuilt runtime info is compared byte for byte, so the container was refused whole. The declared size is counted now only where the global is: a program that declares LDS and never touches it has none. (#2798) Generated by Mistral Vibe.
A mesh program whose state declares group-shared memory its code never
touches wrote the declared size into the PSV0's GroupSharedBytesUsed:
DXC fills that field from the module's group-shared globals -- ours is
made lazily, by `lds`, when its code lowers one -- and the validator's
rebuilt runtime info is compared byte for byte, so the container was
refused whole. The declared size is counted now only where the global
is: a program that declares LDS and never touches it has none.

(#2798)

Generated by Mistral Vibe.

Co-Authored-By: Mistral Vibe <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:16:03 +00:00
Author
Owner

@⁠kais7654 on GitHub · 2026-11-25 22:31 UTC · original

The declared size is counted now only where the global is.

emit::tests::unused_mesh_lds_is_not_counted_in_psv0: the triangle mesh
program of the existing tests, with lds_bytes 0 (a control) and 16,
both read back from their PSV0 (the shared dword is 0 for each) and
through dxil.dll where there is one. Without the change it fails with
left: 16, right: 0 (verified here).

  • cargo test -p victory-shader --lib --test-threads=1 (RTX 5090; minus
    the suite's known skips): 260 passed + the new test — note 6 IEEE
    discrepancies fail on clean main 61bfc77 here (the BVH
    intersections' one-ULP, arithmetic_matches_the_hardware,
    fspx_programs_run_with_the_hardwares_dot_products,
    image_atomics_of_64_bits); reproduced on a clean tree, not this
    branch's.
  • cargo clippy -p victory-shader --all-targets --locked, and with
    --all-features: 0 warnings, both.

Generated with Mistral Vibe.

**@⁠kais7654** on GitHub · 2026-11-25 22:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/2857#issuecomment-7176469356) The declared size is counted now only where the global is. `emit::tests::unused_mesh_lds_is_not_counted_in_psv0`: the triangle mesh program of the existing tests, with `lds_bytes` 0 (a control) and 16, both read back from their `PSV0` (the shared dword is 0 for each) and through `dxil.dll` where there is one. Without the change it fails with `left: 16, right: 0` (verified here). - `cargo test -p victory-shader --lib --test-threads=1` (RTX 5090; minus the suite's known skips): 260 passed + the new test — note 6 IEEE discrepancies fail on **clean main 61bfc77** here (the BVH intersections' one-ULP, `arithmetic_matches_the_hardware`, `fspx_programs_run_with_the_hardwares_dot_products`, `image_atomics_of_64_bits`); reproduced on a clean tree, not this branch's. - `cargo clippy -p victory-shader --all-targets --locked`, and with `--all-features`: 0 warnings, both. Generated with Mistral Vibe.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 23:00 UTC · original

Reviewed and verified 9c608fce on Windows 11 (RTX 5090 + WARP + dxil.dll) against main (842b0cb):

  • Gating PSV0 GroupSharedBytesUsed on self.lds.is_some() matches how Shader::lds() lazily emits the [lds_dwords x i32] global and how dxil.dll recomputes PSV0 from module globals (#2798), while keeping lds_dwords * 4 when LDS is actually lowered.
  • Local checks: unused_mesh_lds_is_not_counted_in_psv0 1/1 (PSV0[4..8] == 0 for both 0 and 16 declared bytes, dxil.dll accepted), mesh tests 6/6, lds tests 5/5 (including lds_bytes_and_halves_match_the_hardware), emit::tests:: 18/18 on RTX 5090 and WARP, cargo clippy --locked -p victory-shader --all-targets -- -D warnings 0 warnings, cargo xtask policy (186 files ok; emit/lower.rs untouched).

Looks clean and ready to merge.

**@⁠fuzeofficlal** on GitHub · 2026-11-25 23:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/2857#issuecomment-7177040775) Reviewed and verified `9c608fce` on Windows 11 (RTX 5090 + WARP + `dxil.dll`) against `main` (`842b0cb`): - Gating PSV0 `GroupSharedBytesUsed` on `self.lds.is_some()` matches how `Shader::lds()` lazily emits the `[lds_dwords x i32]` global and how `dxil.dll` recomputes PSV0 from module globals (`#2798`), while keeping `lds_dwords * 4` when LDS is actually lowered. - Local checks: `unused_mesh_lds_is_not_counted_in_psv0` 1/1 (`PSV0[4..8] == 0` for both 0 and 16 declared bytes, `dxil.dll` accepted), `mesh` tests 6/6, `lds` tests 5/5 (including `lds_bytes_and_halves_match_the_hardware`), `emit::tests::` 18/18 on RTX 5090 and WARP, `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` 0 warnings, `cargo xtask policy` (`186 files ok`; `emit/lower.rs` untouched). Looks clean and ready to merge.
Author
Owner

@⁠cloph-dsp on GitHub · 2026-11-25 23:00 UTC · original

Local verification on Windows / rustc 1.100.0 / MSVC, no game data, no GPU, no clippy/rustup.

  • cargo test --locked -p victory-shader --lib unused_mesh_lds_is_not_counted_in_psv0 --quiet -> 1 passed, 279 filtered.
  • Diff vs merge-base 61bfc77: 2 files, +45/-5; git diff --check clean.
  • Negative control: the new test name is absent on the base commit; the author also verified it fails before the fix.

AI-assisted (Hy4 flash).

**@⁠cloph-dsp** on GitHub · 2026-11-25 23:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/2857#issuecomment-7177043545) Local verification on Windows / rustc 1.100.0 / MSVC, no game data, no GPU, no clippy/rustup. - `cargo test --locked -p victory-shader --lib unused_mesh_lds_is_not_counted_in_psv0 --quiet` -> 1 passed, 279 filtered. - Diff vs merge-base 61bfc77: 2 files, +45/-5; `git diff --check` clean. - Negative control: the new test name is absent on the base commit; the author also verified it fails before the fix. AI-assisted (Hy4 flash).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 03:22 UTC · original

Automated triage for the maintainers.

Verdict: proposed close (duplicate). This is the same change as the earlier open #2798, which also has the same title and test name. Both gate mesh PSV0 GroupSharedBytesUsed in Shader::finish (crates/victory-shader/src/emit/shader.rs) on self.lds.is_some() and add unused_mesh_lds_is_not_counted_in_psv0. #2798 merges cleanly, has validator runs before and after the change, and is already a merge candidate.

If you have something #2798 lacks, please add it there as a review comment. This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label.

CI: check passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 03:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2857#issuecomment-7181664874) <!-- victory-triage v1 head=9c608fce10c3c41a57f9197feea4723b289105bb verdict=proposed-close at=2026-11-26T03:22:40Z --> Automated triage for the maintainers. **Verdict: proposed close (duplicate).** This is the same change as the earlier open #2798, which also has the same title and test name. Both gate mesh PSV0 `GroupSharedBytesUsed` in `Shader::finish` (`crates/victory-shader/src/emit/shader.rs`) on `self.lds.is_some()` and add `unused_mesh_lds_is_not_counted_in_psv0`. #2798 merges cleanly, has validator runs before and after the change, and is already a merge candidate. If you have something #2798 lacks, please add it there as a review comment. This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/2857/head:github-bot/gh-2857'
git switch 'github-bot/gh-2857'

Merge

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