startup: accept slot 57 VCC branches on a wave-uniform compare (Part of #2413) #2558
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2566"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-25T21:14:42Z.
Part of #2413, the extension of the forward-branch work of #2548 (claim).
#2548 refuses
s_cbranch_vccz/s_cbranch_vccnzoutside the exchanges as a wave-wide condition. This accepts them when VCC is provably the same bit in every lane:v_cmp_*under the full EXEC mask.mesh_skeletontracks the set of such compares and merges it at joins; a path without one empties it.Stageproves each compare's sources wave-uniform: no VGPR operand, uniform SGPRs or constants.VCC is then all ones or all zeros, so the per-lane test equals the wave-wide one. Anything else stays refused with the existing message.
Three test commits add refusal controls:
s_call_b64,s_swappc_b64, a forwards_cbranch_execnz, and ans_branchfrom between the exchanges to after the count exchange (#2548 had no controls for these), a VCC compare made under a narrowed EXEC before EXEC is restored and the branch is taken, and a compare whose SGPR source was written before a join.Tests (Windows 11, Python 3.14, DXC from the Windows SDK 10.0.26100), on main
381abc3plus the four commits:python -B tests/startup_mesh57_skeleton_check.py: ok.vcczandvccnzbranches, and avcczbranch after a join, translate.... draw <dxc> offscreen_check warpandhardware: ok. The branch cases are drawn against the CPU model (WARP: Microsoft Basic Render Driver; hardware: NVIDIA GeForce RTX 5080).docs_links_check,bidi_controls_check,startup_gfx2hlsl_watch_check,startup_translator_check,startup_gfx2hlsl_join_symbols_check,startup_gfx2hlsl_refusals_check,startup_compute_translate_check,startup_gfx2hlsl_capture_check,startup_gfx2hlsl_waitcnt_depctr_checkandstartup_gfx2hlsl_loop_constants_check.Mutation checks, run by hand. The controls fail on each:
uniform_sourcereplaced byTrue(only the SGPR-before-join control fails; the VGPR control stays refused throughmesh_vregs);s_cbranch_execnzaccepted;Measured on a local capture (counts and instruction shape only, inputs private): with #2548 applied, 77 slot 57 requests stopped at a VCC branch on a wave-wide condition. With this change none stop there, and none of them translates yet: they now stop at
a branch enters or crosses a group-memory exchange. In the program I inspected,v_cmpx_gt_u32narrows EXEC at the end of the region before the count exchange and ans_cbranch_execztargets its firsts_barrier, so the exchange is entered under a narrowed EXEC. Supporting that shape is the next step; I inspected one program and have not checked that the others stop for the same reason, and an earlier version of this text wrongly described it as a third group-memory exchange.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T21:17:32Z.
Review: COMMENTED
Review of head
acc85ad9(comment only, not merging for now).Finding (test gap, not a proven code bug):
tools/startup/gfx2hlsl.py:2429now requiresnot mesh_vregs([tok]) and self.uniform_source(tok)for every compare source. In the new tests only the VGPR case is exercised ("a VGPR compare"). Withself.uniform_source(tok)replaced byTrue,python3 -B tests/startup_mesh57_skeleton_check.pystill printsok. So the SGPR half of the uniformity proof has no guard:uniform_sourcealso refuses SGPRs invarying_s, inmasks, or written before the last join (gfx2hlsl.py:2550-2565), and none of those is covered by a refusal control.masks, or one written before a join) and the VCC branch must be refused. It should fail when that call is dropped.Checked and fine:
all(definitions)empties the set when a path has none), the EXEC-at-branch and EXEC-at-compare checks, and the refusal of other VCC writes. Mutatingif mask is not None or not vcc_compares:toif False:makes the join control fail, as intended.Still open before a merge: CI is pending on this head, and the WARP/hardware draw cases (
draw ... warp) need a Windows run on the head after the branch is brought up to date (5 behind main). I did not run those.Commands run locally (Linux worktree on this head):
python3 -B tests/startup_mesh57_skeleton_check.py: okif False:at the branch check): fails as expecteduniform_sourcereplaced byTrue): still ok (the gap above)python3 tests/docs_links_check.py: passpython3 tests/bidi_controls_check.py: passgit diff --check origin/main...HEAD: cleanAI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T21:36:59Z.
Review: COMMENTED
Review of head
f8643e74(fixture and code review only, no executable run).Code: the proof in
mesh_skeletonis sound. VCC compares are tracked as a set, merged at joins (any path without one empties it), emptied by any other VCC write, and the branch needs a full EXEC.Stage.translatethen requires every tracked compare to have wave-uniform sources (no VGPR, uniform SGPR or constant). I found no sibling table or callsite left out. No other open or merged PR covers this slice (#2548 is the base).Checked locally on this head:
python3 -B tests/startup_mesh57_skeleton_check.py: okpython3 tests/docs_links_check.py: okpython3 tests/bidi_controls_check.py: okgit diff --check origin/main...HEAD: cleanuniform_sourcerequirement.ops[0] in ('vcc', 'vcc_lo')destination test. Not a blocker; a compare writing a non-VCC SGPR pair is not in the set because the VCC-write test is checked first. A one-line control would still pin it.The CPU-reference draws need DXC and WARP, so they were not run in this review. A Windows WARP run will follow before any merge.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T21:48:48Z.
Review: COMMENTED
Review of head
f0849990: this head isf8643e74merged with current main. The PR's own diff (3 files) is unchanged, so the earlier review off8643e74applies.Checked on this head: CI green, and the Windows Server 2025 WARP dev and release run passed (receipt above,
tests/startup_mesh57_skeleton_check.pyrc=0).Scope: fixture and code review only. No executable run.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-25T21:33:24Z.
Thanks, confirmed: with
self.uniform_source(tok)replaced byTruethe skeleton check still passed, because the VGPR control is also refused bymesh_vregs. The body's mutation list was wrong on that point; I've corrected it.Added
a VCC compare on an SGPR written before a join(f8643e74): s40 is set, a uniforms_cbranch_scc1skips a second write to it, and the compare after the join reads s40.uniform_sourcedoes not prove an SGPR written before the last join, so thevcczbranch stays refused. With the mutation above the check now fails on this case (got 'ok'); restored, it passes. A saved EXEC mask as the source did not work as a control: it is refused earlier, as an unproven use of a saved mask.The branch is rebased onto main
381abc3. On that head:startup_mesh57_skeleton_check.pyok, anddraw ... warpanddraw ... hardwareok (WARP; NVIDIA GeForce RTX 5080).AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T21:48:41Z.
Win2025 WARP receipt for head
f0849990after updating with main.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
f08499902676b34029f915b1c40b42766b668b18:--preset dev):cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2):49.55s(configure5.42s)/O2(--preset release):cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2):86.83s(configure4.10s)tests/mesh_heap_sampler_check.pyok (1.0s),tests/startup_buffer_address_check.pyok (1.3s),tests/startup_buffer_format_word3_table_check.pyok (0.6s),tests/startup_compute_request_offline_check.pyok (2.3s),tests/startup_compute_translate_check.pyok (0.5s),tests/startup_flat_param_check.pyok (0.2s),tests/startup_gfx2hlsl_add_sub_co_check.pyok (0.2s),tests/startup_gfx2hlsl_add_sub_co_ci_check.pyok (0.2s),tests/startup_gfx2hlsl_bit_alu_check.pyok (1.3s),tests/startup_gfx2hlsl_capture_check.pyok (1.5s),tests/startup_gfx2hlsl_cmp16_check.pyok (0.4s),tests/startup_gfx2hlsl_compare_dst_check.pyok (0.1s),tests/startup_gfx2hlsl_compute_check.pyok (0.6s),tests/startup_gfx2hlsl_cselect_mask_check.pyok (0.1s),tests/startup_gfx2hlsl_cvt_alu_check.pyok (0.2s),tests/startup_gfx2hlsl_cvt_off_f32_i4_check.pyok (0.2s),tests/startup_gfx2hlsl_f32_lg_check.pyok (1.8s),tests/startup_gfx2hlsl_f32_nan_check.pyok (7.2s),tests/startup_gfx2hlsl_fma_mix_check.pyok (0.1s),tests/startup_gfx2hlsl_getpc_refusal_check.pyok (0.1s),tests/startup_gfx2hlsl_handler_arity_check.pyok (0.1s),tests/startup_gfx2hlsl_image_arity_check.pyok (0.1s),tests/startup_gfx2hlsl_image_get_lod_check.pyok (0.1s),tests/startup_gfx2hlsl_int_med3_check.pyok (0.2s),tests/startup_gfx2hlsl_join_symbols_check.pyok (0.3s),tests/startup_gfx2hlsl_loop_constants_check.pyok (0.1s),tests/startup_gfx2hlsl_mask_overwrite_check.pyok (0.1s),tests/startup_gfx2hlsl_operand_count_check.pyok (0.4s),tests/startup_gfx2hlsl_pack_absdiff_check.pyok (3.8s),tests/startup_gfx2hlsl_readfirstlane_recompute_check.pyok (0.1s),tests/startup_gfx2hlsl_readfirstlane_uniform_check.pyok (0.1s),tests/startup_gfx2hlsl_refusals_check.pyok (0.7s),tests/startup_gfx2hlsl_root_check.pyok (0.9s),tests/startup_gfx2hlsl_sad_check.pyok (0.5s),tests/startup_gfx2hlsl_saveexec_same_reg_check.pyok (0.1s),tests/startup_gfx2hlsl_scalar_arity_check.pyok (0.3s),tests/startup_gfx2hlsl_scalar_brev_fold_check.pyok (0.2s),tests/startup_gfx2hlsl_scalar_m0_check.pyok (0.2s),tests/startup_gfx2hlsl_scalar_table_arity_check.pyok (0.4s),tests/startup_gfx2hlsl_sdwa_cvt_check.pyok (0.4s),tests/startup_gfx2hlsl_sgpr_spill_check.pyok (0.2s),tests/startup_gfx2hlsl_shift64_check.pyok (0.2s),tests/startup_gfx2hlsl_sload_const_offset_check.pyok (0.1s),tests/startup_gfx2hlsl_smem_offset_check.pyok (0.1s),tests/startup_gfx2hlsl_sop2_complement_check.pyok (8.5s),tests/startup_gfx2hlsl_sopk_accum_check.pyok (1.3s),tests/startup_gfx2hlsl_sopk_signext_check.pyok (0.2s),tests/startup_gfx2hlsl_swap_check.pyok (0.5s),tests/startup_gfx2hlsl_vopc_sdwa_check.pyok (6.5s),tests/startup_gfx2hlsl_waitcnt_depctr_check.pyok (0.1s),tests/startup_gfx2hlsl_watch_check.pyok (2.6s),tests/startup_image_2d_array_check.pyok (0.2s),tests/startup_image_3d_check.pyok (0.1s),tests/startup_image_gather_lz_check.pyok (0.7s),tests/startup_image_load_d16_check.pyok (0.9s),tests/startup_image_sample_a16_check.pyok (0.2s),tests/startup_image_sample_b_check.pyok (0.2s),tests/startup_image_sample_c_check.pyok (0.3s),tests/startup_image_sample_l_check.pyok (0.2s),tests/startup_image_sample_lod_check.pyok (0.7s),tests/startup_inline_sampler_check.pyok (0.2s),tests/startup_mesh57_skeleton_check.pyok (0.5s),tests/startup_run_ps1_check.pyok (12.9s),tests/startup_run_sh_check.pyskipped (0.1s),tests/startup_sampler_heap_check.pyok (0.1s),tests/startup_shader_cache_rekey_check.pyok (2.7s),tests/startup_smem_address_check.pyok (0.1s),tests/startup_stream_fetch_check.pyok (0.3s),tests/startup_stream_interface_check.pyok (1.0s),tests/startup_translator_check.pyok (1.3s)sccache: 71/298 hits; wall235.7sAI-assisted; commands listed were executed locally.