help wanted: GPU translation, part 4 (compute shaders) #2015

Open
opened 2026-11-24 23:18:16 +00:00 by denn0x · 28 comments
denn0x commented 2026-11-24 23:18:16 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-24T23:18:16Z.


Compute programs (gfx1013) that the startup compute translator still refuses. Each row is an independent piece of work for one pull request with a source-built or hand-assembled fixture. Counts are aggregate numbers from a private run (dispatches skipped per 300 frames of one scene / distinct programs); they only rank the items.

Items (pick one, say so in a comment)

Item What is refused today Weight Notes
A Formatted buffer load through a descriptor taken from a heap at run time (buffer_load_format_x and wider, indexed) about 104,000 / 204 The format, stride and size come from the descriptor words, which are only known at run time. Needs the descriptor words available to the shader (for example a side buffer of descriptor words per view) and a load that switches on the format field. The same gap exists for vertex and mesh stages. Related: #1542, #1143.
B Formatted buffer store through a heap descriptor (buffer_store_format_xyzw, d16 forms) about 7,200 / 7 Related: #1542.
C Scalar holding a descriptor word used numerically (v_writelane_b32, s_cselect_b32, s_cmp_eq_i32 on a descriptor word or descriptor count) about 16,000 / 72 The value tracker treats descriptor words as opaque. Needs a model of which fields may be read as numbers.
D v_bcnt_u32_b32 about 7,500 / 4 Population count plus addend.
E image_gather4_l about 7,200 / 3 Related: #1802 (gather needs view and mip state).
F s_ff1_i32_b32 / s_ff1_i32_b64 of a general scalar (not exec) about 4,100 / 12
G Smaller ALU and compare gaps: v_cmp_ne_i32 in some operand forms, s_bcnt1, v_mbcnt over a mask, a vcc_hi operand about 3,000 / 20 One pull request each is fine. Related: #1546.
H Image forms: cube images, image atomics (or, compare-swap), ds_append small Related: #1545, #1541.

What a pull request needs

  • One item per pull request.
  • A source-built or hand-assembled fixture (no bytes from any retail software) with buffer or image read-back and a negative control that fails when the lowering is disabled.
  • LLVM / Mesa semantics cited for each instruction.
  • Refuse precisely what the change does not cover. A wrong culling or argument-building pass hides every draw that depends on it, so a refusal that stays is better than a wrong translation.

Existing issues cover neighbouring areas and are not repeated here: #1541 (LDS and barriers), #1543 (DPP and cross-lane), #1544 (entry layout), #1545 (image stores and atomics), #1546 (lane-pattern masks), #1412 (running compute pipelines).

Other parts: #1996 (pixel shaders), #1998 (mesh shaders), #1999 (render state and indirect draws).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6593376673 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022). Originally posted by [denn0x](https://github.com/denn0x) on 2026-11-24T23:18:16Z. --- Compute programs (gfx1013) that the startup compute translator still refuses. Each row is an independent piece of work for one pull request with a source-built or hand-assembled fixture. Counts are aggregate numbers from a private run (dispatches skipped per 300 frames of one scene / distinct programs); they only rank the items. ## Items (pick one, say so in a comment) | Item | What is refused today | Weight | Notes | |---|---|---:|---| | A | Formatted buffer load through a descriptor taken from a heap at run time (`buffer_load_format_x` and wider, indexed) | about 104,000 / 204 | The format, stride and size come from the descriptor words, which are only known at run time. Needs the descriptor words available to the shader (for example a side buffer of descriptor words per view) and a load that switches on the format field. The same gap exists for vertex and mesh stages. Related: #1542, #1143. | | B | Formatted buffer store through a heap descriptor (`buffer_store_format_xyzw`, d16 forms) | about 7,200 / 7 | Related: #1542. | | C | Scalar holding a descriptor word used numerically (`v_writelane_b32`, `s_cselect_b32`, `s_cmp_eq_i32` on a descriptor word or descriptor count) | about 16,000 / 72 | The value tracker treats descriptor words as opaque. Needs a model of which fields may be read as numbers. | | D | `v_bcnt_u32_b32` | about 7,500 / 4 | Population count plus addend. | | E | `image_gather4_l` | about 7,200 / 3 | Related: #1802 (gather needs view and mip state). | | F | `s_ff1_i32_b32` / `s_ff1_i32_b64` of a general scalar (not exec) | about 4,100 / 12 | | | G | Smaller ALU and compare gaps: `v_cmp_ne_i32` in some operand forms, `s_bcnt1`, `v_mbcnt` over a mask, a `vcc_hi` operand | about 3,000 / 20 | One pull request each is fine. Related: #1546. | | H | Image forms: cube images, image atomics (or, compare-swap), `ds_append` | small | Related: #1545, #1541. | ## What a pull request needs - One item per pull request. - A source-built or hand-assembled fixture (no bytes from any retail software) with buffer or image read-back and a negative control that fails when the lowering is disabled. - LLVM / Mesa semantics cited for each instruction. - Refuse precisely what the change does not cover. A wrong culling or argument-building pass hides every draw that depends on it, so a refusal that stays is better than a wrong translation. Existing issues cover neighbouring areas and are not repeated here: #1541 (LDS and barriers), #1543 (DPP and cross-lane), #1544 (entry layout), #1545 (image stores and atomics), #1546 (lane-pattern masks), #1412 (running compute pipelines). Other parts: #1996 (pixel shaders), #1998 (mesh shaders), #1999 (render state and indirect draws).
SimSalabimse commented 2026-11-25 01:01:54 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-24T23:28:27Z.


I'd like to take item F from this list: s_ff1_i32_b32 / s_ff1_i32_b64 of a general scalar (not exec) in the startup compute translator.

  • Scope: lower those bit-scan forms when the source is a tracked general scalar, with LLVM/Mesa cited semantics. Keep exec-only cases, untracked sources, and anything this slice does not cover refused.
  • Evidence: a source-built or hand-assembled fixture (no retail bytes) with a negative control that fails when the lowering is disabled. Python/LLVM 15 checks first; Windows ctest on WARP and an RTX 4070 Ti.

AI-Assisted

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147440270 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7147440270). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-11-24T23:28:27Z. --- I'd like to take item F from this list: s_ff1_i32_b32 / s_ff1_i32_b64 of a general scalar (not exec) in the startup compute translator. - Scope: lower those bit-scan forms when the source is a tracked general scalar, with LLVM/Mesa cited semantics. Keep exec-only cases, untracked sources, and anything this slice does not cover refused. - Evidence: a source-built or hand-assembled fixture (no retail bytes) with a negative control that fails when the lowering is disabled. Python/LLVM 15 checks first; Windows ctest on WARP and an RTX 4070 Ti. AI-Assisted
archielcqp-a11y commented 2026-11-25 02:02:06 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by archielcqp-a11y on 2026-11-25T01:20:54Z.


I'd like to take item A, formatted buffer loads through a heap descriptor, in tools/compute_store_aot.py. Before writing code, here is the scope I propose. Please correct it if it is not the cut you want.

There are two separate gaps. The compute profile resolves a descriptor only at a static table offset. Its formatted loads are gfx1030 only, with the format stated by the caller (--source-format). Item A needs both of these to become run-time values. I'd split them into two pull requests.

Slice 1 (first PR): the format switch. This mirrors the store path from #1542 (--descriptor-format-constant, store_descriptor_format).

  • Forms: gfx1013 buffer_load_format_{x,xy,xyz,xyzw} and the d16_ forms, idxen only, through the existing static t0 source binding with its stated stride.

  • Format input: V# word 3 comes from a ready s_buffer_load constant word that the caller names, one per formatted load, in program order.

  • Decode: one HLSL load_descriptor_format(formatWord, addr, channels, d16) reads FORMAT (bits 18:12) and accepts the same fixed bits as the store path: the GFX10 identity 0x01000FAC and the legacy DFMT/NFMT identity 0x00000FAC. It handles the same format set as the stores:

    • 32-bit UINT and FLOAT, 1 to 4 channels;
    • 8_8_8_8_UNORM, 16_16_UNORM and 10_10_10_2_UNORM;
    • 16_16_FLOAT and 16_16_16_16_FLOAT;
    • 16-bit UNORM, SNORM, UINT, SINT and FLOAT.
  • Conversion:

    • UNORM is x / (2^n - 1);
    • SNORM is max(x / (2^(n-1) - 1), -1);
    • FLOAT16 is f16tof32;
    • 16-bit UINT and SINT are zero-extended and sign-extended;
    • d16 packs each result back to binary16, two per VGPR.

    I'll cite the RDNA 2 ISA (§8.1.4 and §8.1.8) and Mesa's ac_build_buffer_load_format / ac_nir lowering for each rule. The PR will name any rule I cannot tie to a source.

  • Open question, opcode wider than the format (for example xyzw on 32_FLOAT). D3D and Vulkan fill missing components with (0, 0, 0, 1). I have not found an RDNA statement of what the format unit returns. My proposal is that the slice handles only opcode widths no larger than the format, plus fixed bits and formats from the table. Anything else returns 0 in every component, and the docs list that zero result as a known gap, not as hardware behaviour. If you would rather have the (0, 0, 0, 1) fill with a citation, or the dispatch treated as invalid, I'll do that instead.

  • Fixture: source-built gfx1013 assembly in LLVM 15 spelling, with readback on WARP and hardware. It loads every format through each opcode width it accepts, with record bytes that put sign bits, tie values and denormal halves in each field.

    • Wrong references must fail on the GPU: a UNORM divisor off by one, SNORM without the clamp, an unsigned 16-bit SINT, the d16 halves swapped and a legacy format field misread.
    • Translation controls refuse gfx1030 with a constant format, a missing or unready format word, offen, a format word left unused, and the existing static-format flags combined with this one.
    • With the decode removed, the controls fail.

Slice 2 (later PR, design only for now): the descriptor from the heap. The 204 programs take the descriptor itself from the heap at run time, so slice 1 alone unblocks none of them. Slice 2 needs:

  • a side buffer of guest V# words per heap view, filled by the runtime when it writes the view;
  • the desktop view through ResourceDescriptorHeap[index] (SM 6.6);
  • stride from word 1 and num_records from word 2, with out-of-range indices returning 0.

This overlaps the dynamic heap indexing in #1143, so I'd coordinate with that work before starting, and keep slice 2 out of the first PR.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7149454342 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7149454342). Originally posted by [archielcqp-a11y](https://github.com/archielcqp-a11y) on 2026-11-25T01:20:54Z. --- I'd like to take item A, formatted buffer loads through a heap descriptor, in `tools/compute_store_aot.py`. Before writing code, here is the scope I propose. Please correct it if it is not the cut you want. There are two separate gaps. The compute profile resolves a descriptor only at a static table offset. Its formatted loads are gfx1030 only, with the format stated by the caller (`--source-format`). Item A needs both of these to become run-time values. I'd split them into two pull requests. **Slice 1 (first PR): the format switch.** This mirrors the store path from #1542 (`--descriptor-format-constant`, `store_descriptor_format`). - **Forms:** gfx1013 `buffer_load_format_{x,xy,xyz,xyzw}` and the `d16_` forms, `idxen` only, through the existing static t0 source binding with its stated stride. - **Format input:** V# word 3 comes from a ready `s_buffer_load` constant word that the caller names, one per formatted load, in program order. - **Decode:** one HLSL `load_descriptor_format(formatWord, addr, channels, d16)` reads FORMAT (bits 18:12) and accepts the same fixed bits as the store path: the GFX10 identity `0x01000FAC` and the legacy DFMT/NFMT identity `0x00000FAC`. It handles the same format set as the stores: - 32-bit UINT and FLOAT, 1 to 4 channels; - `8_8_8_8_UNORM`, `16_16_UNORM` and `10_10_10_2_UNORM`; - `16_16_FLOAT` and `16_16_16_16_FLOAT`; - 16-bit UNORM, SNORM, UINT, SINT and FLOAT. - **Conversion:** - UNORM is `x / (2^n - 1)`; - SNORM is `max(x / (2^(n-1) - 1), -1)`; - FLOAT16 is `f16tof32`; - 16-bit UINT and SINT are zero-extended and sign-extended; - d16 packs each result back to binary16, two per VGPR. I'll cite the RDNA 2 ISA (§8.1.4 and §8.1.8) and Mesa's `ac_build_buffer_load_format` / `ac_nir` lowering for each rule. The PR will name any rule I cannot tie to a source. - **Open question, opcode wider than the format** (for example `xyzw` on `32_FLOAT`). D3D and Vulkan fill missing components with (0, 0, 0, 1). I have not found an RDNA statement of what the format unit returns. My proposal is that the slice handles only opcode widths no larger than the format, plus fixed bits and formats from the table. Anything else returns 0 in every component, and the docs list that zero result as a known gap, not as hardware behaviour. If you would rather have the (0, 0, 0, 1) fill with a citation, or the dispatch treated as invalid, I'll do that instead. - **Fixture:** source-built gfx1013 assembly in LLVM 15 spelling, with readback on WARP and hardware. It loads every format through each opcode width it accepts, with record bytes that put sign bits, tie values and denormal halves in each field. - Wrong references must fail on the GPU: a UNORM divisor off by one, SNORM without the clamp, an unsigned 16-bit SINT, the d16 halves swapped and a legacy format field misread. - Translation controls refuse gfx1030 with a constant format, a missing or unready format word, `offen`, a format word left unused, and the existing static-format flags combined with this one. - With the decode removed, the controls fail. **Slice 2 (later PR, design only for now): the descriptor from the heap.** The 204 programs take the descriptor itself from the heap at run time, so slice 1 alone unblocks none of them. Slice 2 needs: - a side buffer of guest V# words per heap view, filled by the runtime when it writes the view; - the desktop view through `ResourceDescriptorHeap[index]` (SM 6.6); - stride from word 1 and `num_records` from word 2, with out-of-range indices returning 0. This overlaps the dynamic heap indexing in #1143, so I'd coordinate with that work before starting, and keep slice 2 out of the first PR.
tedin7 commented 2026-11-25 02:02:06 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:23:25Z.


Picking up Item A (buffer_load_format from runtime heap descriptor in compute) with WARP readback tests.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7149495083 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7149495083). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T01:23:25Z. --- Picking up Item A (buffer_load_format from runtime heap descriptor in compute) with WARP readback tests.
R0Y00 commented 2026-11-25 02:02:06 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T01:24:41Z.


Two item A claims came in. Please split them along the existing proposal: @archielcqp-a11y can take the format decoder on one static t0 binding first, and @tedin7 can take the heap-descriptor retrieval and its bounds/lifetime controls, building on that decoder instead of duplicating it. Please confirm that split here. For the first slice, start with matching format/opcode widths and ordinary word results. An unsupported format or over-wide opcode must be refused or report a distinct invalid outcome before any valid-looking output is published. Zero data from a valid read needs to remain distinguishable. D16 can follow with integer versus float handling and a format-specific rounding or conversion control. Keep the existing static and gfx1030 paths as regressions. Neither slice alone should be counted as application coverage until it is used in a real dispatch.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7149517078 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7149517078). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T01:24:41Z. --- Two item A claims came in. Please split them along the existing proposal: @archielcqp-a11y can take the format decoder on one static t0 binding first, and @tedin7 can take the heap-descriptor retrieval and its bounds/lifetime controls, building on that decoder instead of duplicating it. Please confirm that split here. For the first slice, start with matching format/opcode widths and ordinary word results. An unsupported format or over-wide opcode must be refused or report a distinct invalid outcome before any valid-looking output is published. Zero data from a valid read needs to remain distinguishable. D16 can follow with integer versus float handling and a format-specific rounding or conversion control. Keep the existing static and gfx1030 paths as regressions. Neither slice alone should be counted as application coverage until it is used in a real dispatch.
tedin7 commented 2026-11-25 02:02:06 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:27:44Z.


Yielding Item A (slice 1) to @archielcqp-a11y who claimed it 3 minutes earlier — we have not opened a PR for it.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7149572424 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7149572424). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T01:27:44Z. --- Yielding Item A (slice 1) to @archielcqp-a11y who claimed it 3 minutes earlier — we have not opened a PR for it.
tedin7 commented 2026-11-25 02:02:07 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:41:00Z.


Confirmed on Item A split: we will wait for @archielcqp-a11y Slice 1 static format decoder before building Slice 2 (heap-descriptor retrieval + bounds/lifetime controls) on top of it. Meanwhile picking up Item G (compute ALU & compare gaps: v_cmp_ne_i32, s_bcnt1, v_mbcnt, vcc_hi) with WARP readback tests.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7149833694 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7149833694). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T01:41:00Z. --- Confirmed on Item A split: we will wait for @archielcqp-a11y Slice 1 static format decoder before building Slice 2 (heap-descriptor retrieval + bounds/lifetime controls) on top of it. Meanwhile picking up Item G (compute ALU & compare gaps: `v_cmp_ne_i32`, `s_bcnt1`, `v_mbcnt`, `vcc_hi`) with WARP readback tests.
tedin7 commented 2026-11-25 02:02:08 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:43:32Z.


Also picking up Item C (scalar holding a descriptor word used numerically in compute_store_aot) as a separate PR with WARP readback tests.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7149883047 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7149883047). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T01:43:32Z. --- Also picking up Item C (scalar holding a descriptor word used numerically in `compute_store_aot`) as a separate PR with WARP readback tests.
archielcqp-a11y commented 2026-11-25 03:01:20 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by archielcqp-a11y on 2026-11-25T02:04:22Z.


Confirming the split, @R0Y00, and thanks @tedin7 for yielding. I keep the format decoder on one static t0 binding. tedin7 builds the heap-descriptor retrieval and its bounds and lifetime controls on top of it.

Slice 1 is #2150. It is now updated to the rules above (95d75de):

  • Widths: only an opcode that reads exactly the format's channel count is valid.
  • Invalid loads: an unknown format, other fixed bits (including DST_SEL), or a narrower or wider opcode makes the load invalid. Every load is staged before the first store, and an invalid load returns before any store. So u0 stays unwritten, and a valid read of zero data stays distinguishable. Four GPU runs check this on WARP and an RTX 3080, with zero-fill and (0, 0, 0, 1)-fill references that must fail.
  • d16: not in this slice.
  • Existing paths: the gfx1030 caller-format path and the static raw reads are unchanged, and a control checks the gfx1030 one.
  • Coverage: the docs and the PR say this is not application coverage until the heap slice is used in a real dispatch.

@tedin7, the decoder is load_descriptor_format(formatWord, addr, channels, out bool valid), from descriptor_load_hlsl() in tools/compute_store_aot.py. The heap slice can pass the view's word 3 where this slice passes the constant word.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7150283576 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7150283576). Originally posted by [archielcqp-a11y](https://github.com/archielcqp-a11y) on 2026-11-25T02:04:22Z. --- Confirming the split, @R0Y00, and thanks @tedin7 for yielding. I keep the format decoder on one static t0 binding. tedin7 builds the heap-descriptor retrieval and its bounds and lifetime controls on top of it. Slice 1 is #2150. It is now updated to the rules above (`95d75de`): - **Widths:** only an opcode that reads exactly the format's channel count is valid. - **Invalid loads:** an unknown format, other fixed bits (including `DST_SEL`), or a narrower or wider opcode makes the load invalid. Every load is staged before the first store, and an invalid load returns before any store. So u0 stays unwritten, and a valid read of zero data stays distinguishable. Four GPU runs check this on WARP and an RTX 3080, with zero-fill and (0, 0, 0, 1)-fill references that must fail. - **d16:** not in this slice. - **Existing paths:** the gfx1030 caller-format path and the static raw reads are unchanged, and a control checks the gfx1030 one. - **Coverage:** the docs and the PR say this is not application coverage until the heap slice is used in a real dispatch. @tedin7, the decoder is `load_descriptor_format(formatWord, addr, channels, out bool valid)`, from `descriptor_load_hlsl()` in `tools/compute_store_aot.py`. The heap slice can pass the view's word 3 where this slice passes the constant word.
R0Y00 commented 2026-11-25 03:01:22 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T02:24:29Z.


Item A slice 1 landed in #2150 (c118f569). The exact candidate passed Windows Release controls, WARP and RTX 4060 Laptop. Wrong format, mismatched opcode width and unsupported fixed bits leave the output sentinel untouched. A valid zero-valued load writes its result. @tedin7 can now build the agreed heap-descriptor lookup and range/lifetime controls on this static decoder. Tests and commands

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7150679642 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7150679642). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T02:24:29Z. --- Item A slice 1 landed in #2150 (c118f569). The exact candidate passed Windows Release controls, WARP and RTX 4060 Laptop. Wrong format, mismatched opcode width and unsupported fixed bits leave the output sentinel untouched. A valid zero-valued load writes its result. @tedin7 can now build the agreed heap-descriptor lookup and range/lifetime controls on this static decoder. [Tests and commands](https://github.com/R0Y00/Xbox2Windows/pull/2150)
tedin7 commented 2026-11-25 03:01:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:47:09Z.


#2150 merged; starting Item A Slice 2: runtime heap-descriptor retrieval + bounds/lifetime controls for formatted buffer loads.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7151184517 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7151184517). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T02:47:09Z. --- #2150 merged; starting Item A Slice 2: runtime heap-descriptor retrieval + bounds/lifetime controls for formatted buffer loads.
RavenCurseBurg commented 2026-11-25 05:04:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T04:52:04Z.


I’ll take a first slice of item B on Windows with LLVM 15 and WARP. I’ll start with indexed buffer_store_format_xyzw for a four-component 32-bit UINT view. The source-built fixture will select a view record at run time and check the bytes written through u0, including the untouched adjacent output. Two valid records with different base offsets should produce distinct readbacks. Released views and out-of-range indices should leave the output sentinel intact.

This builds on the store packing in #1683 and the record layout proposed for loads in #2174. I’ll prepare the independent fixture and reference first, and coordinate the shared layout with #2174 before wiring it into the translator. The first slice uses a fixed destination resource and a run-time view record. The SM 6.6 heap resource binding and D16 stores remain separate work.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7153236954 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7153236954). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T04:52:04Z. --- I’ll take a first slice of item B on Windows with LLVM 15 and WARP. I’ll start with indexed `buffer_store_format_xyzw` for a four-component 32-bit UINT view. The source-built fixture will select a view record at run time and check the bytes written through u0, including the untouched adjacent output. Two valid records with different base offsets should produce distinct readbacks. Released views and out-of-range indices should leave the output sentinel intact. This builds on the store packing in #1683 and the record layout proposed for loads in #2174. I’ll prepare the independent fixture and reference first, and coordinate the shared layout with #2174 before wiring it into the translator. The first slice uses a fixed destination resource and a run-time view record. The SM 6.6 heap resource binding and D16 stores remain separate work.
RavenCurseBurg commented 2026-11-25 06:01:36 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T05:21:21Z.


Item B's initial UINT4 store and its source-built fixture are on this integration branch, based on #2174. LLVM 15 assembled and decoded the gfx1013 program, and the CLI emitted the same HLSL as the assembly source. On WARP, 12 cases matched the full 320-word reference and all seven shader mutations produced a readback mismatch. The partial-texel case caught an important detail during implementation: the root UAV has no size field, so the binding now supplies the writable u0 extent separately from the t0 table size. Fork integration CI

Once #2174 is on main, I’ll open the store-only diff against it.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7153690968 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7153690968). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T05:21:21Z. --- Item B's initial UINT4 store and its source-built fixture are on this [integration branch](https://github.com/RavenCurseBurg/Xbox2Windows/commit/2ec1c2485621984ae5fbdf07ca5befac4627028d), based on #2174. LLVM 15 assembled and decoded the gfx1013 program, and the CLI emitted the same HLSL as the assembly source. On WARP, 12 cases matched the full 320-word reference and all seven shader mutations produced a readback mismatch. The partial-texel case caught an important detail during implementation: the root UAV has no size field, so the binding now supplies the writable u0 extent separately from the t0 table size. [Fork integration CI](https://github.com/RavenCurseBurg/Xbox2Windows/actions/runs/45552909687) Once #2174 is on main, I’ll open the store-only diff against it.
roansystemlabs commented 2026-11-25 06:01:39 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-25T05:48:01Z.


I'd like to take item E, image_gather4_l in the compute translator. If someone already has it in progress, I'll step back and review.

Scope: 2D, explicit LOD, constant sampler, following the fixed-mip gather slice in #1927 (view-relative mip, component order). Comparison, offset and cube gathers stay refused.

Evidence: source-built compute program assembled with LLVM 15 for gfx1013, synthetic texture with distinct texels per mip, UAV readback on WARP and an RTX 3070. Negative controls: the wrong mip and swapped gather order must fail; the guard removed must fail.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7154150093 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7154150093). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-25T05:48:01Z. --- I'd like to take item E, image_gather4_l in the compute translator. If someone already has it in progress, I'll step back and review. Scope: 2D, explicit LOD, constant sampler, following the fixed-mip gather slice in #1927 (view-relative mip, component order). Comparison, offset and cube gathers stay refused. Evidence: source-built compute program assembled with LLVM 15 for gfx1013, synthetic texture with distinct texels per mip, UAV readback on WARP and an RTX 3070. Negative controls: the wrong mip and swapped gather order must fail; the guard removed must fail. AI-assisted.
R0Y00 commented 2026-11-25 07:01:13 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T06:20:21Z.


Item B now has its first UINT4 store in main (#2224). The final suite passed 12 GPU cases and all eight intended negative controls on both WARP and RTX 4060 Laptop. The profile writes through one bound raw UAV and checks the full 16-byte texel extent. For item E, roansystemlabs, please proceed with the 2D explicit-LOD slice from your claim. Pin the supported LOD behavior and include a nonzero view-relative mip with distinct texels, plus wrong-mip, swapped-order and removed-guard controls. Leave comparison, offset and cube cases out of this slice. A reproducible LLVM 15 command and WARP/hardware readback command in the PR will make the review straightforward.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7154688164 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7154688164). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T06:20:21Z. --- Item B now has its first UINT4 store in main (#2224). The final suite passed 12 GPU cases and all eight intended negative controls on both WARP and RTX 4060 Laptop. The profile writes through one bound raw UAV and checks the full 16-byte texel extent. For item E, roansystemlabs, please proceed with the 2D explicit-LOD slice from your claim. Pin the supported LOD behavior and include a nonzero view-relative mip with distinct texels, plus wrong-mip, swapped-order and removed-guard controls. Leave comparison, offset and cube cases out of this slice. A reproducible LLVM 15 command and WARP/hardware readback command in the PR will make the review straightforward.
RavenCurseBurg commented 2026-11-25 07:01:13 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T06:25:18Z.


I'll take the packed D16 follow-up to item B for one destination format: buffer_store_format_d16_xyzw from two VGPRs to a runtime-selected 32_32_32_32_FLOAT view. LLVM 15 assembles and disassembles this exact gfx1013 form, and the current heap-view route refuses it. The fixture will check four distinct half values expanded in low/high VGPR order, literal expected output words, and a FLOAT-versus-UINT view control. I'll reuse the bounded 16-byte store and verify the existing UINT4 cases alongside it on WARP and hardware.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7154772905 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7154772905). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T06:25:18Z. --- I'll take the packed D16 follow-up to item B for one destination format: `buffer_store_format_d16_xyzw` from two VGPRs to a runtime-selected `32_32_32_32_FLOAT` view. LLVM 15 assembles and disassembles this exact gfx1013 form, and the current heap-view route refuses it. The fixture will check four distinct half values expanded in low/high VGPR order, literal expected output words, and a FLOAT-versus-UINT view control. I'll reuse the bounded 16-byte store and verify the existing UINT4 cases alongside it on WARP and hardware.
Vladimir-Human commented 2026-11-25 13:01:00 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Vladimir-Human on 2026-11-25T12:50:11Z.


