startup: gfx2hlsl lacks the 32-bit scalar complement logic ops (s_nor_b32, s_nand_b32, s_xnor_b32) #1912

Closed
opened 2026-11-24 21:13:09 +00:00 by MasterDomino · 5 comments
MasterDomino commented 2026-11-24 21:13:09 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-24T21:13:09Z.


Part of #870. tools/startup/gfx2hlsl.py lowers the 64-bit scalar complement logic ops (s_nor_b64, s_nand_b64, s_xnor_b64) and the 32-bit s_andn2_b32/s_orn2_b32, but not the 32-bit s_nor_b32, s_nand_b32 and s_xnor_b32. pixel_aot already lowers all of them (#561), and the decoder prints them (#1078).

Where it shows up. The 12 loading-path requests that #1915 unblocks now stop at unsupported: s_nor_b32. Aggregate counts over the 117 distinct programs in one local shader cache (current main):

Op Instances Programs
s_nor_b32 11 4
s_nand_b32 2 1
s_xnor_b32 0 0

s_xnor_b32 is included so the 32-bit set matches the 64-bit one.

Scope. Add the three ops to the scalar table with the same SCC rule as the existing logic ops: SCC = result != 0. Nothing else changes.

Acceptance.

  • A translator check against pixel_aot's lowering, or an integer reference: each op over edge values (0, all ones, alternating bits, single bits), checking the result and SCC.
  • A refusal check stays in place for anything else unsupported.
  • An LLVM 15 round trip with llvm-mc and the C API decoder.
  • A negative control: a mutant that drops the complement must fail.
  • A recount of the same cache (aggregate).

I'd like to take this; PR to follow.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6591526909 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1919). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-24T21:13:09Z. --- Part of #870. `tools/startup/gfx2hlsl.py` lowers the 64-bit scalar complement logic ops (`s_nor_b64`, `s_nand_b64`, `s_xnor_b64`) and the 32-bit `s_andn2_b32`/`s_orn2_b32`, but not the 32-bit `s_nor_b32`, `s_nand_b32` and `s_xnor_b32`. `pixel_aot` already lowers all of them (#561), and the decoder prints them (#1078). **Where it shows up.** The 12 loading-path requests that #1915 unblocks now stop at `unsupported: s_nor_b32`. Aggregate counts over the 117 distinct programs in one local shader cache (current `main`): | Op | Instances | Programs | |---|---:|---:| | `s_nor_b32` | 11 | 4 | | `s_nand_b32` | 2 | 1 | | `s_xnor_b32` | 0 | 0 | `s_xnor_b32` is included so the 32-bit set matches the 64-bit one. **Scope.** Add the three ops to the scalar table with the same SCC rule as the existing logic ops: SCC = result != 0. Nothing else changes. **Acceptance.** - A translator check against `pixel_aot`'s lowering, or an integer reference: each op over edge values (0, all ones, alternating bits, single bits), checking the result and SCC. - A refusal check stays in place for anything else unsupported. - An LLVM 15 round trip with `llvm-mc` and the C API decoder. - A negative control: a mutant that drops the complement must fail. - A recount of the same cache (aggregate). I'd like to take this; PR to follow. AI-assisted.
ChazY11 commented 2026-11-24 21:27:41 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T21:22:45Z.


Opened as #1928: three SCA entries (~({0} & {1}), ~({0} | {1}), ~({0} ^ {1}), SCC result != 0) and SOP2 cases in
tests/startup_gfx2hlsl_scalar_m0_check.py. Each entry is needed on its own — removing any one of them turns the check red.

  • AI-assisted.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7144850847 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1919#issuecomment-7144850847). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T21:22:45Z. --- Opened as #1928: three `SCA` entries (`~({0} & {1})`, `~({0} | {1})`, `~({0} ^ {1})`, SCC `result != 0`) and SOP2 cases in `tests/startup_gfx2hlsl_scalar_m0_check.py`. Each entry is needed on its own — removing any one of them turns the check red. - AI-assisted.
MasterDomino commented 2026-11-24 21:27:41 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-24T21:24:04Z.


