diff options
| author | AwkGrep256 <AwkGrep256@users.noreply.github.com> | 2026-11-23 00:13:33 +0300 |
|---|---|---|
| committer | AwkGrep256 <AwkGrep256@users.noreply.github.com> | 2026-11-23 00:13:40 +0300 |
| commit | 58bc80c331097fe25df0cd43577ea17af2cd1e46 (patch) | |
| tree | 095c574303cf503640469115056aa1226017f7dc /docs/shader_validation.md | |
| parent | adefa18b1386241953ddec58e540e72647ff5420 (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.md | 34 |
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 | |||
| 1484 | P0 = 0 and P10 = 4.0 for the single parameter, and a second patch with another constant changes the result (nothing | 1484 | P0 = 0 and P10 = 4.0 for the single parameter, and a second patch with another constant changes the result (nothing |
| 1485 | is cached). | 1485 | is cached). |
| 1486 | 1486 | ||
| 1487 | #### Helper lanes at a triangle edge (`tools/ps_helper_probe.py`, SHADER-681) | ||
| 1488 | |||
| 1489 | What 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 | ||
| 1492 | interpolated value is its own pixel centre. The template pixel shader takes a derivative, so the driver builds it as | ||
| 1493 | a shader that needs quads. Seven wave64 programs replace the pixel shader. A helper is never written to the target, | ||
| 1494 | so a covered lane of the same quad reads the helper's registers through DPP `quad_perm` and exports them. | ||
| 1495 | |||
| 1496 | ```sh | ||
| 1497 | LEONIDA_VK_DEVICE=raphael python -I tools/ps_helper_probe.py --build <runtime build> [--json out.json] | ||
| 1498 | ``` | ||
| 1499 | |||
| 1500 | On the Ryzen 7 9800X3D iGPU (`RADV RAPHAEL_MENDOCINO`, gfx1036, Mesa 26.3.1): 137 covered pixels in three waves, | ||
| 1501 | 25 (covered lane, helper neighbour) pairs, and all 10 checks hold in three runs, with identical words except an | ||
| 1502 | unwritten 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 | |||
| 1517 | The last row is what the driver's own code relies on: RADV compiles the template as `s_wqm_b64 exec, exec` at entry, | ||
| 1518 | then the interpolation and an `exp mrt0 ... done vm` with the helpers still on. The programs are wave64; a wave32 | ||
| 1519 | pixel 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 | ||