shader, gpu: port 32-lane BVH builder lowering, structure views, and GPURT node answer #403

Open
github-bot wants to merge 1 commit from github-bot/gh-403 into main AGit
Owner

@⁠Kikoarl on GitHub · 2026-11-27 21:55 UTC · original
Kikoarl:feat/bvh-builder-32lane → main · +542 −66 · 5 files · 1 commits · open

Summary

Ports the portable 32-lane BVH builder lowering fixes, placed acceleration-structure view_address (Location), and GPURT [u32::MAX; 4] node answer from fxceless/victory-fork commits 17533c5, 1170216, 1320dfd, and 9a9091d (GPL-3.0-or-later), rebased onto main (df2daaf).

VICTORY_BVH_BUILDER remains opt-in (=1, off by default).

Changes

  • crates/victory-shader/src/emit/lower.rs, emit/wave64_tests.rs: Enables USER_DISPATCH_THREADS_X guarding (partial_active, effect_guard) for spilled 1D compute programs on 32-lane waves and programs with barriers instead of returning early; refines lane_uniform dword tracking, uniform ds_read checks, and v_readfirstlane_b32 masking when halves match or are guarded.
  • crates/victory-shader/src/bvh.rs, emit/intersect.rs: Returns [u32::MAX; 4] (-1 per AMD GPURT) for instance and procedural BVH nodes (kinds 6 and 7), and applies effect_guard to BVH intersection loads.
  • crates/victory-gpu/src/descriptor/host.rs: Extracts Location (words 4–5) for placed as well as shader acceleration-structure views in view_address, returning None when zero.
  • Adaptations for main: Omits 17533c5 (VICTORY_WAVE_PAIRS_SPILLED, paired.rs is absent on main) and omits 9a9091d written-page tracking because main uses Shadow::by_address sync (preserving PR #88 and PR #58).

Verification

Verified on Windows (x86_64-pc-windows-msvc) against main (df2daaf):

  • git diff --check main..HEAD — clean
  • cargo test -p xtask --locked — 6 passed, 0 failed (asset policy: 287 files ok)
  • cargo clippy -p victory-shader -p victory-gpu --all-targets --locked — exit 0, 0 warnings in changed files (main has pre-existing clippy warnings in untouched files)
  • cargo test -p victory-shader --locked emit::wave64_tests — 17 passed, 0 failed
  • cargo test -p victory-gpu --locked descriptor:: — 62 passed, 0 failed
**@⁠Kikoarl** on GitHub · 2026-11-27 21:55 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/403) `Kikoarl:feat/bvh-builder-32lane` → `main` · +542 −66 · 5 files · 1 commits · open ### Summary Ports the portable 32-lane BVH builder lowering fixes, placed acceleration-structure `view_address` (`Location`), and GPURT `[u32::MAX; 4]` node answer from `fxceless/victory-fork` commits `17533c5`, `1170216`, `1320dfd`, and `9a9091d` (`GPL-3.0-or-later`), rebased onto `main` (`df2daaf`). `VICTORY_BVH_BUILDER` remains opt-in (`=1`, off by default). ### Changes - **`crates/victory-shader/src/emit/lower.rs`, `emit/wave64_tests.rs`**: Enables `USER_DISPATCH_THREADS_X` guarding (`partial_active`, `effect_guard`) for spilled 1D compute programs on 32-lane waves and programs with barriers instead of returning early; refines `lane_uniform` dword tracking, uniform `ds_read` checks, and `v_readfirstlane_b32` masking when halves match or are guarded. - **`crates/victory-shader/src/bvh.rs`, `emit/intersect.rs`**: Returns `[u32::MAX; 4]` (`-1` per AMD GPURT) for instance and procedural BVH nodes (kinds 6 and 7), and applies `effect_guard` to BVH intersection loads. - **`crates/victory-gpu/src/descriptor/host.rs`**: Extracts `Location` (words 4–5) for placed as well as shader acceleration-structure views in `view_address`, returning `None` when zero. - **Adaptations for `main`**: Omits `17533c5` (`VICTORY_WAVE_PAIRS_SPILLED`, `paired.rs` is absent on `main`) and omits `9a9091d` written-page tracking because `main` uses `Shadow::by_address` sync (preserving PR #88 and PR #58). ### Verification Verified on Windows (`x86_64-pc-windows-msvc`) against `main` (`df2daaf`): - `git diff --check main..HEAD` — clean - `cargo test -p xtask --locked` — 6 passed, 0 failed (`asset policy: 287 files ok`) - `cargo clippy -p victory-shader -p victory-gpu --all-targets --locked` — exit 0, 0 warnings in changed files (`main` has pre-existing clippy warnings in untouched files) - `cargo test -p victory-shader --locked emit::wave64_tests` — 17 passed, 0 failed - `cargo test -p victory-gpu --locked descriptor::` — 62 passed, 0 failed
Port the portable pieces of fxceless/victory-fork commits 17533c5, 1170216, 1320dfd, and 9a9091d onto trustno1 main (f3534e6):

