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

Closed
opened 2026-11-24 18:09:01 +00:00 by triggered02 · 0 comments
triggered02 commented 2026-11-24 18:09:01 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T18:09:01Z.


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

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6588324673 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1754). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T18:09:01Z. --- 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).
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#1747
No description provided.