shader: lower v_mul_hi_u32 in gfx2hlsl #1952
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!1952
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1952/head"
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?
@tedin7 on GitHub · 2026-11-24 22:04 UTC · original
tedin7:x2w-frontier-1792-mul-hi-u32→main· +109 −1 · 4 files · 2 commits · closed without mergingPart of #1792
What this unblocks:
v_mul_hi_u32(register and literal forms) lowers instead of being refused, removing 1 of the loading-screen shader refusals under #870.Changes:
tools/startup/gfx2hlsl.py:v_mul_hi_u32lowers to a preamble helpermul_hi_u32built from halfword products (no 64-bit multiply in these stages; a plain*would give the low half).tests/startup_gfx2hlsl_mul_hi_u32_check.py(+ cteststartup_gfx2hlsl_mul_hi_u32): synthetic VOP3A words (opcode0x16a) are decoded, then translated. It checks the register form, the literal form0xaaaaaaab, thatv_mul_lo_u32is unchanged, and that the helper is in the preamble with halfword products.docs/experiments.md: entry added.Not in this slice:
v_mul_hi_i32, the 24-bit_u24forms, DXC/draw results.Verification:
Run on Linux. Not yet run on Win2025: ctest
-R startup_gfx2hlsl_mul_hi_u32and an FXC/DXC compile of the lowered output.AI-assisted; commands listed were executed locally.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 22:04 UTC · original · edited 2026-11-24 22:07 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
ba94004ℹ️ 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.
@ChazY11 on GitHub · 2026-11-24 22:06 UTC · original
Ran it, checked the helper arithmetic independently, and found one term the fixture does not pin
Windows 11 build 26300.9974, device-free:
The helper is correct
I evaluated the emitted body as HLSL
uintarithmetic against(a * b) >> 32for 200,144 pairs — 144 edge pairs(
0,1,0xFFFF,0x10000,0x7FFFFFFF,0x80000000,0xFFFF0000,0xFFFFFFFF, …) plus 200,000 seeded random pairs:Including the carry case that halfword decompositions usually get wrong:
Mutations
mul_hi_u32({0}, {1})→{0} * {1}(low half)(la * lb) >> 16→(la * lb) << 16+ (((middle & 0xffffu) + la * (b >> 16)) >> 16)removedThe survivor is a real arithmetic change, not an equivalent mutant:
Both differ from the reference by exactly the carry the term supplies. The fixture asserts that the helper is present and that it
contains halfword products — which is what the description says it checks — but nothing evaluates the helper, so a dropped carry
passes.
Suggested check, in the style of the other value-level tests in
tests/That fails on the dropped-carry mutation and on the
<<16mutation, and it would also catch a change to the emitted body thatkeeps the "halfword products" text but alters the arithmetic.
Scope
v_mul_hi_i32, the_u24forms, DXC and draws are out of scope in the description, and I did not touch them either. Thev_mul_lo_u32line staying as{0} * {1}is correct: it is a register-only table entry, and the fixture checks it is unchanged.Verdict
Reviewed. The lowering is right; one term of it is unverified by the fixture.
Notes
@tedin7 on GitHub · 2026-11-24 22:19 UTC · original
CI fix pushed at
a0830b07: the newmul_hi_u32helper spelled its halfword shifts as>> 16), which thev_cvt_f32_ubyte2mutation control instartup_gfx2hlsl_cvt_alu_check.pyalso matches (11 hits instead of 4). The shifts are now>> 16u); the generated math is unchanged.Verification:
python3 tests/startup_gfx2hlsl_cvt_alu_check.pyfailed before (AssertionError: ('v_cvt_f32_ubyte2', 11)), passes after.python3 tests/startup_gfx2hlsl_mul_hi_u32_check.pypasses.tests/startup_gfx2hlsl*.pypass locally.AI-assisted; commands listed were executed locally.
@tedin7 on GitHub · 2026-11-25 00:30 UTC · original
Closing as superseded by earlier open PRs #1747 (includes draw test) and #1793 covering v_mul_hi_u32.
Pull request closed