Skip to content

shader: slot 86 mesh programs set the root SRV stride with s_bitset1_b32, then stop at a scalar loop #3703

Backlog

Description

@lukaslw-lab

On a local start-up capture (main 1c634037, X2W_REFUSE_FIXED_MESH=1, X2W_NATIVE_MESH86=1), 24 slot 86 mesh pipelines become placeholders before they reach binding:

x2w-mesh86 slot86 native <key>: native compute +0xf0: unbound numeric SGPR s1   (18 keys; s5 in 6)

All 24 build a raw V# over root parameter 3, the 128-byte root SRV of #3639:

s_mov_b32 s1, s20 ; s_mov_b32 s0, s19        ; root SRV address
s_bitset1_b32 s1, 16                         ; byte stride 1  <- refused
s_mov_b32 s2, -1 ; s_mov_b32 s3, 0x11014fac
s_buffer_load_dword ... s[0:3], 0x4 ... 0x7c ; tbuffer_load_format / buffer_load ... s[0:3]

The translator already maps s_or_b32 <high>, 0x10000 to root_stride_one_high; s_bitset1_b32 <high>, 16 sets the same bit and is not recognised. #3702 adds it.

Offline (compile_dxil <dxc> <out> gfx1013-container-ms-texture-heap <request>.m86 <out>.cso), the next refusals with that change:

Next refusal Requests
unsupported mesh scalar branch destination: a uniform counted loop, s_add_i32 sN, sN, 1; s_cmp_ge_u32 sN, sM; s_cbranch_scc0 <back> 18
unsupported mesh instruction or EXEC state: v_mad_f32 3
raw buffer load needs offen with zero scalar offset and no modifiers (buffer_load_dword ... idxen offen offset:876) 3

Counts only; request keys and bytes stay local.

Refs #3641, #3639

AI-assisted.

Main integration update

#3718 added the committed-buffer root SRV resolver and range-control fixture. #3807 added indexed raw table SRV binding to the native Mesh86 path, covering a supported record stride, wrong stride and unbacked descriptors with source-built mesh and pixel fixtures. #3764 fixed staged primitive index decoding. The remaining scene geometry stream and rasterization checks are tracked at #3763 and #3641.

