shader: accept more result-neutral SOPP hints like s_nop 0 #1681

Merged
rm-NoobInCoding merged 1 commit from upstream-pr/1688 into main 2026-11-24 17:41:31 +00:00
rm-NoobInCoding commented 2026-11-24 17:05:47 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by rm-NoobInCoding on 2026-11-24T17:05:47Z.


Change

tools/pixel_aot.py already translates the scheduling hints s_clause, s_setprio and s_sleep exactly like s_nop 0, because they affect timing only (docs/experiments.md). This PR applies the same rule to the SOPP hints that change no register, memory or exported result:

Hint Operand Why the result does not change
s_incperflevel, s_decperflevel counter in SIMM16[3:0], at most 15 performance-level hint
s_ttracedata_imm 16-bit field thread-trace marker
s_ttracedata none (reads M0) thread-trace marker
s_icache_inv none instruction-cache invalidation
s_wakeup none wakes waves sleeping in s_sleep

s_inst_prefetch was already accepted, but no fixture used it.

Each hint translates exactly like s_nop 0 at the same position. The following stay refused:

  • an operand above its field;
  • a missing operand;
  • an operand on an operandless hint;
  • a hint between the color export and s_endpgm, as for the existing hints;
  • s_wait_idle and s_waitcnt_depctr. Both are waits, not hints. test_pixel_cb_read_trace_follows_translator_scalar_alu_and_waits already pins s_waitcnt_depctr 0xffe3 as refused, and this PR keeps it that way. s_code_end stays refused as documented.

The hinted fixture program (scheduling_hints()) now carries one of each new hint. So the LLVM 15 assemble/disassemble round trip in check_binary covers their spellings, and the controls record them for the coverage chart. tools/scan_unsupported_shaders.py accepts the same spellings, and the new test_timing_hint_instructions covers both the accepted and the refused ones.

Coverage: +7 gfx1013 and gfx1030 SOPP forms (s_inst_prefetch, s_icache_inv, s_incperflevel, s_decperflevel, s_ttracedata, s_ttracedata_imm, s_wakeup).

Verification

Base f674edfd, patch 80f48e3d. Windows 11 build 26300, dev preset, DXC 10.0.26100.0, NVIDIA GeForce RTX 4070 (driver 32.0.16.1714) and WARP.

ctest --preset dev --no-tests=error -R '^pixel_aot_(hardware|warp)$' --output-on-failure
python -B tests/pixel_aot_check.py
python -B tests/rdna2_tools_check.py

plus every platform-independent Python check listed in AGENTS.md.

  • pixel_aot_hardware and pixel_aot_warp: 2/2 passed. Both coverage records list all seven hints.
  • check_scheduling_hints covers each operand hint at 0, at its field limit (decimal and hex) and one above it, and without an operand. It covers each operandless hint bare, with an operand, and between the export and s_endpgm. It also checks s_wait_idle and s_waitcnt_depctr. Every accepted form must translate exactly like s_nop 0.
  • pixel_aot_check.py static controls, rdna2_tools_check.py (OK, 18 skipped without LLVM), and all 49 platform-independent Python checks listed in AGENTS.md: passed.

Not run locally: the LLVM 15 round trip, because this host has no LLVM with gfx1013. The Assemble and translate gfx1013 fixtures CI job runs it on the hinted program.

Evidence and follow-up

The hints are accepted because none of them changes what the lowered program computes. The fixture shows they translate like s_nop 0; it does not measure their timing effect on a console. s_waitcnt_depctr (a hardware hazard wait) is a candidate for the same treatment, but because an existing test pins it as refused, that is left to a maintainer's decision.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6587202521 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1688). Originally posted by [rm-NoobInCoding](https://github.com/rm-NoobInCoding) on 2026-11-24T17:05:47Z. --- ## Change `tools/pixel_aot.py` already translates the scheduling hints `s_clause`, `s_setprio` and `s_sleep` exactly like `s_nop 0`, because they affect timing only (`docs/experiments.md`). This PR applies the same rule to the SOPP hints that change no register, memory or exported result: | Hint | Operand | Why the result does not change | |---|---|---| | `s_incperflevel`, `s_decperflevel` | counter in SIMM16[3:0], at most 15 | performance-level hint | | `s_ttracedata_imm` | 16-bit field | thread-trace marker | | `s_ttracedata` | none (reads M0) | thread-trace marker | | `s_icache_inv` | none | instruction-cache invalidation | | `s_wakeup` | none | wakes waves sleeping in `s_sleep` | `s_inst_prefetch` was already accepted, but no fixture used it. Each hint translates exactly like `s_nop 0` at the same position. The following stay refused: - an operand above its field; - a missing operand; - an operand on an operandless hint; - a hint between the color export and `s_endpgm`, as for the existing hints; - `s_wait_idle` and `s_waitcnt_depctr`. Both are waits, not hints. `test_pixel_cb_read_trace_follows_translator_scalar_alu_and_waits` already pins `s_waitcnt_depctr 0xffe3` as refused, and this PR keeps it that way. `s_code_end` stays refused as documented. The hinted fixture program (`scheduling_hints()`) now carries one of each new hint. So the LLVM 15 assemble/disassemble round trip in `check_binary` covers their spellings, and the controls record them for the coverage chart. `tools/scan_unsupported_shaders.py` accepts the same spellings, and the new `test_timing_hint_instructions` covers both the accepted and the refused ones. Coverage: +7 gfx1013 and gfx1030 SOPP forms (`s_inst_prefetch`, `s_icache_inv`, `s_incperflevel`, `s_decperflevel`, `s_ttracedata`, `s_ttracedata_imm`, `s_wakeup`). ## Verification Base `f674edfd`, patch `80f48e3d`. Windows 11 build 26300, `dev` preset, DXC 10.0.26100.0, NVIDIA GeForce RTX 4070 (driver 32.0.16.1714) and WARP. ```powershell ctest --preset dev --no-tests=error -R '^pixel_aot_(hardware|warp)$' --output-on-failure python -B tests/pixel_aot_check.py python -B tests/rdna2_tools_check.py ``` plus every platform-independent Python check listed in AGENTS.md. - `pixel_aot_hardware` and `pixel_aot_warp`: 2/2 passed. Both coverage records list all seven hints. - `check_scheduling_hints` covers each operand hint at 0, at its field limit (decimal and hex) and one above it, and without an operand. It covers each operandless hint bare, with an operand, and between the export and `s_endpgm`. It also checks `s_wait_idle` and `s_waitcnt_depctr`. Every accepted form must translate exactly like `s_nop 0`. - `pixel_aot_check.py` static controls, `rdna2_tools_check.py` (OK, 18 skipped without LLVM), and all 49 platform-independent Python checks listed in AGENTS.md: passed. **Not run locally:** the LLVM 15 round trip, because this host has no LLVM with gfx1013. The `Assemble and translate gfx1013 fixtures` CI job runs it on the hinted program. ## Evidence and follow-up The hints are accepted because none of them changes what the lowered program computes. The fixture shows they translate like `s_nop 0`; it does not measure their timing effect on a console. `s_waitcnt_depctr` (a hardware hazard wait) is a candidate for the same treatment, but because an existing test pins it as refused, that is left to a maintainer's decision. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted.
upstream-sync closed this pull request 2026-11-24 18:02:32 +00:00
tedin7 commented 2026-11-24 18:02:32 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:17:53Z.

Review: COMMENTED


Review of head 80f48e3dc8 (comment only, not an approval).

No blocking findings.

What I checked

  • Assembled all seven new hints (s_inst_prefetch, s_icache_inv, s_incperflevel, s_decperflevel, s_ttracedata, s_ttracedata_imm, s_wakeup) with llvm-mc-19 -triple=amdgcn -mcpu=gfx1013 (also gfx1030, gfx1010). All assemble and none writes a register, memory or the export. s_wait_idle and s_waitcnt_depctr also assemble and stay refused.
  • python3 -B tests/pixel_aot_check.py: exit 0. python3 -B tests/rdna2_tools_check.py: 146 tests OK (18 skipped).
  • Mutations, each restored with git checkout -- <file> and re-run green: "s_incperflevel": 0xf -> 0x1f in tools/pixel_aot.py (check_scheduling_hints fails); removing s_wakeup from OPERANDLESS_HINTS (same sub-check fails); scanner pattern 1[0-5] -> 1[0-6] (rdna2_tools_check fails on s_incperflevel 16).

Non-blocking

  • tools/pixel_aot.py:3230: s_inst_prefetch stays on the old unlimited path and is still accepted after the colour export, so the PR text "a hint between the export and s_endpgm is refused, as for the existing hints" is not true for it. This predates the PR; either soften the sentence or add the refusal case.
  • test_timing_hint_instructions has no case for an operand on an operandless hint in the scanner. By hand s_wakeup 0, s_icache_inv 1 and s_ttracedata 3 are refused correctly, so it is only a test gap.
  • The 15 limit on the perf-level operand is stricter than LLVM (any 16-bit value); fine if intentional, worth one sentence in the docs.

Overlap: no open PR touches these hints; a conflict is possible only in the docs/experiments.md hint paragraph or HINT_NAMES.
Linux limits: no Windows, MASM, MSVC, DXC or D3D12 device here; LLVM 19 only (CI uses LLVM 15). Anything that needs them was not run.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6044023192 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1688#pullrequestreview-6044023192). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T17:17:53Z. **Review:** COMMENTED --- Review of head 80f48e3dc8812e9b8cb4793454da23443617bf76 (comment only, not an approval). No blocking findings. What I checked - Assembled all seven new hints (`s_inst_prefetch`, `s_icache_inv`, `s_incperflevel`, `s_decperflevel`, `s_ttracedata`, `s_ttracedata_imm`, `s_wakeup`) with `llvm-mc-19 -triple=amdgcn -mcpu=gfx1013` (also gfx1030, gfx1010). All assemble and none writes a register, memory or the export. `s_wait_idle` and `s_waitcnt_depctr` also assemble and stay refused. - `python3 -B tests/pixel_aot_check.py`: exit 0. `python3 -B tests/rdna2_tools_check.py`: 146 tests OK (18 skipped). - Mutations, each restored with `git checkout -- <file>` and re-run green: `"s_incperflevel": 0xf` -> `0x1f` in tools/pixel_aot.py (check_scheduling_hints fails); removing `s_wakeup` from `OPERANDLESS_HINTS` (same sub-check fails); scanner pattern `1[0-5]` -> `1[0-6]` (rdna2_tools_check fails on `s_incperflevel 16`). Non-blocking - tools/pixel_aot.py:3230: `s_inst_prefetch` stays on the old unlimited path and is still accepted after the colour export, so the PR text "a hint between the export and `s_endpgm` is refused, as for the existing hints" is not true for it. This predates the PR; either soften the sentence or add the refusal case. - `test_timing_hint_instructions` has no case for an operand on an operandless hint in the scanner. By hand `s_wakeup 0`, `s_icache_inv 1` and `s_ttracedata 3` are refused correctly, so it is only a test gap. - The 15 limit on the perf-level operand is stricter than LLVM (any 16-bit value); fine if intentional, worth one sentence in the docs. Overlap: no open PR touches these hints; a conflict is possible only in the docs/experiments.md hint paragraph or `HINT_NAMES`. Linux limits: no Windows, MASM, MSVC, DXC or D3D12 device here; LLVM 19 only (CI uses LLVM 15). Anything that needs them was not run. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-24 18:02:32 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:40:36Z.

Review: COMMENTED


Dual-platform peer review at head_sha: 80f48e3dc8812e9b8cb4793454da23443617bf76

Findings

No blocking issues (0 P1, 0 P2).

  • tools/pixel_aot.py and tools/scan_unsupported_shaders.py: accept the result-neutral SOPP hints (s_incperflevel and s_decperflevel with 4-bit counter 0..15, s_ttracedata_imm with 16-bit immediate 0..0xffff, and operandless s_icache_inv, s_ttracedata, s_wakeup) lowered like s_nop 0, while keeping s_wait_idle, s_waitcnt_depctr, s_code_end, missing/out-of-range operands, and operands on operandless hints rejected.
  • tests/pixel_aot_check.py, tests/rdna2_tools_check.py, docs/experiments.md: cover positive lowering equivalence to s_nop 0, boundary and refusal cases, and scanner parity; title-neutral.

