shader: lower two disjoint LDS dword fills before a compute barrier #2743

Merged
brainbudt merged 1 commit from upstream-pr/2751 into main 2026-11-26 06:02:04 +00:00
brainbudt commented 2026-11-26 05:53:49 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by brainbudt on 2026-11-26T05:53:49Z.


Problem

The startup compute translator accepts one per-lane LDS fill. It refuses a second consecutive ds_write_b32 even when the same local-X address and two immediate offsets prove that every lane writes distinct words in both banks. On 601eb62, the original proof accepts case F and refuses the new source with LDS exchange needs one bounded dword per local X ID.

Change

Track both initialized byte ranges through one unconditional workgroup barrier. Each read must fit entirely inside one range. The new gfx1013 fixture writes two banks, reads a peer lane from the first and broadcasts lane 37 from the second. The host tests cover reversed bank order, omitted or overlapping fills, a read in the gap, a third fill, unproven addresses, GDS and malformed encodings.

Scope

Refs #2274. This claimed Part A follow-up covers consecutive dword stores in a straight-line, full-EXEC 1D workgroup. The tracker gives an aggregate LDS count and does not report the frequency of this two-bank shape.

Verification

  • Linux x86-64 (Python 3.12.16, LLVM 15.0.6): the python-linux workflow command passed all 196 checks and the pixel-binary LLVM matrix passed all 124 checks. python -B tests/startup_gfx2hlsl_compute_check.py binary llvm-mc-15 reproduced the fixture bytes.
  • Rebased onto origin/main (594bb3c) and verified python3 -B tests/startup_gfx2hlsl_compute_check.py passes cleanly.
  • Windows 11 build 26200, Microsoft Basic Render Driver 10.0.26100.9818, DXC 1.9.2609.5 (D3D12 debug layer unavailable): python -B tests/startup_gfx2hlsl_compute_check.py dispatch dxc.exe offscreen_check.exe warp matched all 320 words in each of 26 cases using the upstream GPU-check artifact (e9ae884f).
  • Negative control: python -B tests/startup_gfx2hlsl_compute_check.py control f-second-fill dxc.exe offscreen_check.exe warp detected 128 incorrect words when the second fill wrote zero (first mismatch: word 1, expected 00000094, actual 00000000). Physical GPU readback remains outstanding.
  • To reproduce with a built Windows checkout: ctest --preset release --no-tests=error -j 1 -R '^startup_gfx2hlsl_compute_(controls|(f-second-fill_)?(warp|hardware))$' -V.

Reviewed with mistral-loop: APPROVE (2 rounds, mistral-large-4-0 + deepseek-v4-1-flash-1017).
Created with gpt-6.2-astra in Codex (orchestrated with Gemini 4 Neon in T3 Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6620492957 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2751). Originally posted by [brainbudt](https://github.com/brainbudt) on 2026-11-26T05:53:49Z. --- ## Problem The startup compute translator accepts one per-lane LDS fill. It refuses a second consecutive `ds_write_b32` even when the same local-X address and two immediate offsets prove that every lane writes distinct words in both banks. On `601eb62`, the original proof accepts case F and refuses the new source with `LDS exchange needs one bounded dword per local X ID`. ## Change Track both initialized byte ranges through one unconditional workgroup barrier. Each read must fit entirely inside one range. The new gfx1013 fixture writes two banks, reads a peer lane from the first and broadcasts lane 37 from the second. The host tests cover reversed bank order, omitted or overlapping fills, a read in the gap, a third fill, unproven addresses, GDS and malformed encodings. ## Scope Refs #2274. This [claimed Part A follow-up](https://github.com/R0Y00/Xbox2Windows/issues/2274#issuecomment-7183697072) covers consecutive dword stores in a straight-line, full-EXEC 1D workgroup. The tracker gives an aggregate LDS count and does not report the frequency of this two-bank shape. ## Verification - Linux x86-64 (Python 3.12.16, LLVM 15.0.6): the `python-linux` workflow command passed all 196 checks and the `pixel-binary` LLVM matrix passed all 124 checks. `python -B tests/startup_gfx2hlsl_compute_check.py binary llvm-mc-15` reproduced the fixture bytes. - Rebased onto `origin/main` (`594bb3c`) and verified `python3 -B tests/startup_gfx2hlsl_compute_check.py` passes cleanly. - Windows 11 build 26200, Microsoft Basic Render Driver `10.0.26100.9818`, DXC `1.9.2609.5` (D3D12 debug layer unavailable): `python -B tests/startup_gfx2hlsl_compute_check.py dispatch dxc.exe offscreen_check.exe warp` matched all 320 words in each of 26 cases using the upstream [GPU-check artifact](https://github.com/R0Y00/Xbox2Windows/actions/runs/45699000690/artifacts/15063912674) (`e9ae884f`). - Negative control: `python -B tests/startup_gfx2hlsl_compute_check.py control f-second-fill dxc.exe offscreen_check.exe warp` detected 128 incorrect words when the second fill wrote zero (first mismatch: word 1, expected `00000094`, actual `00000000`). Physical GPU readback remains outstanding. - To reproduce with a built Windows checkout: `ctest --preset release --no-tests=error -j 1 -R '^startup_gfx2hlsl_compute_(controls|(f-second-fill_)?(warp|hardware))$' -V`. --- Reviewed with mistral-loop: APPROVE (2 rounds, `mistral-large-4-0` + `deepseek-v4-1-flash-1017`). Created with gpt-6.2-astra in Codex (orchestrated with Gemini 4 Neon in T3 Code).
R0Y00 commented 2026-11-26 06:02:04 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T06:01:57Z.

Review: APPROVED


Reviewed the two disjoint fill ranges, single barrier and initialized-read bounds. The full source-built compute dispatch suite and the f-second-fill mutation ran after combining with main 5f27d8cf, on Windows 11 build 26200 with WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656. The mutation changed 128 of 320 words on each adapter, first word 1 (00000094 vs 00000000). Debug-layer errors and warnings were zero.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6069252801 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2751#pullrequestreview-6069252801). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-26T06:01:57Z. **Review:** APPROVED --- Reviewed the two disjoint fill ranges, single barrier and initialized-read bounds. The full source-built compute dispatch suite and the f-second-fill mutation ran after combining with main 5f27d8cf, on Windows 11 build 26200 with WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656. The mutation changed 128 of 320 words on each adapter, first word 1 (00000094 vs 00000000). Debug-layer errors and warnings were zero.
upstream-sync closed this pull request 2026-11-26 06:04:44 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!2743
No description provided.