feat: multi-lane pixel shader waves with SM 6.0 ballot and readlane (#68) #117

Closed
github-bot wants to merge 3 commits from gh-pr/117/head into gh-pr/117/base
Owner

@⁠Lewandox on GitHub · 2026-11-23 23:59 UTC · original
Lewandox:feat/ps-wave-ballot-readlane → main · +307 −17 · 4 files · 3 commits · closed without merging

Second part of #68: adds multi-lane pixel shader wave support (ballot, v_readlane_b32, v_readfirstlane_b32, and EXEC masks) in both the graphics reference interpreter and the HLSL SM 6.0 recompiler.

Changes

  • PrototypeScarlett/emu/rdna2_exec_graphics.py: adds run_pixel_wave(data, pixels, primitive, sgprs, memory) to execute a pixel shader across a wave32 of 1 to 32 pixels (EXEC_LO = (1 << n) - 1, per-lane v[0]/v[1]); run_pixel now delegates to it.
  • PrototypeScarlett/emu/rdna2_hlsl_graphics.py: auto-detects cross-lane operations (_uses_wave_ops, with explicit multi_lane override) and emits HLSL SM 6.0 wave intrinsics (WaveGetLaneIndex(), WaveActiveBallot(bit).x, WaveReadLaneAt(value, other & 31u), s[126] = WaveActiveBallot(true).x) while keeping the lightweight single-lane path for plain pixel shaders.
  • tests/test_rdna2_graphics_wave.py: verifies run_pixel_wave on 4 pixels with v_cmp_gt_f32 (ballot), s_and_saveexec_b32, v_readlane_b32, and v_readfirstlane_b32, as well as SM 6.0 emission and single-lane preservation.
  • README.md and docs/i18n/README.*.md: updated test count (555 -> 559).

Local verification

  • .venv\Scripts\python.exe -m pytest tests/test_rdna2_graphics_wave.py tests/test_rdna2_graphics.py tests/test_rdna2_image.py tests/test_readme_sync.py -v: 19 passed, 7 skipped (dxc/anyxboxx_gpu_run.exe not installed locally).
  • .venv\Scripts\python.exe -m ruff check --select W605,F,E9 PrototypeScarlett tests tools: All checks passed!

No game, console, or SDK files used. AI-assisted contribution.

**@⁠Lewandox** on GitHub · 2026-11-23 23:59 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/117) `Lewandox:feat/ps-wave-ballot-readlane` → `main` · +307 −17 · 4 files · 3 commits · closed without merging Second part of #68: adds multi-lane pixel shader wave support (ballot, `v_readlane_b32`, `v_readfirstlane_b32`, and EXEC masks) in both the graphics reference interpreter and the HLSL SM 6.0 recompiler. ### Changes - **`PrototypeScarlett/emu/rdna2_exec_graphics.py`**: adds `run_pixel_wave(data, pixels, primitive, sgprs, memory)` to execute a pixel shader across a wave32 of 1 to 32 pixels (`EXEC_LO = (1 << n) - 1`, per-lane `v[0]`/`v[1]`); `run_pixel` now delegates to it. - **`PrototypeScarlett/emu/rdna2_hlsl_graphics.py`**: auto-detects cross-lane operations (`_uses_wave_ops`, with explicit `multi_lane` override) and emits HLSL SM 6.0 wave intrinsics (`WaveGetLaneIndex()`, `WaveActiveBallot(bit).x`, `WaveReadLaneAt(value, other & 31u)`, `s[126] = WaveActiveBallot(true).x`) while keeping the lightweight single-lane path for plain pixel shaders. - **`tests/test_rdna2_graphics_wave.py`**: verifies `run_pixel_wave` on 4 pixels with `v_cmp_gt_f32` (ballot), `s_and_saveexec_b32`, `v_readlane_b32`, and `v_readfirstlane_b32`, as well as SM 6.0 emission and single-lane preservation. - **`README.md` and `docs/i18n/README.*.md`**: updated test count (555 -> 559). ### Local verification - `.venv\Scripts\python.exe -m pytest tests/test_rdna2_graphics_wave.py tests/test_rdna2_graphics.py tests/test_rdna2_image.py tests/test_readme_sync.py -v`: **19 passed, 7 skipped** (`dxc`/`anyxboxx_gpu_run.exe` not installed locally). - `.venv\Scripts\python.exe -m ruff check --select W605,F,E9 PrototypeScarlett tests tools`: **All checks passed!** No game, console, or SDK files used. AI-assisted contribution.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:32:22 +00:00
github-bot closed this pull request 2026-11-26 05:32:22 +00:00
Author
Owner

@⁠Lewandox on GitHub · 2026-11-24 08:59 UTC · original

Added @⁠gpu\ byte-for-byte comparison \ est_multi_lane_pixel_shader_with_divergent_exec_matches_interpreter\ in \ ests/test_rdna2_graphics_wave.py:

  • Exercises \WaveGetLaneIndex(), \WaveActiveBallot(bit).x\ (via \ _cmp_gt_f32, already ANDed with active \s[126]\ in
    dna2_hlsl.py), divergent \EXEC\ (\s_and_saveexec_b32\ + \s_mov_b32 exec_lo), and \WaveReadLaneAt\ (\ _readfirstlane_b32) on a full-screen quad, comparing every covered pixel against
    un_pixel_wave\ byte for byte regardless of D3D12/WARP lane assignment.
**@⁠Lewandox** on GitHub · 2026-11-24 08:59 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/117#issuecomment-7126813867) Added \@⁠gpu\ byte-for-byte comparison \ est_multi_lane_pixel_shader_with_divergent_exec_matches_interpreter\ in \ ests/test_rdna2_graphics_wave.py\: - Exercises \WaveGetLaneIndex()\, \WaveActiveBallot(bit).x\ (via \ _cmp_gt_f32\, already ANDed with active \s[126]\ in \ dna2_hlsl.py\), divergent \EXEC\ (\s_and_saveexec_b32\ + \s_mov_b32 exec_lo\), and \WaveReadLaneAt\ (\ _readfirstlane_b32\) on a full-screen quad, comparing every covered pixel against \ un_pixel_wave\ byte for byte regardless of D3D12/WARP lane assignment.
Author
Owner