- victory-shader: enable USER_DISPATCH_THREADS_X guarding for spilled 1D compute programs on 32-lane waves and programs with barriers by adding partial_active/effect_guard instead of early return when threads must stay for s_barrier or two-wave exchanges (after 1320dfd).

- victory-shader: check exact operand dwords in lane_uniform (full dwords on scalars, exact VGPR dwords except v_movrel/v_swap), widen ordered/stable uniform ds_read checks beyond ds_read_b32, and mask v_readfirstlane_b32 with partial_active when halves are alike or guarded (after 1170216, 1320dfd).

- victory-shader: return [u32::MAX; 4] (-1 per AMD GPURT) for instance and procedural BVH nodes (kinds 6 and 7) in bvh::intersect and emit::intersect, and use effect_guard for BVH intersection loads (after 9a9091d).

- victory-gpu: extract Location (words 4-5) for placed as well as shader acceleration-structure views in view_address, returning None when zero (after 9a9091d).

Adaptations for main: 17533c5 (VICTORY_WAVE_PAIRS_SPILLED) is inapplicable because main uses halves/exchange/pairs without paired.rs; 9a9091d memory sync/written-page tracking is omitted because main already uses arena Shadow::by_address sync (preserving PR #88 and PR #58) and VICTORY_BVH_BUILDER remains opt-in (=1).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 21:58:24 +00:00
Author
Owner

@⁠Castyan on GitHub · 2026-11-27 22:20 UTC · original

i'm on it for testing

**@⁠Castyan** on GitHub · 2026-11-27 22:20 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/403#issuecomment-7229243068) i'm on it for testing
Author
Owner

@⁠Castyan on GitHub · 2026-11-27 22:30 UTC · original · edited 2026-11-27 23:05 UTC

#388 + #403 merged on main (df2daaf): no conflict, no new failure. Windows, RTX 5060, cargo test --workspace --no-fail-fast: 1070 passed (main 1064, the +6 are #403's new tests), 2 failed (victory-gpu indirect::tests, the same 2 on main). The clippy error at victory-formats/src/texture.rs:1346 is on main too. Not tested in game or with translate --list.

In game (RTX 5060 8 GB, 15 GB RAM, below the README's 32 GB): CS_CollectTriangles_Meshlets translates and gets its host pipeline. Series S + 2x frame gen ran 11 min, then device removed (0x887A0007). Series X runs out of memory after 2-3 min (E_OUTOFMEMORY), with main too (driver access violation in nvwgf2umx.dll). So the crashes look like this PC's memory, not these PRs. Not a like-for-like comparison.

**@⁠Castyan** on GitHub · 2026-11-27 22:30 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/403#issuecomment-7229378044) · edited 2026-11-27 23:05 UTC **#388 + #403 merged on `main` (`df2daaf`): no conflict, no new failure.** Windows, RTX 5060, `cargo test --workspace --no-fail-fast`: 1070 passed (main 1064, the +6 are #403's new tests), 2 failed (`victory-gpu` `indirect::tests`, the same 2 on `main`). The clippy error at `victory-formats/src/texture.rs:1346` is on `main` too. Not tested in game or with `translate --list`. **In game** (RTX 5060 8 GB, 15 GB RAM, below the README's 32 GB): `CS_CollectTriangles_Meshlets` translates and gets its host pipeline. Series S + 2x frame gen ran 11 min, then device removed (`0x887A0007`). Series X runs out of memory after 2-3 min (`E_OUTOFMEMORY`), with `main` too (driver access violation in `nvwgf2umx.dll`). So the crashes look like this PC's memory, not these PRs. Not a like-for-like comparison.
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/403/head:github-bot/gh-403'
git switch 'github-bot/gh-403'

Merge

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