Claiming a narrow Item B follow-up in \ ools/compute_store_aot.py: \uffer_store_format_d16_x\ into \32_FLOAT\ side-table heap views (extending #2230). Leaving #2274\ item A's \gfx2hlsl.py\ path untouched. PR incoming with WARP + hardware readback tests and refusal controls.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7162923878 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7162923878). Originally posted by [Vladimir-Human](https://github.com/Vladimir-Human) on 2026-11-25T12:50:11Z. --- Claiming a narrow Item B follow-up in \ ools/compute_store_aot.py\: \uffer_store_format_d16_x\ into \32_FLOAT\ side-table heap views (extending #2230). Leaving \#2274\ item A's \gfx2hlsl.py\ path untouched. PR incoming with WARP + hardware readback tests and refusal controls. AI-assisted.
RavenCurseBurg commented 2026-11-25 14:05:09 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T13:24:15Z.


I’ll take the two-channel packed store in item B for the existing standalone compute_store_aot.py heap-view profile. The slice is buffer_store_format_d16_xy with one packed VGPR and a live 32_32_FLOAT destination. I’ll check the low/high half ordering, an eight-byte range ending at the output boundary, and wrong-format/short-view guards with source-built bytecode and WARP and hardware readback. This follows the FLOAT1 work in #2340 and the earlier FLOAT4 fixture. The separate startup translator item in #2274 stays available.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7163726796 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7163726796). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T13:24:15Z. --- I’ll take the two-channel packed store in item B for the existing standalone `compute_store_aot.py` heap-view profile. The slice is `buffer_store_format_d16_xy` with one packed VGPR and a live `32_32_FLOAT` destination. I’ll check the low/high half ordering, an eight-byte range ending at the output boundary, and wrong-format/short-view guards with source-built bytecode and WARP and hardware readback. This follows the FLOAT1 work in #2340 and the earlier FLOAT4 fixture. The separate startup translator item in #2274 stays available.
RavenCurseBurg commented 2026-11-25 14:05:15 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T13:55:50Z.


Following #2361, I will take the remaining packed three-component form in the stand-alone item B heap-store fixture. LLVM 15 assembles and decodes buffer_store_format_d16_xyz v[10:11], v8, s[20:23], 0 idxen offset:4. AMD's RDNA 2 format table lists 74 as 32_32_32_FLOAT; the identity descriptor word is 0x0104afac. I will verify the two halves of the first VGPR and the low half of the second, including a poisoned unused high half, 12-byte bounds and guard readbacks on WARP, NVIDIA and Intel. The destination is a three-component FLOAT view in the existing raw-buffer experiment. AMD format table

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7164497358 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7164497358). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T13:55:50Z. --- Following #2361, I will take the remaining packed three-component form in the stand-alone item B heap-store fixture. LLVM 15 assembles and decodes `buffer_store_format_d16_xyz v[10:11], v8, s[20:23], 0 idxen offset:4`. AMD's RDNA 2 format table lists 74 as `32_32_32_FLOAT`; the identity descriptor word is `0x0104afac`. I will verify the two halves of the first VGPR and the low half of the second, including a poisoned unused high half, 12-byte bounds and guard readbacks on WARP, NVIDIA and Intel. The destination is a three-component FLOAT view in the existing raw-buffer experiment. [AMD format table](https://docs.amd.com/api/khub/documents/Et~wpu9g~Ffl7d9q0QZ~Og/content)
SimSalabimse commented 2026-11-26 00:01:15 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-26T00:01:01Z.


Refreshing my earlier claim on Item F: s_ff1_i32_b32 / s_ff1_i32_b64 of a general scalar (not only exec_lo) in tools/startup/gfx2hlsl.py.

Plan: keep the existing compute-entry exec_lo special-case; add the general-SGPR / immediate forms matching pixel_aot (firstbitlow, and the 64-bit lo-then-hi scan). Lane masks and descriptor sources stay refused. One focused PR, hand-assembled fixture with a negative control, Linux CPU evaluation.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7178302812 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7178302812). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-11-26T00:01:01Z. --- Refreshing my earlier claim on **Item F**: `s_ff1_i32_b32` / `s_ff1_i32_b64` of a general scalar (not only `exec_lo`) in `tools/startup/gfx2hlsl.py`. Plan: keep the existing compute-entry `exec_lo` special-case; add the general-SGPR / immediate forms matching `pixel_aot` (`firstbitlow`, and the 64-bit lo-then-hi scan). Lane masks and descriptor sources stay refused. One focused PR, hand-assembled fixture with a negative control, Linux CPU evaluation. AI-assisted.
consolelogkyo commented 2026-11-26 03:03:26 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by consolelogkyo on 2026-11-26T02:59:10Z.


I'll take the compute global_load_dword vdst, vaddr, s[base:base+1] [offset:imm] slice (#2618 ticket C500-01/031) in tools/startup/gfx2hlsl.py:

  • Scope: lower one-dword global_load_dword in the cs stage when s[base:base+1] holds a proven 64-bit root buffer pointer (('ptr', ('root', index)) / ptr_high_symbol, direct, copied, or literal-advanced via s_add_u32 + s_addc_u32), vaddr is a 32-bit vector byte offset, and optional offset is a signed 12-bit immediate (-2048..2047), with check_encoding rejecting unprinted nv / data / reserved bits. Keep off (64-bit vaddr), wider/sub-dword global_load_*, global_store_*, global_atomic_*, lds, non-compute stages, and incomplete/unproven pointer pairs refused.
  • Evidence: source-built gfx1013 compute fixture (tests/startup_compute_global_load_check.py) with 320 distinguishable adjacent words, varying per-lane offsets and scalar bases, LLVM 15 round-trip encodings, and D3D12 readback + negative controls on WARP and Radeon RX 9070 XT.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7181292703 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7181292703). Originally posted by [consolelogkyo](https://github.com/consolelogkyo) on 2026-11-26T02:59:10Z. --- I'll take the compute `global_load_dword vdst, vaddr, s[base:base+1] [offset:imm]` slice (`#2618` ticket `C500-01/031`) in `tools/startup/gfx2hlsl.py`: - **Scope:** lower one-dword `global_load_dword` in the `cs` stage when `s[base:base+1]` holds a proven 64-bit root buffer pointer (`('ptr', ('root', index))` / `ptr_high_symbol`, direct, copied, or literal-advanced via `s_add_u32` + `s_addc_u32`), `vaddr` is a 32-bit vector byte offset, and optional `offset` is a signed 12-bit immediate (`-2048..2047`), with `check_encoding` rejecting unprinted `nv` / `data` / reserved bits. Keep `off` (`64-bit vaddr`), wider/sub-dword `global_load_*`, `global_store_*`, `global_atomic_*`, `lds`, non-compute stages, and incomplete/unproven pointer pairs refused. - **Evidence:** source-built gfx1013 compute fixture (`tests/startup_compute_global_load_check.py`) with 320 distinguishable adjacent words, varying per-lane offsets and scalar bases, LLVM 15 round-trip encodings, and D3D12 readback + negative controls on WARP and Radeon RX 9070 XT. AI-assisted.
consolelogkyo commented 2026-11-26 04:04:36 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by consolelogkyo on 2026-11-26T03:15:25Z.


Opened #2715 (https://github.com/R0Y00/Xbox2Windows/pull/2715) for the compute global_load_dword vdst, vaddr, s[base:base+1] [offset:imm] slice (#2618 ticket C500-01/031) claimed above — verified on WARP and Radeon RX 9070 XT with 6 DXC cs_6_0 dispatches, 5 negative HLSL mutations, and encoding/provenance refusal controls.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7181540911 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7181540911). Originally posted by [consolelogkyo](https://github.com/consolelogkyo) on 2026-11-26T03:15:25Z. --- Opened #2715 (https://github.com/R0Y00/Xbox2Windows/pull/2715) for the compute `global_load_dword vdst, vaddr, s[base:base+1] [offset:imm]` slice (`#2618` ticket `C500-01/031`) claimed above — verified on WARP and Radeon RX 9070 XT with 6 DXC `cs_6_0` dispatches, 5 negative HLSL mutations, and encoding/provenance refusal controls. AI-assisted.
Ybucaille commented 2026-11-26 07:00:27 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-26T06:18:40Z.


Fresh compute refusal counts on main 0827f43c, and a claim: SGPR spills in compute

One local 300 s run (Windows 11, RTX 2070, run.ps1 -Render -Translate -HostCpu -MemoryGiB 12, no crash, ExecuteIndirect calls all 0), then gfx2hlsl.py --pending over the cache. First refusal reason per slot-67 compute request, 2,575 requests:

requests first refusal existing work
400 v_readfirstlane_b32 requires a proven uniform source #2607 and the other readfirstlane proofs
341 v_cmp_gt_i32_e64 in an execz block: vcc live at the join #2723
333 s_andn2_b32 in an execz block: lane mask live at the join #2723
158 s_load of a resource-heap record whose index is read from a buffer #2580
85 LDS exchange needs a 1D group and a bounded allocation #1541 / #1566
85 TG_SIZE_EN requires at most N threads per group #2432
68 image_store dmask #2661
68 v_writelane_b32 is lowered in pixel and mesh stages only none: #2712 covers wave64 and vertex stages
59 (translated)
50 LDS in straight-line code only
50 s_mov_b32 in an execz block
45 s_bfm_b64 #2007
38 src_scc not proven #2577 merged since
37 SCC from descriptor data
35 image_store on a non-2D view

These are first reasons only: a request refused here may hit others behind it.

Claim: constant-lane SGPR spills (v_writelane_b32 / v_readlane_b32) in compute, stacked on @tedin7's #2712 (same spill_operands lines; I will build on it rather than conflict, and only after it settles). The 68 requests come from 68 distinct wave32 programs with branches and loops, constant lanes only. Accepting cs alone wins nothing, because every one of them spills a descriptor, a pointer or a lane mask, not a plain number. Measured on a scratch copy:

  • cs allowed: 65 then refused on "source holds lane mask or descriptor", 2 on a heap-record s_load, 1 on lane ≥ 32;
  • descriptors, pointers and lane masks also carried through the spill: 0 fully translated yet. 33 stop at "formatted buffer load requires descriptor words proven in the entry block" (the provenance is lost at the reload), and 32 at s_nand_b32 on a lane mask (#2030).

Plan, one PR each: (1) cs spills of descriptor and pointer words, keeping the tracked symbol across the reload with the existing write-before-read proof, so that the reloaded descriptor still counts as proven for the formatted load; (2) lane-mask spills, the reload restoring the mask. Source-built gfx1013 fixtures with negative controls; WARP and RTX 2070 runs on my side.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7184304033 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7184304033). Originally posted by [Ybucaille](https://github.com/Ybucaille) on 2026-11-26T06:18:40Z. --- ## Fresh compute refusal counts on `main` `0827f43c`, and a claim: SGPR spills in compute One local 300 s run (Windows 11, RTX 2070, `run.ps1 -Render -Translate -HostCpu -MemoryGiB 12`, no crash, ExecuteIndirect calls all 0), then `gfx2hlsl.py --pending` over the cache. **First refusal reason per slot-67 compute request, 2,575 requests:** | requests | first refusal | existing work | |---:|---|---| | 400 | `v_readfirstlane_b32` requires a proven uniform source | #2607 and the other readfirstlane proofs | | 341 | `v_cmp_gt_i32_e64` in an execz block: `vcc` live at the join | #2723 | | 333 | `s_andn2_b32` in an execz block: lane mask live at the join | #2723 | | 158 | `s_load` of a resource-heap record whose index is read from a buffer | #2580 | | 85 | LDS exchange needs a 1D group and a bounded allocation | #1541 / #1566 | | 85 | `TG_SIZE_EN` requires at most N threads per group | #2432 | | 68 | `image_store` dmask | #2661 | | **68** | **`v_writelane_b32` is lowered in pixel and mesh stages only** | **none: #2712 covers wave64 and vertex stages** | | 59 | (translated) | | | 50 | LDS in straight-line code only | | | 50 | `s_mov_b32` in an execz block | | | 45 | `s_bfm_b64` | #2007 | | 38 | `src_scc` not proven | #2577 merged since | | 37 | SCC from descriptor data | | | 35 | `image_store` on a non-2D view | | These are first reasons only: a request refused here may hit others behind it. **Claim: constant-lane SGPR spills (`v_writelane_b32` / `v_readlane_b32`) in compute**, stacked on @tedin7's #2712 (same `spill_operands` lines; I will build on it rather than conflict, and only after it settles). The 68 requests come from 68 distinct wave32 programs with branches and loops, constant lanes only. Accepting `cs` alone wins nothing, because every one of them spills a descriptor, a pointer or a lane mask, not a plain number. Measured on a scratch copy: - `cs` allowed: 65 then refused on "source holds lane mask or descriptor", 2 on a heap-record `s_load`, 1 on lane ≥ 32; - descriptors, pointers and lane masks also carried through the spill: 0 fully translated yet. 33 stop at "formatted buffer load requires descriptor words proven in the entry block" (the provenance is lost at the reload), and 32 at `s_nand_b32` on a lane mask (#2030). Plan, one PR each: (1) `cs` spills of descriptor and pointer words, keeping the tracked symbol across the reload with the existing write-before-read proof, so that the reloaded descriptor still counts as proven for the formatted load; (2) lane-mask spills, the reload restoring the mask. Source-built gfx1013 fixtures with negative controls; WARP and RTX 2070 runs on my side. AI-assisted (Claude Code).
Leyukaka commented 2026-11-26 17:53:47 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-26T17:53:47Z.


Claiming a new compute item: image_store on SQ_RSRC_IMG_3D and SQ_RSRC_IMG_1D, translator plus runtime binding. Today tools/startup/gfx2hlsl.py refuses both with image_store on SQ_RSRC_IMG_3D|1D: only 2D images are lowered.

Measured on a local capture (counts and instruction shape only):

  • Offline census at main b505c32: 29 requests stop at the 3D form and 7 at the 1D form.
  • One 600 s start-up run at main 6ee878d8, no inputs. Every graphics pipeline the runtime looked up was translated. Seven compute keys dispatch with no translation. The three most dispatched account for 18,172 of those 18,187 dispatches:
    • one 16,798 times, about once per presented frame;
    • two 687 times each.
  • Their first refusals are these two forms, each image_store v[8:11], <address>, s[..] dmask:0xf ... unorm. The address is v[2:4] for the 3D image and v0 for the 1D images. The 3D program's other image accesses are two image_load on 2D images; the 1D programs have none.
  • In an earlier run at b505c32, the 3D refusal was hit 16 times over 15 requests: 13 with dmask:0xf (7 tuple address, 6 NSA), 3 with partial dmasks (2 of them d16). Partial dmasks stay refused here.

Plan, translator:

  • Lower image_store with dmask:0xf on a 3D image to RWTexture3D<float4> with a 3-component address, and on a 1D image to RWTexture1D<float4> with one component.
  • Reuse the 2D compute path (op_image_store: format, unorm, address tuple or NSA form, fixed-table descriptor), add the two kinds to the UAV declarations, and emit uav N tex3d|tex1d ... in the manifest.
  • Partial dmasks stay refused, including the two d16 forms seen.

Plan, runtime:

  • Parse uav N tex3d|tex1d in src/startup_stubs/d3d12_compute_dispatch.inl. The slot needs a dimension kind, not only the array flag.
  • Bind D3D12_UAV_DIMENSION_TEXTURE3D / TEXTURE1D next to the 2D and 2D-array branches, checking the resource dimension, the mip and, for 3D, the W range.

Tests:

  • refusal controls for the kept refusals;
  • translator checks of the emitted HLSL and manifest lines;
  • a source-built dispatch that stores to a 3D and a 1D image, read back on WARP and hardware against a CPU reference;
  • mutants that drop the third address component or map 1D to 2D, which must fail.

Prior art in the offline tool tools/compute_store_aot.py: 3D stores (#1649) and the 1D slice claimed in #1545. tests/compute_check.cpp already reads back 1D and 3D UAVs. I will reuse that readback.

@NiiRoZz, binding tex3d and tex1d UAVs is part of your "Texture UAVs" item in #2274 (uav N tex1d|tex2d|tex2da|tex3d). The 2D and 2D-array views are on main through #2532, and I found no PR, commit or comment on tex3d/tex1d. I am taking over that part since there has been no activity on it for 2 h; I will hand it back if you resume.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7199818165 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7199818165). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-26T17:53:47Z. --- Claiming a new compute item: **`image_store` on `SQ_RSRC_IMG_3D` and `SQ_RSRC_IMG_1D`**, translator plus runtime binding. Today `tools/startup/gfx2hlsl.py` refuses both with `image_store on SQ_RSRC_IMG_3D|1D: only 2D images are lowered`. Measured on a local capture (counts and instruction shape only): - Offline census at main `b505c32`: 29 requests stop at the 3D form and 7 at the 1D form. - One 600 s start-up run at main `6ee878d8`, no inputs. Every graphics pipeline the runtime looked up was translated. Seven compute keys dispatch with no translation. The three most dispatched account for 18,172 of those 18,187 dispatches: - one 16,798 times, about once per presented frame; - two 687 times each. - Their first refusals are these two forms, each `image_store v[8:11], <address>, s[..] dmask:0xf ... unorm`. The address is `v[2:4]` for the 3D image and `v0` for the 1D images. The 3D program's other image accesses are two `image_load` on 2D images; the 1D programs have none. - In an earlier run at `b505c32`, the 3D refusal was hit 16 times over 15 requests: 13 with `dmask:0xf` (7 tuple address, 6 NSA), 3 with partial dmasks (2 of them `d16`). Partial dmasks stay refused here. Plan, translator: - Lower `image_store` with `dmask:0xf` on a 3D image to `RWTexture3D<float4>` with a 3-component address, and on a 1D image to `RWTexture1D<float4>` with one component. - Reuse the 2D compute path (`op_image_store`: format, `unorm`, address tuple or NSA form, fixed-table descriptor), add the two kinds to the UAV declarations, and emit `uav N tex3d|tex1d ...` in the manifest. - Partial dmasks stay refused, including the two `d16` forms seen. Plan, runtime: - Parse `uav N tex3d|tex1d` in `src/startup_stubs/d3d12_compute_dispatch.inl`. The slot needs a dimension kind, not only the array flag. - Bind `D3D12_UAV_DIMENSION_TEXTURE3D` / `TEXTURE1D` next to the 2D and 2D-array branches, checking the resource dimension, the mip and, for 3D, the W range. Tests: - refusal controls for the kept refusals; - translator checks of the emitted HLSL and manifest lines; - a source-built dispatch that stores to a 3D and a 1D image, read back on WARP and hardware against a CPU reference; - mutants that drop the third address component or map 1D to 2D, which must fail. Prior art in the offline tool `tools/compute_store_aot.py`: 3D stores (#1649) and the 1D slice claimed in #1545. `tests/compute_check.cpp` already reads back 1D and 3D UAVs. I will reuse that readback. @NiiRoZz, binding `tex3d` and `tex1d` UAVs is part of your "Texture UAVs" item in #2274 (`uav N tex1d|tex2d|tex2da|tex3d`). The 2D and 2D-array views are on main through #2532, and I found no PR, commit or comment on `tex3d`/`tex1d`. I am taking over that part since there has been no activity on it for 2 h; I will hand it back if you resume. AI-assisted.
Leyukaka commented 2026-11-26 21:21:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-26T21:21:58Z.


Claiming a new item for tools/startup/gfx2hlsl.py: v_pk_max_f16 and v_pk_min_f16, which have no handler today. They are refused by name.

Measured on a local capture (counts and instruction shape only):

  • Offline census at main 6ee878d8 plus #2902: 4 requests stop at v_pk_max_f16 and 2 at v_pk_min_f16.
  • 600 s start-up run: two compute pipelines that the title dispatched 5,363 times stop at v_pk_max_f16. The run reports them as untranslated, and the offline translator names the instruction.
  • Each refused form has exactly one non-VGPR source:
    • v_pk_max_f16 vN, vN, 0 op_sel_hi:[..];
    • v_pk_max_f16 vN, <literal>, vN;
    • v_pk_max_f16 vN, vN, sN;
    • v_pk_min_f16 vN, <literal>, vN.

Plan:

  • Handlers: add both through the existing packed_half helper, per lane, with the min/max rule tools/pixel_aot.py already uses (minmax16_num, added to the gfx2hlsl preamble): one NaN returns the other operand, and mixed zeros give -0 for min and +0 for max. NaN is tested on the binary16 encoding, not with a float isnan().

  • Sources: accept the kinds the real forms use, with the packed-source rule that pixel_aot.py implements in vop3p_f16_word:

    • an integer inline 0;
    • a hex literal as a full 32-bit word;
    • a numeric SGPR as a full word.

    Sources are whitelisted (single VGPR, sN, 0x…, 0) before they are read. op_sel picks the low or high half for the low result, and op_sel_hi for the high result.

  • What is new ground: pixel_aot's draw fixture covers a literal only with default selectors and SGPRs only on add and fma. A non-default selector on a literal or SGPR is not yet covered, and the tests below cover it. The PR also updates the packed_half docstring, which today calls these sources unproven.

  • Kept refused:

    • nonzero inline integers;
    • inline floats;
    • neg_lo/neg_hi/clamp;
    • any source the translator cannot read as a whole word.

    The existing non-VGPR refusal stays for v_pk_add/mul/fma_f16.

  • Tests:

    • translator checks for each accepted source kind with both selector values, and refusal controls for the kept refusals;
    • a source-built draw or dispatch read back on WARP and hardware against a CPU reference. It covers both zero orders, a single NaN, both operands NaN (or that case stated as untested), and a selector flip on a literal and on an SGPR.
    • mutants: one that swaps the op_sel/op_sel_hi roles, and one that uses max for min. Both must change the result.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7203654842 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7203654842). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-26T21:21:58Z. --- Claiming a new item for `tools/startup/gfx2hlsl.py`: **`v_pk_max_f16` and `v_pk_min_f16`**, which have no handler today. They are refused by name. Measured on a local capture (counts and instruction shape only): - Offline census at main `6ee878d8` plus #2902: 4 requests stop at `v_pk_max_f16` and 2 at `v_pk_min_f16`. - 600 s start-up run: two compute pipelines that the title dispatched 5,363 times stop at `v_pk_max_f16`. The run reports them as untranslated, and the offline translator names the instruction. - Each refused form has exactly one non-VGPR source: - `v_pk_max_f16 vN, vN, 0 op_sel_hi:[..]`; - `v_pk_max_f16 vN, <literal>, vN`; - `v_pk_max_f16 vN, vN, sN`; - `v_pk_min_f16 vN, <literal>, vN`. Plan: - **Handlers:** add both through the existing `packed_half` helper, per lane, with the min/max rule `tools/pixel_aot.py` already uses (`minmax16_num`, added to the gfx2hlsl preamble): one NaN returns the other operand, and mixed zeros give `-0` for min and `+0` for max. NaN is tested on the binary16 encoding, not with a float `isnan()`. - **Sources:** accept the kinds the real forms use, with the packed-source rule that `pixel_aot.py` implements in `vop3p_f16_word`: - an integer inline `0`; - a hex literal as a full 32-bit word; - a numeric SGPR as a full word. Sources are whitelisted (single VGPR, `sN`, `0x…`, `0`) before they are read. `op_sel` picks the low or high half for the low result, and `op_sel_hi` for the high result. - **What is new ground:** `pixel_aot`'s draw fixture covers a literal only with default selectors and SGPRs only on add and fma. A non-default selector on a literal or SGPR is not yet covered, and the tests below cover it. The PR also updates the `packed_half` docstring, which today calls these sources unproven. - **Kept refused:** - nonzero inline integers; - inline floats; - `neg_lo`/`neg_hi`/`clamp`; - any source the translator cannot read as a whole word. The existing non-VGPR refusal stays for `v_pk_add/mul/fma_f16`. - **Tests:** - translator checks for each accepted source kind with both selector values, and refusal controls for the kept refusals; - a source-built draw or dispatch read back on WARP and hardware against a CPU reference. It covers both zero orders, a single NaN, both operands NaN (or that case stated as untested), and a selector flip on a literal and on an SGPR. - mutants: one that swaps the `op_sel`/`op_sel_hi` roles, and one that uses `max` for `min`. Both must change the result. AI-assisted.
Leyukaka commented 2026-11-26 21:36:56 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-26T21:36:56Z.


Follow-up claim to #2927: let v_pk_add_f16, v_pk_mul_f16 and v_pk_fma_f16 take the same non-VGPR sources that #2927 accepts for min and max:

  • a numeric SGPR;
  • a hex literal of up to 8 digits, read as a full 32-bit word, so a short literal has a zero high half;
  • the inline 0.

The half that op_sel / op_sel_hi selects follows the vop3p_f16_word rule in tools/pixel_aot.py.

Measured on a local capture (counts and instruction shape only):

  • A compute pipeline that the title dispatched 5,152 times in a 600 s start-up run stops in the offline translator at v_pk_max_f16. #2927 moves it past that, and it then stops at v_pk_mul_f16 with a hex literal source.
  • In the offline census:
    • with #2927 applied, the 2 requests it moves past v_pk_max/min_f16 stop next at v_pk_mul_f16 with a hex literal;
    • one more request stops at v_pk_mul_f16 with an SGPR source.

Plan:

  • Gate the new sources on the same whitelist and lane-mask refusal as #2927. The arithmetic itself is unchanged: f16tof32 of the selected half, f16rn of the result.
  • Keep refused:
    • inline floats (1 census request on v_pk_fma_f16);
    • nonzero inline integers;
    • neg_lo/neg_hi (3 census requests on v_pk_add_f16, a separate item);
    • clamp and other modifiers.
  • Stacked on #2927.
  • Tests:
    • translator checks for each source kind with both selector values;
    • a draw read back on WARP and hardware against a CPU reference, with a literal and an SGPR source under default and flipped selectors for each of add, mul and fma;
    • a mutant that swaps the selector roles.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7203896230 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7203896230). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-26T21:36:56Z. --- Follow-up claim to #2927: let `v_pk_add_f16`, `v_pk_mul_f16` and `v_pk_fma_f16` take the same non-VGPR sources that #2927 accepts for min and max: - a numeric SGPR; - a hex literal of up to 8 digits, read as a full 32-bit word, so a short literal has a zero high half; - the inline `0`. The half that `op_sel` / `op_sel_hi` selects follows the `vop3p_f16_word` rule in `tools/pixel_aot.py`. Measured on a local capture (counts and instruction shape only): - A compute pipeline that the title dispatched 5,152 times in a 600 s start-up run stops in the offline translator at `v_pk_max_f16`. #2927 moves it past that, and it then stops at `v_pk_mul_f16` with a hex literal source. - In the offline census: - with #2927 applied, the 2 requests it moves past `v_pk_max/min_f16` stop next at `v_pk_mul_f16` with a hex literal; - one more request stops at `v_pk_mul_f16` with an SGPR source. Plan: - Gate the new sources on the same whitelist and lane-mask refusal as #2927. The arithmetic itself is unchanged: `f16tof32` of the selected half, `f16rn` of the result. - Keep refused: - inline floats (1 census request on `v_pk_fma_f16`); - nonzero inline integers; - `neg_lo`/`neg_hi` (3 census requests on `v_pk_add_f16`, a separate item); - `clamp` and other modifiers. - Stacked on #2927. - Tests: - translator checks for each source kind with both selector values; - a draw read back on WARP and hardware against a CPU reference, with a literal and an SGPR source under default and flipped selectors for each of add, mul and fma; - a mutant that swaps the selector roles. AI-assisted.
SimSalabimse commented 2026-11-27 22:56:49 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-27T22:56:49Z.


I'm taking the remaining pixel-stage case where a heap image descriptor word is read as a number. #2161 already covers compute raw num_records, and this is the image-word slice that's still refused. I'll add a source-built fixture in tools/startup/gfx2hlsl.py, keep every other descriptor word refused, and open a PR against main.

AI-Assisted

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7229746858 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7229746858). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-11-27T22:56:49Z. --- I'm taking the remaining pixel-stage case where a heap image descriptor word is read as a number. #2161 already covers compute raw `num_records`, and this is the image-word slice that's still refused. I'll add a source-built fixture in `tools/startup/gfx2hlsl.py`, keep every other descriptor word refused, and open a PR against main. AI-Assisted
Leyukaka commented 2026-11-29 12:29:17 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T12:29:17Z.


Releasing my claim of 2026-11-26 on SGPR, hex and inline 0 sources for v_pk_add_f16, v_pk_mul_f16 and v_pk_fma_f16; draft #2930 is closed.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7255847481 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7255847481). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-29T12:29:17Z. --- Releasing my claim of 2026-11-26 on SGPR, hex and inline `0` sources for `v_pk_add_f16`, `v_pk_mul_f16` and `v_pk_fma_f16`; draft #2930 is closed.
Leyukaka commented 2026-11-29 17:21:28 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T17:21:28Z.


Taking back one part of the claim I released above: v_pk_mul_f16 with a 32-bit literal source in tools/startup/gfx2hlsl.py.

  • Today packed_half refuses it with operand ... is not a single VGPR (tools/startup/gfx2hlsl.py:10116-10117 on main 26df1826). The native compute frontend already accepts a literal there (src/gfx1013_direct_compute.inl:1684-1691).
  • One long local run of the application, with only the Python path active: one compute program with this source accounted for about 847,000 dispatches, none translated.
  • Scope: the source operand only, 32-bit literal, with the existing half selection and rounding; SGPR and inline 0 sources, v_pk_add_f16 and v_pk_fma_f16 stay refused, with controls. One small PR, referencing #2930.

I'm working on this.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7259626641 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2022#issuecomment-7259626641). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-29T17:21:28Z. --- Taking back one part of the claim I released above: **`v_pk_mul_f16` with a 32-bit literal source** in `tools/startup/gfx2hlsl.py`. - Today `packed_half` refuses it with `operand ... is not a single VGPR` (`tools/startup/gfx2hlsl.py:10116-10117` on `main` `26df1826`). The native compute frontend already accepts a literal there (`src/gfx1013_direct_compute.inl:1684-1691`). - One long local run of the application, with only the Python path active: one compute program with this source accounted for about 847,000 dispatches, none translated. - Scope: the source operand only, 32-bit literal, with the existing half selection and rounding; SGPR and inline `0` sources, `v_pk_add_f16` and `v_pk_fma_f16` stay refused, with controls. One small PR, referencing #2930. I'm working on this.
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#2015
No description provided.