@⁠Lewandox on GitHub · 2026-11-24 10:42 UTC · original

Rebased onto \main\ (including #116/#118/#119/#123) and addressed all review points:

  1. Lane-dependent @⁠gpu\ test (\ est_multi_lane_pixel_shader_lane_dependent_matches_interpreter):
    • Interpolates per-pixel \ttr0.x\ across a single oversized fullscreen triangle (-1,-1), (3,-1), (-1,3)\, \ttr0.x\ in \[0.0, 2.5], so the \
**@⁠Lewandox** on GitHub · 2026-11-24 10:42 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/117#issuecomment-7129130393) Rebased onto \main\ (including #116/#118/#119/#123) and addressed all review points: 1. **Lane-dependent \@⁠gpu\ test** (\ est_multi_lane_pixel_shader_lane_dependent_matches_interpreter\): - Interpolates per-pixel \ttr0.x\ across a single oversized fullscreen triangle (\(-1,-1), (3,-1), (-1,3)\, \ttr0.x\ in \[0.0, 2.5]\), so the \
Author
Owner

@⁠Lewandox on GitHub · 2026-11-24 12:10 UTC · original

Rebased onto main (b15d882) and addressed both blocking items in 8a2dba3:

  1. Helper lanes: Multi-lane pixel shaders now compile with ps_6_6 (PIXEL_WAVE_MODEL in rdna2_gpu.py), exclude helper lanes via !IsHelperLane() in WaveBallot32() (both initial s[126] EXEC and every ballot) and guard pixel-record writes with if (!IsHelperLane()). Parametrized the @gpu test over both a single oversized triangle and a two-triangle diagonal split (two_triangles) that exercises partially covered quads with real helper lanes.
  2. Wave size (>32 lanes): WaveBallot32() selects the 32-lane slice via WaveGetLaneIndex() >> 5 (b.x / b.y / b.z / b.w) and ReadLane() offsets by WaveGetLaneIndex() & ~31u, preventing lanes 32–63 from aliasing onto 0–31 on wave64 hardware.

CI (lint + pytest) is green and the PR is ready for re-review.

**@⁠Lewandox** on GitHub · 2026-11-24 12:10 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/117#issuecomment-7131059850) Rebased onto `main` (`b15d882`) and addressed both blocking items in `8a2dba3`: 1. **Helper lanes:** Multi-lane pixel shaders now compile with `ps_6_6` (`PIXEL_WAVE_MODEL` in `rdna2_gpu.py`), exclude helper lanes via `!IsHelperLane()` in `WaveBallot32()` (both initial `s[126]` EXEC and every ballot) and guard pixel-record writes with `if (!IsHelperLane())`. Parametrized the `@gpu` test over both a single oversized triangle and a two-triangle diagonal split (`two_triangles`) that exercises partially covered quads with real helper lanes. 2. **Wave size (>32 lanes):** `WaveBallot32()` selects the 32-lane slice via `WaveGetLaneIndex() >> 5` (`b.x` / `b.y` / `b.z` / `b.w`) and `ReadLane()` offsets by `WaveGetLaneIndex() & ~31u`, preventing lanes 32–63 from aliasing onto 0–31 on wave64 hardware. CI (`lint` + `pytest`) is green and the PR is ready for re-review.
Author
Owner

@⁠KainanP on GitHub · 2026-11-24 13:20 UTC · original

Essai sur NVIDIA (RTX 4060 Laptop, pilote 32.0.16.1047, Windows 11), commit 8a2dba3, runtime compilé :

python -m pytest                                   → 1 failed, 572 passed, 14 skipped
pytest tests/test_rdna2_graphics_wave.py           → 1 failed, 6 passed   (3 essais sur 3, déterministe)
ANYXBOXX_GPU=warp pytest tests/test_rdna2_graphics_wave.py → 7 passed

Échec : test_multi_lane_pixel_shader_lane_dependent_matches_interpreter[diagonal_split-verts1]

AssertionError: diagonal_split prim 1 pixel 0 lane 8
At index 1 diff: 4280286976 != 4280287231      (ballot : GPU 0xFF200000, interpréteur 0xFF2000FF)

Cause mesurée : le pilote NVIDIA met des pixels des deux triangles dans le même warp. En regroupant les enregistrements mrt1 par (first_i, first_j, init_exec) sans la primitive :

NVIDIA : 3 warps, dont 1 avec deux primitives :
  init_exec 0xFF1FFFFF → prim 0 : lignes 0-7 (8 pixels), prim 1 : lignes 8-28 (21 pixels)
WARP   : 20 warps, aucun avec deux primitives

Le test regroupe les waves par (primitive, first_i, first_j, init_exec) : ce warp est coupé en deux, et run_pixel_wave(..., primitive=1, exec_mask=0xFF1FFFFF) exécute les lignes 0-7 sans leurs pixels (v2 = 0, donc 0.5 > v2 vrai), alors que sur le GPU ces lignes portent les pixels du triangle 0 (v2 ≥ 0.5). D'où les 8 bits bas en trop dans le ballot attendu.

Ce n'est donc pas une erreur de traduction du ballot, mais une hypothèse du test (et de run_pixel_wave, une primitive par wave) que NVIDIA ne respecte pas. Pistes : une primitive par ligne dans run_pixel_wave (la clé de regroupement n'aurait plus la primitive), ou, au minimum, sauter les warps à plusieurs primitives dans le test en le disant. Le script de diagnostic (reconstruction des warps depuis mrt1) est à disposition si utile.

Le reste de la PR passe sur cette carte (les 6 autres tests, et toute la suite hors ce cas).

Essai et analyse faits avec l'aide d'une IA (Claude Code).

