Skip to content

Shaders: lower row permutations on wave32 hosts - #40

Open
jaschinski97-ops wants to merge 2 commits into
fxceless:mainfrom
jaschinski97-ops:fix/permlane-compute
Open

jaschinski97-ops wants to merge 2 commits into
fxceless:mainfrom
jaschinski97-ops:fix/permlane-compute

Conversation

@jaschinski97-ops

@jaschinski97-ops jaschinski97-ops commented Nov 24, 2026 •

Copy link
Copy Markdown

The translator rejects ordinary v_permlane16_b32 and v_permlanex16_b32 instructions outside recognized whole-wave reduction patterns. v_permlanex16_b32 is among the outstanding translation failures reported in #26 and the RTX 3080 report in #22.

This change lowers both instructions to DXIL row selection and lane reads, including both runtime selector words, EXEC, fetch-inactive, bound-control and aliased source/destination registers. It also marks the instructions as requiring console lane layout, allowing the existing Wave64-on-Wave32 path to handle their 32-lane-local permutations. Fetch-inactive inside a divergent host branch remains explicitly unsupported because the absent invocations' last VGPR values are unavailable. Cross-lane use outside compute retains its existing rejection.

Validation on Windows 11 / NVIDIA RTX 3080 (driver 32.0.16.2140), Rust 1.98.1, Windows GNU target with a local LLVM/MinGW linker:

  • Synthetic hardware test: 800 dispatches, 102,400 lane results checked across Wave32 and Wave64-on-Wave32, both instructions, all FI/BC combinations, aliasing, five selector patterns and five EXEC masks. Emitted containers pass the available DXIL validator.
  • Regression test checks rejection of FI inside a divergent host branch.
  • cargo test --locked -p victory-shader --lib -- --test-threads=1: 212 passed, 0 failed, 2 existing ignored tests.
  • cargo clippy --locked -p victory-shader --all-targets --features diagnostics,host -- -D warnings: clean.
  • cargo xtask policy: 170 files OK. git diff --check: clean.
  • The local WARP device reports 4..4 lanes; the new row-permutation execution tests skip it based on its advertised capabilities.
  • Local integration with Shaders: retain live interpolation first halves #52: 217 shader tests passed, 0 failed, 2 existing ignored; Clippy with diagnostics,host and -D warnings and the asset policy pass. The two changes combine without conflicts.

No title data or shader dumps are included. No gameplay, performance or native Wave64-device validation was performed; this addresses a translation gap rather than demonstrating that the title is playable. Instruction semantics follow AMD's RDNA 2 ISA, section 12.12: https://docs.amd.com/v/u/en-US/rdna2-shader-instruction-set-architecture

AI-assisted contribution with Codex; code and synthetic hardware tests run locally.

Additional independent review found that per-lane loop-limit returns can bypass later reconvergence. Commit 39f1717 adds a dedicated FI participation analysis including those synthetic return edges, leaving the existing LDS/split-wave analysis unchanged. The new loop-abort case fails before the correction and passes afterwards; all four control-flow regression tests and shader Clippy (all targets/all features, warnings denied) pass. The GPU matrix reported above was run for the original change. No game test is claimed.

@rostaddotcc

Copy link
Copy Markdown

Verified at 4d3aaab on a Linux host (CachyOS, x86-64):

  • cargo test -p victory-shader — 171 passed, 0 failed, 2 ignored.
  • cargo test -p victory-pipeline — 4 passed.
  • cargo xtask policy — 169 files ok.
  • cargo xwin build --release -p victory --target x86_64-pc-windows-msvc — clean.

But the two new tests did not run. crates/victory-shader/src/emit/mod.rs:94 registers mod permlane_tests; under #[cfg(all(test, windows))], and the module imports super::validator, which is itself #[cfg(windows)]. The test list on this host is 173 entries both before and after the patch, so nothing from permlane_tests.rs executed here — the build is all a Linux machine can add for this PR.

That gate looks stricter than the code needs. permlane_tests.rs:110-116 already tolerates a missing validator:

match validator::Validator::load(validator::Validator::default_path().as_deref()) {
    ...
    Err(e) => eprintln!("DXIL validator unavailable: {e}"),
}

so the lowering assertions would run on any platform; only the validation step needs dxil.dll. If the validator import were #[cfg(windows)] with a no-op shim elsewhere, mod permlane_tests; could be #[cfg(test)] and these two tests would run in a Linux CI — which is the only place a wave32 lowering change can be tested without a 32-lane GPU.

Since I cannot run them: is the row-permutation rewrite exercised by anything that does run off Windows, e.g. a translate case that checks the emitted container bytes? If not, the "fixes #26/#22" claim rests on a test that only Windows CI can see.

@adriaespii

Copy link
Copy Markdown