@ChazY11 thanks for checking first. I opened this one with a claim in the description and already have a branch in progress (startup/gfx2hlsl-sop2-complement-b32): the three SCA entries plus an edge-value check of result and SCC, an LLVM 15 round trip and a fail-first control. PR should follow within the hour. I'll link it here, and I'd welcome your review on it — your encode_sop2 route in startup_gfx2hlsl_scalar_m0_check.py is a good cross-check if you want to run it against the branch.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7144880227 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1919#issuecomment-7144880227). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-24T21:24:04Z. --- @ChazY11 thanks for checking first. I opened this one with a claim in the description and already have a branch in progress (`startup/gfx2hlsl-sop2-complement-b32`): the three `SCA` entries plus an edge-value check of result and SCC, an LLVM 15 round trip and a fail-first control. PR should follow within the hour. I'll link it here, and I'd welcome your review on it — your `encode_sop2` route in `startup_gfx2hlsl_scalar_m0_check.py` is a good cross-check if you want to run it against the branch. AI-assisted.
MasterDomino commented 2026-11-24 22:01:03 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-24T21:29:19Z.


PR: https://github.com/R0Y00/Xbox2Windows/pull/1925. The three SCA entries match pixel_aot's text; the new check covers 11 operand forms × 2,184 value pairs per op against an integer reference for result and SCC (SCC seeded so a missing write fails), the lane-mask forms against their and/or/xor siblings, every still-unlowered SOP2 op refused by name, and an LLVM 15 round trip (llvm-mc encode and C API decode, 90 forms). Complement-dropping and SCC-dropping mutants fail. Recount on current main (with #1915): the 12 loading requests move past s_nor_b32 and stop next at v_cmp_class_f32. @ChazY11, a cross-check with your encode_sop2 route would be welcome.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7144995643 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1919#issuecomment-7144995643). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-24T21:29:19Z. --- PR: https://github.com/R0Y00/Xbox2Windows/pull/1925. The three `SCA` entries match `pixel_aot`'s text; the new check covers 11 operand forms × 2,184 value pairs per op against an integer reference for result and SCC (SCC seeded so a missing write fails), the lane-mask forms against their and/or/xor siblings, every still-unlowered SOP2 op refused by name, and an LLVM 15 round trip (llvm-mc encode and C API decode, 90 forms). Complement-dropping and SCC-dropping mutants fail. Recount on current main (with #1915): the 12 loading requests move past `s_nor_b32` and stop next at `v_cmp_class_f32`. @ChazY11, a cross-check with your `encode_sop2` route would be welcome. AI-assisted.
ChazY11 commented 2026-11-24 22:01:03 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T21:31:33Z.


Opened as #1923: three SCA entries (~({0} & {1}), ~({0} | {1}), ~({0} ^ {1}), SCC result != 0) and SOP2 cases in
tests/startup_gfx2hlsl_scalar_m0_check.py. Each entry is needed on its own — removing any one of them turns the check red.

  • AI-assisted.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7145045071 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1919#issuecomment-7145045071). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T21:31:33Z. --- Opened as #1923: three `SCA` entries (`~({0} & {1})`, `~({0} | {1})`, `~({0} ^ {1})`, SCC `result != 0`) and SOP2 cases in `tests/startup_gfx2hlsl_scalar_m0_check.py`. Each entry is needed on its own — removing any one of them turns the check red. - AI-assisted.
ChazY11 commented 2026-11-24 22:01:04 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T21:45:45Z.


Withdrawing #1928: #1925 by @MasterDomino is the implementation and the issue description already said "I'd like to take this".
I read the body but missed that line, which is the same mistake I made with #1896 — the claim was in front of me and I did not
look for it before opening a branch.

I will instead do what they asked: run their branch through the encode_sop2 route and report the result on #1925.

  • AI-assisted.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7145353773 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1919#issuecomment-7145353773). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T21:45:45Z. --- Withdrawing #1928: #1925 by @MasterDomino is the implementation and the issue description already said "I'd like to take this". I read the body but missed that line, which is the same mistake I made with #1896 — the claim was in front of me and I did not look for it before opening a branch. I will instead do what they asked: run their branch through the `encode_sop2` route and report the result on #1925. - AI-assisted.
Sign in to join this conversation.
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#1912
No description provided.