Split vector ALU lowering to restore the asset-policy check #72

Open
github-bot wants to merge 2 commits from github-bot/gh-72 into main AGit
Owner

@⁠Yoshi-233 on GitHub · 2026-11-25 13:21 UTC · original
Yoshi-233:fix/split-vector-lowering → main · +2857 −2848 · 3 files · 2 commits · open

The repository-wide asset check fails at 71652a2 because the shader lowerer is 630,652 bytes. The configured limit is 524,288 bytes, and the same failure breaks the xtask unit test that scans the checkout.

Move the 29 vector ALU and comparison methods into a private lower/valu.rs module. Only its instruction dispatcher needs parent visibility. The common 64-bit register helpers stay in lower.rs for the other instruction families. The two source files are now 499,516 and 131,464 bytes. This also resolves the corresponding README entry.

Verification

  • cargo xtask policy passed for all 185 files and cargo xtask policy --staged passed for the three changed paths. The policy and its existing size limit apply to both Rust files. cargo test --locked -p xtask went from one failing repository check on main to four passing tests.
  • Compared the extracted source, including comments, against the original and checked every moved method body. Using the public emitter API, 50 synthetic compute shaders generated byte-identical DXIL before and after the split (111,528 bytes total). The cases include comparisons, packed arithmetic, mixed scalar/vector operations and a DPP lane permutation.
  • Built the full victory-shader library test binary with Rust 1.98.1 for x86_64-pc-windows-gnu and ran it serially on native Windows. At both revisions exactly the same 251 tests passed, 15 failed and 6 were ignored. The 15 baseline failures produced the same assertions and adapter diagnostics on both builds. This machine has an RTX 4070 Ti SUPER and an Intel UHD 770.
**@⁠Yoshi-233** on GitHub · 2026-11-25 13:21 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/72) `Yoshi-233:fix/split-vector-lowering` → `main` · +2857 −2848 · 3 files · 2 commits · open The repository-wide asset check fails at `71652a2` because the shader lowerer is 630,652 bytes. The configured limit is 524,288 bytes, and the same failure breaks the xtask unit test that scans the checkout. Move the 29 vector ALU and comparison methods into a private `lower/valu.rs` module. Only its instruction dispatcher needs parent visibility. The common 64-bit register helpers stay in `lower.rs` for the other instruction families. The two source files are now 499,516 and 131,464 bytes. This also resolves the corresponding README entry. ## Verification - `cargo xtask policy` passed for all 185 files and `cargo xtask policy --staged` passed for the three changed paths. The policy and its existing size limit apply to both Rust files. `cargo test --locked -p xtask` went from one failing repository check on main to four passing tests. - Compared the extracted source, including comments, against the original and checked every moved method body. Using the public emitter API, 50 synthetic compute shaders generated byte-identical DXIL before and after the split (111,528 bytes total). The cases include comparisons, packed arithmetic, mixed scalar/vector operations and a DPP lane permutation. - Built the full `victory-shader` library test binary with Rust 1.98.1 for `x86_64-pc-windows-gnu` and ran it serially on native Windows. At both revisions exactly the same 251 tests passed, 15 failed and 6 were ignored. The 15 baseline failures produced the same assertions and adapter diagnostics on both builds. This machine has an RTX 4070 Ti SUPER and an Intel UHD 770.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:35:01 +00:00
Author
Owner

@⁠Adika713 on GitHub · 2026-11-25 15:36 UTC · original

Verified on AMD Radeon RX 6950 XT, Ryzen 5 3600, 32 GB RAM, Windows 11, Rust 1.98.1 / Cargo 1.98.1. No game data, no GPU device tests.

I used clean detached worktrees and an isolated CARGO_TARGET_DIR per tree. A clean worktree matters here: the policy test in my main checkout also sees two untracked local .log files, which are not part of this PR comparison.

Before, at upstream/main 01aadd193d57e71fb4d57810eb2fdd1bc95c950b:

cargo test -p xtask policy::tests::repository_passes_policy -- --exact --nocapture
cargo test -p xtask
  • policy test: exit 101 — test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 3 filtered out.
  • violation: POLICY: crates/victory-shader/src/emit/lower.rs: 630652 bytes exceeds the 524288-byte limit.
  • full xtask suite: exit 101 — test result: FAILED. 3 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out.

After, at this PR's head 0771808:

cargo test --manifest-path F:\VIctory-Belobug-AMD\_agent_tmp\policy-72\Cargo.toml -p xtask policy::tests::repository_passes_policy -- --exact --nocapture
cargo test --manifest-path F:\VIctory-Belobug-AMD\_agent_tmp\policy-72\Cargo.toml -p xtask
  • policy test: exit 0 — test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 3 filtered out.
  • full xtask suite: exit 0 — test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out.
  • File sizes in this tree: lower.rs 499,516 bytes and lower/valu.rs 131,464 bytes, both under the limit.

Overlap: PR #84 head b5a4046 also passes both commands (4 passed / 0 failed for xtask), with lower.rs 453,035 bytes and lower/alu.rs 177,971 bytes. I did not write a competing fix.

Not tested: the game or any shader-GPU test; no game files were used.

AI-assisted: OpenCode, model Big Pickle. No game data.

**@⁠Adika713** on GitHub · 2026-11-25 15:36 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/72#issuecomment-7167096413) Verified on AMD Radeon RX 6950 XT, Ryzen 5 3600, 32 GB RAM, Windows 11, Rust 1.98.1 / Cargo 1.98.1. No game data, no GPU device tests. I used clean detached worktrees and an isolated `CARGO_TARGET_DIR` per tree. A clean worktree matters here: the policy test in my main checkout also sees two untracked local `.log` files, which are not part of this PR comparison. Before, at `upstream/main` `01aadd193d57e71fb4d57810eb2fdd1bc95c950b`: ```powershell cargo test -p xtask policy::tests::repository_passes_policy -- --exact --nocapture cargo test -p xtask ``` - policy test: exit 101 — `test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 3 filtered out`. - violation: `POLICY: crates/victory-shader/src/emit/lower.rs: 630652 bytes exceeds the 524288-byte limit`. - full xtask suite: exit 101 — `test result: FAILED. 3 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out`. After, at this PR's head `0771808`: ```powershell cargo test --manifest-path F:\VIctory-Belobug-AMD\_agent_tmp\policy-72\Cargo.toml -p xtask policy::tests::repository_passes_policy -- --exact --nocapture cargo test --manifest-path F:\VIctory-Belobug-AMD\_agent_tmp\policy-72\Cargo.toml -p xtask ``` - policy test: exit 0 — `test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 3 filtered out`. - full xtask suite: exit 0 — `test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out`. - File sizes in this tree: `lower.rs` 499,516 bytes and `lower/valu.rs` 131,464 bytes, both under the limit. Overlap: PR #84 head `b5a4046` also passes both commands (4 passed / 0 failed for xtask), with `lower.rs` 453,035 bytes and `lower/alu.rs` 177,971 bytes. I did not write a competing fix. Not tested: the game or any shader-GPU test; no game files were used. AI-assisted: OpenCode, model Big Pickle. No game data.
Author
Owner

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

Tested on an RX 7600 XT 16 GB (RDNA3, Navi 33), driver 32.0.32015.2008, Windows 11 Pro build 26300, Rust 1.98.1, at 0771808: cargo test -p victory-shader --lib --locked: 266 passed, 0 failed, 6 ignored, hardware dispatch tests included (main at 01aadd1: 266 passed). Two runs, with #140 applied on top. Without it, parallel victory-shader runs here sometimes crash inside WARP (d3d10warp.dll, STATUS_ACCESS_VIOLATION). main does that too, so it has nothing to do with this PR, but it made the first run of this PR look broken. Workspace tests only; not run in the title.

**@⁠ySKELLETONX** on GitHub · 2026-11-25 16:36 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/72#issuecomment-7168244819) Tested on an RX 7600 XT 16 GB (RDNA3, Navi 33), driver 32.0.32015.2008, Windows 11 Pro build 26300, Rust 1.98.1, at `0771808`: `cargo test -p victory-shader --lib --locked`: **266 passed, 0 failed, 6 ignored**, hardware dispatch tests included (`main` at `01aadd1`: 266 passed). Two runs, with #140 applied on top. Without it, parallel `victory-shader` runs here sometimes crash inside WARP (`d3d10warp.dll`, STATUS_ACCESS_VIOLATION). `main` does that too, so it has nothing to do with this PR, but it made the first run of this PR look broken. Workspace tests only; not run in the title.
Author
Owner

@⁠Yoshi-233 on GitHub · 2026-11-26 01:15 UTC · original

Thanks for checking the split on both AMD setups. I merged current main (4f62c2a) into this branch at c94789d. The only conflict was in the README. I kept the new upstream notes and removed the two lines about the oversized shader source. Both Rust files are byte-for-byte identical to the revision you tested (0771808).

I reran the checks on the merged revision with Rust 1.98.1 on Linux. cargo xtask policy accepted all 187 files, all four xtask tests passed, and cargo test --locked -p victory-shader --lib reported 196 passed and 6 ignored. This rerun covers the CPU-side tests.

**@⁠Yoshi-233** on GitHub · 2026-11-26 01:15 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/72#issuecomment-7179585721) Thanks for checking the split on both AMD setups. I merged current main (`4f62c2a`) into this branch at `c94789d`. The only conflict was in the README. I kept the new upstream notes and removed the two lines about the oversized shader source. Both Rust files are byte-for-byte identical to the revision you tested (`0771808`). I reran the checks on the merged revision with Rust 1.98.1 on Linux. `cargo xtask policy` accepted all 187 files, all four xtask tests passed, and `cargo test --locked -p victory-shader --lib` reported 196 passed and 6 ignored. This rerun covers the CPU-side tests.
Author
Owner

@⁠gut0to on GitHub · 2026-11-25 16:06 UTC · original · reviewed

AI-assisted static review; I did not run tests or launch the game. This change moves vector ALU lowering methods into private emit/lower/valu.rs and leaves the module dispatcher in lower.rs. The repository asset-policy check catches the over-limit source-file constraint; the PR reports cargo test -p xtask passing, which I did not execute.

**@⁠gut0to** on GitHub · 2026-11-25 16:06 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/72#pullrequestreview-6060925691) · **reviewed** AI-assisted static review; I did not run tests or launch the game. This change moves vector ALU lowering methods into private emit/lower/valu.rs and leaves the module dispatcher in lower.rs. The repository asset-policy check catches the over-limit source-file constraint; the PR reports cargo test -p xtask passing, which I did not execute.
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/72/head:github-bot/gh-72'
git switch 'github-bot/gh-72'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-72'
git switch 'github-bot/gh-72'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-72'
git switch 'github-bot/gh-72'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-72'
git switch 'main'
git merge --squash 'github-bot/gh-72'
git switch 'main'
git merge --ff-only 'github-bot/gh-72'
git switch 'main'
git merge 'github-bot/gh-72'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.