startup: an op_sel on a float operation is silently dropped instead of refused #1754

Closed
opened 2026-11-26 23:31:19 +00:00 by github-bot · 0 comments
Owner

@⁠triggered02 on GitHub · 2026-11-24 18:09 UTC · original

Found through tedin7's review of the conversion-modifier change (#1705): the review noted that set_vf() silently ignores an op_sel modifier while the documentation claims it is refused.

Problem

Stage.set_vf() ended its modifier loop with:

elif m.startswith('op_sel'):
    pass

so a float operation carrying op_sel emitted exactly the same text as without it:

v_add_f32_e64 v1, v1, v2                -> v1 = U(F(v1) + F(v2));
v_add_f32_e64 v1, v1, v2 op_sel:[0,0,1] -> v1 = U(F(v1) + F(v2));     (op_sel dropped)
v_mad_f32 v1, v1, v2, v2 op_sel:[0,0,0,1] -> v1 = U(F(v1) * F(v2) + F(v2));  (op_sel dropped)

op_sel selects which half of a packed source the operation reads, so ignoring it silently changes the operand — the same class as the earlier off-channel export mistake.

Measured

VOP3A/VOP2-as-VOP3 encodings built in the test, main at a4d17cf5:

form before after
v_add_f32_e64 v1, v1, v2 U(F(v1) + F(v2)) unchanged
v_add_f32_e64 ... op_sel:[0,0,1] same text (modifier dropped) refused
v_mad_f32 ... op_sel:[0,0,0,1] same text (modifier dropped) refused
v_cvt_f32_u32_e64 ... op_sel:[0,0,1] refused stays refused
v_cvt_f32_ubyte0_e64 v1, |v1| refused stays refused

Done when

  • An op_sel that reaches the float lowering is refused with its spelling rather than ignored.
  • Conversions keep refusing op_sel and source abs.
  • The byte-extracting conversion expressions are pinned exactly (>> 8, >> 16, >> 24, masks), since a review mutation check showed moving one of those shifts survived the tests.
  • A ctest starts from synthetic encoded instructions, decodes, then translates, and fails if the no-op branch is restored.
  • docs/experiments.md records the refusal.

Not in this slice: actually lowering op_sel (which needs the packed-source semantics per instruction), and DXC/draw results.

AI-assisted (Claude Code).

**@⁠triggered02** on GitHub · 2026-11-24 18:09 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/1754) Found through tedin7's review of the conversion-modifier change (#1705): the review noted that `set_vf()` silently ignores an `op_sel` modifier while the documentation claims it is refused. ## Problem `Stage.set_vf()` ended its modifier loop with: ```python elif m.startswith('op_sel'): pass ``` so a float operation carrying `op_sel` emitted exactly the same text as without it: ``` v_add_f32_e64 v1, v1, v2 -> v1 = U(F(v1) + F(v2)); v_add_f32_e64 v1, v1, v2 op_sel:[0,0,1] -> v1 = U(F(v1) + F(v2)); (op_sel dropped) v_mad_f32 v1, v1, v2, v2 op_sel:[0,0,0,1] -> v1 = U(F(v1) * F(v2) + F(v2)); (op_sel dropped) ``` `op_sel` selects which half of a packed source the operation reads, so ignoring it silently changes the operand — the same class as the earlier `off`-channel export mistake. ## Measured VOP3A/VOP2-as-VOP3 encodings built in the test, `main` at `a4d17cf5`: | form | before | after | |---|---|---| | `v_add_f32_e64 v1, v1, v2` | `U(F(v1) + F(v2))` | unchanged | | `v_add_f32_e64 ... op_sel:[0,0,1]` | same text (modifier dropped) | refused | | `v_mad_f32 ... op_sel:[0,0,0,1]` | same text (modifier dropped) | refused | | `v_cvt_f32_u32_e64 ... op_sel:[0,0,1]` | refused | stays refused | | `v_cvt_f32_ubyte0_e64 v1, \|v1\|` | refused | stays refused | ## Done when - An `op_sel` that reaches the float lowering is refused with its spelling rather than ignored. - Conversions keep refusing `op_sel` and source `abs`. - The byte-extracting conversion expressions are pinned exactly (`>> 8`, `>> 16`, `>> 24`, masks), since a review mutation check showed moving one of those shifts survived the tests. - A ctest starts from **synthetic** encoded instructions, decodes, then translates, and fails if the no-op branch is restored. - `docs/experiments.md` records the refusal. Not in this slice: actually lowering `op_sel` (which needs the packed-source semantics per instruction), and DXC/draw results. AI-assisted (Claude Code).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:31:19 +00:00
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/R0Y00--Xbox2Windows#1754
No description provided.