Perf/shader relative shift bounds #1801

Open
VlREX wants to merge 3 commits from upstream-pr/1802 into main
VlREX commented 2026-11-24 22:48:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by VlREX on 2026-11-24T22:48:38Z.


No description provided.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5481626916 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1802). Originally posted by [VlREX](https://github.com/VlREX) on 2026-11-24T22:48:38Z. --- _No description provided._
catminou4 commented 2026-11-24 23:04:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T23:04:20Z.

Review: APPROVED


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.

<!-- greyfinch-sync:Marvisak/VIctory:review:6048810551 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1802#pullrequestreview-6048810551). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T23:04:20Z. **Review:** APPROVED --- 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.
DesertGamer commented 2026-11-24 23:06:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DesertGamer on 2026-11-24T22:57:10Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7146837766 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1802#issuecomment-7146837766). Originally posted by [DesertGamer](https://github.com/DesertGamer) on 2026-11-24T22:57:10Z. --- ### 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.*
upipibi commented 2026-11-25 00:06:46 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-24T23:18:41Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7147254275 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1802#issuecomment-7147254275). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-24T23:18:41Z. --- 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.
Marvisak commented 2026-11-25 07:03:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T06:27:15Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7154806213 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1802#issuecomment-7154806213). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T06:27:15Z. --- <!-- 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)_
fuzeofficlal commented 2026-11-26 18:53:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T18:53:29Z.

Review: APPROVED


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.

<!-- greyfinch-sync:Marvisak/VIctory:review:6079202839 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1802#pullrequestreview-6079202839). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T18:53:29Z. **Review:** APPROVED --- 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.
Dukestar69 commented 2026-11-27 00:09:21 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-27T00:09:21Z.

Review: APPROVED


LGTM — verified on Windows against origin/main (63bcca4).

  • Refining relative shift bounds in range.rs passes all range tests cleanly with zero clippy warnings.
  • cargo test -p victory-shader --lib range:: -- --test-threads=1: all passed.
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6081865177 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1802#pullrequestreview-6081865177). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-27T00:09:21Z. **Review:** APPROVED --- LGTM — verified on Windows against `origin/main` (`63bcca4`). - Refining relative shift bounds in `range.rs` passes all range tests cleanly with zero clippy warnings. - `cargo test -p victory-shader --lib range:: -- --test-threads=1`: all passed. - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1802:upstream-pr/1802'
git switch 'upstream-pr/1802'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1802'
git switch 'upstream-pr/1802'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1802'
git switch 'upstream-pr/1802'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1802'
git switch 'main'
git merge --squash 'upstream-pr/1802'
git switch 'main'
git merge --ff-only 'upstream-pr/1802'
git switch 'main'
git merge 'upstream-pr/1802'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!1801
No description provided.