shader: lower v_cvt_pknorm_i16_f16 and v_cvt_pknorm_u16_f16 in the direct compute path #3319
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!3319
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3317"
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-28 09:28 UTC · original
R0D4X:feat/native-cvt-pknorm-f16→main· +272 −1 · 4 files · 2 commits · merged 2026-11-29 10:29 UTCFixes #3318. Refs #2935.
What this changes
v_cvt_pknorm_i16_f16(VOP30x312) andv_cvt_pknorm_u16_f16(VOP30x313) insrc/gfx1013_direct_compute.inlusing exact 32-bit integer RNE normalization of two binary16 inputs into a packed 2×16-bit integer destination.240..248throughpacked_f16_inline_constant, supports VOP3op_sel[1:0]andabs/neg, enforcesgraphics_inputand binary16MODEguards (and registers both ops in thehalf_binaryscan), and refuses unsupported modifiers (clamp,omod,op_sel[3:2], non-VGPR high-halfop_sel, unusedsrc2).Tests & docs added
tests/native_cvt_pknorm_f16_check.py&tests/cmake/native_cvt_pknorm_f16.cmake:native_cvt_pknorm_f16_controls: validates emitted integer DXIL (mul i32,32767,65535), refuses invalid modifiers and non-defaults_round_mode, and verifies that thetruncateandinline_as_zeronegative controls each differ.native_cvt_pknorm_f16_hardware: dispatches 8 packed binary16 pairs (normals, subnormals,0x3801–0x3804RNE boundaries,±0.5hties, saturation,±Inf,qNaN) across plain,op_sel[1:0]+abs/neg, and inline0.5(src0=240) forms, matching 2048 result words and 16 sentinel guards.docs/experiments/native-cvt-pknorm-f16.md: experiment note and reproduction commands.Verification
693e9f1f10.0.26300.9974), MSVC19.44.35230, Windows SDK / DXC10.0.26100.0, NVIDIA GeForce RTX 5080 (10de:2c02, driver32.0.16.2140).ctest --preset dev --no-tests=error -R '^native_cvt_pknorm_|^native_cvt_norm_f16_' -V: 12/12 passed (0 skipped).ctest --preset release --no-tests=error -R '^native_cvt_pknorm_f16_' -V: 2/2 passed (0 skipped).tests/docs_links_check.py&tests/bidi_controls_check.py: passed.Scope: covers synthetic direct-DXIL compute fixtures for
v_cvt_pknorm_i16_f16andv_cvt_pknorm_u16_f16only; does not establish full-game execution.@Leyukaka on GitHub · 2026-11-28 20:08 UTC · original · requested changes
Reviewed
693e9f1f.Run on a release build of
mainf2972840with this PR and 17 other open PRs merged locally, Windows Sandbox, network off, vGPU:native_cvt_pknorm_f16_controlsandnative_cvt_pknorm_f16_hardwarepass._hardwareran on the NVIDIA GeForce RTX 5080 (driver 32.0.16.2101) and matched 2048 result words and 16 guards. Makingsigned_outtestv_cvt_pknorm_u16_f16made_hardwarefail;_controlsstill passed.Test gaps. Each mutation below leaves every fixture word unchanged, so both tests still pass:
src/gfx1013_direct_compute.inl:1907if (op_sel & (1u << j))->if (op_sel & 1u). Add op_sel=1 and op_sel=2 forms. For example,v_cvt_pknorm_i16_f16 v4, v2, v3 op_sel:[1,0]onCASES[1](0x3C003801,0xB801BC00) should give0x80017FFF; the mutant gives0xBFF17FFF.240(0.5), and only in S0. Mutation::1909r <= 248->r <= 240, which sends 241-248 tooperand32 & 65535. Addv_cvt_pknorm_i16_f16 v4, 242, 243, expecting0x80017FFF.src2 != 0, high-half op_sel on a non-VGPR source, and abs/neg bit 2. Mutation::1896drop|| i.src[2]. Add refusal cases with src2 = v1 (... operand modifiers), op_sel=1 with S0 = s4 (... high-half op_sel on non-VGPR source), and neg = 4 (... operand modifiers).absis tested only on S1 andnegonly on S0, and every S0 half inCASESis positive, soabson S0 has no observable effect. Mutation::1914if (i.abs & (1u << j))->if (j == 1 && (i.abs & (1u << j))). Add a case(S0, S1) = (0x0000BC00, 0x00003C00)withv_cvt_pknorm_i16_f16 v4, |v2|, -v3, expecting0x80017FFF. The mutant gives0x80018001.Request changes for the test gaps above.
@R0D4X on GitHub · 2026-11-29 08:35 UTC · original
Thanks @Leyukaka! Closed all four test gaps in
tests/native_cvt_pknorm_f16_check.py:op_sel=1(op_sel:[1,0]) andop_sel=2(op_sel:[0,1]) cases onCASES[1](0x3C003801,0xB801BC00).v_cvt_pknorm_i16_f16 v4, 242, 243(inline1.0,-1.0->0x80017FFF).src2 = v1,op_sel=1withS0 = s4, andneg = 4).(0x0000BC00, 0x00003C00)withv_cvt_pknorm_i16_f16 v4, |v2|, -v3(abs_m=1, neg_m=2->0x80017FFF).Re-verified on NVIDIA GeForce RTX 5080 (
10de:2c02, driver32.0.16.2140), Windows 11 (10.0.26300.9974), MSVC19.44.35230, SDK DXC10.0.26100.0:ctest --preset dev --no-tests=error -R '^native_cvt_pknorm_f16_' -V: 2/2 passed (0 skipped); 2048 result words and 16 guards matched.ctest --preset release --no-tests=error -R '^native_cvt_pknorm_f16_' -V: 2/2 passed (0 skipped); 2048 result words and 16 guards matched.@Leyukaka on GitHub · 2026-11-29 08:56 UTC · original · approved these changes
Head
b9fdb5ae, by reading the diff from693e9f1f(nothing built or run).The four gaps are closed:
CASES[1]: withop_sel & 1u, lane 1 reads0xB801in the op_sel=1 slot and the low half0xBC00in the op_sel=2 slot, so both words change.v_cvt_pknorm_i16_f16 v4, 242, 243expects0x80017FFF. Withr <= 240, both operands take the low half of the f32 constant (0).src2,opsel_sgprandneg_bit2refusals each have a control case that expects its message.|v2|, -v3on(0x0000BC00, 0x00003C00)expects0x80017FFF; the S1-only abs mutant gives0x80018001.native_cvt_pknorm_f16_*is not in theprpreset filter (CMakePresets.json:51), so CI does not run these tests.git merge-treeagainst main184b15db: clean.github-bot referenced this pull request2026-12-02 19:43:14 +00:00