Skip to content

startup: src_scc is refused as an unknown scalar operand (1 of the remaining loading-screen shader refusals) #1820

Done

Description

@triggered02

Found in the refusal census (#870). 1 refused shader:

s_mul_i32 s28, 1.0, src_scc    -> REFUSED: operand 'src_scc'

Problem

Scalar source code 253 (src_scc) reads the SCC bit as the integer value 0 or 1. The translator refused it as an unknown operand, because Stage.u() only understood registers, inline constants and m0.

Fix

The generated shader already carries SCC as a bool scc (initialised, and updated by the scalar instructions that set it), so the source lowers to a conditional:

if tok == 'src_scc':
    # Source code 253 reads the SCC bit as the integer value 0 or 1 (used by e.g. s_mul_i32).
    return '(scc ? 1u : 0u)'

Measured on main at 813045b3:

form before after
s_mul_i32 s28, 1.0, src_scc refused s28 = 0x3f800000u * (scc ? 1u : 0u);
s_and_b32 s28, src_scc, s5 refused s28 = (scc ? 1u : 0u) & s5; scc = s28 != 0;

The census form multiplies the raw bits of the inline float 1.0 (0x3f800000) by the SCC bit — that is what the scalar integer multiply does, and it is why the constant is not emitted as 1u.

Test

startup_gfx2hlsl_src_scc builds SOP2 encodings from the checked-in decoder's layout ([31:30] == 0b10, opcode w0[29:23], destination w0[22:16], src1 w0[15:8], src0 w0[7:0]), decodes them, then translates. Five checks: the census form decodes and lowers, src_scc works in the first source position as well, a bitwise op still updates SCC, and a definition followed by a use emits both statements (scc = s28 != 0; then s29 = 0x3f800000u * (scc ? 1u : 0u);).

dev:     19/21 - the 2 failures are pre-existing (below)
release: startup_gfx2hlsl_src_scc Passed 0.14 s

Fail-first, both caught:

refuse src_scc again          -> Unsupported: operand 'src_scc'
lower it as the constant 0u   -> "a defined SCC is read back by the next instruction" FAIL

Pre-existing failures, not from this PR

startup_gfx2hlsl_mad_preserve_{warp,hardware} fail in this dev tree with Unknown GPU operation or invalid arguments: --raw-uav-dump-sm62 — the built offscreen_check is stale. Confirmed identical on origin/main with the same binary. A rebuild fixes it; this branch does not touch that tool.

What this does not establish

  • That the emitted HLSL compiles or computes the right value — the test compares text; DXC/WARP were not run here.
  • The s_cselect-style conditional uses of SCC (cond operand) are separate and already handled.

AI-assisted (Claude Code).

Activity

  1. ChazY11 commented on Nov 24, 2026

    @ChazY11
    Contributor

    Taking this one, with the approach the issue describes: u('src_scc') → (scc ? 1u : 0u), the two census forms as the positive cases, and a device-free check that builds the SOP2 words from the decoder layout, decodes, and translates. If you already have a branch for it, say so and I will drop mine.

    I will report the fail-first runs (guard removed, both forms) and the startup_gfx2hlsl_* neighbours in the PR.

    • AI-assisted.
  2. ChazY11 commented on Nov 24, 2026

    @ChazY11
    Contributor

    Withdrawing my #1896: #1821 by @triggered02 implements the same Stage.u() branch and was opened 73 minutes earlier, so
    theirs is the one to merge. I claimed the issue without noticing the branch already open on it — that was my miss.

    The two things I verified and that #1821 should keep: the census form has to preserve the raw bits of the inline float
    (s28 = 0x3f800000u * (scc ? 1u : 0u);), and returning 1u instead of (scc ? 1u : 0u) is the mutation a fixture on this
    path should catch. Details are in the closed PR.

    • AI-assisted.
  3. added 4 commits that reference this issue on Nov 25, 2026
    4ee0460
    619dfcf
    e09daaa
    bc801eb
  4. added 2 commits that reference this issue on Nov 26, 2026
    12c45b8
    0827f43
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