Reject BVH hits from unmapped title memory #206

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

@⁠Lkxex on GitHub · 2026-11-25 22:24 UTC · original
Lkxex:fix/windows-render-belo → main · +60 −19 · 1 files · 2 commits · open

Use Belobug's memory-map residency to prevent bogus hits from null BVH views. Narrow nodes need only their first 64 bytes. Wide nodes read the second span separately so it maps into the right view. Native backward permutes avoid reading inactive hardware lanes.

Tested: Windows x64 diagnostics build. Game rendering and FPS are unverified.

AI use: Codex (GPT-6.2 Sol).

**@⁠Lkxex** on GitHub · 2026-11-25 22:24 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/206) `Lkxex:fix/windows-render-belo` → `main` · +60 −19 · 1 files · 2 commits · open Use Belobug's memory-map residency to prevent bogus hits from null BVH views. Narrow nodes need only their first 64 bytes. Wide nodes read the second span separately so it maps into the right view. Native backward permutes avoid reading inactive hardware lanes. Tested: Windows x64 diagnostics build. Game rendering and FPS are unverified. AI use: Codex (GPT-6.2 Sol).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:37:58 +00:00
Author
Owner

@⁠gut0to on GitHub · 2026-11-26 16:24 UTC · original · reviewed

AI-assisted review. I inspected the BVH residency checks statically; I did not run shader tests, Windows runtime tests, or the game. This review suggests a focused partial-mapping test.

**@⁠gut0to** on GitHub · 2026-11-26 16:24 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/206#pullrequestreview-6077517234) · **reviewed** AI-assisted review. I inspected the BVH residency checks statically; I did not run shader tests, Windows runtime tests, or the game. This review suggests a focused partial-mapping test.
@ -2876,0 +2891,4 @@
let mut values: Vec<_> = words.into_iter().map(|word| (word, zero_bits)).collect();
let yes = self.s.m.bool(true);
values.push((tail_present, yes));
let mut words = self.end_guarded(tail, &values);
Author
Owner

@⁠gut0to on GitHub · 2026-11-26 16:24 UTC · original

AI-assisted review; I did not run tests. Could a generated BVH fixture cover a wide box whose first 64-byte span is resident but whose tail span is unmapped, alongside a narrow box in the resident span? That would verify the new second-span read is guarded and that tail_present rejects only the wide hit; the PR adds no test for this split-residency behavior.

**@⁠gut0to** on GitHub · 2026-11-26 16:24 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/206#discussion_r4711079058) AI-assisted review; I did not run tests. Could a generated BVH fixture cover a wide box whose first 64-byte span is resident but whose tail span is unmapped, alongside a narrow box in the resident span? That would verify the new second-span read is guarded and that `tail_present` rejects only the wide hit; the PR adds no test for this split-residency behavior.
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-26 19:49 UTC · original

Tested natively on Windows 11, RX 7900 XT (RDNA3, driver 32.0.32029.2010), head 7eaaadf against base 4f62c2a. Other jobs were running on the machine at the same time.

Corpus translate (shaders.rpf, --validate, host lanes 32-64):

  • Totals are identical to base: 26084 translated, VS/PS 14247/14247, CS 2682/2682, MS 8694/8765 validated, and the same 195 + 71 refusals. No programs were added or lost.
  • DXIL changes for 29 compute programs: indirect_diffuse_lighting, indirect_light_probes, shadowmask, sr_tracing, CS_ComputeStickyLips and CS_CollisionRaytraced.
  • All 29 change with d7b72b5 alone. 7eaaadf changes 5 of them again: CS_ComputeStickyLips and 4 shadowmask checkerboard variants.

Tests:

  • victory-shader --lib: 277 passed at both base and head.
  • victory-gpu --lib: 5 runs at head, all passed.

ds_bpermute on hardware (a local throwaway test, not for merge): a hand-written wave64 compute program where lane t reads lane t+1 with ds_bpermute_b32.

  • Base, host lanes 32-64: lane 31 reads lane 32, crossing into the other half.
  • Head, host lanes 32-64: lane 31 reads lane 0. Each half wraps on its own, for 64 and 128 threads.
  • With only even lanes active (each reads an inactive odd lane), base and head both return 0 on this GPU. The ballot change made no visible difference in that case.

The split path is now reachable on 32-lane-only hosts:

  • I forced a 32-32 target for the same program with no LDS allocated. Base refuses it ("console wave64 lanes on a host without 64-lane waves").
  • Head accepts it and emits it as wave32 (split in halves). Run on the RX 7900 XT as wave32, it matches the half-wave result, for 64 and 128 threads and for the inactive-lane case.
  • With LDS allocated, the program is still refused at both base and head on a 32-32 target.
  • I did not measure how many corpus programs this adds at host lanes 32-32.

Not tested:

  • The BVH residency rejection at runtime. No harness sets up the memory map.
  • Game rendering and FPS.
  • WARP.
  • A real 32-lane-only GPU.
**@⁠adrianmjim** on GitHub · 2026-11-26 19:49 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/206#issuecomment-7202003351) Tested natively on Windows 11, RX 7900 XT (RDNA3, driver 32.0.32029.2010), head 7eaaadf against base 4f62c2a. Other jobs were running on the machine at the same time. Corpus translate (shaders.rpf, --validate, host lanes 32-64): - Totals are identical to base: 26084 translated, VS/PS 14247/14247, CS 2682/2682, MS 8694/8765 validated, and the same 195 + 71 refusals. No programs were added or lost. - DXIL changes for 29 compute programs: indirect_diffuse_lighting, indirect_light_probes, shadowmask, sr_tracing, CS_ComputeStickyLips and CS_CollisionRaytraced. - All 29 change with d7b72b5 alone. 7eaaadf changes 5 of them again: CS_ComputeStickyLips and 4 shadowmask checkerboard variants. Tests: - victory-shader --lib: 277 passed at both base and head. - victory-gpu --lib: 5 runs at head, all passed. ds_bpermute on hardware (a local throwaway test, not for merge): a hand-written wave64 compute program where lane t reads lane t+1 with ds_bpermute_b32. - Base, host lanes 32-64: lane 31 reads lane 32, crossing into the other half. - Head, host lanes 32-64: lane 31 reads lane 0. Each half wraps on its own, for 64 and 128 threads. - With only even lanes active (each reads an inactive odd lane), base and head both return 0 on this GPU. The ballot change made no visible difference in that case. The split path is now reachable on 32-lane-only hosts: - I forced a 32-32 target for the same program with no LDS allocated. Base refuses it ("console wave64 lanes on a host without 64-lane waves"). - Head accepts it and emits it as wave32 (split in halves). Run on the RX 7900 XT as wave32, it matches the half-wave result, for 64 and 128 threads and for the inactive-lane case. - With LDS allocated, the program is still refused at both base and head on a 32-32 target. - I did not measure how many corpus programs this adds at host lanes 32-32. Not tested: - The BVH residency rejection at runtime. No harness sets up the memory map. - Game rendering and FPS. - WARP. - A real 32-lane-only GPU.
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/206/head:github-bot/gh-206'
git switch 'github-bot/gh-206'

Merge

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