**@⁠KainanP** on GitHub · 2026-11-24 13:20 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/117#issuecomment-7132692108) Essai sur NVIDIA (RTX 4060 Laptop, pilote 32.0.16.1047, Windows 11), commit `8a2dba3`, runtime compilé : ``` python -m pytest → 1 failed, 572 passed, 14 skipped pytest tests/test_rdna2_graphics_wave.py → 1 failed, 6 passed (3 essais sur 3, déterministe) ANYXBOXX_GPU=warp pytest tests/test_rdna2_graphics_wave.py → 7 passed ``` Échec : `test_multi_lane_pixel_shader_lane_dependent_matches_interpreter[diagonal_split-verts1]` ``` AssertionError: diagonal_split prim 1 pixel 0 lane 8 At index 1 diff: 4280286976 != 4280287231 (ballot : GPU 0xFF200000, interpréteur 0xFF2000FF) ``` **Cause mesurée** : le pilote NVIDIA met des pixels des deux triangles dans **le même warp**. En regroupant les enregistrements mrt1 par `(first_i, first_j, init_exec)` sans la primitive : ``` NVIDIA : 3 warps, dont 1 avec deux primitives : init_exec 0xFF1FFFFF → prim 0 : lignes 0-7 (8 pixels), prim 1 : lignes 8-28 (21 pixels) WARP : 20 warps, aucun avec deux primitives ``` Le test regroupe les waves par `(primitive, first_i, first_j, init_exec)` : ce warp est coupé en deux, et `run_pixel_wave(..., primitive=1, exec_mask=0xFF1FFFFF)` exécute les lignes 0-7 sans leurs pixels (v2 = 0, donc `0.5 > v2` vrai), alors que sur le GPU ces lignes portent les pixels du triangle 0 (v2 ≥ 0.5). D'où les 8 bits bas en trop dans le ballot attendu. Ce n'est donc pas une erreur de traduction du ballot, mais une hypothèse du test (et de `run_pixel_wave`, une primitive par wave) que NVIDIA ne respecte pas. Pistes : une primitive par ligne dans `run_pixel_wave` (la clé de regroupement n'aurait plus la primitive), ou, au minimum, sauter les warps à plusieurs primitives dans le test en le disant. Le script de diagnostic (reconstruction des warps depuis mrt1) est à disposition si utile. Le reste de la PR passe sur cette carte (les 6 autres tests, et toute la suite hors ce cas). _Essai et analyse faits avec l'aide d'une IA (Claude Code)._
Author
Owner

@⁠Lewandox on GitHub · 2026-11-24 13:49 UTC · original

Fixed the multi-primitive warp issue reported by @⁠KainanP and @⁠LooperSalty on NVIDIA:

  1. rdna2_exec_graphics.run_pixel_wave (PrototypeScarlett/emu/rdna2_exec_graphics.py):
    • primitive now accepts either a single int (backward-compatible) or a per-lane mapping/sequence ({lane: prim} / [prim, ...]).
    • _interpolate() reads the parameter block for each active lane's own primitive (cached per primitive in the wave).
  2. tests/test_rdna2_graphics_wave.py:
    • Reconstructs GPU waves by (first_i, first_j, init_exec) without splitting on primitive, passing wave_primitives = {lane: prim, ...} into run_pixel_wave(...) so multi-primitive NVIDIA warps (like prim 0 lanes 0–7 + prim 1 lanes 8–28 in diagonal_split) are compared intact.
    • Added test_run_pixel_wave_supports_per_lane_primitives covering the exact multi-primitive warp ballot/readlane case on CPU.
  3. Synced all 8 READMEs to 588 tests. Will rebase once #139 lands on main.
**@⁠Lewandox** on GitHub · 2026-11-24 13:49 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/117#issuecomment-7133379297) Fixed the multi-primitive warp issue reported by @⁠KainanP and @⁠LooperSalty on NVIDIA: 1. **`rdna2_exec_graphics.run_pixel_wave` (`PrototypeScarlett/emu/rdna2_exec_graphics.py`):** - `primitive` now accepts either a single `int` (backward-compatible) or a per-lane mapping/sequence (`{lane: prim}` / `[prim, ...]`). - `_interpolate()` reads the parameter block for each active lane's own primitive (cached per primitive in the wave). 2. **`tests/test_rdna2_graphics_wave.py`:** - Reconstructs GPU waves by `(first_i, first_j, init_exec)` without splitting on `primitive`, passing `wave_primitives = {lane: prim, ...}` into `run_pixel_wave(...)` so multi-primitive NVIDIA warps (like `prim 0` lanes 0–7 + `prim 1` lanes 8–28 in `diagonal_split`) are compared intact. - Added `test_run_pixel_wave_supports_per_lane_primitives` covering the exact multi-primitive warp ballot/readlane case on CPU. 3. Synced all 8 READMEs to `588` tests. Will rebase once `#139` lands on `main`.
Author
Owner

@⁠KainanP on GitHub · 2026-11-24 14:06 UTC · original

Re-testé sur NVIDIA (RTX 4060 Laptop, pilote 32.0.16.1047, Windows 11), commit fd510d3, runtime compilé :

pytest tests/test_rdna2_graphics_wave.py                  → 8 passed  (3 essais sur 3)
ANYXBOXX_GPU=warp pytest tests/test_rdna2_graphics_wave.py → 8 passed
python -m pytest                                          → 574 passed, 14 skipped

Le cas diagonal_split (warp NVIDIA à deux primitives) passe maintenant. Merci pour la correction rapide.

Essai fait avec l'aide d'une IA (Claude Code).

**@⁠KainanP** on GitHub · 2026-11-24 14:06 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/117#issuecomment-7133842082) Re-testé sur NVIDIA (RTX 4060 Laptop, pilote 32.0.16.1047, Windows 11), commit `fd510d3`, runtime compilé : ``` pytest tests/test_rdna2_graphics_wave.py → 8 passed (3 essais sur 3) ANYXBOXX_GPU=warp pytest tests/test_rdna2_graphics_wave.py → 8 passed python -m pytest → 574 passed, 14 skipped ``` Le cas `diagonal_split` (warp NVIDIA à deux primitives) passe maintenant. Merci pour la correction rapide. _Essai fait avec l'aide d'une IA (Claude Code)._
Author
Owner

