Skip to content

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

Done

Description

@MasterDomino

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.

Activity

  1. ChazY11 commented on Nov 24, 2026

    @ChazY11
    Contributor

    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.
  2. MasterDomino commented on Nov 24, 2026

    @MasterDomino
    CollaboratorAuthor

    @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.

  3. MasterDomino commented on Nov 24, 2026

    @MasterDomino
    CollaboratorAuthor

    PR: #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.

  4. ChazY11 commented on Nov 24, 2026

    @ChazY11
    Contributor

    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.
  5. ChazY11 commented on Nov 24, 2026

    @ChazY11
    Contributor

    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.
  6. added a commit that references this issue on Nov 24, 2026
    aeb6d28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions