tests: read back SAVEEXEC with overlapping and distinct SGPRs #2310

Merged
RavenCurseBurg merged 2 commits from upstream-pr/2318 into main 2026-11-25 12:15:16 +00:00
RavenCurseBurg commented 2026-11-25 12:05:38 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T12:05:38Z.


Follow-up to #2308. Case E in the existing startup compute dispatch fixture checks the saved destination, SCC and resulting EXEC after AND (B32/B64), OR (B32/B64) and ANDN2 (B64). Each form runs with D equal to S0 and with a distinct source. Four single-thread groups cover all four (old EXEC, S0) pairs. This exercises the translated compute program through DXC and a D3D12 dispatch.

The CPU oracle compares 40 result words and the other 280 sentinel words. With the old translator from 209938b0, the combined case has exactly five incorrect results, one for each same-register form. With the merged fix all 320 words match. Original side-by-side hardware measurements.

Validated on 417a101c plus this fixture:

  • The existing host translation controls and the new upstream same-register check both passed.
  • LLVM 15.0.7 assembled the 648-byte source to the recorded bytes.
  • The normal unfiltered dispatch entry ran A, B, C, D, D-wrap and E on WARP and RTX 4060. Each case matched all 320 words on both adapters.
  • git diff --check passed.

Agent environment: Codex + GPT-6.2 Astra xhigh.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6604077996 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2318). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T12:05:38Z. --- Follow-up to #2308. Case E in the existing startup compute dispatch fixture checks the saved destination, SCC and resulting EXEC after AND (B32/B64), OR (B32/B64) and ANDN2 (B64). Each form runs with D equal to S0 and with a distinct source. Four single-thread groups cover all four (old EXEC, S0) pairs. This exercises the translated compute program through DXC and a D3D12 dispatch. The CPU oracle compares 40 result words and the other 280 sentinel words. With the old translator from 209938b0, the combined case has exactly five incorrect results, one for each same-register form. With the merged fix all 320 words match. [Original side-by-side hardware measurements](https://github.com/R0Y00/Xbox2Windows/pull/2308#issuecomment-7161482758). Validated on 417a101c plus this fixture: - The existing host translation controls and the new upstream same-register check both passed. - LLVM 15.0.7 assembled the 648-byte source to the recorded bytes. - The normal unfiltered dispatch entry ran A, B, C, D, D-wrap and E on WARP and RTX 4060. Each case matched all 320 words on both adapters. - `git diff --check` passed. Agent environment: Codex + GPT-6.2 Astra xhigh.
upstream-sync closed this pull request 2026-11-25 13:00:45 +00:00
tedin7 commented 2026-11-25 13:00:45 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:20:30Z.

Review: COMMENTED


Review of head af9df2ab8eb6036fdb727d742418a9d225527be3 (tests only, tests/startup_gfx2hlsl_compute_check.py).

Result: 0 P1, 0 P2.

Logic check (clean-room, RDNA 2 SOP1 semantics: D = old EXEC, EXEC = f(S0, EXEC), SCC = EXEC != 0):

  • Case E expected words re-derived by hand for AND, OR and ANDN2 over (old EXEC, S0) = (0,0), (0,1), (1,0), (1,1). They match and_bits, or_bits, andn2_bits.
  • The alias form (D == S0) is covered for the b64 and b32 variants. The lowering copies S0 to w before writing D, so the alias results are correct.
  • Distinct-register forms use s_xor_b32 s20, s22, 1 so S0 and D differ.

Commands run locally:

  • python3 tests/startup_gfx2hlsl_compute_check.py -> Self-test passed
  • python3 tests/startup_gfx2hlsl_compute_check.py binary /usr/lib/llvm-19/bin/llvm-mc -> fixture words match llvm-mc
  • python3 tests/docs_links_check.py -> pass; python3 tests/bidi_controls_check.py -> pass; git diff --check origin/main...HEAD -> clean
  • Win2025 WARP, Debug (dev) and Release /O2 builds with the 17 direct downstream tests -> 100% passed on the second full-build run, including startup_gfx2hlsl_compute_warp (case E). The first run used the skip-build fast path and failed 2 unrelated startup_compute_translate_e2e* tests. A forced full build passed them all.
  • Mutation: disabled the D == S0 copy in op_s_and_saveexec_b64 (tools/startup/gfx2hlsl.py). startup_gfx2hlsl_compute_warp then failed with case E: word=2 expected=00000004 actual=00000007. Reverted afterwards.
  • GitHub CI Build and test on Windows = SUCCESS.

Related PRs: #2314 (execz) and #1684 (buffer atomics) do not cover SAVEEXEC readback.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6057490936 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2318#pullrequestreview-6057490936). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T12:20:30Z. **Review:** COMMENTED --- Review of head `af9df2ab8eb6036fdb727d742418a9d225527be3` (tests only, `tests/startup_gfx2hlsl_compute_check.py`). Result: 0 P1, 0 P2. Logic check (clean-room, RDNA 2 SOP1 semantics: D = old EXEC, EXEC = f(S0, EXEC), SCC = EXEC != 0): - Case E expected words re-derived by hand for AND, OR and ANDN2 over (old EXEC, S0) = (0,0), (0,1), (1,0), (1,1). They match `and_bits`, `or_bits`, `andn2_bits`. - The alias form (D == S0) is covered for the b64 and b32 variants. The lowering copies S0 to `w` before writing D, so the alias results are correct. - Distinct-register forms use `s_xor_b32 s20, s22, 1` so S0 and D differ. Commands run locally: - `python3 tests/startup_gfx2hlsl_compute_check.py` -> Self-test passed - `python3 tests/startup_gfx2hlsl_compute_check.py binary /usr/lib/llvm-19/bin/llvm-mc` -> fixture words match llvm-mc - `python3 tests/docs_links_check.py` -> pass; `python3 tests/bidi_controls_check.py` -> pass; `git diff --check origin/main...HEAD` -> clean - Win2025 WARP, Debug (dev) and Release /O2 builds with the 17 direct downstream tests -> 100% passed on the second full-build run, including `startup_gfx2hlsl_compute_warp` (case E). The first run used the skip-build fast path and failed 2 unrelated `startup_compute_translate_e2e*` tests. A forced full build passed them all. - Mutation: disabled the D == S0 copy in `op_s_and_saveexec_b64` (tools/startup/gfx2hlsl.py). `startup_gfx2hlsl_compute_warp` then failed with `case E: word=2 expected=00000004 actual=00000007`. Reverted afterwards. - GitHub CI `Build and test on Windows` = SUCCESS. Related PRs: #2314 (execz) and #1684 (buffer atomics) do not cover SAVEEXEC readback. AI-assisted; commands listed were executed locally.
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!2310
No description provided.