Independent test run on commit 4d3aaab (AMD RDNA4):

  • Hardware: AMD Radeon RX 9070 (driver 32.0.32015.7029), AMD Ryzen 5 7600, Windows 11 Pro, Rust 1.98.1 (x86_64-pc-windows-msvc)
  • cargo clippy --workspace --all-targets -- -D warnings: 0 warnings
  • cargo test --workspace: 498 passed, 0 failed, 7 ignored (victory-shader: 212 passed, 0 failed, 2 ignored; victory-gpu: 110 passed, 0 failed, 1 ignored)
  • Not tested: live game run (no game files on this machine)

AI use: Antigravity (Gemini 4 Neon) ran clippy/tests locally and wrote this report.

@arminkhaleghirod

Copy link
Copy Markdown

Ran victory translate --validate over the full title on an RTX 4080 (Windows 11), main 90228a7 vs this PR. All 26,148 programs on both.

The only change is the one v_permlanex16_b32 failure, which is gone. Every other failure reason has the same count, and nothing new appears. Total failure lines: 17,907 → 17,906.

@Mesrine67

Copy link
Copy Markdown

Independent targeted run on the current PR head 39f1717a9366295726b105a5900269bad33ba3b7:

  • Hardware: AMD Radeon RX 6750 XT (RDNA2), driver 32.0.21045.29003; Windows x86_64-pc-windows-msvc; Rust 1.98.1.
  • Command: cargo test --locked --offline -p victory-shader --lib permlane_ -- --nocapture --test-threads=1
  • Result: 5 passed, 0 failed. The four fetch-inactive control-flow cases all passed, including reconvergence, uniform branch, lane-local loop abort, and rejection outside the host branch.
  • The synthetic row/EXEC matrix ran on the hardware adapter: D3D12 reported wave lanes 32..64, and the test printed all row and EXEC cases passed on hardware. The 4-lane WARP adapter was skipped by the test's capability guard.

This validates the translator's synthetic cases on RDNA2; it does not test the game or establish gameplay/performance.

@Mesrine67

Copy link
Copy Markdown

Integration test against the latest fork main fetched for this review.

  • PR head: 39f1717
  • Fetched origin/main: 2119b0e. The PR API still reports base 4e17478, so I tested the combined tree locally rather than changing the author's branch.
  • Merge result: clean, no conflicts; integrated tree 8be816e96c52ee50b36d4e82bcea43276ce7efea.
  • Hardware: AMD Radeon RX 6750 XT, driver 32.0.21045.29003; Rust 1.98.1; Windows x86_64 MSVC.
  • Full crate: cargo test --locked --offline -p victory-shader --lib -- --test-threads=1 — 215 passed, 0 failed, 2 ignored.
  • Wave32 follow-up on the same integrated tree: 5 passed, 0 failed; hardware reported wave lanes 32..64, and all row/EXEC cases passed. WARP reports 4..4 and skips the two-row GPU checks as expected.

Full sanitized log: https://gist.github.com/Mesrine67/4b0a982a3a078aaad1a8d0a45695b892

No game executable was launched; these are shader/runtime tests only. The PR branch and fork main were not modified or pushed.

Copy link
Copy Markdown

Fresh local rerun on 2026-11-25 at PR head 39f1717a9366295726b105a5900269bad33ba3b7:

  • Hardware/toolchain: AMD Radeon RX 6750 XT (driver 32.0.21045.29003), Windows x86_64 MSVC, Rust 1.100.0.
  • cargo test --locked --offline -p victory-shader --lib permlane_ -- --nocapture --test-threads=1: 5 passed, 0 failed. The hardware adapter reported wave lanes 32..64 and passed the row/EXEC matrix; WARP reported 4..4 and skipped the two-row GPU checks as expected.
  • cargo test --locked --offline -p victory-shader --lib -- --test-threads=1: 215 passed, 0 failed, 2 ignored.
  • cargo clippy --locked --offline -p victory-shader --all-targets --features diagnostics,host -- -D warnings: clean.
  • cargo xtask policy: 170 files OK.

These are translator and synthetic GPU tests only; no game executable was launched and no gameplay or performance result is claimed.

justlovett0 added a commit to justlovett0/victory-gta6 that referenced this pull request Nov 24, 2026
…OMPARE_PARALLEL

VICTORY_PERMLANE=0 refuses v_permlane16/x16 as before (default on).
VICTORY_CARD_COMPARE_PARALLEL=0 uses the original one-thread-per-piece
CARD_COMPARE_SERIAL (default on = parallel group reduction). The COPY queue
already has VICTORY_RELAY_COPY_QUEUE. Verified intertwined: geometry/models/
lighting load properly, 230-240ms; fetch wait 86->6ms, copy-back 186->34ms,
GPU 172->140ms; refusals 21->9 (permlane hash a929109552ce1e84 now translates).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants