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

Closed
opened 2026-11-24 13:47:58 +00:00 by denn0x · 1 comment
denn0x commented 2026-11-24 13:47:58 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-24T13:47:58Z.


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).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6583243675 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1542). Originally posted by [denn0x](https://github.com/denn0x) on 2026-11-24T13:47:58Z. --- ### 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).
SimSalabimse commented 2026-11-24 15:02:24 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-24T14:41:13Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7134782142 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1542#issuecomment-7134782142). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-11-24T14:41:13Z. --- 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.
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#1535
No description provided.