Repository navigation
startup: refuse a modifier for handlers that do not model one - #1778
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f8b962f935
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
Review on R0Y00#1778 (P2): the p1/p2 interpolations have their own VOP3 operand profile (data source in w1[16:9], abs at w0[9], neg at w1[30]), and the decoder prints those modifiers inside the operand text rather than as a modifier list, so the dispatch guard does not see them. The handlers never read that operand (the value comes from the interpolator), so |v2| or -v2 on it was silently ignored. Both handlers now refuse a modified data source. The test's previous p1/p2 checks used the generic [V2, 0] layout, which is invalid for these forms and only exercised decoder refusal; they are replaced with real encodings that translate plain forms and refuse abs/neg, plus a clamp through the modifier list.
|
Fixed in The finding: the p1/p2 forms have their own VOP3 operand profile — data source in Both handlers now refuse a modified data source ( My fixture was the worse mistake: the earlier p1/p2 checks used the generic 17 checks pass, dev Thanks for catching the invalid fixture — a passing test built on a word the assembler would never emit is worse than no test, and this is the second time that shape has hidden a gap in my work. AI-assisted (Claude Code). |
tedin7
left a comment
There was a problem hiding this comment.
Reviewed at f8b962f93504146bd48466fca293906b9f7a5618.
No P1/P2 defects found in local verification. MODIFIER_FREE_HANDLERS (op_v_mov_b32, op_v_cvt_pkrtz_f16_f32, op_v_interp_p1_f32, op_v_interp_p2_f32, op_v_interp_mov_f32) covers the vector/interpolation handlers in tools/startup/gfx2hlsl.py that accept mods without reading it, and Stage.one rejects non-empty mods with Unsupported before dispatch while leaving scalar-ALU handlers (whose encodings carry no modifier field) unaffected.
Local Verification
- Linux checks:
python3 /root/.local/state/xbox2windows/pipeline/x2w_pipe.py prep-verify 1778 --dir /tmp/rev-sm2-rexb/1778 --json(git_diff_check,docs_links_check,bidi_controls_check,py_compile: all ok)/root/.local/share/x2w-rev-venv/bin/python -B /tmp/rev-sm2-rexb/1778/tests/startup_gfx2hlsl_modifier_free_check.py: PASS- All
tests/startup_gfx2hlsl*_check.pyscripts (9/9): PASS
- Win2025 Debug (
--preset dev) & Release/O2(--preset release):python3 /root/.local/state/xbox2windows/pipeline/x2w_pipe.py win2025 1778 --regex '^(startup_gfx2hlsl_modifier_free|startup_gfx2hlsl_bit_alu_controls|startup_gfx2hlsl_cndmask_neg|startup_gfx2hlsl_operand_count|startup_gfx2hlsl_sdwa|startup_gfx2hlsl_sdwa_cvt|startup_gfx2hlsl_smem_offset|startup_gfx2hlsl_vcvt_omod|startup_translator)$' --py-checks tests/startup_gfx2hlsl_modifier_free_check.py- Debug (
--preset dev): 9/9 passed (0.84s), Windows Python check ok (0.15s) - Release
/O2(--preset release): 9/9 passed (0.82s)
- Mutation test:
- Commented out
'op_v_mov_b32'inMODIFIER_FREE_HANDLERSintools/startup/gfx2hlsl.pyand ran/root/.local/share/x2w-rev-venv/bin/python -B /tmp/rev-sm2-rexb/1778/tests/startup_gfx2hlsl_modifier_free_check.py: FAIL (rc=1onthe declared modifier-free handlers are exactly these five,a clamp on the move is refused,a mul:2 on the move is refused), then restored withgit checkout -- ..
- Commented out
AI-assisted; commands listed were executed locally.
|
Small note on the fixture: AI-assisted. |
Ran it; the guard, the list and the self-check all fail when brokenAt the PR head, device-free: out/pe-env/Scripts/python.exe -B tests/startup_gfx2hlsl_modifier_free_check.py
no scalar handler is declared modifier-free: ok
PASS exit 0Three mutations to
The third is the one I would not have expected a fixture to catch: the set is a hand-maintained list, and a later contributor Why this shape is right for the class
One consequence worth stating in the description: a handler that does model a modifier must not be in the set, so adding ScopeThree files ( VerdictReviewed. Every part of the mechanism is pinned by a mutation, including the list's self-consistency. No objections. Notes
|
|
@triggered02 could you rebase this branch onto current GitHub reports head Files that conflict with current
Commands run locally: Once it is rebased and CI is green it will be re-checked right away. AI-assisted; commands listed were executed locally. |
|
Rebased onto current
Two of the five I closed rather than rebased, because their content is already on
AI-assisted (Claude Code). |
|
@triggered02 could you rebase this branch onto current GitHub reports head Files that conflict with current
Commands run locally: Once it is rebased and CI is green it will be re-checked right away. AI-assisted; commands listed were executed locally. |
tedin7
left a comment
There was a problem hiding this comment.
Review of head 7a72fab0fe42780f7a4c3f063582c880610e9a2d.
Summary: The change is correct in intent. The modifier refusal for v_mov_b32, v_cvt_pkrtz_f16_f32 and the interpolation handlers is sound, and the new test kills my mutations. One existing test now fails, so this is not mergeable as is.
P1: existing test regresses
tests/startup_gfx2hlsl_readfirstlane_uniform_check.py:111:modified move overwrite refused: MISMATCH "v_mov_b32 with ['clamp']". The casev_mov_b32_e32 v7, s2 clampis still refused, but now by the dispatch guard (tools/startup/gfx2hlsl.py:691) before the readfirstlane code runs. The test expects the readfirstlane refusal text, so it reports 1 failure.- This test passes on
origin/main(0 failed). The PR registers a new CTest but does not update this one. - Fix: add
'modified move overwrite': "v_mov_b32 with ['clamp']"to theEARLIERmap (next to the existingop_sel overwriteentry, just after theREFUSEDlist). If the case was meant to reach the readfirstlane path, use a modifier that is not refused earlier.
P2: none.
Nits
tools/startup/gfx2hlsl.py:308-315:MODIFIER_FREE_HANDLERSis followed directly bydef smem_modswith no blank lines, and the two blank lines beforeclass Stage(line 340) were removed. This breaks PEP8 spacing (E302/E305).
Checked and fine
- The guard sits before
handler(ops, mods), so it covers every handler in the set.handler.__name__matches the declared names. - The p1/p2 abs/neg refusal on
ops[1]is needed because the decoder prints it inside the operand, not as a mod. - Title is neutral. No clean-room problems seen. No CI checks are reported for the branch.
Commands run locally (worktree at the head SHA)
python3 -B tests/startup_gfx2hlsl_modifier_free_check.py-> PASS- all
tests/startup_gfx2hlsl_*_check.py(31 files) -> 1 FAIL:startup_gfx2hlsl_readfirstlane_uniform_check.py(passes onorigin/main) python3 tests/docs_links_check.py-> ok (18 files, 395 links)python3 tests/bidi_controls_check.py-> okgit diff --check origin/main...HEAD-> clean- Mutation 1: removed
op_v_cvt_pkrtz_f16_f32from the set -> new test fails (MISMATCH) - Mutation 2: disabled the dispatch guard -> new test fails (6 MISMATCH)
- Mutation 3: disabled the p1/p2 source-modifier check -> new test fails (3 MISMATCH)
- Windows WARP run: not needed. The change only adds refusals in Python and emits no new HLSL.
AI-assisted; commands listed were executed locally.
7a72fab to
3af8ad7
Compare
|
Re-created on
Measured checks
Not established
AI-assisted (Gemini). |
3af8ad7 to
72603d6
Compare
|
I integrated current main in |
Fixes #1771. The systematic fix for the class that produced five separate review findings (
set_vfop_sel,op_v_cndmask_b32clamp/mul:2,compare()modifiers, the handlers here, and the interpolation source modifiers found while reviewing this PR).Problem
Several handlers take the modifier list and never read it, so a modifier their encoding can carry was dropped from the emitted HLSL:
The interpolations also carry modifiers inside the operand text, which no modifier-list guard can see:
v_interp_p1_f32_e64 v1, |v2|, attr0.xsilently interpolated the unmodified source because the handler never reads that operand.Fix
A module-level set names the handlers whose encoding can carry a modifier but whose lowering does not model it, and the dispatch refuses the modifier before the handler runs:
The two p1/p2 handlers additionally refuse an
abs/negprinted on their data-source operand, since that one arrives as operand text rather than as a modifier list.Scalar-ALU handlers are deliberately absent: their encoding has no modifier field, so nothing can reach them with one; adding them would be noise that cannot be exercised. The test asserts none is in the set.
Test
startup_gfx2hlsl_modifier_freebuilds VOP1/VOP2/VOP3A encodings from the checked-in decoder's layout, decodes them, then translates. For the interpolations it uses their real operand profile (attrinw1[5:0], channelw1[7:6], data sourcew1[16:9],absatw0[9],negatw1[30]) — an earlier revision of this PR used the generic[V2, 0]layout, which is invalid for those forms and only exercised decoder refusal.Seventeen checks: the declared set, plain forms translating, each modifier refused per handler,
abs/negon the interpolation data source refused, the attribute channel read from the operand, and no scalar handler in the set.Fail-first: removing the dispatch guard fails a clamp on the flat interpolation is refused; dropping a handler from the set fails a mul:2 on the move is refused; removing the p1/p2 source check fails an absolutely-modified p2 source is refused.
What this does not establish
AI-assisted (Claude Code).