startup: lower v_sat_pk_u8_i16 in gfx2hlsl #3033
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!3033
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3033"
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?
@R0D4X on GitHub · 2026-11-27 09:09 UTC · original
R0D4X:feat/gfx2hlsl-v-sat-pk-u8-i16→main· +265 −0 · 4 files · 2 commits · merged 2026-11-27 20:21 UTCWhat this changes
Adds lowering for
v_sat_pk_u8_i16(VOP10x62/ VOP3A0x1e2) intools/startup/gfx2hlsl.py(already decoded bytools/disasm_rdna2.py).S0to[0, 255], packs the two resultinguint8lanes intoD[7:0]andD[15:8], and zeroesD[31:16].check_encoding()guard forv_sat_pk_u8_i16_e64that refuses VOP3Aneg/absbits and non-zero unusedsrc1/src2fields;VEC_Uhandles both_e32and_e64spellings,EXECmasking, and refuses modifiers or wrong operand counts.Tests added
tests/startup_gfx2hlsl_v_sat_pk_u8_i16_check.py: VOP1 (e32) and VOP3A (e64) binary decode viaG.decode(), 169 half-word boundary pairs,EXECmasking, encoding and Stage refusals, unlowered control, and FXCps_5_1+ DXCps_6_0GPU readback draws for bothe32ande64(including a negative-control draw).tests/cmake/startup_gfx2hlsl_v_sat_pk_u8_i16.cmakeandtests/checks/python-linux/startup_gfx2hlsl_v_sat_pk_u8_i16.txt.Verification
23e57e7c(onupstream/main3b6c38a8)10.0.26300.9974), MSVC19.44.35230, Windows SDK10.0.26100.0, FXC + DXC1.9.2602.17, D3D12 debug layer enabled1414:008c, driver10.0.26100.9818) and NVIDIA GeForce RTX 5080 (10de:2c02, driver32.0.16.2124)Results:
ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_v_sat_pk_u8_i16|^startup_tools_lint$' -V-> 4/4 passed, 0 skipped (debug_errors=0 debug_warnings=0on all draws)ctest --preset release --no-tests=error -R '^startup_gfx2hlsl_v_sat_pk_u8_i16'-> 3/3 passed, 0 skippeddocs_links_check.py,bidi_controls_check.py,startup_gfx2hlsl_cvt_pk_int16_check.py,startup_gfx2hlsl_handler_arity_check.py,startup_gfx2hlsl_refusals_check.py,git diff --check) -> all passedgfx2hlsl.py(droppingneg/absguard, dropping unusedsrc1/src2guard, wrong high-byte shift) -> 3/3 caught (rc=1)Scope: Covers synthetic gfx1013 VOP1/VOP3A fixtures translated by
gfx2hlsl.pyand run on WARP and RTX 5080; does not establish full-title startup or frame rate.@tedin7 on GitHub · 2026-11-27 10:05 UTC · original · reviewed
Review of head
23e57e7c(comment only).Read the diff of
tools/startup/gfx2hlsl.py(11 lines): the newv_sat_pk_u8_i16lowering (two signed 16-bit lanes saturated to unsigned 8-bit, packed in the low 16 bits) and the_e64encoding guard (refuses abs/neg and non-zero unused src1/src2). Both match the ISA description in the code comment.The PR's check does what a lowering needs:
startup_gfx2hlsl_v_sat_pk_u8_i16_warp/_hardwaredraw the translated shader and compare the readback withref_sat_pk_u8_i16, a CPU reference written independently of the HLSL template (dxc, and fxc when set), plus a_controlstest.Ran locally (Linux):
python3 -B tests/startup_gfx2hlsl_v_sat_pk_u8_i16_check.py(the controls): ok.eval_hlslmirrors the formula instead of running it), so only the WARP draw can; it needs a Windows run.No defect found. This PR only lacks a Windows receipt on this head:
ctest -R "startup_gfx2hlsl_v_sat_pk_u8_i16"(dev + release).AI-assisted; commands listed were executed locally.
23e57e7c59to142ca42896@tedin7 on GitHub · 2026-11-27 20:21 UTC · original · reviewed
Review of
39de43ebb5(updated with main). Comment only.The
VEC_Utemplate sign-extends each 16-bit half (asint(x << 16) >> 16for the low half,asint(x) >> 16for the high half), clamps to [0, 255] and packs the two bytes into D[15:0] with D[31:16] zero. The_e64guard refuses abs/neg and nonzero unused src1/src2 fields. The_warpand_hardwaredraws compare withref_sat_pk_u8_i16, written independently of the template. This is the gfx2hlsl path; #3095 (merged) covers the direct C++ compute path, so the two do not overlap.Windows results are in the comment below.
Commands:
git diff origin/main...pull/3033/head(read), plus the Windows commands listed in the comment.AI-assisted; commands listed were executed locally.
@tedin7 on GitHub · 2026-11-27 20:21 UTC · original
Windows Server 2025 verification of
39de43ebb591e80396f1bd3a4a037d6c09853d75(D3D12 WARP, MSVC 14.44.35207):cmake --build --preset dev --target offscreen_check;ctest --preset dev -R '^startup_gfx2hlsl_': 382/382 passed, includingstartup_gfx2hlsl_v_sat_pk_u8_i16_controls,_warpand_hardwarecmake --build --preset release --target offscreen_check;ctest --preset release -R '^startup_gfx2hlsl_': 382/382 passedtools/startup/gfx2hlsl.py: all ok;tests/startup_run_sh_check.pyskips (77) on WindowsAI-assisted; commands listed were executed locally.