tooling: translate VOP1/VOP2 sub-dword addressing in gfx2hlsl #1249
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1256"
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-24T05:39:07Z.
Translates the SDWA forms this issue names.
tools/startup/gfx2hlsl.pyno longer stops on them: the byte and word selects of the 32-bit integer VOP1/VOP2 forms are lowered, with source zero-extension,sext()sign extension, destination field placement, andUNUSED_PAD/UNUSED_PRESERVE.Parity with the pixel AOT path is checked mechanically, not by eye.
startup_gfx2hlsl_sdwacompares the selection helpers againsttools/pixel_aot.pyfor every selection (BYTE_0..3,WORD_0..1,DWORD) with and withoutsext(), and for the destination with both unused forms — the expressions must be identical. Then it drives the translator on gfx1013 assembly for:sext(v5)withsrc0_sel:BYTE_0asuint(asint(v5 << 24u) >> 24u)dst_unused:UNUSED_PRESERVEv9 = v10 ^ v11)UNUSED_SEXT, missingsrc0_selTwo bugs this caught while writing it, both real:
v_or_b32withdst_sel:WORD_1first emitted(v7 | v8 & 0xffff) << 16, which binds asv7 | (v8 & 0xffff)and keeps bits the hardware clears. The operation's HLSL is now grouped before the destination mask:(((v7 | v8) & 0xffffu) << 16u).sext()is a shift pair, not a mask — a byte selection has to sign-extend through the whole word.Still refused, and recorded in
docs/startup-runtime.md: float SDWA forms anddst_unused:UNUSED_SEXT. Nothing is translated to something inexact.Measured on the
releasepreset:startup_gfx2hlsl_sdwapasses;docs_links_check.pypasses. Thestartup_stream_*checks fail on this machine both before and after the change (missing external assembler,FileNotFoundError), so they are not a regression — I checked against a cleanmaincheckout rather than assuming.I did not run a full title startup from this branch, so I have not measured whether the pipeline that previously stopped on SDWA now translates; say the word and I will run one and report the pipeline count.
Closes #1141.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T05:39:16Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
83d4e18ℹ️ 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-24T05:52:05Z.
Measured impact, and it is weaker than the issue implies — reporting it rather than letting the PR look like a pipeline win.
I captured a fresh shader cache from an offline startup (
-ShaderCache, run to the known null at 88 s, 1,869 frames) and translated the four pipelines withgfx2hlsl.py --pending:.failorigin/main(4182af8f, no SDWA).failSo the two pipelines that used to fail were blocked by
s_setprio, not by SDWA — #1241 is merged and that is what unblocked them. Sinceorigin/main's translator raisesUnsupportedon any SDWA form, a 4/4 result there also proves none of these four pipelines contains an SDWA instruction. This change is therefore not exercised by the capture I can reach: the run stops at 88 s, before any pipeline that would need it is requested.What that leaves:
Your call, and I am fine either way: keep it as ahead-of-need coverage with the fixture, or close it and reopen when a capture actually hits a
v_*_sdwaform — the fixture and the parity checks would be the thing to bring back. I would rather close it than have an unexercised translator path looking like a fix.For completeness, the same run also re-confirms #1240's clamp against current
main: the heap request of 1,245,184 descriptors is refused and clamped to the measured 1,000,000, and the run proceeds to 1,869 frames at 28.7 fps instead of stopping at ~2 s.