@⁠Lewandox on GitHub · 2026-11-24 15:25 UTC · original

Rebased onto latest \main\ (\ecaf78) and synced all 8 READMEs to 655 tests. Ready to merge.

**@⁠Lewandox** on GitHub · 2026-11-24 15:25 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/117#issuecomment-7136008203) Rebased onto latest \main\ (\ecaf78\) and synced all 8 READMEs to 655 tests. Ready to merge.
Author
Owner

@⁠minecraftafk072 on GitHub · 2026-11-24 18:32 UTC · original

Usage d'IA : essais lancés et résumés avec Claude Code (Claude Opus 5.5) sur ma machine.

Essai sur RDNA 2, RTX et WARP

PR à 03150d8, runtime de la PR compilé (VS Build Tools 2026, MSVC 14.52), Windows 26300.

Adaptateur test_rdna2_graphics_wave.py (3 essais) Suite complète
AMD Radeon, RDNA 2 (iGPU du Ryzen 9 7900X3D, 1002:164e, pilote 31.0.24027.1012) 7/8 à chaque essai : fullscreen-verts0 échoue 643 passent, 1 échoue, 12 ignorés
NVIDIA RTX 4070 Ti SUPER (32.0.16.1742) 8/8 644 passent, 12 ignorés
WARP 8/8 non lancée

Les 12 ignorés : Rust et TomBox non compilés dans ce checkout, la PR n'y touche pas.

Sur la Radeon, l'échec vient de la ligne 210, assert len(lane2_values) > 1 or len(waves) == 1. La comparaison de la ligne 204 passe avant : les 64 pixels donnent les mêmes octets que run_pixel_wave. La traduction est donc juste ; c'est l'hypothèse du test sur la disposition des vagues qui ne tient pas sur AMD. La CI, sans GPU, passe par WARP et ne verra pas cet échec.

Disposition mesurée des vagues de pixels

Chaque pixel écrit WaveGetLaneCount() et WaveGetLaneIndex() bruts (patch local du HLSL de pixel généré, géométrie fullscreen du test, 8×8) :

Radeon : WaveGetLaneCount() = 32, deux vagues matérielles empilées (lignes 0-3, puis 4-7, même motif) :

 0  1  4  5 16 17 20 21
 2  3  6  7 18 19 22 23
 8  9 12 13 24 25 28 29
10 11 14 15 26 27 30 31

RTX : WaveGetLaneCount() = 32, deux vagues côte à côte (colonnes 0-3, puis 4-7, même motif) :

 0  1 16 17
 2  3 18 19
 4  5 20 21
 6  7 22 23
 8  9 24 25
10 11 26 27
12 13 28 29
14 15 30 31

WARP : WaveGetLaneCount() = 4, seize vagues d'un quad.

Avec les sommets (-1,-1, r=0), (3,-1, r=2.5), (-1,3, r=0), attr0.x ne dépend que de x. Sur la Radeon, la ligne 2 tombe sur les pixels (0,1) et (0,5) : même x, donc les deux vagues lisent la même valeur (1.078125) et lane2_values n'a qu'un élément. Sur la RTX, elle tombe sur (0,1) et (4,1) : 1.078125 et 0.703125.

Correctif proposé, essayé en local

Faire varier l'attribut avec y aussi, par exemple r = 1.0 au troisième sommet :

-    ("fullscreen", [(-1.0, -1.0, 0.0), (3.0, -1.0, 2.5), (-1.0, 3.0, 0.0)]),
+    ("fullscreen", [(-1.0, -1.0, 0.0), (3.0, -1.0, 2.5), (-1.0, 3.0, 1.0)]),

Avec ce seul changement, test_rdna2_graphics_wave.py passe 8/8 sur la Radeon, la RTX et WARP, 3 essais sur 3 chacun ; saw_divergence reste vrai.

**@⁠minecraftafk072** on GitHub · 2026-11-24 18:32 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/117#issuecomment-7140788791) *Usage d'IA : essais lancés et résumés avec Claude Code (Claude Opus 5.5) sur ma machine.* ## Essai sur RDNA 2, RTX et WARP PR à `03150d8`, runtime de la PR compilé (VS Build Tools 2026, MSVC 14.52), Windows 26300. | Adaptateur | `test_rdna2_graphics_wave.py` (3 essais) | Suite complète | |---|---|---| | AMD Radeon, RDNA 2 (iGPU du Ryzen 9 7900X3D, `1002:164e`, pilote 31.0.24027.1012) | **7/8 à chaque essai** : `fullscreen-verts0` échoue | 643 passent, 1 échoue, 12 ignorés | | NVIDIA RTX 4070 Ti SUPER (32.0.16.1742) | 8/8 | 644 passent, 12 ignorés | | WARP | 8/8 | non lancée | Les 12 ignorés : Rust et TomBox non compilés dans ce checkout, la PR n'y touche pas. Sur la Radeon, l'échec vient de la ligne 210, `assert len(lane2_values) > 1 or len(waves) == 1`. La comparaison de la ligne 204 passe avant : les 64 pixels donnent les mêmes octets que `run_pixel_wave`. La traduction est donc juste ; c'est l'hypothèse du test sur la disposition des vagues qui ne tient pas sur AMD. La CI, sans GPU, passe par WARP et ne verra pas cet échec. ## Disposition mesurée des vagues de pixels Chaque pixel écrit `WaveGetLaneCount()` et `WaveGetLaneIndex()` bruts (patch local du HLSL de pixel généré, géométrie `fullscreen` du test, 8×8) : **Radeon** : `WaveGetLaneCount() = 32`, deux vagues matérielles **empilées** (lignes 0-3, puis 4-7, même motif) : ``` 0 1 4 5 16 17 20 21 2 3 6 7 18 19 22 23 8 9 12 13 24 25 28 29 10 11 14 15 26 27 30 31 ``` **RTX** : `WaveGetLaneCount() = 32`, deux vagues **côte à côte** (colonnes 0-3, puis 4-7, même motif) : ``` 0 1 16 17 2 3 18 19 4 5 20 21 6 7 22 23 8 9 24 25 10 11 26 27 12 13 28 29 14 15 30 31 ``` **WARP** : `WaveGetLaneCount() = 4`, seize vagues d'un quad. Avec les sommets `(-1,-1, r=0)`, `(3,-1, r=2.5)`, `(-1,3, r=0)`, attr0.x ne dépend que de x. Sur la Radeon, la ligne 2 tombe sur les pixels (0,1) et (0,5) : même x, donc les deux vagues lisent la même valeur (1.078125) et `lane2_values` n'a qu'un élément. Sur la RTX, elle tombe sur (0,1) et (4,1) : 1.078125 et 0.703125. ## Correctif proposé, essayé en local Faire varier l'attribut avec y aussi, par exemple r = 1.0 au troisième sommet : ```diff - ("fullscreen", [(-1.0, -1.0, 0.0), (3.0, -1.0, 2.5), (-1.0, 3.0, 0.0)]), + ("fullscreen", [(-1.0, -1.0, 0.0), (3.0, -1.0, 2.5), (-1.0, 3.0, 1.0)]), ``` Avec ce seul changement, `test_rdna2_graphics_wave.py` passe 8/8 sur la Radeon, la RTX et WARP, 3 essais sur 3 chacun ; `saw_divergence` reste vrai.
Author
Owner

