Perf/shader relative shift bounds #1802

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

@⁠VlREX on GitHub · 2026-11-24 22:48 UTC · original
VlREX:perf/shader-relative-shift-bounds → main · +79 −1 · 1 files · 3 commits · open

No description provided.

**@⁠VlREX** on GitHub · 2026-11-24 22:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/1802) `VlREX:perf/shader-relative-shift-bounds` → `main` · +79 −1 · 1 files · 3 commits · open *No description provided.*
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:45:03 +00:00
Author
Owner

@⁠DesertGamer on GitHub · 2026-11-24 22:57 UTC · original

VIctory V2: community PRs, merged and tested

Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.

Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).

⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.

Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2

Unofficial community fork of Marvisak/VIctory, GPL-3.0.

**@⁠DesertGamer** on GitHub · 2026-11-24 22:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/1802#issuecomment-7146837766) ### VIctory V2: community PRs, merged and tested Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch. **Where it stands today:** launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1). :warning: Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk. Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help: https://DesertGamer/VIctory-V2 *Unofficial community fork of Marvisak/VIctory, GPL-3.0.*
Author
Owner

@⁠upipibi on GitHub · 2026-11-24 23:18 UTC · original

NVIDIA run: RTX 3070 8 GB, driver 616.56, plus WARP, Windows 11, debug, 70b895d (on main 70564ae). cargo test -p victory-shader --locked: 207 passed, 3 failed, 2 ignored. The 3 are #1744's NVIDIA heap-cap failures on main, so there are no new failures.

AI-assisted (Claude Code). Synthetic tests only.

**@⁠upipibi** on GitHub · 2026-11-24 23:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/1802#issuecomment-7147254275) NVIDIA run: RTX 3070 8 GB, driver 616.56, plus WARP, Windows 11, debug, `70b895d` (on `main` `70564ae`). `cargo test -p victory-shader --locked`: 207 passed, 3 failed, 2 ignored. The 3 are #1744's NVIDIA heap-cap failures on `main`, so there are no new failures. AI-assisted (Claude Code). Synthetic tests only.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 06:27 UTC · original · edited 2026-11-25 16:46 UTC

Automated triage for the maintainers.

Merge candidate. Ranges in crates/victory-shader/src/range.rs bounds s_lshr_b32 and v_lshrrev_b32 when the shift count is a constant. That narrows the registers that later relative moves (v_movrels) are taken to read. constant_shift takes inline constants 128..=159 as 0..31 and literals below 32 as they are. Anything else stays unbounded: larger constants (which the hardware masks to 5 bits), negative inline constants, and variable counts. That is conservative, and a shift by 0 leaves the operand's bound unchanged.

New since the last review: d570108 adds shift_bounds_accept_only_unambiguous_constant_counts. It covers the edges of both encodings (literals 32, 63 and u32::MAX; codes 127, 160, 192, 193 and 208), and I checked its expectations against the inline-constant table. The verdict is unchanged.

CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 06:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/1802#issuecomment-7154806213) · edited 2026-11-25 16:46 UTC <!-- victory-triage v1 head=d5701082fca665f35e009aabb1b3dcd2440d9da8 verdict=merge-candidate at=2026-11-25T16:45:09Z --> Automated triage for the maintainers. **Merge candidate.** `Ranges` in `crates/victory-shader/src/range.rs` bounds `s_lshr_b32` and `v_lshrrev_b32` when the shift count is a constant. That narrows the registers that later relative moves (`v_movrels`) are taken to read. `constant_shift` takes inline constants 128..=159 as 0..31 and literals below 32 as they are. Anything else stays unbounded: larger constants (which the hardware masks to 5 bits), negative inline constants, and variable counts. That is conservative, and a shift by 0 leaves the operand's bound unchanged. New since the last review: `d570108` adds `shift_bounds_accept_only_unambiguous_constant_counts`. It covers the edges of both encodings (literals 32, 63 and `u32::MAX`; codes 127, 160, 192, 193 and 208), and I checked its expectations against the inline-constant table. The verdict is unchanged. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠catminou4 on GitHub · 2026-11-24 23:04 UTC · original · approved these changes

Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae), cargo test -p victory-shader --locked → 119 passed, 0 failed. GPU execution tests (valu_tests/host) are #[cfg(all(test, windows))] and run only on Windows; macOS covers lowering/structure unit tests.

Relative shift bounds: constant_shift() bounds register reads for constant right shifts — constant_right_shifts_bound_relative_register_reads test. Small, precise.

**@⁠catminou4** on GitHub · 2026-11-24 23:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/1802#pullrequestreview-6048810551) · **approved these changes** Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae), cargo test -p victory-shader --locked → 119 passed, 0 failed. GPU execution tests (valu_tests/host) are #[cfg(all(test, windows))] and run only on Windows; macOS covers lowering/structure unit tests. Relative shift bounds: constant_shift() bounds register reads for constant right shifts — constant_right_shifts_bound_relative_register_reads test. Small, precise.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 18:53 UTC · original · approved these changes

Verified d5701082fca665f35e009aabb1b3dcd2440d9da8 cleanly merged onto main (63bcca43) on Windows 11 x64:

  • s_lshr_b32 / v_lshrrev_b32 bounding (crates/victory-shader/src/range.rs:285-286, 305-311) is mathematically sound: constant_shift accepts only 0..=31 (Operand::Const(128..=159) and Operand::Literal(< 32)), while shifts >= 32, variable shifts, left shifts, and arithmetic right shifts conservatively stay u32::MAX.
  • cargo test -p xtask --locked policy::tests::repository_passes_policy: 1 passed (asset policy: 191 files ok).
  • cargo clippy --locked -p victory-shader --all-targets -- -D warnings (default and --all-features): clean.
  • cargo test --locked -p victory-shader --lib range::: 5 passed, 0 failed (constant_right_shifts_bound_relative_register_reads and shift_bounds_accept_only_unambiguous_constant_counts pass).

Minor formatting nit: rustfmt --edition 2024 --check crates/victory-shader/src/range.rs flags comment alignment at range.rs:427, 429, 450. Ready to merge.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 18:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/1802#pullrequestreview-6079202839) · **approved these changes** Verified `d5701082fca665f35e009aabb1b3dcd2440d9da8` cleanly merged onto `main` (`63bcca43`) on Windows 11 x64: - `s_lshr_b32` / `v_lshrrev_b32` bounding (`crates/victory-shader/src/range.rs:285-286, 305-311`) is mathematically sound: `constant_shift` accepts only `0..=31` (`Operand::Const(128..=159)` and `Operand::Literal(< 32)`), while shifts `>= 32`, variable shifts, left shifts, and arithmetic right shifts conservatively stay `u32::MAX`. - `cargo test -p xtask --locked policy::tests::repository_passes_policy`: `1 passed` (`asset policy: 191 files ok`). - `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` (default and `--all-features`): clean. - `cargo test --locked -p victory-shader --lib range::`: `5 passed, 0 failed` (`constant_right_shifts_bound_relative_register_reads` and `shift_bounds_accept_only_unambiguous_constant_counts` pass). Minor formatting nit: `rustfmt --edition 2024 --check crates/victory-shader/src/range.rs` flags comment alignment at `range.rs:427, 429, 450`. Ready to merge.
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/1802/head:github-bot/gh-1802'
git switch 'github-bot/gh-1802'

Merge

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