shader: lower v_pack_b32_f16 in pixel_aot #960

Closed
opened 2026-11-23 19:09:43 +00:00 by rasptum · 2 comments
rasptum commented 2026-11-23 19:09:43 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-23T19:09:43Z.


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)

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6566811565 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/967). Originally posted by [rasptum](https://github.com/rasptum) on 2026-11-23T19:09:43Z. --- `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)
R0Y00 commented 2026-11-24 06:49:31 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T19:17:08Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7111373477 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/967#issuecomment-7111373477). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T19:17:08Z. --- 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 commented 2026-11-24 06:49:40 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T20:57:16Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7113793913 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/967#issuecomment-7113793913). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T20:57:16Z. --- 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.
Sign in to join this conversation.
No labels
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.

Reference
R0Y00/Xbox2Windows#960
No description provided.