shader: lower v_pk_add/sub_i16 and v_pk_add/sub_u16 in the direct compute path #3088
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!3088
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3088"
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 14:50 UTC · original
R0D4X:feat/native-pk-add-sub-16→main· +237 −0 · 4 files · 2 commits · merged 2026-11-27 15:43 UTCFixes #3085. Refs #2935.
What this changes
v_pk_add_i16(0x02),v_pk_sub_i16(0x03),v_pk_add_u16(0x0a), andv_pk_sub_u16(0x0b) insrc/gfx1013_direct_compute.inl:op_sel[1:0]andop_sel_hi[1:0]lane selection (ignoring LLVM's default 2-sourceop_sel_hi[2]bit 14).[-32768, 32767](i16) or[0, 65535](u16) whenclampis set.neg_lo,neg_hi,op_sel[2], and nonzerosrc2withunsupported packed 16-bit add/sub operand modifiers.Tests & docs added
tests/native_pk_add_sub_16_check.py&tests/cmake/native_pk_add_sub_16.cmake: DXIL compile & disassembly controls, four modifier/reserved-bit refusal encodings, andnative_store_replayhardware dispatches (dense, sparseEXEC, and no-clamp negative control across 8 patterns x 4 forms = 2,048 words + 16 guards).docs/experiments/native-pk-add-sub-16.md: semantics and reproduction commands.Verification
Commit:
90d0a1cbon Windows 11 x64 (10.0.26300.9974), MSVC19.44.35230, Windows SDK & DXC10.0.26100.0,NVIDIA GeForce RTX 5080(10de:2c02, driver32.0.16.2124), SM 6.6 wave32:ctest --preset dev --no-tests=error -R '^native_pk_add_sub_16_|^native_packed_dot4_' -V: 4/4 passed, 0 skippednative_pk_add_sub_16_hardware:sparse=Falseandsparse=Truematched 2048 result words and 16 guards; no-clamp control differed on 842 words.ctest --preset release --no-tests=error -R '^native_pk_add_sub_16_|^native_packed_dot4_': 4/4 passed, 0 skippeddocs_links_check.py,bidi_controls_check.py,git diff --check): all passed.Scope: Covers synthetic
v_pk_add/sub_i16andv_pk_add/sub_u16wave32 compute fixtures throughcompile_dxilandnative_store_replay; does not establish full-title startup or runtime execution.@R0Y00 on GitHub · 2026-11-27 15:26 UTC · original · requested changes
Independent replay of
90d0a1cbintegrated overmain5df098daand exact #3089 (tree19292252cf9f52e56a431d1c664d45bf091a355d) found a packed clamp failure on the RTX 4060 Laptop, driver 32.0.16.1656, Windows 11 26200.9974, SDK DXC 10.0.26100. The compile controls and all six adjacent control/replay tests passed. Both Debug and Release/O2failednative_pk_add_sub_16_hardwarefirst at word 8,ffff8000versus7fff8000.I let the Release fixture run all three cases. Dense and sparse clamped readbacks had 190 and 252 mismatches respectively, while the unclamped case had zero. The offline DXIL dump for the first packed add still contains both signed saturation sequences and an
and 65535on each result before the OR pack. Please retain the signed saturation oracle and investigate whether selecting the already-masked 16-bit values avoids the corruption. The underlying cause still needs confirmation. Repro:ctest --test-dir <build> --no-tests=error -j 1 -V -R '^native_(pk_add_sub_16|int16|int16_ternary|packed_dot2)_(controls|hardware)$'.@R0Y00 on GitHub · 2026-11-27 15:31 UTC · original
A two-line local change passed the original Release
/O2compile controls and RTX 4060 Laptop replay. In the signed clamped branch, replace the two assignments toreswith:This selects among values already bounded to the output half. Dense and sparse each matched 2,048 words and 16 guards, and the no-clamp control still changed 842 words. The expected values and fixture were untouched. The experiment is local. Please carry the change to the PR head and rerun both configurations.
@R0D4X on GitHub · 2026-11-27 15:39 UTC · original
Applied the bounded 16-bit select in the signed clamped branch in
aa01349eand reran both Debug and Release/O2configurations on NVIDIA GeForce RTX 5080 (10de:2c02, driver32.0.16.2124, Windows 1110.0.26300.9974, SDK DXC10.0.26100.0):ctest --preset dev --no-tests=error -j 1 -V -R '^native_(pk_add_sub_16|int16|int16_ternary|packed_dot2)_(controls|hardware)$': 8/8 passed (dense and sparse each matched 2048 words and 16 guards; no-clamp control differed on 842 words).ctest --preset release --no-tests=error -j 1 -V -R '^native_(pk_add_sub_16|int16|int16_ternary|packed_dot2)_(controls|hardware)$': 8/8 passed (dense and sparse each matched 2048 words and 16 guards; no-clamp control differed on 842 words).Ready for re-review!
@R0Y00 on GitHub · 2026-11-27 15:43 UTC · original · approved these changes
Retested
aa01349eintegrated overmain4a6302eb(tree9a6fd8454a89c509cac8bf6119f45c1b461e4751). The signed clamp now selects an already packed halfword. I verified the signed bounds and the unsigned add/subtract paths, and the prior failing RT readback now matches.Built
compile_dxilandnative_store_replayindevandrelease. Ranctest --test-dir <build> --no-tests=error -j 1 -V -R '^native_(pk_add_sub_16|int16|int16_ternary|packed_dot2|pk_shift16|pk_mul_mad_16)_(controls|hardware)$'in each. Debug and Release/O2both passed 12/12, zero skips. Dense and sparse packed add/subtract each matched all 2,048 words and 16 guards. The no-clamp control still differed at 842 words. The invalid modifier controls still passed.NVIDIA GeForce RTX 4060 Laptop GPU, driver
32.0.16.1656, Windows26200.9974, SDK/DXC10.0.26100.0, wave32, D3D12 debug layer disabled. This supersedes my changes-requested review on90d0a1cb.