Skip to content

shader: lower v_pack_b32_f16 in the direct C++ DXIL path #2909

Done

Description

@R0Y00

Target branch cpp-migration. Open to contributors. Comment here to claim.

On 4036577 the opcode table recognizes VOP3 0x311, but a source-built pixel shader stops at native compute +0x10: direct DXIL lowering for v_pack_b32_f16 in the pixel profile. Removing only the pack instruction produces DXIL.

Reproduce with patched_pixel from tests/native_direct_container_check.py. Supply the instruction words [0x7e0802ff, 0x11223344, 0x7e0a02ff, 0x55667788, 0xd7110004, 0x00020b04] and export (0xf800180f, 0x05040504). Run compile_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.py already passes 2304 reference cases. #1723 tracks the older translator census. #2906–#2908 cover separate branch and descriptor work.

Activity

  1. added
    help wanted
    on Nov 26, 2026
  2. Ybucaille commented on Nov 26, 2026

    @Ybucaille
    Contributor

    I'd like to take this one. I'll implement the direct-path lowering on cpp-migration from the instruction semantics and the existing fixture, with the overlap, SGPR and wrong-result controls, plus a GPU readback on a synthetic fixture.

  3. added a commit that references this issue on Nov 26, 2026
    16099d7
  4. MasterDomino commented on Nov 26, 2026

    @MasterDomino
    Collaborator

    Closing: the fix landed on cpp-migration via #2917, squash-merged as 16099d7c. Fixes #2909 does not close issues automatically outside the default branch. Evidence on #2917: native_pack_b32_f16_ir passed on Windows, and on Linux (Ybucaille) and a GTX 1080 Ti (sydney-0o). The GPU readback native_pack_b32_f16_hardware passed 3/3 on an RTX 3080 (JB2WIN, 528 packed words bit-exact). The issue's words now compile with compile_dxil ... gfx1013-container-ps. The RX 9070 XT readback stays blocked by #2915.

    AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions