shader: accept s_version as a no-op marker in pixel_aot #790

Merged
JB2WIN merged 1 commit from upstream-pr/796 into main 2026-11-23 05:18:03 +00:00
JB2WIN commented 2026-11-23 05:03:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-23T05:03:24Z.


Change

tools/pixel_aot.py now accepts SOPK s_version K (K from 0 to 0xffff, in hex or decimal) as a no-op marker, wherever s_nop is accepted, including after the colour export. It does not change SCC, pending loads or outstanding samples. These forms are refused with Invalid s_version operand: values above 0xffff, negatives, registers, extra or missing operands, and leading-zero decimals.

  • Evidence: LLVM 15.0.7 SOPInstructions.td L956-963 defines S_VERSION : SOPK_Pseudo<"s_version", (outs), (ins s16imm:$simm16), "$simm16"> { let has_sdst = 0; } under isGFX10Plus. The definition is outside any Defs = [SCC] block, so it has no result and no SCC write. llvm-mc for gfx1013 encodes s_version 0x1004 as [0x04,0x10,0x80,0xb0].
  • Scanner: the supported pattern is limited to 0..0xffff.
  • Disassembler: tools/disasm_rdna2.py now decodes SOPK opcode 0x01 as s_version 0xK. Before this, it printed s_sopk_01 s0, …, so the scanner would have flagged binaries containing the marker even with the new pattern.

AI-assisted (Claude Code).

Verification

Environment: Windows 11 10.0.26200.9974, NVIDIA GeForce RTX 3080 (driver 32.0.16.2124) and WARP 10.0.26100.9818, on 333562f.

  • Controls:
    • The marker is inserted at every position before the export of the s_cmpk/s_cselect program, which covers SCC live, a pending sample and descriptor loads in flight. Each lowering gives the same HLSL after temporaries are renumbered.
    • After the export, the lowering is byte-identical to the one with s_nop there.
    • 21 refused forms are checked against their exact messages.
    • An early use of the sample and other instructions after the export are still refused.
  • Dev-time check (not committed): without the change, the controls fail with Unsupported instruction 0: s_version 0x1004.
  • Other checks: the LLVM 15 binary round trip (local clang -cc1as shim), form_coverage_check.py (("SOPK","s_version") covered in both TSVs), rdna2_tools_check.py (including the decoding of 041080b0, 000080b0 and ffff80b0), pso_readiness_check.py and docs_links_check.py pass.
  • Full ctest --preset dev --no-tests=error: 360 of 361 passed, with the skips bvh_wave64_hardware, bvh_wave64_warp and wave_shuffle_warp. The one failure is compute_store_aot_hardware, which hits its 45 s timeout.
    • On plain 333562f, without this change, it times out on this RTX 3080 as well.
    • Run directly, it passes in about 57 s with mismatches=0.
    • On an older base (37ed46d) it took 35.2 s.
    • So it predates this change; I'll add the numbers to #448.
  • No GPU draw: nothing is observable on screen. The evidence is the identical-HLSL controls.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6552652383 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/796). Originally posted by [JB2WIN](https://github.com/JB2WIN) on 2026-11-23T05:03:24Z. --- ## Change `tools/pixel_aot.py` now accepts SOPK `s_version K` (K from 0 to 0xffff, in hex or decimal) as a no-op marker, wherever `s_nop` is accepted, including after the colour export. It does not change SCC, pending loads or outstanding samples. These forms are refused with `Invalid s_version operand`: values above 0xffff, negatives, registers, extra or missing operands, and leading-zero decimals. - **Evidence:** LLVM 15.0.7 [`SOPInstructions.td` L956-963](https://github.com/llvm/llvm-project/blob/llvmorg-15.0.7/llvm/lib/Target/AMDGPU/SOPInstructions.td#L956-L963) defines `S_VERSION : SOPK_Pseudo<"s_version", (outs), (ins s16imm:$simm16), "$simm16"> { let has_sdst = 0; }` under `isGFX10Plus`. The definition is outside any `Defs = [SCC]` block, so it has no result and no SCC write. llvm-mc for gfx1013 encodes `s_version 0x1004` as `[0x04,0x10,0x80,0xb0]`. - **Scanner:** the supported pattern is limited to 0..0xffff. - **Disassembler:** `tools/disasm_rdna2.py` now decodes SOPK opcode 0x01 as `s_version 0xK`. Before this, it printed `s_sopk_01 s0, …`, so the scanner would have flagged binaries containing the marker even with the new pattern. AI-assisted (Claude Code). ## Verification Environment: Windows 11 10.0.26200.9974, NVIDIA GeForce RTX 3080 (driver 32.0.16.2124) and WARP 10.0.26100.9818, on `333562f`. - **Controls:** - The marker is inserted at every position before the export of the `s_cmpk`/`s_cselect` program, which covers SCC live, a pending sample and descriptor loads in flight. Each lowering gives the same HLSL after temporaries are renumbered. - After the export, the lowering is byte-identical to the one with `s_nop` there. - 21 refused forms are checked against their exact messages. - An early use of the sample and other instructions after the export are still refused. - **Dev-time check (not committed):** without the change, the controls fail with `Unsupported instruction 0: s_version 0x1004`. - **Other checks:** the LLVM 15 binary round trip (local `clang -cc1as` shim), `form_coverage_check.py` (`("SOPK","s_version")` covered in both TSVs), `rdna2_tools_check.py` (including the decoding of `041080b0`, `000080b0` and `ffff80b0`), `pso_readiness_check.py` and `docs_links_check.py` pass. - **Full `ctest --preset dev --no-tests=error`:** 360 of 361 passed, with the skips `bvh_wave64_hardware`, `bvh_wave64_warp` and `wave_shuffle_warp`. The one failure is `compute_store_aot_hardware`, which hits its 45 s timeout. - On plain `333562f`, without this change, it times out on this RTX 3080 as well. - Run directly, it passes in about 57 s with `mismatches=0`. - On an older base (`37ed46d`) it took 35.2 s. - So it predates this change; I'll add the numbers to #448. - **No GPU draw:** nothing is observable on screen. The evidence is the identical-HLSL controls. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-24 06:44:49 +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!790
No description provided.