@⁠Lewandox on GitHub · 2026-11-24 18:37 UTC · original

Thanks @⁠minecraftafk072 for testing on RDNA 2, RTX 4070 Ti SUPER, and WARP and tracking down the vertical vs. horizontal wave layout difference!

Applied the (-1.0, 3.0, 1.0) fix in tests/test_rdna2_graphics_wave.py so attr0.x varies along both x and y across stacked RDNA 2 waves as well as side-by-side NVIDIA warps.

**@⁠Lewandox** on GitHub · 2026-11-24 18:37 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/117#issuecomment-7140905699) Thanks @⁠minecraftafk072 for testing on RDNA 2, RTX 4070 Ti SUPER, and WARP and tracking down the vertical vs. horizontal wave layout difference! Applied the `(-1.0, 3.0, 1.0)` fix in `tests/test_rdna2_graphics_wave.py` so `attr0.x` varies along both `x` and `y` across stacked RDNA 2 waves as well as side-by-side NVIDIA warps.
Author
Owner

@⁠minecraftafk072 on GitHub · 2026-11-24 18:41 UTC · original

Usage d'IA : essais lancés et résumés avec Claude Code (Claude Opus 5.5) sur ma machine.

Confirmé à 212a418 (runtime de la PR) : test_rdna2_graphics_wave.py passe 8/8 sur la Radeon RDNA 2, la RTX 4070 Ti SUPER et WARP, 3 essais sur 3 chacun. Suite complète sur la Radeon : 644 passent, 12 ignorés (Rust et TomBox non compilés), plus aucun échec.

**@⁠minecraftafk072** on GitHub · 2026-11-24 18:41 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/117#issuecomment-7141000074) *Usage d'IA : essais lancés et résumés avec Claude Code (Claude Opus 5.5) sur ma machine.* Confirmé à `212a418` (runtime de la PR) : `test_rdna2_graphics_wave.py` passe 8/8 sur la Radeon RDNA 2, la RTX 4070 Ti SUPER et WARP, 3 essais sur 3 chacun. Suite complète sur la Radeon : 644 passent, 12 ignorés (Rust et TomBox non compilés), plus aucun échec.
Author
Owner

@⁠Cai-piroska on GitHub · 2026-11-24 21:42 UTC · original

Usage d'IA : essais et mesure faits avec Claude Code (Claude Opus 5.5) sur ma machine.

Essai à 6a1b3b8, runtime de main (8b466b1) compilé avec VS 2022 Build Tools, Windows 26300 : premier essai sur une carte qui exécute les pixel shaders en wave64, donc qui passe par la branche « wave > 32 lignes » de WaveBallot32 (b.y) et de ReadLane (& ~31u).

