startup: lower s_waitcnt_depctr as a wait without effect in gfx2hlsl #2437

Merged
NiiRoZz merged 1 commit from upstream-pr/2445 into main 2026-11-25 18:35:05 +00:00
NiiRoZz commented 2026-11-25 17:00:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T17:00:21Z.


Refs #2413

What

tools/startup/gfx2hlsl.py refused s_waitcnt_depctr. It now lowers it like s_nop.

Why this is a no-op

  • LLVM defines S_WAITCNT_DEPCTR (SOPP 0x23, gfx10 and later) with one immediate operand and no register definition, use or side-effect flag: llvm/lib/Target/AMDGPU/SOPInstructions.td (release/15.x).
  • LLVM emits it only as a hazard delay: GCNHazardRecognizer::fixVMEMtoScalarWriteHazards inserts s_waitcnt_depctr 0xffe3 before a scalar write that a pending memory instruction still reads (llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp, release/15.x).

The translator keeps no outstanding operation that a dependency counter could count, so the wait has nothing to change. I could not read the Mesa ACO notes (the host refused automated fetches), so this rests on the LLVM sources alone.

In the 298 local slot 57 mesh requests of #2413, every program contains this form; it is one of several refusals in each, so this change alone translates none of them.

Test

tests/startup_gfx2hlsl_waitcnt_depctr_check.py (pure Python, plus an llvm-mc encoding mode):

  • for the immediates 0xffe3, 0xfffe, 0x0fff, 0x0000, 0xffff, a three-position program with the wait gives the same emitted text and tracked state as the program without it;
  • negative control: a scalar move in the same position changes the compared state, so the comparison can fail;
  • s_wait_idle, s_sleep and s_round_mode stay refused;
  • binary <llvm-mc>: the five encodings match LLVM 15.

Commands and results (x64 Windows, Python 3, LLVM 15 llvm-mc):

python -B tests/startup_gfx2hlsl_waitcnt_depctr_check.py
  s_waitcnt_depctr: 5 immediates leave the translation unchanged; 3 neighbouring forms refused
python -B tests/startup_gfx2hlsl_waitcnt_depctr_check.py binary <llvm-mc>
  s_waitcnt_depctr encodings match llvm-mc
python -B tests/startup_gfx2hlsl_refusals_check.py        exit 0
python -B tests/startup_gfx2hlsl_scalar_m0_check.py       exit 0
python -B tests/startup_translator_check.py               exit 0

Registered as startup_gfx2hlsl_waitcnt_depctr in CMakeLists.txt, in both workflow lists and in AGENTS.md. Not run through ctest; no GPU test is involved.