Activity

  1. lukaslw-lab commented on Dec 1, 2026

    @lukaslw-lab
    ContributorAuthor

    Offline chain for the 24 programs, on #3702 (1c634037 + 22ba8dbe). To see past a refusal, a local copy of each request replaces the refused word: the loop back edge with s_nop 0, v_cvt_i32_f32 with v_cvt_u32_f32, v_mad_f32 with v_fma_f32. This changes what the programs compute; it only measures how far they get.

    Group Programs Refusals in order
    L 18 scalar loop → v_cvt_i32_f32 (×2) → mesh image load lacks a remapped Texture1D heap contract
    M 3 v_mad_f32 (×4) → raw buffer load needs offen with zero scalar offset and no modifiers
    R 3 raw buffer load needs offen with zero scalar offset and no modifiers

    What lies beyond the image load and the idxen offen load is not measured.

    The loop is the same in all 18 programs apart from register numbers: one header, one back edge, 15 instructions, scalar only.

    i = 0                                          ; bound n = dword 0 of root SRV 3 (#3639); n == 0 skips the loop
    loop:  flags = s_buffer_load_dword(table 1 slot 0 buffer, i * 0x130 + 0x50)
           if (flags & 2)  goto found_a
           if (flags & 64) goto found_b
           i += 1 ; if (i < n) goto loop           ; s_add_i32, s_cmp_ge_u32, s_cbranch_scc0 <back>
    none / found_a / found_b each set two VGPRs, then join at one block
    

    The body has no VALU, VMEM, LDS, EXEC write or export. The loop sits inside a forward s_cbranch_execz region, and every exit branches forward into that region.

    Proposed lowering, for the maintainer to accept or reject. In lower_mesh, admit a uniform scalar loop:

    • One header H and one back edge B (s_cbranch_scc0/scc1/s_branch to H).
    • [H, B] holds only SALU, SMEM, s_waitcnt and s_nop.
    • Every other branch in [H, B] goes forward past B and stays inside the enclosing EXECZ region. Nothing branches into [H, B] except at H.

    Emit it as a DXIL loop:

    • A header block with a phi for each SGPR the body writes, and for SCC.
    • Exit edges carry their SGPR state into the existing forward-join merge.
    • Symbol state at H is the entry state joined with the back-edge state; every SGPR the body writes becomes numeric-unknown.

    The trip count comes from guest data, the same as on the console; no cap. The graphics stages already build loops with block phis (gfx1013_direct_graphics.inl, loop_dependencies); the mesh emitter is forward-only today.

    Fixture idea: a source-built mesh program with this shape that searches a small root or table buffer, with one case per outcome (none / bit 2 / bit 64) checked on WARP. Controls:

    • a VALU instruction in the body;
    • two back edges;
    • an exit into [H, B];
    • a back edge on VCC from a per-lane compare.

    Work split. Comment here to claim an item, one PR each. Items 1 and 2 are independent of each other; item 3 can be done in parallel.

    # Item Programs (first reached) Size Notes
    1 Uniform scalar loop in lower_mesh, as above 18 large design above
    2 v_cvt_i32_f32 and v_mad_f32 in the mesh VALU list (the shared ALU already lowers both, gfx1013_direct_compute.inl:3389) 21 small taking this one (said above)
    3 buffer_load_dword ... idxen offen offset:N in the raw-load decoder (gfx1013_compute_native.cpp:285) 6 small–medium
    4 2D image_load through a descriptor-table texture in the mesh path, plus its SRV in the slot 86 root (native_mesh86.inl). Today only the 1D heap slot map is accepted (gfx1013_direct_mesh.inl:1298). 18 (after 1, 2) medium touches runtime binding; coordinate with #3639

    Related open work, none of which covers these items:

    Taking item 2 only. Items 1, 3 and 4 are open. The reach probe can be rerun on any branch.

    AI-assisted.

  2. lukaslw-lab commented on Dec 1, 2026

    @lukaslw-lab
    ContributorAuthor

    Item 2 is in #3704 (independent of #3702). With both applied, the 3 v_mad_f32 requests reach the idxen offen load (item 3), and the 18 loop requests no longer stop at v_cvt_i32_f32 after the loop. Items 1, 3 and 4 are still open.

  3. lukaslw-lab commented on Dec 1, 2026

    @lukaslw-lab
    ContributorAuthor

    Taking item 3 (idxen offen raw loads through a table buffer V#, the graphics branch of the raw-load decoder). It doesn't change #3631's compute branch.

  4. lukaslw-lab commented on Dec 1, 2026

    @lukaslw-lab
    ContributorAuthor

    Item 3 is in #3705 (translator part). With #3702, #3704 and #3705 applied, the 6 requests pass the idxen offen load. Two follow-ups:

    AI-assisted.

  5. lukaslw-lab commented on Dec 1, 2026

    @lukaslw-lab
    ContributorAuthor

    Taking item 1 (uniform scalar loop in lower_mesh), built to the design above. Loop-carried SGPRs and SCC go through local slots, so the single forward pass stays as it is; anything outside the narrow shape keeps the refusal. PR will follow; happy to change direction if the design is rejected.

  6. mumba17 commented on Dec 1, 2026

    @mumba17
    Contributor

    Taking item 5: the "if not VCC" region in the C++ mesh frontend (s_xor_b64 sX, vcc, -1, then s_and_saveexec_b64, then s_cbranch_execz). It is next to the SAVEEXEC shapes of #3668, so I'll extend that path: accept the inverted VCC mask as the region condition, keep refusing any other operand to the s_xor_b64. Source-built fixture with WARP readback plus negative controls; PR stacks on nothing, and I'll report how far the 6 requests get on top of #3702/#3704/#3705.

    AI-assisted.

  7. mumba17 commented on Dec 1, 2026

    @mumba17
    Contributor

    Item 5 is in #3706. s_xor_b64 sD, vcc, -1 now goes through the mesh mask-complement path, so the following SAVEEXEC (in-skip if/else, paired, or if-only) takes it as an ordinary lane-mask pair. vcc_hi and any operand other than -1 still refuse. I haven't measured the 6 requests yet; I couldn't do a Mesh86 capture run on this host today. @lukaslw-lab, if you rerun your reach probe with #3702/#3704/#3705 + #3706, I'd like to see what comes next.

    AI-assisted.

  8. lukaslw-lab commented on Dec 1, 2026

    @lukaslw-lab
    ContributorAuthor

    Item 6 (new, open): with #3702, #3704, #3705 and #3706 applied, the 6 idxen offen requests pass the "if not VCC" open. They stop at its first load with graphics register undefined on an incoming path: 274 / 276 / 278 (v18 / v20 / v22, the load's index VGPR). That VGPR is written under an earlier EXEC region, closed by s_mov_b64 exec, s[20:21] just before the s_xor_b64. So the join at that restore does not treat it as defined on every path. Details in #3706. Not claimed.

    Status: item 1 (loop) in progress on our side; items 2/3/5 are in #3704 / #3705 / #3706; 3b waits for #3639; item 4 is open.

  9. mumba17 commented on Dec 1, 2026

    @mumba17
    Contributor

    Thanks for the reach run, @lukaslw-lab. Taking item 6: the index VGPR (v18/v20/v22) written under the earlier EXEC region and read in the "if not VCC" arm after s_mov_b64 exec, s[20:21]. Same family as #3671: keep the partial write across the restore only where the reading mask is provably within the lanes that wrote it, and keep refusing every other read. Fixture with positive and negative controls; I'll stack it on #3706 and report the reach on the same 6 requests.

    AI-assisted.

  10. lukaslw-lab commented on Dec 1, 2026

    @lukaslw-lab
    ContributorAuthor

    Item 1 is in #3707 (independent of #3702 / #3704 / #3705 / #3706). With #3702 and #3704 applied, the 18 loop requests pass the loop without any stand-in and stop at item 4 (mesh image load lacks a remapped Texture1D heap contract). Items 4 and 3b remain; 6 is with @mumba17.

  11. lukaslw-lab commented on Dec 1, 2026

    @lukaslw-lab
    ContributorAuthor

    Taking item 4: 2D image_load through a descriptor-table texture in the mesh frontend, routed to the shared image_io. The slot 86 runtime already binds 2D table textures (from #3638), so I expect no runtime change and nothing in the root-SRV path of #3639.

  12. mumba17 commented on Dec 1, 2026

    @mumba17
    Contributor

    Census: every slot 86 program from a native Mesh86 run

    This is wider than the 24 above, in case it helps choose what to do next. Counts only; request bytes stay local.

    Capture. main 1c634037, run with run_preset.py --console x --gpu nvidia --set translate=false, X2W_REFUSE_FIXED_MESH=1 and X2W_NATIVE_MESH86=1, 600 s from a saved profile, RTX 3090. It recorded 2,873 .m86 requests, 1,569 of them distinct by content. Each went through compile_dxil … gfx1013-container-ms-texture-heap.

    First refusal per program, on main and with #3708:

    First refusal main + #3708 Owner
    s_not_b32 / s_bfe_i32 / s_brev_b32 286 / 198 / 71 0 #3708 (mine)
    v_rcp_iflag_f32 85 371 taking this next
    unbound numeric SGPR s1 (root SRV stride bit) 174 174 #3702
    indexed raw load needs a reflected table SRV 154 156 —
    v_cmpx_ne_u32 83 143 — (next to @Kawiu's CMPX set in #3666)
    graphics register undefined on an incoming path 37 79 item 6 (mine)
    buffer_load_format_x 57 57 —
    v_ashrrev_i32 16 50 —
    mesh SAVEEXEC then arm depends on EXEC (nested SAVEEXEC) 29 29 —
    v_mad_f32 18 27 #3704
    translate fully 267 389

    Taking v_rcp_iflag_f32 in the mesh frontend. The shared ALU lowering already exists; I'll check its IEEE-flag semantics against the compute path and add tests. Item 6 stays mine too, after this.

    AI-assisted.

  13. mumba17 commented on Dec 1, 2026

    @mumba17
    Contributor

    v_rcp_iflag_f32 (371) is in #3709, together with v_ashrrev_i32 (50, same lane ALU list). Measured on top of #3708, those 421 programs now stop at v_and_or_b32 (144, already in @SimSalabimse's #3659), mesh heap slot lacks masked root constant provenance (142), s_cmp_le_u32 (85) and the offen raw-load form (51). Next for me is item 6.

    AI-assisted.

  14. mumba17 commented on Dec 1, 2026

    @mumba17
    Contributor

    Item 6: #3710. In my census, the undefined on an incoming path refusals come from a nested CMPX skip inside the vertex skip, where both exit to the same EXEC restore. The #3671 lane-limit tag was skipped there, so the restore erased the position VGPRs. With #3710, 32 more programs translate on main (267 → 299), and 65 more with #3706/#3708/#3709 stacked (389 → 454). No regressions.

    One caveat, @lukaslw-lab: your 6 requests read v18/v20/v22 as a load index in the "if not VCC" arm, not in a count-guarded export. I can't reproduce them here because they need #3702/#3704/#3705 first. #3710 may not cover that read. If your probe still shows it with #3710 applied, I'll take that shape as a follow-up.

    AI-assisted.

  15. 55 remaining items

  16. timbot103 commented on Dec 2, 2026

    @timbot103
    Contributor

    Opened #3827 for the claimed mesh small ALU cluster (v_cmpx_<p>_f32, s_cmpk_*, s_bcnt0/1_i32_b32, v_min_f32, v_bfi_b32) + v_pack_b32_f16 constant sources.

  17. timbot103 commented on Dec 2, 2026

    @timbot103
    Contributor

    Claiming three disjoint #3703 mesh slices from the 0dd65da1 census (will stage as Draft PRs per #3514 until our active review slots open, each with source-built DXIL + verification fixtures):

    1. unsupported image dimension or D16 (609 programs): D16 image_load (and direct image dimension/D16 forms) in decode and lowering.
    2. mesh vertex outputs do not share the position mask (308 programs): mesh vertex export mask matching when POS0 and PARAM exports have sound masks.
    3. mesh heap slot lacks masked root constant provenance (544 programs, shapes beyond shader: prove packed root selectors for mesh heap reads (Part of #3703) #3719) + mesh scalar memory needs a verified guest root mapping: s_load_dwordx4 (77 programs).
  18. timbot103 commented on Dec 2, 2026

    @timbot103
    Contributor

    Wave 1 Draft PR opened & claiming next disjoint #3703 slice (staged as Draft per #3514):

  19. timbot103 commented on Dec 2, 2026

    @timbot103
    Contributor

    Wave 1 Draft PRs opened & claiming 3 more disjoint #3703 mesh slices (staged as Drafts per #3514):

  20. timbot103 commented on Dec 2, 2026

    @timbot103
    Contributor

    Draft PR opened & claiming next #3703 mesh slice (staged as Draft per #3514):

  21. timbot103 commented on Dec 2, 2026

    @timbot103
    Contributor

    Claiming the next unclaimed wall noted in the 2 Dec stack check (staged as Draft per #3514):

    • buffer_load_format_xyzw (164 programs in the stacked mesh census; plus multi-component buffer_load_format_xy/xyz/xyzw in src/gfx1013_direct_mesh.inl).
  22. timbot103 commented on Dec 2, 2026

    @timbot103
    Contributor

    Wave 2 + early Wave 3 Draft PRs opened (staged as Drafts per #3514):

  23. timbot103 commented on Dec 2, 2026

    @timbot103
    Contributor

    Opened Draft PR for buffer_load_format_x/_xy/_xyz/_xyzw (164-program stacked mesh wall, staged as Draft per #3514):

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions