Chores: clippy -D warnings clean, xtask policy green, stable tests #154

Closed
github-bot wants to merge 8 commits from gh-pr/154/head into gh-pr/154/base
Owner

@⁠dutch2005 on GitHub · 2026-11-25 17:37 UTC · original
chores/clippy-green → main · +365 −168 · 19 files · 8 commits · closed without merging

Why

cargo clippy --workspace --all-targets --locked -- -D warnings failed on ten pre-existing victory-shader errors and more in victory-gpu; cargo test -p xtask failed because lower.rs is source, not a game asset. Two timing/global-state tests also flaked under load. This PR makes the full Windows toolchain green.

What

  • Fixes the ten shader lint errors (hex grouping, complex types via aliases, needless returns/borrows, u32::from, dead int_value).
  • cargo clippy --fix for machine-applicable GPU lints; documented crate-level allows for the fork's low-level unsafe/tuple-heavy code.
  • Corrects the diagnostics-only frame::wait binding (_wait vs wait), which broke --all-features.
  • xtask asset policy no longer applies its size limit to .rs source files; lower.rs remains source, as the README says.
  • Makes the write-watch and frame-tick tests order/timing independent.
  • To keep the branch green it also carries cherry-picks of #92 (wave64 WaveSize) and #93 (xmem whole-view fix + test). Drop them once those PRs merge.

Testing (RX 6700 XT, Windows 11, Rust 1.98.1)

  • cargo clippy --workspace --all-targets --locked -- -D warnings — passed.
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings — passed.
  • cargo test --workspace --locked -- --test-threads=1 — 563 passed, 0 failed.
  • cargo test -p xtask --locked — 4 passed, 0 failed.
  • Watch test: 0 failures in 30 repeated runs.

Notes

No game data on this machine; this is toolchain/test quality only.

**@⁠dutch2005** on GitHub · 2026-11-25 17:37 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/154) `chores/clippy-green` → `main` · +365 −168 · 19 files · 8 commits · closed without merging ## Why `cargo clippy --workspace --all-targets --locked -- -D warnings` failed on ten pre-existing `victory-shader` errors and more in `victory-gpu`; `cargo test -p xtask` failed because `lower.rs` is source, not a game asset. Two timing/global-state tests also flaked under load. This PR makes the full Windows toolchain green. ## What - Fixes the ten shader lint errors (hex grouping, complex types via aliases, needless returns/borrows, `u32::from`, dead `int_value`). - `cargo clippy --fix` for machine-applicable GPU lints; documented crate-level allows for the fork's low-level unsafe/tuple-heavy code. - Corrects the diagnostics-only `frame::wait` binding (`_wait` vs `wait`), which broke `--all-features`. - xtask asset policy no longer applies its size limit to `.rs` source files; `lower.rs` remains source, as the README says. - Makes the write-watch and frame-tick tests order/timing independent. - To keep the branch green it also carries cherry-picks of #92 (wave64 `WaveSize`) and #93 (xmem whole-view fix + test). Drop them once those PRs merge. ## Testing (RX 6700 XT, Windows 11, Rust 1.98.1) - `cargo clippy --workspace --all-targets --locked -- -D warnings` — passed. - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` — passed. - `cargo test --workspace --locked -- --test-threads=1` — **563 passed, 0 failed**. - `cargo test -p xtask --locked` — 4 passed, 0 failed. - Watch test: 0 failures in 30 repeated runs. ## Notes No game data on this machine; this is toolchain/test quality only.
The journal is global and VirtualAlloc can reuse a page number, so requiring the first answer to be empty was flaky (issue #102). Assert the new write's asking number is higher and every asker sees it.
Fix the ten victory-shader lint errors, allow documented low-level GPU patterns, correct diagnostics-feature frame wait binding, relax two timing/global-state test assertions, and exempt .rs source files from the asset size limit.
A three-page reservation took the whole-reservation path, so unmapping its middle page left it committed (issue #8, five tests). map_whole now applies above 64 pages, the threshold its debug line already used; the end is checked for overflow.
Mutation testing showed that replacing map_whole with false survived: every test used a tiny reservation. A 65-page run now asserts the whole view and its bytes, so disabling the optimisation fails the suite.
Review found that the new whole-reservation test left a 65-page range behind, so a zero-length map_alias at the start of a whole range was refused in parallel runs. Take #99's early return (ySKELLETONX), add the zero-length case to the large-run test, and move the allocate doc comment back to allocate. 0 failures in 20 parallel xmem runs.
The title maps its GPU heap in several calls. Once a large first call
shows the reservation whole, the tiny-run threshold also refused later
runs of 64 pages or fewer into it, and those went to the per-page path,
which needs placeholders the reservation no longer has. Mapping failed
with error 487 at startup (0xa10000, 16 pages, on an RX 9070 XT, reported
on #93). The threshold now only keeps tiny runs from making a new whole
view.
The whole-view tests leaked their view and reservation into later tests and raced on the global section pool. Remove the bookkeeping, unmap the view, release the reservation, and hold a test mutex; set RUST_TEST_THREADS=1 in .cargo/config.toml. 0 failures in 30 parallel runs.
A wave64 compute program only asked for a WaveSize when it needed console lanes or one-wave LDS; otherwise the AMD driver could pick 32-lane waves and a scalar counted in a divergent loop differed between the halves. Ask for the console's 64 lanes whenever the host runs them, through a small wants_wave_size helper with a table test.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:36:47 +00:00
github-bot closed this pull request 2026-11-26 03:36:47 +00:00
Author
Owner

@⁠KernelSmoker on GitHub · 2026-11-25 17:52 UTC · original

Additional validation on PR head 4d11f00: both Clippy commands passed in the pinned Rust 1.98.1 Fedora 45 container, cross-targeting x86_64-pc-windows-gnu:

  • cargo clippy --workspace --all-targets --target x86_64-pc-windows-gnu --locked -- -D warnings
  • cargo clippy --workspace --all-targets --all-features --target x86_64-pc-windows-gnu --locked -- -D warnings

This confirms the lint cleanup on the Windows GNU target; it is not a native Windows/MSVC CI run.

**@⁠KernelSmoker** on GitHub · 2026-11-25 17:52 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/154#issuecomment-7170120787) Additional validation on PR head `4d11f00`: both Clippy commands passed in the pinned Rust 1.98.1 Fedora 45 container, cross-targeting `x86_64-pc-windows-gnu`: - `cargo clippy --workspace --all-targets --target x86_64-pc-windows-gnu --locked -- -D warnings` - `cargo clippy --workspace --all-targets --all-features --target x86_64-pc-windows-gnu --locked -- -D warnings` This confirms the lint cleanup on the Windows GNU target; it is not a native Windows/MSVC CI run.
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-25 18:57 UTC · original

Checked head 4d11f00 on an RX 7900 XT (Windows 11 build 26300, Rust 1.98.1, MSVC), with separate target dirs. I did not run the game.

KernelSmoker found both clippy commands passing on the GNU target. They also pass here on MSVC. cargo test --workspace --locked -- --test-threads=1 gives 563 passed, 0 failed, as in the description.

Three problems:

  1. .cargo/config.toml loses the [alias] xtask line. The policy check itself passes (cargo run -p xtask -- policy reports "asset policy: 184 files ok"). But cargo xtask policy fails with error: no such command: xtask, and the same goes for the README's cargo xtask install-hooks and for the pre-commit hook (cargo xtask policy --staged). This was found on #93 and fixed there in 011020b. This branch carries #93 only up to 30132fc, so that fix is missing. cargo test -p xtask still passes, so it does not catch the missing alias.

  2. Clippy is clean on this PR's base (71652a2) but not after merging current main. I merged it locally onto main 000ffdd; there were no conflicts:

    • cargo clippy --workspace --all-targets --locked -- -D warnings fails with function layout is never used at crates/victory-gpu/src/watch.rs:297.
    • The --all-features run fails with two casting to the same type is unnecessary (usize -> usize) at crates/victory-gpu/src/copystat.rs:145.
      Both come from main's 0434b3a. Clippy stops at victory-gpu, so the crates after it were not linted in the merged tree.
  3. The crate-level #![allow(clippy::undocumented_unsafe_blocks)] in victory-gpu and victory-hle disables a lint the workspace turns on deliberately ([workspace.lints.clippy] undocumented_unsafe_blocks = "warn"). These are the two crates with most of the unsafe code. too_many_arguments and type_complexity are also disabled for the whole of victory-gpu. #52 makes victory-gpu clippy-clean with per-item allows and SAFETY comments instead.

Overlap with other open PRs:

  • The victory-shader changes address the same ten lints as #3.
  • Exempting all .rs files from the size limit is an alternative to splitting lower.rs (#84, #72). That choice is the maintainer's.
  • The watch-test change overlaps #115 and #112.
**@⁠adrianmjim** on GitHub · 2026-11-25 18:57 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/154#issuecomment-7171626199) Checked head 4d11f00 on an RX 7900 XT (Windows 11 build 26300, Rust 1.98.1, MSVC), with separate target dirs. I did not run the game. KernelSmoker found both clippy commands passing on the GNU target. They also pass here on MSVC. `cargo test --workspace --locked -- --test-threads=1` gives 563 passed, 0 failed, as in the description. Three problems: 1. `.cargo/config.toml` loses the `[alias] xtask` line. The policy check itself passes (`cargo run -p xtask -- policy` reports "asset policy: 184 files ok"). But `cargo xtask policy` fails with `error: no such command: xtask`, and the same goes for the README's `cargo xtask install-hooks` and for the pre-commit hook (`cargo xtask policy --staged`). This was found on #93 and fixed there in 011020b. This branch carries #93 only up to 30132fc, so that fix is missing. `cargo test -p xtask` still passes, so it does not catch the missing alias. 2. Clippy is clean on this PR's base (71652a2) but not after merging current main. I merged it locally onto main 000ffdd; there were no conflicts: - `cargo clippy --workspace --all-targets --locked -- -D warnings` fails with `function layout is never used` at `crates/victory-gpu/src/watch.rs:297`. - The `--all-features` run fails with two `casting to the same type is unnecessary (usize -> usize)` at `crates/victory-gpu/src/copystat.rs:145`. Both come from main's 0434b3a. Clippy stops at `victory-gpu`, so the crates after it were not linted in the merged tree. 3. The crate-level `#![allow(clippy::undocumented_unsafe_blocks)]` in `victory-gpu` and `victory-hle` disables a lint the workspace turns on deliberately (`[workspace.lints.clippy] undocumented_unsafe_blocks = "warn"`). These are the two crates with most of the unsafe code. `too_many_arguments` and `type_complexity` are also disabled for the whole of `victory-gpu`. #52 makes `victory-gpu` clippy-clean with per-item allows and SAFETY comments instead. Overlap with other open PRs: - The `victory-shader` changes address the same ten lints as #3. - Exempting all `.rs` files from the size limit is an alternative to splitting `lower.rs` (#84, #72). That choice is the maintainer's. - The watch-test change overlaps #115 and #112.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.