Verification

  • Linux:
    • git diff --check origin/main...HEAD: clean.
    • python3 tests/docs_links_check.py: passed (17 Markdown files, 363 links).
    • python3 tests/bidi_controls_check.py: passed (1280 tracked files).
    • python3 -B tests/rdna2_tools_check.py -k test_timing_hint_instructions: 1 test ran, OK.
    • python3 -B tests/pixel_aot_check.py: passed.
    • llvm-mc-19 -arch=amdgcn -mcpu=gfx1013 -show-encoding: verified encodings for all 7 hint instructions (s_incperflevel 15, s_decperflevel 2, s_ttracedata_imm 0xffff, s_icache_inv, s_ttracedata, s_wakeup, s_inst_prefetch 1).
    • Local mutation checks (each restored via git checkout -- tools/pixel_aot.py):
      1. Replaced if line in OPERANDLESS_HINTS: with if False: -> python3 -B tests/pixel_aot_check.py failed in check_scheduling_hints (ValueError: Unsupported instruction 2: s_icache_inv, exit 1).
      2. Relaxed "s_incperflevel": 0xf to 0x10 -> python3 -B tests/pixel_aot_check.py failed in check_scheduling_hints (AssertionError: translate accepted invalid input, exit 1).
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Python checks: tests/pixel_aot_check.py ok (9.2s).
    • Debug (--preset dev): ctest --preset dev -R '^(pixel_aot_warp|rdna2_tools_check)$' --parallel 4 --no-tests=error --output-on-failure: 2/2 passed (13.51s).
    • Release /O2 (--preset release): ctest --preset release -R '^(pixel_aot_warp|rdna2_tools_check)$' --parallel 4 --no-tests=error --output-on-failure: 2/2 passed (13.44s).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6044359446 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1688#pullrequestreview-6044359446). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T17:40:36Z. **Review:** COMMENTED --- Dual-platform peer review at `head_sha`: `80f48e3dc8812e9b8cb4793454da23443617bf76` ### Findings No blocking issues (0 P1, 0 P2). - `tools/pixel_aot.py` and `tools/scan_unsupported_shaders.py`: accept the result-neutral SOPP hints (`s_incperflevel` and `s_decperflevel` with 4-bit counter `0..15`, `s_ttracedata_imm` with 16-bit immediate `0..0xffff`, and operandless `s_icache_inv`, `s_ttracedata`, `s_wakeup`) lowered like `s_nop 0`, while keeping `s_wait_idle`, `s_waitcnt_depctr`, `s_code_end`, missing/out-of-range operands, and operands on operandless hints rejected. - `tests/pixel_aot_check.py`, `tests/rdna2_tools_check.py`, `docs/experiments.md`: cover positive lowering equivalence to `s_nop 0`, boundary and refusal cases, and scanner parity; title-neutral. ### Verification - **Linux**: - `git diff --check origin/main...HEAD`: clean. - `python3 tests/docs_links_check.py`: passed (17 Markdown files, 363 links). - `python3 tests/bidi_controls_check.py`: passed (1280 tracked files). - `python3 -B tests/rdna2_tools_check.py -k test_timing_hint_instructions`: 1 test ran, OK. - `python3 -B tests/pixel_aot_check.py`: passed. - `llvm-mc-19 -arch=amdgcn -mcpu=gfx1013 -show-encoding`: verified encodings for all 7 hint instructions (`s_incperflevel 15`, `s_decperflevel 2`, `s_ttracedata_imm 0xffff`, `s_icache_inv`, `s_ttracedata`, `s_wakeup`, `s_inst_prefetch 1`). - **Local mutation checks** (each restored via `git checkout -- tools/pixel_aot.py`): 1. Replaced `if line in OPERANDLESS_HINTS:` with `if False:` -> `python3 -B tests/pixel_aot_check.py` failed in `check_scheduling_hints` (`ValueError: Unsupported instruction 2: s_icache_inv`, exit 1). 2. Relaxed `"s_incperflevel": 0xf` to `0x10` -> `python3 -B tests/pixel_aot_check.py` failed in `check_scheduling_hints` (`AssertionError: translate accepted invalid input`, exit 1). - **Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)**: - Python checks: `tests/pixel_aot_check.py` ok (`9.2s`). - **Debug (`--preset dev`)**: `ctest --preset dev -R '^(pixel_aot_warp|rdna2_tools_check)$' --parallel 4 --no-tests=error --output-on-failure`: **2/2 passed** (`13.51s`). - **Release `/O2` (`--preset release`)**: `ctest --preset release -R '^(pixel_aot_warp|rdna2_tools_check)$' --parallel 4 --no-tests=error --output-on-failure`: **2/2 passed** (`13.44s`). 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!1681
No description provided.