Largeur mesurée dans le pixel shader du test fullscreen (patch local : WaveGetLaneCount() et WaveGetLaneIndex() bruts écrits à la place de v[7]/v[8] dans l'enregistrement mrt1, 8×8 pixels) :

Adaptateur WaveGetLaneCount() WaveGetLaneIndex() max
RX 9070 XT (RDNA 4), pilote 32.0.32029.2010 64 (les 64 pixels dans une seule wave) 63
RTX 3080 Ti (Ampere), pilote 32.0.16.2114 32 31
WARP 4 3

Résultats (2 essais chacun) :

Adaptateur test_rdna2_graphics_wave.py tests/test_rdna2*.py
RX 9070 XT 8/8 311 passent
RTX 3080 Ti 8/8 310 passent, 1 échoue
WARP 8/8 311 passent

L'échec sur la 3080 Ti est test_extended_alu_matches_interpreter_on_gpu (v_rndne_f32 2.5 → 3.0, repli du pilote NVIDIA traité par #160), sans rapport avec cette PR. Les deux géométries (fullscreen et diagonal_split, avec helper lanes) passent donc aussi avec des waves de 64 lignes.

**@⁠Cai-piroska** on GitHub · 2026-11-24 21:42 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/117#issuecomment-7145281631) *Usage d'IA : essais et mesure faits avec Claude Code (Claude Opus 5.5) sur ma machine.* Essai à `6a1b3b8`, runtime de `main` (`8b466b1`) compilé avec VS 2022 Build Tools, Windows 26300 : **premier essai sur une carte qui exécute les pixel shaders en wave64**, donc qui passe par la branche « wave > 32 lignes » de `WaveBallot32` (`b.y`) et de `ReadLane` (`& ~31u`). Largeur mesurée dans le pixel shader du test `fullscreen` (patch local : `WaveGetLaneCount()` et `WaveGetLaneIndex()` bruts écrits à la place de `v[7]`/`v[8]` dans l'enregistrement mrt1, 8×8 pixels) : | Adaptateur | `WaveGetLaneCount()` | `WaveGetLaneIndex()` max | |---|---|---| | RX 9070 XT (RDNA 4), pilote 32.0.32029.2010 | **64** (les 64 pixels dans une seule wave) | 63 | | RTX 3080 Ti (Ampere), pilote 32.0.16.2114 | 32 | 31 | | WARP | 4 | 3 | Résultats (2 essais chacun) : | Adaptateur | `test_rdna2_graphics_wave.py` | `tests/test_rdna2*.py` | |---|---|---| | RX 9070 XT | 8/8 | 311 passent | | RTX 3080 Ti | 8/8 | 310 passent, 1 échoue | | WARP | 8/8 | 311 passent | L'échec sur la 3080 Ti est `test_extended_alu_matches_interpreter_on_gpu` (`v_rndne_f32` 2.5 → 3.0, repli du pilote NVIDIA traité par #160), sans rapport avec cette PR. Les deux géométries (`fullscreen` et `diagonal_split`, avec helper lanes) passent donc aussi avec des waves de 64 lignes.
Author
Owner

@⁠Lewandox on GitHub · 2026-11-24 21:42 UTC · original

Rebased onto latest \main\ (\547bb2) and synced all 9 READMEs including \docs/i18n/README.ru.md\ (663 tests; \ est_readme_sync.py\ +
uff\ passing).

**@⁠Lewandox** on GitHub · 2026-11-24 21:42 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/117#issuecomment-7145286743) Rebased onto latest \main\ (\547bb2\) and synced all 9 READMEs including \docs/i18n/README.ru.md\ (663 tests; \ est_readme_sync.py\ + \ uff\ passing).
Author
Owner

@⁠minecraftafk072 on GitHub · 2026-11-24 22:32 UTC · original

Usage d'IA : essais lancés et résumés avec Claude Code (Claude Opus 5.5) sur ma machine.

Tête a401ad3 (base 608cd4b), Windows 26300, dxc 1.9.2602.17, runtime de main compilé (la PR ne touche pas runtime/).

Adaptateur test_rdna2_graphics_wave.py Suite complète
AMD Radeon, RDNA 2 (iGPU du Ryzen 9 7900X3D, 1002:164e, pilote 31.0.24027.1012) 8 passent 651 passent, 13 ignorés
RTX 4070 Ti SUPER (pilote 32.0.16.1742) 8 passent 651 passent, 13 ignorés
WARP 10.0.26100.9818 8 passent 651 passent, 13 ignorés
  • 651 + 13 = 664, le compteur des README de la PR. Les 13 ignorés : crates Rust et DLL de TomBox non compilées, sous-module VIctory non récupéré dans ce checkout.
  • Les têtes précédentes passaient aussi sur ces trois adaptateurs, sans aucun échec : 6a1b3b8 (648 passent, 12 ignorés) et 9813756, rebasée sur b547bb2 (650 passent, 13 ignorés).
**@⁠minecraftafk072** on GitHub · 2026-11-24 22:32 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/117#issuecomment-7146362850) *Usage d'IA : essais lancés et résumés avec Claude Code (Claude Opus 5.5) sur ma machine.* Tête `a401ad3` (base `608cd4b`), Windows 26300, dxc 1.9.2602.17, runtime de `main` compilé (la PR ne touche pas `runtime/`). | Adaptateur | `test_rdna2_graphics_wave.py` | Suite complète | |---|---|---| | AMD Radeon, RDNA 2 (iGPU du Ryzen 9 7900X3D, `1002:164e`, pilote 31.0.24027.1012) | 8 passent | 651 passent, 13 ignorés | | RTX 4070 Ti SUPER (pilote 32.0.16.1742) | 8 passent | 651 passent, 13 ignorés | | WARP 10.0.26100.9818 | 8 passent | 651 passent, 13 ignorés | - 651 + 13 = 664, le compteur des README de la PR. Les 13 ignorés : crates Rust et DLL de TomBox non compilées, sous-module VIctory non récupéré dans ce checkout. - Les têtes précédentes passaient aussi sur ces trois adaptateurs, sans aucun échec : `6a1b3b8` (648 passent, 12 ignorés) et `9813756`, rebasée sur `b547bb2` (650 passent, 13 ignorés).
Author
Owner

@⁠LooperSalty on GitHub · 2026-11-25 15:12 UTC · original

Closed by the maintainer during PR triage: this PR conflicts with main in code (PrototypeScarlett/emu/rdna2_hlsl_graphics.py) and the queue is being cleared now. You are welcome to reopen it once rebased on main (keep main's 1100+ README line). Thanks for the work.

**@⁠LooperSalty** on GitHub · 2026-11-25 15:12 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/117#issuecomment-7166480303) Closed by the maintainer during PR triage: this PR conflicts with `main` in code (`PrototypeScarlett/emu/rdna2_hlsl_graphics.py`) and the queue is being cleared now. You are welcome to reopen it once rebased on `main` (keep main's `1100+` README line). Thanks for the work.
Author
Owner

@⁠LooperSalty on GitHub · 2026-11-24 08:31 UTC · original · requested changes

Thanks for this. Two blocking points:

  1. Rule 4: the multi-lane path (WaveActiveBallot, WaveReadLaneAt, WaveGetLaneIndex) never runs on GPU/WARP. tests/test_rdna2_graphics_wave.py compares the interpreter with hand-written values and the HLSL only by string search. Please add a GPU test comparing the translated pixel shader with run_pixel_wave, byte for byte.
  2. Semantics to check in rdna2_hlsl_graphics.py (MULTI_LANE_REGISTERS / MULTI_LANE_HELPERS): D3D's lane order for a pixel shader is not the interpreter's pixel order; helper lanes count in WaveActiveBallot(true); s[126] is fed from a ballot instead of a real EXEC mask; and the ballot is not ANDed with EXEC. A GPU test with divergent EXEC would show whether these matter.

Also: #119 edits the same COMMON.format(...) calls in translate_vertex/translate_pixel (wave_helpers= vs images=ALU_HELPERS + ...), so whichever lands second needs a small rebase. CI is blocked by the deleted Leonida submodule until #120 is merged.

🤖 Generated with Claude Code

**@⁠LooperSalty** on GitHub · 2026-11-24 08:31 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/117#pullrequestreview-6035948083) · **requested changes** Thanks for this. Two blocking points: 1. **Rule 4**: the multi-lane path (`WaveActiveBallot`, `WaveReadLaneAt`, `WaveGetLaneIndex`) never runs on GPU/WARP. `tests/test_rdna2_graphics_wave.py` compares the interpreter with hand-written values and the HLSL only by string search. Please add a GPU test comparing the translated pixel shader with `run_pixel_wave`, byte for byte. 2. **Semantics to check in `rdna2_hlsl_graphics.py`** (`MULTI_LANE_REGISTERS` / `MULTI_LANE_HELPERS`): D3D's lane order for a pixel shader is not the interpreter's pixel order; helper lanes count in `WaveActiveBallot(true)`; `s[126]` is fed from a ballot instead of a real EXEC mask; and the ballot is not ANDed with EXEC. A GPU test with divergent EXEC would show whether these matter. Also: #119 edits the same `COMMON.format(...)` calls in `translate_vertex`/`translate_pixel` (`wave_helpers=` vs `images=ALU_HELPERS + ...`), so whichever lands second needs a small rebase. CI is blocked by the deleted Leonida submodule until #120 is merged. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@⁠LooperSalty on GitHub · 2026-11-24 10:06 UTC · original · requested changes

Thanks for the GPU test. It passes here (RTX 4070 SUPER), but it cannot catch the cases I listed: the shader is lane-invariant (v_readfirstlane_b32 of a constant 1.0, then v2 += 1.0), so every lane writes the same value whatever the lane order, the EXEC mask or the helper lanes.

Could you make the GPU comparison depend on the lane?

  • write v_readlane_b32 of a lane other than 0 (e.g. lane 2) and the ballot result (v_cmp_* then s_and_saveexec_b32) into the output, with an input that differs per pixel;
  • handle helper lanes: on D3D, quad helper lanes are active in WaveActiveBallot(true) and WaveReadLaneAt; either exclude them (IsHelperLane(), SM 6.6) or document why the result cannot depend on them;
  • check that s[126] (EXEC) is built from the real active mask, ANDed with the ballot.
    The 32-pixel blocks in pixel order are not guaranteed to be the waves the driver forms; the comparison should only rely on values that are independent of that grouping, or read the lane index back from the GPU.

🤖 Generated with Claude Code

**@⁠LooperSalty** on GitHub · 2026-11-24 10:06 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/117#pullrequestreview-6037238427) · **requested changes** Thanks for the GPU test. It passes here (RTX 4070 SUPER), but it cannot catch the cases I listed: the shader is lane-invariant (`v_readfirstlane_b32` of a constant 1.0, then `v2 += 1.0`), so every lane writes the same value whatever the lane order, the EXEC mask or the helper lanes. Could you make the GPU comparison depend on the lane? - write `v_readlane_b32` of a lane other than 0 (e.g. lane 2) and the ballot result (`v_cmp_*` then `s_and_saveexec_b32`) into the output, with an input that differs per pixel; - handle helper lanes: on D3D, quad helper lanes are active in `WaveActiveBallot(true)` and `WaveReadLaneAt`; either exclude them (`IsHelperLane()`, SM 6.6) or document why the result cannot depend on them; - check that `s[126]` (EXEC) is built from the real active mask, ANDed with the ballot. The 32-pixel blocks in pixel order are not guaranteed to be the waves the driver forms; the comparison should only rely on values that are independent of that grouping, or read the lane index back from the GPU. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@⁠LooperSalty on GitHub · 2026-11-24 11:39 UTC · original · requested changes

Review of #117 (multi-lane pixel waves, ballot and readlane). Changes requested.

Improved since the last round: the GPU test is now lane-dependent (per-pixel input, readlane of lane 2, ballot-narrowed EXEC), and it rebuilds the waves from the GPU's own lane index and initial EXEC, so it does not depend on the driver's grouping. Passing: 424 tests, the GPU test passes, ruff clean, README test count 584 matches.

Blocking:

  1. Helper lanes are not covered. The justification in translate_pixel ("les quads entièrement couverts ... n'ont aucune helper lane") holds only for fully covered quads. The test uses one oversized triangle with no internal edge, so it never exercises a partially covered quad. On such a quad, D3D counts the helper lanes in WaveActiveBallot(true), so s[126] = WaveActiveBallot(true).x and any ballot include pixels that the interpreter does not have. Please either exclude them with IsHelperLane() (SM 6.6, check that the dxc of the Windows SDK accepts it), or add a GPU test with an internal edge (two triangles sharing a diagonal) and make it pass, or reject multi-lane shaders with a named error. A comment alone is not enough for rule 4.
  2. Wave size: Ballot reads .x (lanes 0-31) and the lane index is WaveGetLaneIndex() & 31u. On a 64-lane wave, lanes 32-63 alias onto 0-31 and the ballot misses them. Guard it (for example against WaveGetLaneCount()) or name the limitation and test it.

The t = active && cond masking on the ballot (EXEC combined with the ballot) is correct as written.

🤖 Generated with Claude Code

**@⁠LooperSalty** on GitHub · 2026-11-24 11:39 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/117#pullrequestreview-6038521440) · **requested changes** Review of #117 (multi-lane pixel waves, ballot and readlane). Changes requested. Improved since the last round: the GPU test is now lane-dependent (per-pixel input, readlane of lane 2, ballot-narrowed EXEC), and it rebuilds the waves from the GPU's own lane index and initial EXEC, so it does not depend on the driver's grouping. Passing: 424 tests, the GPU test passes, ruff clean, README test count 584 matches. Blocking: 1. Helper lanes are not covered. The justification in `translate_pixel` ("les quads entièrement couverts ... n'ont aucune helper lane") holds only for fully covered quads. The test uses one oversized triangle with no internal edge, so it never exercises a partially covered quad. On such a quad, D3D counts the helper lanes in `WaveActiveBallot(true)`, so `s[126] = WaveActiveBallot(true).x` and any ballot include pixels that the interpreter does not have. Please either exclude them with `IsHelperLane()` (SM 6.6, check that the dxc of the Windows SDK accepts it), or add a GPU test with an internal edge (two triangles sharing a diagonal) and make it pass, or reject multi-lane shaders with a named error. A comment alone is not enough for rule 4. 2. Wave size: `Ballot` reads `.x` (lanes 0-31) and the lane index is `WaveGetLaneIndex() & 31u`. On a 64-lane wave, lanes 32-63 alias onto 0-31 and the ballot misses them. Guard it (for example against `WaveGetLaneCount()`) or name the limitation and test it. The `t = active && cond` masking on the ballot (EXEC combined with the ballot) is correct as written. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@⁠LooperSalty on GitHub · 2026-11-24 13:30 UTC · original · requested changes

Le test test_multi_lane_pixel_shader_lane_dependent_matches_interpreter[diagonal_split-verts1] échoue de façon déterministe sur NVIDIA (RTX 4060 Laptop, pilote 32.0.16.1047) : 3 essais sur 3. Sur WARP, les 7 tests du fichier passent.

Écart : pixel 0, primitive 1, lane 8. mrt0[1] est un masque de ballot : 0xFF1FFF00 sur GPU contre 0xFF1FFFFF attendu. Les lanes 0 à 7 diffèrent, ce qui est cohérent avec l'analyse de KainanP : le pilote NVIDIA met des pixels des deux triangles dans une même wave, et la clé (primitive, first_i, first_j, init_exec) coupe alors cette wave en deux. (Le commentaire de KainanP donne 0xFF200000 / 0xFF2000FF : les bonnes valeurs hexadécimales sont celles ci-dessus.)

À corriger : le test ne doit pas supposer qu'une wave appartient à une seule primitive. Soit run_pixel_wave accepte une primitive par lane, soit le test regroupe sans la primitive, soit il rejette explicitement les waves multi-primitives avec une assertion de couverture. Un test @⁠gpu rouge sur une carte NVIDIA ne peut pas être fusionné.

Autres points : rdna2_hlsl_graphics.py et le README entrent en conflit avec #139 (et le README avec toute la pile) : rebaser après la fusion de #139. Les autres points de la revue précédente sont traités dans le commit courant.

**@⁠LooperSalty** on GitHub · 2026-11-24 13:30 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/117#pullrequestreview-6040057064) · **requested changes** Le test `test_multi_lane_pixel_shader_lane_dependent_matches_interpreter[diagonal_split-verts1]` échoue de façon déterministe sur NVIDIA (RTX 4060 Laptop, pilote 32.0.16.1047) : 3 essais sur 3. Sur WARP, les 7 tests du fichier passent. Écart : pixel 0, primitive 1, lane 8. `mrt0[1]` est un masque de ballot : 0xFF1FFF00 sur GPU contre 0xFF1FFFFF attendu. Les lanes 0 à 7 diffèrent, ce qui est cohérent avec l'analyse de KainanP : le pilote NVIDIA met des pixels des deux triangles dans une même wave, et la clé `(primitive, first_i, first_j, init_exec)` coupe alors cette wave en deux. (Le commentaire de KainanP donne 0xFF200000 / 0xFF2000FF : les bonnes valeurs hexadécimales sont celles ci-dessus.) À corriger : le test ne doit pas supposer qu'une wave appartient à une seule primitive. Soit `run_pixel_wave` accepte une primitive par lane, soit le test regroupe sans la primitive, soit il rejette explicitement les waves multi-primitives avec une assertion de couverture. Un test @⁠gpu rouge sur une carte NVIDIA ne peut pas être fusionné. Autres points : `rdna2_hlsl_graphics.py` et le README entrent en conflit avec #139 (et le README avec toute la pile) : rebaser après la fusion de #139. Les autres points de la revue précédente sont traités dans le commit courant.
Author
Owner

@⁠LooperSalty on GitHub · 2026-11-24 20:54 UTC · original · reviewed

Après la fusion de #162 (main 292079d), docs/i18n/README.ru.md fait partie des traductions contrôlées par tests/test_readme_sync.py. Une fois la branche rebasée sur main, ce test échoue (compteur de tests, vérifié en fusionnant main localement). Il faut reporter les mêmes changements dans README.ru.md (compteur à la valeur de cette PR) puis relancer pytest.

**@⁠LooperSalty** on GitHub · 2026-11-24 20:54 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/117#pullrequestreview-6047237202) · **reviewed** Après la fusion de #162 (main 292079d), `docs/i18n/README.ru.md` fait partie des traductions contrôlées par `tests/test_readme_sync.py`. Une fois la branche rebasée sur main, ce test échoue (compteur de tests, vérifié en fusionnant main localement). Il faut reporter les mêmes changements dans `README.ru.md` (compteur à la valeur de cette PR) puis relancer pytest.
Author
Owner

@⁠LooperSalty on GitHub · 2026-11-25 14:56 UTC · original · approved these changes

Re-tested at dcd171a on NVIDIA GeForce RTX 4070 SUPER: tests/test_rdna2_graphics_wave.py 8 passed (3/3 failure from my review is gone). Approving.

**@⁠LooperSalty** on GitHub · 2026-11-25 14:56 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/117#pullrequestreview-6059985856) · **approved these changes** Re-tested at `dcd171a` on NVIDIA GeForce RTX 4070 SUPER: `tests/test_rdna2_graphics_wave.py` 8 passed (3/3 failure from my review is gone). Approving.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.