compute: buffer_store_format_* and the d16 forms with the format taken from the descriptor #1542

Closed
opened 2026-11-26 23:15:21 +00:00 by github-bot · 1 comment
Owner

@⁠denn0x on GitHub · 2026-11-24 13:47 UTC · original

Problem

Measured on the 349 gfx1013 compute programs (device slot 67 pipelines) that the executable created in one run past start-up, and on the 627 dispatches of one busy frame after loading. 50 programs (69 of the busy frame's dispatches) stop at a formatted buffer store:
buffer_store_format_d16_x (49 dispatches), buffer_store_format_xyzw, buffer_store_format_d16_xyzw,
buffer_store_format_xyz. The data format is in word 3 of the buffer descriptor, known only at run time.

Proposal

Mirror the run-time buffer_load_format lowering: pass word 3 of the descriptor as an entry constant, read the
format (bits 18:12) in the shader and select the packing:

  • 32-bit float/uint 1-4 channels: raw dword stores.
  • 16_16_FLOAT, 16_16_16_16_FLOAT: f32tof16 pairs per dword.
  • 8_8_8_8_UNORM, 16_16_UNORM, 10_10_10_2_UNORM: saturate, scale, round and pack.
  • 16-bit single-channel formats: read-modify-write of the containing dword with InterlockedAnd/InterlockedOr
    (no 16-bit raw stores below SM 6.2).
  • d16 forms carry two halves per data VGPR; convert them to binary32 before packing.
  • Unknown formats: raw dwords, recorded as a shortcut.

Alternatives

A per-format specialisation chosen when the dispatch is recorded, at the cost of one pipeline per format.

Verification

A source-built gfx1013 fixture (LLVM 15 llvm-mc, as the existing compute_store_check.py and pixel_aot_check.py
fixtures) that uses the instructions, translated and dispatched on WARP, with the UAV read back and compared with
expected words. Include a negative control (an operand form or modifier the lowering refuses).

Checklist

  • I checked for an existing issue or pull request for this change.
  • I did not include game files, dumps, distribution links or credentials.

AI-assisted (Claude Code).

**@⁠denn0x** on GitHub · 2026-11-24 13:47 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/1542) ### Problem Measured on the 349 gfx1013 compute programs (device slot 67 pipelines) that the executable created in one run past start-up, and on the 627 dispatches of one busy frame after loading. 50 programs (69 of the busy frame's dispatches) stop at a formatted buffer store: `buffer_store_format_d16_x` (49 dispatches), `buffer_store_format_xyzw`, `buffer_store_format_d16_xyzw`, `buffer_store_format_xyz`. The data format is in word 3 of the buffer descriptor, known only at run time. ### Proposal Mirror the run-time `buffer_load_format` lowering: pass word 3 of the descriptor as an entry constant, read the format (bits 18:12) in the shader and select the packing: - 32-bit float/uint 1-4 channels: raw dword stores. - `16_16_FLOAT`, `16_16_16_16_FLOAT`: `f32tof16` pairs per dword. - `8_8_8_8_UNORM`, `16_16_UNORM`, `10_10_10_2_UNORM`: saturate, scale, round and pack. - 16-bit single-channel formats: read-modify-write of the containing dword with `InterlockedAnd`/`InterlockedOr` (no 16-bit raw stores below SM 6.2). - d16 forms carry two halves per data VGPR; convert them to binary32 before packing. - Unknown formats: raw dwords, recorded as a shortcut. ### Alternatives A per-format specialisation chosen when the dispatch is recorded, at the cost of one pipeline per format. ### Verification A source-built gfx1013 fixture (LLVM 15 `llvm-mc`, as the existing `compute_store_check.py` and `pixel_aot_check.py` fixtures) that uses the instructions, translated and dispatched on WARP, with the UAV read back and compared with expected words. Include a negative control (an operand form or modifier the lowering refuses). ### Checklist - [x] I checked for an existing issue or pull request for this change. - [x] I did not include game files, dumps, distribution links or credentials. AI-assisted (Claude Code).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:15:21 +00:00
Author
Owner

@⁠SimSalabimse on GitHub · 2026-11-24 14:41 UTC · original

I'd like to take this one: lower buffer_store_format_* and the d16 forms with the format read from the descriptor, with a source-built gfx1013 fixture dispatched on WARP (plus RTX 4070 Ti) and a negative control. I'll keep it to the store forms only.

**@⁠SimSalabimse** on GitHub · 2026-11-24 14:41 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/1542#issuecomment-7134782142) I'd like to take this one: lower buffer_store_format_* and the d16 forms with the format read from the descriptor, with a source-built gfx1013 fixture dispatched on WARP (plus RTX 4070 Ti) and a negative control. I'll keep it to the store forms only.
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#1542
No description provided.