Pr/amd dxil getdimensions #697

Open
github-bot wants to merge 13 commits from github-bot/gh-697 into main AGit
Owner

@⁠pug205gti6 on GitHub · 2026-11-25 04:39 UTC · original
pug205gti6:pr/amd-dxil-getdimensions → main · +563 −62 · 9 files · 13 commits · open

No description provided.

**@⁠pug205gti6** on GitHub · 2026-11-25 04:39 UTC · [original](https://github.com/fxceless/victory-fork/pull/697) `pug205gti6:pr/amd-dxil-getdimensions` → `main` · +563 −62 · 9 files · 13 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:49:11 +00:00
Author
Owner

@⁠JRamos1993 on GitHub · 2026-11-25 06:28 UTC · original

Offline check on the retail shader pack: +42 programs validate, none lost. 22,167 programs' DXIL changes.

Setup: RTX 5090, Windows 11. victory translate --validate --list over the title's full shader pack (26,084 programs), main 310c6eb against this head, with a local DXIL hash on each validated line.

main this PR
validated 25,382 25,424
newly validated 42: 35 Ps + 4 Cs "a descriptor read only as data", 2 Cs "a wave sum of 16-bit floats where not every lane runs", 1 Cs "a descriptor's address or format read as data"
lost 0
DXIL changed among programs validating on both 22,167
  • It's a bundle: this branch merges #203, #487, #156, #213 and upstream changes. #203 alone validates 38 of these 42 on the same pack, so most of the gain is #203's.
  • A sample of 3 changed programs, dxc -dumpbin with SSA numbers normalized: 12–94 lines differ. They are the same createHandleFromHeap + annotateHandle (ByteAddressBuffer) calls at different places, which fits the getDimensions fix in the last commit. I did not check every changed program.
  • Easier to review apart: the bundle's effects mix with those PRs'. Reviewing the last commit on its own, on top of #203, would separate them.

AI use: Claude Code with Claude Opus 5.5 ran the pack, compared the dumps and wrote this. Nothing from the title is in it.

**@⁠JRamos1993** on GitHub · 2026-11-25 06:28 UTC · [original](https://github.com/fxceless/victory-fork/pull/697#issuecomment-7154830280) **Offline check on the retail shader pack: +42 programs validate, none lost. 22,167 programs' DXIL changes.** **Setup:** RTX 5090, Windows 11. `victory translate --validate --list` over the title's full shader pack (26,084 programs), `main` `310c6eb` against this head, with a local DXIL hash on each validated line. | | `main` | this PR | |---|---|---| | validated | 25,382 | **25,424** | | newly validated | | 42: 35 Ps + 4 Cs "a descriptor read only as data", 2 Cs "a wave sum of 16-bit floats where not every lane runs", 1 Cs "a descriptor's address or format read as data" | | lost | | 0 | | DXIL changed among programs validating on both | | **22,167** | - **It's a bundle:** this branch merges #203, #487, #156, #213 and upstream changes. #203 alone validates 38 of these 42 on the same pack, so most of the gain is #203's. - **A sample of 3 changed programs**, `dxc -dumpbin` with SSA numbers normalized: 12–94 lines differ. They are the same `createHandleFromHeap` + `annotateHandle` (ByteAddressBuffer) calls at different places, which fits the `getDimensions` fix in the last commit. I did not check every changed program. - **Easier to review apart:** the bundle's effects mix with those PRs'. Reviewing the last commit on its own, on top of #203, would separate them. AI use: Claude Code with Claude Opus 5.5 ran the pack, compared the dumps and wrote this. Nothing from the title is in it.
Author
Owner

@⁠kaayzouee on GitHub · 2026-11-25 11:31 UTC · original

Duplicate of #542

**@⁠kaayzouee** on GitHub · 2026-11-25 11:31 UTC · [original](https://github.com/fxceless/victory-fork/pull/697#issuecomment-7161159896) Duplicate of #542
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/697/head:github-bot/gh-697'
git switch 'github-bot/gh-697'

Merge

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