shader: lower v_pack_b32_f16 in pixel_aot #967

Closed
opened 2026-11-26 22:31:49 +00:00 by github-bot · 2 comments
Owner

@⁠rasptum on GitHub · 2026-11-23 19:09 UTC · original

v_pack_b32_f16 is refused by tools/pixel_aot.py today: REJECTED: Unsupported instruction 21: v_pack_b32_f16 v12, s44, v18.

The RDNA ISA defines v_pack_b32_f16 D, S0, S1 as D[15:0].f16 = S0.f16; D[31:16].f16 = S1.f16, i.e. (S0 & 0xffff) | ((S1 & 0xffff) << 16) with no conversion, rounding or NaN handling.

tools/ffx_dispatch_aot.py already uses the same expression ("pack_b32_f16": "({0}&65535u)|({1}<<16)"), so this aligns pixel_aot with an existing in-tree translator.

Taking it as one small PR: one INTEGER row plus INTEGER_VOP3_ONLY, the draw-pack-b32 mode with four negative controls and the static refusals, a form_coverage_check assertion, two CTest registrations and one docs/experiments.md paragraph.

Test plan: WARP and hardware CTest with exact R32G32B32A32_UINT readback at every row, four wrong references that must report pixel_mismatch, refused _e32/clamp/op_sel/float modifiers/bad registers/SDWA, and the LLVM 15 round trip.

AI-assisted (OpenCode)

**@⁠rasptum** on GitHub · 2026-11-23 19:09 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/967) `v_pack_b32_f16` is refused by `tools/pixel_aot.py` today: `REJECTED: Unsupported instruction 21: v_pack_b32_f16 v12, s44, v18`. The RDNA ISA defines `v_pack_b32_f16 D, S0, S1` as `D[15:0].f16 = S0.f16; D[31:16].f16 = S1.f16`, i.e. `(S0 & 0xffff) | ((S1 & 0xffff) << 16)` with no conversion, rounding or NaN handling. `tools/ffx_dispatch_aot.py` already uses the same expression (`"pack_b32_f16": "({0}&65535u)|({1}<<16)"`), so this aligns `pixel_aot` with an existing in-tree translator. Taking it as one small PR: one `INTEGER` row plus `INTEGER_VOP3_ONLY`, the `draw-pack-b32` mode with four negative controls and the static refusals, a `form_coverage_check` assertion, two CTest registrations and one `docs/experiments.md` paragraph. Test plan: WARP and hardware CTest with exact `R32G32B32A32_UINT` readback at every row, four wrong references that must report `pixel_mismatch`, refused `_e32`/`clamp`/`op_sel`/float modifiers/bad registers/SDWA, and the LLVM 15 round trip. AI-assisted (OpenCode)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:31:49 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-23 19:17 UTC · original

Please proceed with the VOP3 bit-pack slice. The result takes S0's low half into bits 15:0 and S1's low half into bits 31:16. Use distinct noisy upper halves, an asymmetric pair of low-half payloads, and an in-place destination case so the reference catches reversed packing or a source read after the destination write. Include raw NaN and signed-zero half patterns as bits and keep the unsupported modifier and pending-input refusals. The proposed LLVM 15 round-trip and integer target readback fit this scope.

**@⁠R0Y00** on GitHub · 2026-11-23 19:17 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/967#issuecomment-7111373477) Please proceed with the VOP3 bit-pack slice. The result takes S0's low half into bits 15:0 and S1's low half into bits 31:16. Use distinct noisy upper halves, an asymmetric pair of low-half payloads, and an in-place destination case so the reference catches reversed packing or a source read after the destination write. Include raw NaN and signed-zero half patterns as bits and keep the unsupported modifier and pending-input refusals. The proposed LLVM 15 round-trip and integer target readback fit this scope.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-23 20:57 UTC · original

Completed by #1001. The source-built VOP3 bit-pack matches the raw UINT readback on WARP and RTX 4060 Laptop, including aliasing and NaN/signed-zero bit patterns. LLVM 15 round-trip and unsupported-form controls passed. Thanks for keeping the patch limited to the verified low-half shape.

**@⁠R0Y00** on GitHub · 2026-11-23 20:57 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/967#issuecomment-7113793913) Completed by #1001. The source-built VOP3 bit-pack matches the raw UINT readback on WARP and RTX 4060 Laptop, including aliasing and NaN/signed-zero bit patterns. LLVM 15 round-trip and unsupported-form controls passed. Thanks for keeping the patch limited to the verified low-half shape.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/R0Y00--Xbox2Windows#967
No description provided.