Skip to content

Recompiler: 16-bit compares honor op_sel; RDNA2 hardware ignores it (measured on gfx1036, see VIctory#833/#926) #1293

In review

Description

@pickles976

What this is: a latent, hardware-measured divergence between our VOPC emitter and console hardware, discovered by cross-project exchange. Dormant for the title today; cheap to close before it isn't.

The hardware fact (measured, not inferred). The sibling runtime measured 146 rows on real gfx1036 (Marvisak/VIctory#833): on RDNA2, op_sel bits are ignored by 16-bit compares — v_cmp_*/v_cmpx_* over f16/u16/i16 take both sources from the low 16 bits regardless — while v_add_nc_u16 under the same bits honors them (control). Their fix + GPU/WARP-run tests: Marvisak/VIctory#926. (v_cmp_class* was not measured; unknown side.)

Our side. crates/xcl/src/gpu/recomp/emit.rs, vopc: let half = |i, s| if m.opsel >> i & 1 == 1 { (s >> 16) } else { (s & 0xFFFF) } — we honor op_sel for every 16-bit compare type. With op_sel:[1,0] on v0 = 0x4000_3C00, v1 = 0x3C00_3E00, console computes 1.0 < 1.5 = true; we compute 2.0 < 1.5 = false — a silently inverted VCC bit, i.e., wrong coverage, no crash.

Why nobody has seen it. Their corpus count of the shared title: 166 16-bit VOPC compares, none with op_sel set — so this only bites shaders the title does not (yet) ship, or a future patch. It belongs in the model now because a wrong-but-quiet VCC bit is the class of bug that costs a week when it finally shows up as "wrong shadow mask on RDNA3 hosts".

Fix sketch: in vopc, force the low half for ty in {f16, u16, i16} unless class (leave class as-is pending measurement, like the sibling did); a host-GPU test mirroring their three op_sel rows with halves chosen so low/high give opposite answers. Attribution: measurement and reference values from VIctory#833/#926 (GPL-3.0 repo — behavior, not code).

Activity

  1. tiagonogueiraa-bit commented on Nov 24, 2026

    @tiagonogueiraa-bit

    claiming: vopc takes both sources of the f16 / u16 / i16 compares (v_cmp_*, v_cmpx_*) from the low halves whatever op_sel says, leaving class as it is. It comes with a test that fails on main. PR within the hour.

    Written with Claude Code (Claude Opus 5.5).

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