upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs/shader_validation.md
diff options
context:
space:
mode:
authorAwkGrep256 <AwkGrep256@users.noreply.github.com>2026-11-23 00:13:33 +0300
committerAwkGrep256 <AwkGrep256@users.noreply.github.com>2026-11-23 00:13:40 +0300
commit58bc80c331097fe25df0cd43577ea17af2cd1e46 (patch)
tree095c574303cf503640469115056aa1226017f7dc /docs/shader_validation.md
parentadefa18b1386241953ddec58e540e72647ff5420 (diff)
tools: ps_helper_probe.py measures helper lanes at a triangle edge on RDNA2 (SHADER-681)
docs/design.md's whole-quad-mode row left helper-invocation behaviour at triangle edges untested. The probe draws a triangle whose edge cuts 2x2 quads and runs seven wave64 raw-ISA pixel shaders through ps_oracle; covered lanes read their helper neighbours through DPP quad_perm. On gfx1036 (RADV, Mesa 26.3.1) all 10 checks hold: entry EXEC is the covered pixels, s_wqm turns on exactly the quads with a covered pixel (packed from lane 0), lane % 4 = (x & 1) + 2 (y & 1), helpers interpolate their own pixel centre, their v0/v1 hold their own I/J before s_wqm, and an exp vm with helpers on writes no pixel outside the triangle. The design.md row now says so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docs/shader_validation.md')
-rw-r--r--docs/shader_validation.md34
1 files changed, 34 insertions, 0 deletions
diff --git a/docs/shader_validation.md b/docs/shader_validation.md
index 7189bf71c..a28cb1a07 100644
--- a/docs/shader_validation.md
+++ b/docs/shader_validation.md
@@ -1484,6 +1484,40 @@ the Windows check's `attr0.x` code (with `v40`, past the template's 8 VGPRs) giv
1484P0 = 0 and P10 = 4.0 for the single parameter, and a second patch with another constant changes the result (nothing 1484P0 = 0 and P10 = 4.0 for the single parameter, and a second patch with another constant changes the result (nothing
1485is cached). 1485is cached).
1486 1486
1487#### Helper lanes at a triangle edge (`tools/ps_helper_probe.py`, SHADER-681)
1488
1489What a pixel wave does with the helper lanes of a partly covered 2x2 quad, which the translator's EXEC model and
1490`s_wqm` lowering depend on (`docs/design.md` row "Whole-quad mode"). The probe draws one triangle, (-1, -1), (1.3, -1),
1491(-1, 0.9), into a 16 x 16 target, so its edge cuts quads; the varying is the vertex position, so each lane's
1492interpolated value is its own pixel centre. The template pixel shader takes a derivative, so the driver builds it as
1493a shader that needs quads. Seven wave64 programs replace the pixel shader. A helper is never written to the target,
1494so a covered lane of the same quad reads the helper's registers through DPP `quad_perm` and exports them.
1495
1496```sh
1497LEONIDA_VK_DEVICE=raphael python -I tools/ps_helper_probe.py --build <runtime build> [--json out.json]
1498```
1499
1500On the Ryzen 7 9800X3D iGPU (`RADV RAPHAEL_MENDOCINO`, gfx1036, Mesa 26.3.1): 137 covered pixels in three waves,
150125 (covered lane, helper neighbour) pairs, and all 10 checks hold in three runs, with identical words except an
1502unwritten helper register:
1503
1504| check | gfx1036 |
1505|---|---|
1506| entry EXEC | exactly the covered pixels: helpers start off |
1507| `s_wqm_b64 exec, exec` | turns on exactly the quads with a covered pixel |
1508| wave layout | quads packed from lane 0; a quad with no covered pixel is not in the wave |
1509| lane order in a quad | lane % 4 = (x & 1) + 2 (y & 1): top-left, top-right, bottom-left, bottom-right |
1510| a helper's `v_interp_p1/p2_f32` after `s_wqm` | its own pixel centre, extrapolated (error 1.64e-4, as covered) |
1511| a helper's v0/v1 without `s_wqm` | already its own pixel's I/J (to 7e-5; I + J > 1, outside the triangle) |
1512| a helper's VGPR without `s_wqm` | not written (an unwritten register, different in every run) |
1513| EXEC without `s_wqm` | stays the entry mask |
1514| DPP without `fi` from an inactive lane | leaves the destination unchanged |
1515| `exp mrt0 ... done vm` with helpers on in EXEC | writes no pixel outside the triangle |
1516
1517The last row is what the driver's own code relies on: RADV compiles the template as `s_wqm_b64 exec, exec` at entry,
1518then the interpolation and an `exp mrt0 ... done vm` with the helpers still on. The programs are wave64; a wave32
1519pixel stage (`RADV_PERFTEST=pswave32`) and GFX11+ exit 77. Not measured: wave32, RDNA1/gfx1013 and the Windows driver.
1520
1487 1521
1488## Coverage plan and cost 1522## Coverage plan and cost
1489 1523