Skip to content

help wanted: GPU translation, part 5 (vertex and pixel pipelines) #2023

Backlog

Description

@denn0x

Ordinary vertex + pixel pipelines that tools/startup/gfx2hlsl.py still refuses. Each row is an independent piece of work for one pull request with a source-built or hand-assembled fixture. Counts are distinct pipeline requests from a private cache (first refusal only; closing one row exposes the next for some requests).

Items (pick one, say so in a comment)

Item What is refused today Requests Notes
A buffer_store_dwordx3, and behind it formatted loads through a descriptor taken from a heap at run time about 470 The typed-load half is shared with compute (part 4, item A): format, stride and size come from descriptor words known only at run time.
B buffer_load_format_x / _xy / _xyz where the format comes from the third buffer-descriptor word about 520
C v_readfirstlane_b32 without a proven uniform source 224 to 352 Needs a rule for when the source is uniform across the lanes that matter (per-primitive or per-draw values), and a precise refusal otherwise.
D Image load with level zero on a 16-bit depth format (the d16 modifier) about 250
E v_cvt_f32_u32 with an SDWA multiply-by-two destination modifier 130 Related: the SDWA conversion forms already lowered.
F image_sample_c_lz with sampler fields the translator does not model (mip filter, upper bits of the third sampler word) 85
G Buffer formats: 16_16_SNORM (76), 8_8_8_8_UINT (30), 2_10_10_10_UNORM (22) about 130 One format per pull request is fine.
H v_min_u32 with a DPP control 64
I v_xor3_b32 55
J s_bitset1_b32 about 47
K v_cvt_pk_u8_f32 31 Related: #1546.
L A lane mask derived from descriptor data 22

Items already listed in part 1 (#1996) are not repeated: v_subrev_f32 with DPP, image_store in a pixel stage, the pixel-stage entry registers.

What a pull request needs

  • One item per pull request.
  • A source-built or hand-assembled fixture (no bytes from any retail software) with a negative control that fails when the lowering is disabled.
  • LLVM / Mesa semantics cited for each instruction or format.
  • The existing tests/startup_gfx2hlsl_*_check.py and tests/startup_translator_check.py still passing.
  • Refuse precisely what the change does not cover.

Related: #1723 (refusal census over an offline archive), #1978 (a census mode that reports every refusal site, not only the first).

Other parts: #1996 (pixel shaders), #1998 (mesh shaders), #1999 (render state and indirect draws), and the compute part filed alongside this one.

Activity

  1. consolelogkyo commented on Nov 24, 2026

    @consolelogkyo
    Contributor

    I'll take item E (v_cvt_f32_u32 and the float-result VEC_U_TO_F conversions in SDWA form with output modifiers clamp, mul:2, mul:4, div:2). I'll apply the output modifier and clamp in hardware order (scale first, saturate second, then bitwise dst_sel / dst_unused placement), keep VEC_U integer/uint-result conversions and float source modifiers refused, and verify with constructed SDWA encodings, negative controls, and desktop GPU readback.

    AI-assisted.

  2. Ybucaille commented on Nov 25, 2026

    @Ybucaille
    Contributor

    I'll take three small items in tools/startup/gfx2hlsl.py, one pull request each:

    • I, v_xor3_b32: same semantics as the compute lowering in shader: lower compute v_xor3_b32 #1573, with a source-built fixture whose three sources differ in every byte and a negative control that drops the third operand.
    • G, the 16_16_SNORM buffer format only (the other two formats stay open): an entry next to BUF_FMT_16_16_UNORM, with -32768 clamped to -1.0 per the D3D/Vulkan SNORM rule, and controls on 0x8000, 0x8001, 0x7fff and 0.
    • K, v_cvt_pk_u8_f32: byte select from src1, insertion into src2, rounding and clamping cited from LLVM 15 and checked against the existing compute_store_aot form if there is one.

    Each keeps refusing what its fixture doesn't cover.

    AI-assisted.

  3. Ybucaille commented on Nov 25, 2026

    @Ybucaille
    Contributor

    Item I is up in #2097 (v_xor3_b32, extends startup_gfx2hlsl_bit_alu_check.py). Item G is up in #2099 (16_16_SNORM only, extends startup_vertex_fetch_formats_check.py). Controls and the llvm-mc fixture checks pass on Linux; the _warp / _hardware draws still need a Windows run. Item K is in progress.

    AI-assisted.

  4. R0Y00 commented on Nov 25, 2026

    @R0Y00
    Owner

    Item E is on main in #2062 at 7aa3b53. The Windows rerun used FXC and DXC on WARP and RTX 4060 Laptop. Each draw matched 1,024 reference words, and all five output-modifier or destination-selection controls produced the expected mismatch. The remainder of this issue still has its own rows and claims.

  5. Ybucaille commented on Nov 25, 2026

    @Ybucaille
    Contributor

    Item K is up in #2101 (v_cvt_pk_u8_f32, same restriction on S0 as the compute lowering: +0.0 or an integer in 1..255; constants outside are refused). Controls pass on Linux; the _warp / _hardware draws still need a Windows run.

    AI-assisted.

  6. R0Y00 commented on Nov 25, 2026

    @R0Y00
    Owner

    Item G is on main via #2099 (246a875). I reran the corrected SNORM readback at 0832296 on WARP and RTX 4060 Laptop. Both checked all 12 formats, 16 vertices each, with CPU byte decoding and nine compiled mutations. The typed-buffer route and DXGI format 37 mapping are in that PR; other format rows stay open.

  7. consolelogkyo commented on Nov 25, 2026

    @consolelogkyo
    Contributor

    I'll take item D (image_load with d16 at mip level zero in tools/startup/gfx2hlsl.py). I'll narrow enabled dmask components from Load to IEEE binary16 with an integer round-to-nearest-even helper (avoiding f32tof16 truncation toward zero on normalized depth values) and pack them pairwise into ceil(popcount(dmask) / 2) destination VGPRs, keep image_load_mip and image_sample* d16 forms refused, and verify with constructed MIMG encodings, negative controls, and desktop GPU readback against DXGI_FORMAT_R16_UNORM and DXGI_FORMAT_R32G32B32A32_FLOAT textures on WARP and hardware.

    AI-assisted.

  8. R0Y00 commented on Nov 25, 2026

    @R0Y00
    Owner

    There is an overlapping item D implementation in #2119. Please coordinate there before starting a second base-load implementation. The common acceptance needs the bound view type, since float/normalized and integer loads require different conversion, and an input whose ties distinguish binary16 nearest-even from truncation. A source-built mip-zero normalized/float comparison can land first; keep mip and integer forms pending until the same contract is proved. Item I is on main in #2097; the source-built third-input omission fails the translated GPU check on WARP and RTX 4060 Laptop.

  9. tedin7 commented on Nov 25, 2026

    @tedin7
    Collaborator

    Picking up Item B (buffer_load_format_x/xy/xyz format from runtime descriptor) with WARP readback tests.

  10. consolelogkyo commented on Nov 25, 2026

    @consolelogkyo
    Contributor

    Item D is up in #2139 (image_load with d16 at mip level zero, verified with DXC ps_6_0 and FXC ps_5_1 against R16_UNORM and R32G32B32A32_FLOAT textures and six negative controls on WARP and RX 9070 XT).

    AI-assisted.

  11. tedin7 commented on Nov 25, 2026

    @tedin7
    Collaborator

    Picking up Item H (v_min_u32 with DPP control) and Item L (lane mask derived from descriptor data) as two separate PRs with D3D12 WARP readback tests.

  12. tedin7 commented on Nov 25, 2026

    @tedin7
    Collaborator

    Update: deferring Item H (v_min_u32 DPP) until one of the open DPP base PRs (#2038/#2140/#2141/#2143) lands on main to avoid stacking a conflicting DPP base. Continuing with Item L.

  13. 17 remaining items

  14. consolelogkyo commented on Nov 25, 2026

    @consolelogkyo
    Contributor

    I'll take an Item F comparison-sampler slice for image_sample_c and image_sample_c_lz in tools/startup/gfx2hlsl.py and src/startup_stubs/translated_sampler_bindings.h: SQ_TEX_CLAMP_BORDER (6) alongside SQ_TEX_CLAMP_LAST_TEXEL (2) in X and Y with fixed SQ_IMG_SAMP_WORD3 BORDER_COLOR_TYPE (TRANS_BLACK, OPAQUE_BLACK, OPAQUE_WHITE), keeping BORDER_COLOR_TYPE == REGISTER, half-border/mirror-once-border modes, and standalone pixel_aot checks refused. I'll include source-built D3D12 draw readback (in-bounds, out-of-bounds, and bilinear border-edge blending across border colors) and negative controls on WARP and AMD hardware.

    AI-assisted.

  15. consolelogkyo commented on Nov 25, 2026

    @consolelogkyo
    Contributor

    Item F slice (CLAMP_BORDER + fixed BORDER_COLOR_TYPE for image_sample_c / image_sample_c_lz and static/dynamic sampler decoding) is up in #2549 (016c68ad), verified with DXC ps_6_0 and FXC ps_5_1 across in-bounds, out-of-bounds, mixed-axis, bilinear border PCF, and four negative-control mutations on WARP and Radeon RX 9070 XT.

    AI-assisted.

  16. consolelogkyo commented on Nov 25, 2026

    @consolelogkyo
    Contributor

    I'll take the Item D explicit-mip follow-up: lowering image_load_mip with d16 in tools/startup/gfx2hlsl.py (2D, 3D and 2D-array views) on top of #2139's pack16_d16 (pack16_rne + pack16_unorm16), d16srv <index> exact SRV validation, and odd-dmask upper-half tracking, keeping compute d16, a16 and tfe refused. I'll include source-built multi-mip D3D12 readback (including R16_UNORM and R32G32B32A32_FLOAT across mips and slices) and negative controls on WARP and AMD hardware.

    AI-assisted.

  17. consolelogkyo commented on Nov 25, 2026

    @consolelogkyo
    Contributor

    Item D explicit-mip follow-up (image_load_mip with d16 on 2D, 3D and 2D-array views in tools/startup/gfx2hlsl.py) is up in #2575 (28e58482), verified with DXC ps_6_0 and FXC ps_5_1 across two-mip (8x2 + 4x1) 2D and two-slice 2D-array R16_UNORM and R32G32B32A32_FLOAT textures, odd-dmask upper-half poison checks, and 14 GPU negative-control mutations on WARP and Radeon RX 9070 XT.

    AI-assisted.

  18. SimSalabimse commented on Nov 25, 2026

    @SimSalabimse
    Contributor

    Claiming Item J (s_bitset1_b32, and the natural pair s_bitset0_b32) in tools/startup/gfx2hlsl.py.

    Plan: one focused PR on main at e3dda42b. Port the pixel_aot / #1579 lowering (D = D \| (1u << (S0 & 31)) / clear form), refuse lane-mask and descriptor destinations, hand-assembled SOP1 fixture with a negative control that fails when the lowering is disabled. Pure-Python CPU evaluation of the translated text; Windows WARP/hardware draws left for an independent retest if wanted.

    AI-assisted.

  19. added a commit that references this issue on Nov 26, 2026
  20. Leyukaka commented on Nov 26, 2026

    @Leyukaka
    Collaborator

    @tedin7 taking over Item L since there has been no activity on it for 2 h (claimed in your 2026-11-25 01:40Z comment, last mentioned at 01:42Z; no PR, commit or comment on it since); will hand back if you resume.

    On my local capture (counts and instruction shape only), 42 requests stop at mask from descriptor data, with 43 refusal hits between them:

    • 41 hits are s_mov_b64 vcc, s[n:n+1] where s[n:n+1] holds descriptor words. In each, the first later references to vcc or s104..s107 are s[104:107] as the descriptor operand of s_buffer_load_dword*. Over all 43 hits, only one has any later write of vcc or s104..s107. This looks like the compiler assembling a four-dword buffer descriptor whose upper half sits in s106/s107, which vcc aliases.
    • 2 hits are s_mov_b64 exec, s[n:n+1] from descriptor data.

    Plan:

    • Record s_mov_b64 vcc, s[n:n+1] from descriptor data as the descriptor symbols of s106/s107 and emit no code, reusing the shader: allow s_load into high SGPRs s[104:107] in gfx2hlsl (Part of #1723) #2057 path for s_load into s[104:107], so that s[104:107] resolves to the same descriptor as the source registers.

    • Keep it refused on any read of that vcc before it is overwritten, explicit or implicit:

      • v_cndmask, the carry-in of v_addc_co/v_subb_co/v_subbrev_co, v_div_fmas;
      • a vcc/vcc_lo/vcc_hi source operand of any scalar or vector instruction (VOPC e64, SDWA, s_and_saveexec and the like);
      • s_cbranch_vccz/vccnz.

      The only accepted read is s[104:107] as a descriptor operand.

    • exec from descriptor data stays refused.

    • Tests: a hand-assembled pixel shader that builds the descriptor this way and loads through it, checked on WARP against the same load through the original registers, plus refusal controls for the reads above. A mutant that drops the copy must change pixels.

    AI-assisted.

  21. added
    priority: P0
    on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: P0

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions