Skip to content

fix(shader): translate two compute descriptor refusals (record count only, descriptor moved under a waterfall's EXEC) - #620

Merged
pragyaangaur merged 2 commits into
pragyaangaur:mainfrom
earpjonathan:shader/descriptor-refusals
Nov 28, 2026
Merged

pragyaangaur merged 2 commits into
pragyaangaur:mainfrom
earpjonathan:shader/descriptor-refusals

Conversation

@earpjonathan

Copy link
Copy Markdown
Contributor

Two compute programs on main are refused by the resource tracker for reasons that turn out to be translatable exactly. This change is independent of the open PRs.

ceb5eb68cd99cb07: "a descriptor read only as data"

The program loads a buffer descriptor only to read its record count (dword 2). It never reads the other dwords and never accesses the buffer. The view addresses hold only a buffer's address, so the read was refused.

The record count now comes from the host view: getDimensions on the table slot's handle. The used-resource entry of that slot gives the kind, structured or raw, so the count is in elements or in bytes, as the console counts them. This is the same rule as for a buffer read with scalar loads. The code is in the new lower/descriptor_records.rs, which keeps lower.rs under the size cap. Any read of the address or format dwords is still refused.

e4a9f58e3acfcf7b: "a per-lane descriptor written where some lanes may keep the old one"

A descriptor is moved into VGPRs under an EXEC that a v_cmpx has narrowed, and a waterfall loop then starts with that same EXEC. The loop header's lane conditions forget the EXEC before the loop, so the check could not show that every lane the loop reads had the move. The solver's satisfiable condition was real, not the solver giving up.

Before asking the lane conditions, Tracer::runs now checks this on SSA values: the access's EXEC holds no lane the move's EXEC did not hold. Values that pass are:

  • phis of such values;
  • v_cmpx writes;
  • s_and/s_andn2/s_mov/s_or/s_xor and the saveexec forms, where they only keep or take out lanes.

Anything else falls back to the lane conditions as before.

This shader still needs another change. It now stops later, at a first-lane read inside an outer loop that the per-lane halves cannot make by themselves. The whole-wave retry then refuses it as "a resource waterfall in literal wave64 halves". Getting it through needs a halves change that judges first-lane reads inside a loop one pass at a time. #589, #591, #605 and #606, alone or together, don't cover it. That area is hackgods', so it isn't folded in here.

Tests

All tests use synthetic programs:

  • A unit test traces a waterfall over a descriptor moved after v_cmpx narrowed EXEC. Without the fix it gives exactly the refusal above.
  • A GPU test samples through that waterfall (waterfall_tests.rs).
  • A GPU test stores a structured buffer's record count from a descriptor loaded only for it.

build_with in the GPU tests takes the expected number of nonuniform accesses. Both new programs use the same descriptor in every lane, so their single access is uniform.

Checks

  • Wine victory-shader suite: 485 passed, 0 failed, 5 ignored. Both new GPU tests pass.
  • Native victory-shader tests pass.
  • cargo test -p xtask and cargo xtask policy pass.
  • Clippy with -D warnings is clean on the gnullvm target, for the whole workspace and all targets, with and without --all-features.

In game

This is a silent scripted opening, run warm, compared with a warm run of main (d1609d9) on the same script:

  • ceb5eb68cd99cb07 translates. Its host pipeline is built and first bound in the world at overall frame 1921.
  • Refused compute programs: 37, against 38 on main.
  • e4a9f58e3acfcf7b is now refused at the whole-wave retry with "a resource waterfall in literal wave64 halves" instead of the descriptor refusal.
  • Median world frame: 383 ms against 378 ms, which is noise.
  • Neither run had hangs or unhandled exceptions.

🤖 Generated with Claude Code

earpjonathan and others added 2 commits November 27, 2026 19:11
A buffer descriptor loaded only for its record count (dword 2), with
its other dwords never read and the buffer never accessed, was refused
as "a descriptor read only as data": the view addresses hold only a
buffer's address. The record count now comes from the host view's
dimensions, the kind from the used-resource entry of the table slot
(structured: elements, raw: bytes), as for a buffer read with scalar
loads (`lower/descriptor_records.rs`).

A per-lane descriptor moved into VGPRs under an EXEC that a waterfall
loop then starts with was refused as "a per-lane descriptor written
where some lanes may keep the old one": the loop header's lane
conditions forget the EXEC before it. The tracer now first checks, on
SSA values, that the access's EXEC holds no lane the move's EXEC did
not (phis of such, and lane-mask operations that keep or take out
lanes), before asking the lane conditions.

Tests: a waterfall over a descriptor moved after `v_cmpx` narrowed
EXEC (tracing, and sampling on the host GPU), and a program storing a
structured buffer's record count (on the host GPU).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both programs' descriptors are the same in every lane, so their single
access is uniform: build_with takes the expected count of nonuniform
accesses (0 here, 1 for the other waterfalls). The decoder prints a zero
SMEM offset with a null soffset as "null".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants