shader: lower v_pack_b32_f16 in the direct C++ DXIL path #2909
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#2909
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@R0Y00 on GitHub · 2026-11-26 19:00 UTC · original
Target branch
cpp-migration. Open to contributors. Comment here to claim.On
4036577020the opcode table recognizes VOP3 0x311, but a source-built pixel shader stops atnative compute +0x10: direct DXIL lowering for v_pack_b32_f16in the pixel profile. Removing only the pack instruction produces DXIL.Reproduce with
patched_pixelfromtests/native_direct_container_check.py. Supply the instruction words[0x7e0802ff, 0x11223344, 0x7e0a02ff, 0x55667788, 0xd7110004, 0x00020b04]and export(0xf800180f, 0x05040504). Runcompile_dxil <sdk-dir> <empty-cache> gfx1013-container-ps input.cdxil output.cso. For the control remove the final two instruction words and adjust the length. The ordinary pack writes 0x77883344 to v4, which also supplies the first source.Implementation references include the experimental lowering at a pinned revision and the existing Python reference and synthetic controls. Implement from the instruction semantics and existing public fixture. The experimental repository has a root MIT license and separately attributed third-party material. Preserve applicable notices for any reused source.
Acceptance follows each source's high/low selection, clears the half sign for abs, then toggles it for neg, and places source 0 low and source 1 high. Preserve bit patterns including signed zero and NaN payloads. Cover operand overlap, SGPR input and both wrong-result controls (swapped halves and neg before abs). Document unsupported modifier forms. Generate DXIL with the direct frontend and verify exact packed bits by GPU readback on a synthetic fixture, recording adapter, driver, build, and any capability skips.
python -B tests/startup_gfx2hlsl_pack_b32_f16_check.pyalready passes 2304 reference cases. #1723 tracks the older translator census. #2906–#2908 cover separate branch and descriptor work.@Ybucaille on GitHub · 2026-11-26 19:42 UTC · original
I'd like to take this one. I'll implement the direct-path lowering on
cpp-migrationfrom the instruction semantics and the existing fixture, with the overlap, SGPR and wrong-result controls, plus a GPU readback on a synthetic fixture.@MasterDomino on GitHub · 2026-11-26 21:38 UTC · original
Closing: the fix landed on
cpp-migrationvia #2917, squash-merged as16099d7c.Fixes #2909does not close issues automatically outside the default branch. Evidence on #2917:native_pack_b32_f16_irpassed on Windows, and on Linux (Ybucaille) and a GTX 1080 Ti (sydney-0o). The GPU readbacknative_pack_b32_f16_hardwarepassed 3/3 on an RTX 3080 (JB2WIN, 528 packed words bit-exact). The issue's words now compile withcompile_dxil ... gfx1013-container-ps. The RX 9070 XT readback stays blocked by #2915.AI-assisted.
@R0Y00 on GitHub · 2026-12-02 18:49 UTC · original
Rechecked this on
mainat1e2b0d524, Windows 11 build 26300, MSVC Debug and NVIDIA GeForce RTX 4060 Laptop GPU (driver32.0.16.1656). The fixture did not enable the D3D12 debug layer.cmake --build --preset dev --target native_pixel_ir_dump native_store_replayandctest --preset dev --no-tests=error -V -j 1 -R '^native_pack_b32_f16_(ir|hardware)$'passed (2/2). The hardware readback matched all 528 packed words bit for bit. In the IR fixture, all 269 results matched the reference. The no-pack control, overlapping and SGPR sources, constant cases and refusals passed. The swapped-half and neg-before-abs alternatives produced different bits, as expected.