Pr/487 ray tracing 32lane #539

Open
github-bot wants to merge 6 commits from github-bot/gh-539 into main AGit
Owner

@⁠pug205gti6 on GitHub · 2026-11-25 02:02 UTC · original
pug205gti6:pr/487-ray-tracing-32lane → main · +532 −59 · 9 files · 6 commits · open

No description provided.

**@⁠pug205gti6** on GitHub · 2026-11-25 02:02 UTC · [original](https://github.com/fxceless/victory-fork/pull/539) `pug205gti6:pr/487-ray-tracing-32lane` → `main` · +532 −59 · 9 files · 6 commits · open *No description provided.*
Two gaps kept the ray-tracing programs off on a host whose waves are 32 lanes.

1. Buffer views picked from the view heap at a computed index. The shadow-ray
   trace programs read the address of their structure out of a heap descriptor
   they choose with a per-wave index, and walk the memory behind it. The
   translator could only take such an address from a fixed table position.
   The host now keeps, after the strides of `SLOT_STRIDES`, two more dwords
   per heap slot (low and high of the title address of the buffer view
   there), written where the strides are written, and the shader reads them
   by heap slot (`SLOT_ADDRESSES`). No new root parameter; the table grows
   from 8 MB to 24 MB per view heap.

2. `lane_uniform` proves three more things where no lane of a wave can part
   from the others: `tid >> 6` of the entry thread number (in a group whose x
   size is a multiple of 64) is the same in all lanes of a console wave; an
   `ds_read_b32` at such an address is; and a value joined by a phi, also at
   a loop header, is when its arguments are and every predecessor is entered
   by all the arriving lanes or none (a greatest fixed point over the loop's
   carried values and lane masks). The structure builder's block-scan
   programs fetch a wave-uniform running total with `v_readfirstlane` in
   such a loop; without the proof they asked for an exchange between the two
   host waves where not every lane runs.

Effect, with `VICTORY_HOST_WAVE=32` on a 32-lane card:
- 4 of the 5 shadow-ray trace programs (and their screen-space variants) now
  translate and validate; the adaptive one still stops at a lane mask read
  as data.
- 52 of the 52 structure-builder programs now translate, validate and
  create a host pipeline (3 did not).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Three translator gaps that dropped world shaders (46 programs of the
retail pack; 0 that translated before stop now, by a whole-pack
`translate --validate --list` against the previous commit):

- A descriptor nothing uses as one, whose dwords the code reads all the
  same ("a descriptor read only as data", 35, and one "a descriptor's
  address or format read as data"): an 8-dword image picked from the heap
  by an index in a constant buffer, its width/height/base level turned
  into a texel size (PS_PuddleDetect, 34 pixel programs), or a 4-dword
  buffer tested for being empty by its record count
  (ShallowWaterSim:CS_MinTimestepReduce). New `unused_descriptor_kind`
  gives such loads a kind (image: a 2D texture, documented as a shortcut;
  buffer: a raw view) and `descriptor_data` rebuilds their size dwords from
  the host view as it does for used descriptors; the buffer's address
  dwords come from the host as before. Lane-copied descriptors and
  samplers keep their own handling (checked first).
- The first half of an f16 interpolation pair whose register an f16 second
  half then writes the high half of ("the first half of an
  interpolation", 8, PS_DeferredTextured and mirror-reflection variants):
  the second half keeps the low half of the register, which the first
  half wrote and nothing reads. The first half of a pair now writes 0.
- A 16-bit float wave sum where some lanes have left the program ("a wave
  sum of 16-bit floats where not every lane runs", 2,
  compute_graph_ops:CS_TransposeVecMatMul*): on a host wave of 64 lanes,
  `half_sum_present` follows the console's balanced tree, each lane
  reading its partner run's partial sum from the first lane of that run
  that is here (every lane of an aligned run holds the run's sum on the
  console, the ones outside EXEC included), +0 where none is. Two host
  waves of 32 still refuse it.

Tests: a GPU test of the 16-bit sum with 64, 63, 40, 33, 32, 17, 5 and 1
lanes staying, bit for bit against the console's tree (RX 7900 XT).
cargo test --workspace and clippy -D warnings pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The node test's reference (bvh.rs) and its emitter (emit/intersect.rs)
took a child whose pointer is 0xffff_ffff for a hit whenever the ray
entered its box. Its result dword was "none" either way, but sorted it
came with a finite distance, so it could stand before a child that is
there; a traversal that stops at the first "none" would then miss that
child.

Both now test the pointer too: a child that is not there is a miss, as
the reference's description of the result already said. The box test's
emitted code grows by two integer instructions per child (a compare and
an and): the parity tests' program (the 64-bit form) goes from 519 to
527 instructions.

The reference's new test is the reproducer of #173: a child that is not
there whose box is entered first, one child behind it, and two that are
not there with their boxes at the ray's origin, in both node widths. The
card tests run the same node and ray. With the reference corrected and
the emitter not, the four parity tests fail on the card; corrected, they
pass on the card and on WARP.

Not known: what the console returns for such a child, and whether the
title's builder ever leaves a box under one. The cases of #173 are
synthetic. docs/fork-ray-tracing.md lists it with the other assumptions.

Reproducer and patch: @Bennet0k, #173.

Co-Authored-By: GLM <[email protected]>
# Conflicts:
#	crates/victory-shader/src/emit/mod.rs
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:45:47 +00:00
Author
Owner

@⁠Revens2 on GitHub · 2026-11-25 07:39 UTC · original

Duplicate of #487: @⁠pepezin-ai opened this patch 35 minutes earlier, and gh pr diff returns the same bytes for both (+532/-59 on 9 file(s), same title).

The original also carries the author's description, which this PR does not.

Both PRs are CONFLICTING, so this copy does not resolve the conflict it was probably made for.

Please continue in #487 so the review history and any test data stay in one place.
Thanks.

**@⁠Revens2** on GitHub · 2026-11-25 07:39 UTC · [original](https://github.com/fxceless/victory-fork/pull/539#issuecomment-7156098081) Duplicate of #487: @⁠pepezin-ai opened this patch 35 minutes earlier, and `gh pr diff` returns the same bytes for both (+532/-59 on 9 file(s), same title). The original also carries the author's description, which this PR does not. Both PRs are CONFLICTING, so this copy does not resolve the conflict it was probably made for. Please continue in #487 so the review history and any test data stay in one place. Thanks.
Author
Owner

@⁠Headache3318 on GitHub · 2026-11-25 08:50 UTC · original

Independent verification: PR #539 (Ray Tracing 32-Lane Support) builds successfully with --profile diag --features diagnostics --target x86_64-pc-windows-gnu. Tests: 251 passed, 1 failed (modules::net::tests::only_loopback_is_reachable — environment-specific network test unrelated to ray tracing), 6 ignored. No conflicts. Ready to merge. Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, Proton, AI-assisted.

**@⁠Headache3318** on GitHub · 2026-11-25 08:50 UTC · [original](https://github.com/fxceless/victory-fork/pull/539#issuecomment-7157542581) Independent verification: PR #539 (Ray Tracing 32-Lane Support) builds successfully with --profile diag --features diagnostics --target x86_64-pc-windows-gnu. Tests: 251 passed, 1 failed (modules::net::tests::only_loopback_is_reachable — environment-specific network test unrelated to ray tracing), 6 ignored. No conflicts. Ready to merge. Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, Proton, AI-assisted.
This pull request has changes conflicting with the target branch.
  • crates/victory-shader/src/emit/lower.rs
  • crates/victory-shader/src/emit/mod.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/539/head:github-bot/gh-539'
git switch 'github-bot/gh-539'

Merge

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