startup: refuse an op_sel the float lowering does not model #1748
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1755"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T18:09:16Z.
Fixes #1754. Follow-up to the review on the conversion-modifier change (#1705), where tedin7 noted that
set_vf()silently ignoresop_selwhile the documentation claims it is refused.Change
set_vf()ended its modifier loop withelif m.startswith('op_sel'): pass, so a float operation carryingop_selemitted exactly the text it would without it:op_selselects which half of a packed source the operation reads, so dropping it silently changes the operand. The float path now refuses it with the modifier spelling:Conversions keep refusing
op_seland a sourceabs(both were already outside their modifier allow-list).This is the same principle as the closed
off-channel export PR: a form whose desktop behaviour would differ from the console is refused and the missing state recorded, rather than approximated.Test
startup_gfx2hlsl_opselbuilds VOP1/VOP2/VOP3A encodings from the checked-in decoder's layout (VOP3A prefix0b110101, opcode[25:16],op_sel[3:0]atw0[14:11],abs[2:0]atw0[10:8], sources inw1), decodes them, then translates — no game-derived bytes.It also pins the exact conversion expressions, which the earlier review's mutation check found unguarded (
v_cvt_f32_ubyte1shift 8,ubyte3shift 24, masks,float(v1)vsfloat(int(v1))):Fail-first: restoring
passin place of the refusal fails the test atan op_sel on a three-source float op is refused.What this does not establish
op_selcan be lowered correctly — that needs the per-instruction packed-source semantics, and is out of scope here.AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T18:14:18Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
748111869aℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T18:46:06Z.
Review: COMMENTED
Reviewed at
d1daca3a79bf1c33bb30f97352907e154e64c2fc.No P1 or P2 defects found in local verification.
tools/startup/gfx2hlsl.pynow raisesUnsupportedforop_sel*modifiers inStage.set_vf()instead of silently dropping them, andStage.compare()now acceptsmodsfromStage.one()and refuses any modifier instead of emitting an unselected comparison predicate.CMakeLists.txtadds thestartup_gfx2hlsl_opselCTest entry andtests/startup_gfx2hlsl_opsel_check.pycoversop_selon VOP2/VOP3A/VOP1/VOPC plus exact byte-extraction shift/mask expressions.Verification executed:
git diff --check origin/main...HEAD-> pass/root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py-> pass (17 Markdown files, 365 links)/root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py-> pass (1299 tracked files)/root/.local/share/x2w-rev-venv/bin/python -B tests/startup_gfx2hlsl_opsel_check.py-> pass (plusstartup_gfx2hlsl_sdwa_check.py,startup_gfx2hlsl_sdwa_cvt_check.py,startup_gfx2hlsl_vcvt_omod_check.pyall pass)python3 /root/.local/state/xbox2windows/pipeline/x2w_pipe.py win2025 1755 --regex '^startup_gfx2hlsl_(opsel|sdwa|sdwa_cvt|vcvt_omod)$' --py-checks tests/startup_gfx2hlsl_opsel_check.py --wait 600-> pass on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP): Debug (--preset dev) 4/4 passed (startup_gfx2hlsl_opsel,startup_gfx2hlsl_sdwa,startup_gfx2hlsl_sdwa_cvt,startup_gfx2hlsl_vcvt_omod), Release/O2(--preset release) 4/4 passed, Windows Python checktests/startup_gfx2hlsl_opsel_check.pyok (0.15s)elif m.startswith('op_sel'):intools/startup/gfx2hlsl.pytopass;tests/startup_gfx2hlsl_opsel_check.pyfailed as expected (an op_sel on the float add is refused: MISMATCH,an op_sel on a three-source float op is refused: MISMATCH), then restored withgit checkout -- ..AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T18:09:31Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
7481118ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T18:18:37Z.
Fixed in
d1daca3a— good catch, and it is the same class as theset_vfcase.Cause:
Stage.one()dispatched comparisons withself.compare(base, ops), so the modifiers never reached the path that emits the predicate:Fix: the dispatch passes the modifiers, and
compare()refuses any that reach it — it reads its two operands directly, soop_sel,clampandomodare all forms it does not model:Test: the comparison cases are in
startup_gfx2hlsl_opsel_check.py— plain compare still translates,op_selon either operand position refused,clamprefused. 16 checks pass;startup_gfx2hlsl*+startup_translatorgreen in dev; fail-first dropping themodsargument fails the test ata clamp on a float compare is refused.Not folded in: a scan of
gfx2hlsl.pyshows 12 other handlers that takemodsand never read them (op_v_mov_b32, thev_interp_*family,op_v_cvt_pkrtz_f16_f32, several SALU ops). Some cannot carry a modifier in their encoding, but the ones that can are the same silent-drop class. That is a mechanical sweep across many dispatch paths, so it belongs in its own change rather than growing this PR — I'll open an issue for it rather than claim they are all safe.AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T18:14:18Z.
Code review location:
tools/startup/gfx2hlsl.py; line 265op_selon float comparisons tooWhen a VOP3
v_cmp_*_f32carriesop_sel,Stage.one()dispatches it tocompare(base, ops)without passingmods, so it bypasses this check and emits a comparison using the unselected operands. Such input can produce a different predicate instead of being refused; reject or model modifiers in the comparison path as well.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T21:38:32Z.
Resolved the current main conflicts while keeping the non-SDWA modifier refusal and the validated SDWA source selectors. On the integrated tree, the op_sel, VOPC SDWA, SDWA conversion, 64-bit shift and scalar m0 fixtures all pass, and the startup translator suite reports zero failures.