Skip to content

Pr/amd dxil getdimensions - #697

Open
pug205gti6 wants to merge 13 commits into
fxceless:mainfrom
pug205gti6:pr/amd-dxil-getdimensions
Open

pug205gti6 wants to merge 13 commits into
fxceless:mainfrom
pug205gti6:pr/amd-dxil-getdimensions

Conversation

@pug205gti6

Copy link
Copy Markdown

No description provided.

sedzz and others added 13 commits November 24, 2026 22:55
…ate on 32-lane GPUs

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 <noreply@anthropic.com>
…16-bit wave sums with lanes gone

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 <noreply@anthropic.com>
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 fxceless#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 fxceless#173 are
synthetic. docs/fork-ray-tracing.md lists it with the other assumptions.

Reproducer and patch: @Bennet0k, fxceless#173.

Co-Authored-By: GLM <noreply@z.ai>
# Conflicts:
#	crates/victory-shader/src/emit/mod.rs
…r defaults; textures are on the card before the character bake; one host copy per placed texture
@JRamos1993

Copy link
Copy Markdown

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

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.

@kaayzouee

Copy link
Copy Markdown

Duplicate of #542

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.

8 participants