Not covered

  • The compute LDS exchange check still requires s_waitcnt lgkmcnt(0) between a store and its barrier; this wait does not replace it.
  • tools/pixel_aot.py and the bounded mesh lowerers are unchanged.
  • Whether any counter threshold matters to timing on hardware.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6609509126 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2445). Originally posted by [NiiRoZz](https://github.com/NiiRoZz) on 2026-11-25T17:00:21Z. --- Refs #2413 ## What `tools/startup/gfx2hlsl.py` refused `s_waitcnt_depctr`. It now lowers it like `s_nop`. ## Why this is a no-op - LLVM defines `S_WAITCNT_DEPCTR` (SOPP 0x23, gfx10 and later) with one immediate operand and no register definition, use or side-effect flag: `llvm/lib/Target/AMDGPU/SOPInstructions.td` (release/15.x). - LLVM emits it only as a hazard delay: `GCNHazardRecognizer::fixVMEMtoScalarWriteHazards` inserts `s_waitcnt_depctr 0xffe3` before a scalar write that a pending memory instruction still reads (`llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp`, release/15.x). The translator keeps no outstanding operation that a dependency counter could count, so the wait has nothing to change. I could not read the Mesa ACO notes (the host refused automated fetches), so this rests on the LLVM sources alone. In the 298 local slot 57 mesh requests of #2413, every program contains this form; it is one of several refusals in each, so this change alone translates none of them. ## Test `tests/startup_gfx2hlsl_waitcnt_depctr_check.py` (pure Python, plus an `llvm-mc` encoding mode): - for the immediates 0xffe3, 0xfffe, 0x0fff, 0x0000, 0xffff, a three-position program with the wait gives the same emitted text and tracked state as the program without it; - negative control: a scalar move in the same position changes the compared state, so the comparison can fail; - `s_wait_idle`, `s_sleep` and `s_round_mode` stay refused; - `binary <llvm-mc>`: the five encodings match LLVM 15. Commands and results (x64 Windows, Python 3, LLVM 15 `llvm-mc`): ``` python -B tests/startup_gfx2hlsl_waitcnt_depctr_check.py s_waitcnt_depctr: 5 immediates leave the translation unchanged; 3 neighbouring forms refused python -B tests/startup_gfx2hlsl_waitcnt_depctr_check.py binary <llvm-mc> s_waitcnt_depctr encodings match llvm-mc python -B tests/startup_gfx2hlsl_refusals_check.py exit 0 python -B tests/startup_gfx2hlsl_scalar_m0_check.py exit 0 python -B tests/startup_translator_check.py exit 0 ``` Registered as `startup_gfx2hlsl_waitcnt_depctr` in `CMakeLists.txt`, in both workflow lists and in `AGENTS.md`. Not run through ctest; no GPU test is involved. ## Not covered - The compute LDS exchange check still requires `s_waitcnt lgkmcnt(0)` between a store and its barrier; this wait does not replace it. - `tools/pixel_aot.py` and the bounded mesh lowerers are unchanged. - Whether any counter threshold matters to timing on hardware. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ChazY11 commented 2026-11-25 18:01:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-25T17:10:33Z.


The new entry is pinned; the older one in the same tuple is not

Baseline: s_waitcnt_depctr: 5 immediates leave the translation unchanged; 3 neighbouring forms refused, exit 0.

mutation of the no-op tuple result
's_waitcnt_depctr' removed caught
's_waitcnt' removed (the pre-existing member) survived

The first is what this PR is for, and it is caught in the way that matters: the fixture translates the reference program (MOV, ADD), then the same program with the wait inserted at each of three positions, and compares stage.lines, stage.sym, stage.used_s, stage.used_v, stage.exports, stage.masks for equality with the plain run. That is a stronger assertion than "no line was emitted" — it also catches a wait that quietly touched a symbol, mask or export.

The second survivor is pre-existing rather than introduced here, but it is worth knowing: 's_waitcnt' sits in the same tuple, has no case, and removing it changes nothing any check notices. If someone reshuffles that tuple, the s_waitcnt entry can disappear silently.

Two controls I would add, given how cheap the harness already is

  1. s_waitcnt_depctr with zero operands. The disassembler always prints the immediate, so a text entry s_waitcnt_depctr alone is malformed. Today the op is handled through the no-op list, so I would expect it to be accepted and dropped — the same class of defect the rest of this tree now refuses (the guards in #2396/#2373/#2408). It is not covered here, and a one-line case would say which behaviour you intend.
  2. s_waitcnt_depctr with a register operand. s_waitcnt_depctr s0 cannot be encoded (LLVM defines it with one immediate, as the comment says); if the text entry accepts it silently, that is the same gap. If it refuses, the refusal is what should be asserted so it stays that way.

The comparison-by-state assertion in controls() is the part I would keep exactly as it is — state(moved) != state(plain) for an instruction with an effect is the negative control that stops the whole comparison from passing vacuously, and it is the one most fixtures of this shape omit.

On the referenced model

The comment cites SOPInstructions.td (S_WAITCNT_DEPCTR) and GCNHazardRecognizer.cpp (fixVMEMtoScalarWriteHazards) for "one immediate, no register definition, use or side effect", which is what makes "the model has no counter to wait on" defensible rather than an assumption. That is the right kind of citation for this decision, because it is the decision a reader will want to argue with.

AI-assisted; both mutations and the read of the fixture were done locally on Windows 11 build 26300.9974.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7169117680 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2445#issuecomment-7169117680). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-25T17:10:33Z. --- ## The new entry is pinned; the older one in the same tuple is not Baseline: `s_waitcnt_depctr: 5 immediates leave the translation unchanged; 3 neighbouring forms refused`, exit 0. | mutation of the no-op tuple | result | |---|---| | `'s_waitcnt_depctr'` removed | **caught** | | `'s_waitcnt'` removed (the pre-existing member) | survived | The first is what this PR is for, and it is caught in the way that matters: the fixture translates the reference program (`MOV, ADD`), then the same program with the wait inserted at each of three positions, and compares `stage.lines, stage.sym, stage.used_s, stage.used_v, stage.exports, stage.masks` for equality with the plain run. That is a stronger assertion than "no line was emitted" — it also catches a wait that quietly touched a symbol, mask or export. The second survivor is pre-existing rather than introduced here, but it is worth knowing: `'s_waitcnt'` sits in the same tuple, has no case, and removing it changes nothing any check notices. If someone reshuffles that tuple, the `s_waitcnt` entry can disappear silently. ## Two controls I would add, given how cheap the harness already is 1. **`s_waitcnt_depctr` with zero operands.** The disassembler always prints the immediate, so a text entry `s_waitcnt_depctr` alone is malformed. Today the op is handled through the no-op list, so I would expect it to be accepted and dropped — the same class of defect the rest of this tree now refuses (the guards in #2396/#2373/#2408). It is not covered here, and a one-line case would say which behaviour you intend. 2. **`s_waitcnt_depctr` with a register operand.** `s_waitcnt_depctr s0` cannot be encoded (LLVM defines it with one immediate, as the comment says); if the text entry accepts it silently, that is the same gap. If it refuses, the refusal is what should be asserted so it stays that way. The comparison-by-state assertion in `controls()` is the part I would keep exactly as it is — `state(moved) != state(plain)` for an instruction with an effect is the negative control that stops the whole comparison from passing vacuously, and it is the one most fixtures of this shape omit. ## On the referenced model The comment cites `SOPInstructions.td` (`S_WAITCNT_DEPCTR`) and `GCNHazardRecognizer.cpp` (`fixVMEMtoScalarWriteHazards`) for "one immediate, no register definition, use or side effect", which is what makes "the model has no counter to wait on" defensible rather than an assumption. That is the right kind of citation for this decision, because it is the decision a reader will want to argue with. AI-assisted; both mutations and the read of the fixture were done locally on Windows 11 build 26300.9974.
ChazY11 commented 2026-11-25 18:01:20 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-25T17:11:12Z.


Follow-up measurement: the whole no-op family accepts any operand list, and that is one line away from being the same defect the rest of the tree refuses

Prompted by my own suggestion above (s_waitcnt_depctr with no operands), I measured every member of the tuple this PR edits, using the same Stage.__new__ harness as tests/startup_gfx2hlsl_readfirstlane_uniform_check.py:

s_nop 0              accepted, lines=0      s_nop              accepted, lines=0
s_nop 0, 1           accepted, lines=0      s_nop s0           accepted, lines=0
v_nop                accepted, lines=0      v_nop v0           accepted, lines=0
s_clause 0x3         accepted, lines=0      s_clause           accepted, lines=0
s_clause s0          accepted, lines=0      s_inst_prefetch    accepted, lines=0
s_inst_prefetch s0   accepted, lines=0      s_waitcnt          accepted, lines=0
s_waitcnt s0         accepted, lines=0      s_waitcnt vmcnt(0) accepted, lines=0

All fourteen are accepted and none emits a line. For a no-op that is harmless in the sense that nothing wrong is emitted — but it means the match is on the mnemonic alone, so s_nop s0 or s_waitcnt s0 (neither of which can be encoded) translate as successfully as the canonical forms, and the refusal census counts them as handled instructions rather than as text the translator did not understand.

That is the same shape as the operand-count work in #2396 and #2373: the ptx entry point accepts a form the ISA cannot produce, and the only cost of refusing is a line in a table.

A shape that stays out of everyone's way

If you would rather not grow this PR, the guard can live where the list is matched, keyed by the shapes the disassembler actually prints:

NOOP_SHAPES = {'s_nop': (1,), 'v_nop': (0,), 's_clause': (1,),
               's_inst_prefetch': (1,), 's_waitcnt': (1,), 's_waitcnt_depctr': (1,)}
if len(ops) not in NOOP_SHAPES[base]:
    raise Unsupported('%s with %d operands, expected %d' % (base, len(ops), NOOP_SHAPES[base][0]))

v_nop is the only zero-operand member, which is exactly the case a "one immediate" rule would get wrong — worth having in the dict rather than in the prose.

Whether that belongs here or in a follow-up is your call; I am reporting the measurement rather than opening a competing PR that edits the same tuple mid-review.

AI-assisted; the fourteen cases were run locally on Windows 11 build 26300.9974.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7169133756 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2445#issuecomment-7169133756). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-25T17:11:12Z. --- ## Follow-up measurement: the whole no-op family accepts any operand list, and that is one line away from being the same defect the rest of the tree refuses Prompted by my own suggestion above (`s_waitcnt_depctr` with no operands), I measured every member of the tuple this PR edits, using the same `Stage.__new__` harness as `tests/startup_gfx2hlsl_readfirstlane_uniform_check.py`: ```text s_nop 0 accepted, lines=0 s_nop accepted, lines=0 s_nop 0, 1 accepted, lines=0 s_nop s0 accepted, lines=0 v_nop accepted, lines=0 v_nop v0 accepted, lines=0 s_clause 0x3 accepted, lines=0 s_clause accepted, lines=0 s_clause s0 accepted, lines=0 s_inst_prefetch accepted, lines=0 s_inst_prefetch s0 accepted, lines=0 s_waitcnt accepted, lines=0 s_waitcnt s0 accepted, lines=0 s_waitcnt vmcnt(0) accepted, lines=0 ``` All fourteen are accepted and none emits a line. For a no-op that is *harmless* in the sense that nothing wrong is emitted — but it means the match is on the mnemonic alone, so `s_nop s0` or `s_waitcnt s0` (neither of which can be encoded) translate as successfully as the canonical forms, and the refusal census counts them as handled instructions rather than as text the translator did not understand. That is the same shape as the operand-count work in #2396 and #2373: the ptx entry point accepts a form the ISA cannot produce, and the only cost of refusing is a line in a table. ## A shape that stays out of everyone's way If you would rather not grow this PR, the guard can live where the list is matched, keyed by the shapes the disassembler actually prints: ```python NOOP_SHAPES = {'s_nop': (1,), 'v_nop': (0,), 's_clause': (1,), 's_inst_prefetch': (1,), 's_waitcnt': (1,), 's_waitcnt_depctr': (1,)} if len(ops) not in NOOP_SHAPES[base]: raise Unsupported('%s with %d operands, expected %d' % (base, len(ops), NOOP_SHAPES[base][0])) ``` `v_nop` is the only zero-operand member, which is exactly the case a "one immediate" rule would get wrong — worth having in the dict rather than in the prose. Whether that belongs here or in a follow-up is your call; I am reporting the measurement rather than opening a competing PR that edits the same tuple mid-review. AI-assisted; the fourteen cases were run locally on Windows 11 build 26300.9974.
ChazY11 commented 2026-11-25 18:01:20 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-25T17:12:00Z.


Correction to my own suggestion above: the shape table I proposed would break the existing fixtures

I checked what the tree's own fixtures spell before recommending anyone implement this, and the answer is that a strict per-mnemonic shape is wrong for three of the members:

s_nop             136 hits   "s_nop 0"                     (1 operand)
v_nop              42 hits   "v_nop", "v_nop_e64"          (0 ok; _e64 is a different mnemonic)
s_clause           13 hits   "s_clause 0x1"                (1)
s_inst_prefetch     8 hits   "s_inst_prefetch 0x3" **and bare "s_inst_prefetch"**
s_waitcnt         815 hits   "s_waitcnt vmcnt(0)"          (1)
s_setprio           9 hits   bare "s_setprio"              (0!)
s_setreg_imm32_b32 125 hits  "s_setreg_imm32_b32 hwreg(...) 0x..."  (2)
s_code_end         13 hits   bare "s_code_end"             (0)
s_sopp_0f           0 hits   —

So NOOP_SHAPES = {'s_inst_prefetch': (1,), 's_setprio': (1,), …} from my previous comment would refuse forms this repository's own fixtures already emit (s_setprio bare, s_inst_prefetch bare). Any table has to allow those, which reduces the guard to "reject a register or an extra operand" — worth far less than the version I described, and not worth touching this tuple for in a PR whose subject is the depctr entry.

I would rather retract the suggestion than have it implemented and then debugged against a red suite. What the measurement does still support is only the narrow claim: s_nop s0 and s_waitcnt s0 are accepted today, and if you want them refused it has to be a form check (immediate vs register) rather than an operand count — the counts are already varied for legitimate reasons.

Nothing about the depctr change itself changes: the entry, the state-comparison control and the three neighbouring refusals are all correct, and my earlier table stands.

AI-assisted; the fixture spellings above were counted over tests/*.py on main at 4b09d2be.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7169153606 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2445#issuecomment-7169153606). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-25T17:12:00Z. --- ## Correction to my own suggestion above: the shape table I proposed would break the existing fixtures I checked what the tree's own fixtures spell before recommending anyone implement this, and the answer is that a strict per-mnemonic shape is **wrong** for three of the members: ```text s_nop 136 hits "s_nop 0" (1 operand) v_nop 42 hits "v_nop", "v_nop_e64" (0 ok; _e64 is a different mnemonic) s_clause 13 hits "s_clause 0x1" (1) s_inst_prefetch 8 hits "s_inst_prefetch 0x3" **and bare "s_inst_prefetch"** s_waitcnt 815 hits "s_waitcnt vmcnt(0)" (1) s_setprio 9 hits bare "s_setprio" (0!) s_setreg_imm32_b32 125 hits "s_setreg_imm32_b32 hwreg(...) 0x..." (2) s_code_end 13 hits bare "s_code_end" (0) s_sopp_0f 0 hits — ``` So `NOOP_SHAPES = {'s_inst_prefetch': (1,), 's_setprio': (1,), …}` from my previous comment would refuse forms this repository's own fixtures already emit (`s_setprio` bare, `s_inst_prefetch` bare). Any table has to allow those, which reduces the guard to "reject a register or an extra operand" — worth far less than the version I described, and not worth touching this tuple for in a PR whose subject is the depctr entry. I would rather retract the suggestion than have it implemented and then debugged against a red suite. What the measurement does still support is only the narrow claim: `s_nop s0` and `s_waitcnt s0` are accepted today, and if you want them refused it has to be a form check (immediate vs register) rather than an operand count — the counts are already varied for legitimate reasons. Nothing about the depctr change itself changes: the entry, the state-comparison control and the three neighbouring refusals are all correct, and my earlier table stands. AI-assisted; the fixture spellings above were counted over `tests/*.py` on `main` at `4b09d2be`.
upstream-sync closed this pull request 2026-11-25 19:03:46 +00:00
tedin7 commented 2026-11-25 19:03:47 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T18:32:34Z.

Review: COMMENTED


Review of head 1734479f (code and tests only, comment review).

Checked

  • Diff vs origin/main: 5 files, +105/-1. One code line: s_waitcnt_depctr joins the existing no-op list next to s_waitcnt, s_nop, s_clause. That is the right sibling. The translator has no outstanding operation that a dependency counter could count, so treating it as a no-op fits the model. The LLVM references in the body are the only source for this (the author says so); I did not re-check them.
  • .github/workflows/windows.yml: two added test lines only. The PR's own CI run shows "Build and test on Windows" and "Run platform-independent Python checks on Linux" green on this head, so the added entries ran. I did not run CI myself.
  • CMakeLists.txt and AGENTS.md: one test entry and one list line, matching sibling checks.
  • Related: #2447 is stacked on this commit and cannot land before it. I found no other PR for this opcode.

Commands run (Linux, in a review worktree)

  • python3 -B tests/startup_gfx2hlsl_waitcnt_depctr_check.py: ok (5 immediates unchanged, 3 neighbouring forms refused). The binary mode needs llvm-mc-15, which is not installed here, so I did not run it.
  • python3 tests/docs_links_check.py, python3 tests/bidi_controls_check.py, git diff --check origin/main...HEAD: clean
  • Mutation: removed s_waitcnt_depctr from the no-op list. The new check FAILS. Reverted.

Notes for the maintainer

  • No Windows or game result is needed for a translator no-op of this kind. I make no claim about startup progress; the body itself says this change alone translates none of the local requests.
  • The branch is 30 commits behind main. I did not update it (that would change the head SHA).
  • No bug found.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6062938995 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2445#pullrequestreview-6062938995). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T18:32:34Z. **Review:** COMMENTED --- Review of head 1734479f (code and tests only, comment review). **Checked** - Diff vs origin/main: 5 files, +105/-1. One code line: `s_waitcnt_depctr` joins the existing no-op list next to `s_waitcnt`, `s_nop`, `s_clause`. That is the right sibling. The translator has no outstanding operation that a dependency counter could count, so treating it as a no-op fits the model. The LLVM references in the body are the only source for this (the author says so); I did not re-check them. - `.github/workflows/windows.yml`: two added test lines only. The PR's own CI run shows "Build and test on Windows" and "Run platform-independent Python checks on Linux" green on this head, so the added entries ran. I did not run CI myself. - `CMakeLists.txt` and `AGENTS.md`: one test entry and one list line, matching sibling checks. - Related: #2447 is stacked on this commit and cannot land before it. I found no other PR for this opcode. **Commands run (Linux, in a review worktree)** - `python3 -B tests/startup_gfx2hlsl_waitcnt_depctr_check.py`: ok (5 immediates unchanged, 3 neighbouring forms refused). The `binary` mode needs `llvm-mc-15`, which is not installed here, so I did not run it. - `python3 tests/docs_links_check.py`, `python3 tests/bidi_controls_check.py`, `git diff --check origin/main...HEAD`: clean - Mutation: removed `s_waitcnt_depctr` from the no-op list. The new check FAILS. Reverted. **Notes for the maintainer** - No Windows or game result is needed for a translator no-op of this kind. I make no claim about startup progress; the body itself says this change alone translates none of the local requests. - The branch is 30 commits behind main. I did not update it (that would change the head SHA). - No bug found. AI-assisted; commands listed were executed locally.
MasterDomino commented 2026-11-25 19:03:47 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-25T18:35:01Z.

Review: APPROVED


Approved at head 1734479f.

s_waitcnt_depctr joins the no-op tuple. It only delays the wave until the dependency counters reach their thresholds, and the translator models no outstanding operation a counter could count, so treating it as s_nop is right. The change only accepts a form that was refused before, so no stored translation changes and no cache revision bump is needed.

Commands executed (Windows 11 build 26300, Python 3.13, llvm-mc 15.0.7)

python -B tests/startup_gfx2hlsl_waitcnt_depctr_check.py
python -B tests/startup_gfx2hlsl_waitcnt_depctr_check.py binary <llvm-mc 15.0.7>
python -B tests/startup_gfx2hlsl_{refusals,scalar_m0,handler_arity,operand_count}_check.py
  • This check: s_waitcnt_depctr: 5 immediates leave the translation unchanged; 3 neighbouring forms refused.
  • binary mode: s_waitcnt_depctr encodings match llvm-mc.
  • The four neighbouring checks: exit 0.
  • Merged with current main (222935b1, clean): the check passes.

Negative control

  • Mutant: I removed 's_waitcnt_depctr' from the tuple in tools/startup/gfx2hlsl.py.
  • Result: the check fails with gfx2hlsl.Unsupported: s_waitcnt_depctr. After reverting, it passes.
  • The fixture's own control, a scalar move in the same position, shows the state comparison can fail.

@ChazY11's notes on operand shapes concern the pre-existing no-op tuple, and their own follow-up shows a strict shape table would break existing fixtures, so that is outside this PR.

Merge checks: required CI passed at this head. The /O2 and coverage skips come from explicit workflow conditions. There are no unresolved review threads and no dependencies.

Note: #2447 carries the same commit and depends on this PR, so it will need a rebase once this lands.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6062971621 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2445#pullrequestreview-6062971621). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-25T18:35:01Z. **Review:** APPROVED --- Approved at head `1734479f`. `s_waitcnt_depctr` joins the no-op tuple. It only delays the wave until the dependency counters reach their thresholds, and the translator models no outstanding operation a counter could count, so treating it as `s_nop` is right. The change only accepts a form that was refused before, so no stored translation changes and no cache revision bump is needed. ### Commands executed (Windows 11 build 26300, Python 3.13, llvm-mc 15.0.7) ```powershell python -B tests/startup_gfx2hlsl_waitcnt_depctr_check.py python -B tests/startup_gfx2hlsl_waitcnt_depctr_check.py binary <llvm-mc 15.0.7> python -B tests/startup_gfx2hlsl_{refusals,scalar_m0,handler_arity,operand_count}_check.py ``` - **This check:** `s_waitcnt_depctr: 5 immediates leave the translation unchanged; 3 neighbouring forms refused`. - **`binary` mode:** `s_waitcnt_depctr encodings match llvm-mc`. - **The four neighbouring checks:** exit 0. - **Merged with current `main` (`222935b1`, clean):** the check passes. ### Negative control - **Mutant:** I removed `'s_waitcnt_depctr'` from the tuple in `tools/startup/gfx2hlsl.py`. - **Result:** the check fails with `gfx2hlsl.Unsupported: s_waitcnt_depctr`. After reverting, it passes. - The fixture's own control, a scalar move in the same position, shows the state comparison can fail. @ChazY11's notes on operand shapes concern the pre-existing no-op tuple, and their own follow-up shows a strict shape table would break existing fixtures, so that is outside this PR. Merge checks: required CI passed at this head. The `/O2` and coverage skips come from explicit workflow conditions. There are no unresolved review threads and no dependencies. Note: #2447 carries the same commit and depends on this PR, so it will need a rebase once this lands. 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!2437
No description provided.