Files
mandy/tools
NotRexed 2edbda73e7 translator: quad reads and helper lanes in pixel shaders, from VIctory
On the console whole-quad mode puts a pixel shader's helper lanes in EXEC.
Vulkan keeps a helper active for quad and derivative operations only;
whether it joins a ballot or a shuffle is the driver's choice. Ported from
VIctory, which runs the title:

- DPP quad_perm, a dpp8 whose every lane reads its own quad, and a
  ds_swizzle that stays in the quad (QUAD_PERM, or masks that keep lane
  bits 2-4) are quad operations in a pixel shader (Gen.quad_read:
  OpGroupNonUniformQuadBroadcast / QuadSwap), the source's EXEC bit too,
  so a helper across a triangle edge is read as on hardware (VIctory
  921d8d3b4). They were subgroup shuffles and a ballot.
- v_readfirstlane_b32 in a pixel shader: an active lane that its own
  ballot leaves out (a helper the driver keeps out) takes its own value,
  so a waterfall loop serves it in the first pass (VIctory 060195536;
  without it such loops spun with only helpers left until DEVICE_HUNG).
  An empty ballot read lane 0 before.
- A pixel's discard keeps the killed lane as a helper for the survivors'
  quad reads (VIctory 77053a0c5): Leonida never ends a lane before the end,
  so this held already; the test pins it.

Vertex, geometry and mesh shaders keep their shuffles (no helpers there,
and quad operations would need quadOperationsInAllStages).

spirv_mini_interp.run_workgroup now runs OpGroupNonUniformQuadBroadcast
and QuadSwap, with `helpers` taking part as Vulkan requires.
test_ds_permute's pixel fixture runs whole quads only (a pixel wave holds
whole quads; a lane missing from its quad is a compute shader's case).

Tests: tests/semantic/test_quad_helper_lanes.py with the hand-written
fixtures quad_helper_reads.asm and discard_keeps_helper.asm, run with
helpers a driver leaves out of ballots, votes and shuffles. Contract rows
in docs/design.md. Not GPU-verified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 18:32:16 -05:00
..
…
2026-11-23 17:08:32 -05:00
2026-11-23 17:07:05 -05:00
2026-11-23 17:08:54 -05:00