feat: accept key-independent body scalars read after a compute waterfall #2729
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2737"
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 tedin7 on 2026-11-26T04:35:57Z.
Part of #1723
What this unblocks: compute readfirstlane waterfall loops whose body writes a scalar that does not depend on the key and is read after the loop (the "body scalar is live at the loop exit" refusal).
What changed
waterfall_refusaltracks which body scalars depend on the key (the key itself, anything computed from a key-dependent scalar, and anything touched by a body load).Why it is correct
What stays refused
Tests
Extends
startup_compute_waterfall.py(run bystartup_compute_readfirstlane): accepted controls, refused controls, and a new WARP dispatch caseinvariant(0 to 4 active lanes, repeated and distinct keys) with the existing wrong-value control.Verification
python3 -B tests/startup_compute_readfirstlane_check.py --llvm-mc llvm-mc-19passes.tests/startup_*check.pypass; the shape kit finds no translation change on 166 shapes.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-26T04:46:09Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
f2061ff0b5ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T04:49:01Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T04:41:22Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
f2061ff0b544875adb748f1cc6a673dfbeca22fd:--preset dev):cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2):5.34s(configure3.77s)ctest --preset dev -R '^startup_compute_(readfirstlane|waterfall)|^startup_gfx2hlsl_compute' --parallel 4 --no-tests=error --output-on-failure): 38/38 passed (7.73s:startup_compute_readfirstlane_warp2.10s,startup_compute_readfirstlane_hardware2.18s,startup_gfx2hlsl_compute_mbcnt_warp0.98s,startup_gfx2hlsl_compute_mbcnt_hardware1.04s,startup_gfx2hlsl_compute_dropped-store_warp0.43s,startup_gfx2hlsl_compute_c-unpredicated_warp0.44s,startup_gfx2hlsl_compute_warp3.98s,startup_gfx2hlsl_compute_hardware4.01s,startup_gfx2hlsl_compute_swapped-axes_warp0.45s,startup_gfx2hlsl_compute_b-offset_warp0.43s,startup_gfx2hlsl_compute_c-unpredicated_hardware0.44s,startup_gfx2hlsl_compute_b-offset_hardware0.46s,startup_gfx2hlsl_compute_controls0.96s,startup_gfx2hlsl_compute_dropped-store_hardware0.43s,startup_gfx2hlsl_compute_swapped-axes_hardware0.42s,startup_gfx2hlsl_compute_m-else-unswitched_hardware0.47s,startup_gfx2hlsl_compute_n-dropped-broadcast_hardware0.44s,startup_gfx2hlsl_compute_m-else-unswitched_warp0.46s,startup_gfx2hlsl_compute_n-dropped-broadcast_warp0.45s,startup_compute_readfirstlane1.15s,startup_gfx2hlsl_compute_f-peer_warp0.43s,startup_gfx2hlsl_compute_f-broadcast_hardware0.43s,startup_gfx2hlsl_compute_f-broadcast_warp0.44s,startup_gfx2hlsl_compute_k-block-entered_warp0.46s,startup_gfx2hlsl_compute_h-inner-unpredicated_hardware0.48s,startup_gfx2hlsl_compute_f-peer_hardware0.44s,startup_gfx2hlsl_compute_k-block-entered_hardware0.46s,startup_gfx2hlsl_compute_h-inner-unpredicated_warp0.46s,startup_gfx2hlsl_compute_j-scalar-dropped_hardware0.44s,startup_gfx2hlsl_compute_g-swapped-offsets_hardware0.45s,startup_gfx2hlsl_compute_g-overlap_warp0.43s,startup_gfx2hlsl_compute_g-swapped-offsets_warp0.42s,startup_gfx2hlsl_compute_g-overlap_hardware0.40s,startup_gfx2hlsl_compute_j-scalar-dropped_warp0.43s,startup_gfx2hlsl_compute_n-unmasked_warp0.41s,startup_gfx2hlsl_compute_o-mask-kept_warp0.42s,startup_gfx2hlsl_compute_n-unmasked_hardware0.40s,startup_gfx2hlsl_compute_o-mask-kept_hardware0.37s)tests/mesh_heap_sampler_check.pyok (0.7s),tests/startup_buffer_address_check.pyok (0.4s),tests/startup_buffer_format_word3_table_check.pyok (0.1s),tests/startup_compute_request_offline_check.pyok (0.8s),tests/startup_compute_store_format_xyzw_check.pyok (0.2s),tests/startup_compute_translate_check.pyok (0.2s),tests/startup_flat_param_check.pyok (0.2s),tests/startup_gfx2hlsl_add_sub_co_check.pyok (0.1s),tests/startup_gfx2hlsl_add_sub_co_ci_check.pyok (0.2s),tests/startup_gfx2hlsl_bit_alu_check.pyok (0.7s),tests/startup_gfx2hlsl_capture_check.pyok (1.1s),tests/startup_gfx2hlsl_cmp16_check.pyok (0.3s),tests/startup_gfx2hlsl_cmp_class_f16_sdwa_check.pyok (34.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_cvt_pk_int16_check.pyok (0.4s),tests/startup_gfx2hlsl_f32_lg_check.pyok (1.5s),tests/startup_gfx2hlsl_f32_nan_check.pyok (5.7s),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_heap_record_check.pyok (0.2s),tests/startup_gfx2hlsl_image_arity_check.pyok (0.1s),tests/startup_gfx2hlsl_image_get_lod_check.pyok (0.2s),tests/startup_gfx2hlsl_int_med3_check.pyok (0.1s),tests/startup_gfx2hlsl_interp_p2_hi_check.pyok (0.3s),tests/startup_gfx2hlsl_join_symbols_check.pyok (0.6s),tests/startup_gfx2hlsl_loop_constants_check.pyok (0.2s),tests/startup_gfx2hlsl_mask_data_check.pyok (0.1s),tests/startup_gfx2hlsl_mask_overwrite_check.pyok (0.1s),tests/startup_gfx2hlsl_operand_count_check.pyok (0.5s),tests/startup_gfx2hlsl_pack_absdiff_check.pyok (2.7s),tests/startup_gfx2hlsl_pack_b32_f16_check.pyok (0.2s),tests/startup_gfx2hlsl_readfirstlane_recompute_check.pyok (0.1s),tests/startup_gfx2hlsl_readfirstlane_uniform_check.pyok (0.2s),tests/startup_gfx2hlsl_refusals_check.pyok (0.8s),tests/startup_gfx2hlsl_root_check.pyok (1.3s),tests/startup_gfx2hlsl_s_abs_check.pyok (0.2s),tests/startup_gfx2hlsl_s_bitset_check.pyok (0.2s),tests/startup_gfx2hlsl_s_ff0_check.pyok (0.5s),tests/startup_gfx2hlsl_s_ff1_check.pyok (1.4s),tests/startup_gfx2hlsl_s_flbit_check.pyok (0.9s),tests/startup_gfx2hlsl_s_quadmask_check.pyok (0.2s),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.3s),tests/startup_gfx2hlsl_scalar_m0_check.pyok (0.2s),tests/startup_gfx2hlsl_scalar_null_check.pyok (0.3s),tests/startup_gfx2hlsl_scalar_table_arity_check.pyok (0.5s),tests/startup_gfx2hlsl_sdwa_cndmask_check.pyok (0.3s),tests/startup_gfx2hlsl_sdwa_cvt_check.pyok (0.4s),tests/startup_gfx2hlsl_sgpr_spill_check.pyok (0.3s),tests/startup_gfx2hlsl_shift64_check.pyok (0.3s),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 (10.7s),tests/startup_gfx2hlsl_sopk_accum_check.pyok (2.0s),tests/startup_gfx2hlsl_sopk_signext_check.pyok (0.3s),tests/startup_gfx2hlsl_spill_branches_check.pyok (1.6s),tests/startup_gfx2hlsl_swap_check.pyok (0.6s),tests/startup_gfx2hlsl_vopc_sdwa_check.pyok (7.9s),tests/startup_gfx2hlsl_waitcnt_depctr_check.pyok (0.2s),tests/startup_gfx2hlsl_watch_check.pyok (3.3s),tests/startup_image_2d_array_check.pyok (0.3s),tests/startup_image_3d_check.pyok (0.2s),tests/startup_image_gather_lz_check.pyok (0.9s),tests/startup_image_load_d16_check.pyok (1.6s),tests/startup_image_sample_a16_check.pyok (0.3s),tests/startup_image_sample_b_check.pyok (0.3s),tests/startup_image_sample_c_check.pyok (0.4s),tests/startup_image_sample_l_check.pyok (0.3s),tests/startup_image_sample_lod_check.pyok (0.9s),tests/startup_inline_sampler_check.pyok (0.3s),tests/startup_mesh57_depth_only_check.pyok (0.3s),tests/startup_mesh57_lane_spill_check.pyok (0.3s),tests/startup_mesh57_loop_check.pyok (0.4s),tests/startup_mesh57_loop_refusal_check.pyok (0.3s),tests/startup_mesh57_skeleton_check.pyok (2.0s),tests/startup_run_ps1_check.pyok (26.6s),tests/startup_run_sh_check.pyskipped (0.2s),tests/startup_sampler_heap_check.pyok (0.3s),tests/startup_shader_cache_rekey_check.pyok (4.2s),tests/startup_smem_address_check.pyok (0.3s),tests/startup_stream_fetch_check.pyok (0.3s),tests/startup_stream_interface_check.pyok (0.4s),tests/startup_translator_check.pyok (0.8s)sccache: 56/63 hits; wall157.5sAI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T04:41:25Z.
Independent gate for
f2061ff0b5: PASS.startup_compute_readfirstlane_check.pyfail.invariantcase (0 to 4 active lanes, wrong-value control) passes on Windows Server 2025 (receipt above).@MasterDomino this is ready for your review.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-26T04:41:30Z.
Independent Windows x64 Release verification at
f2061ff0b544875adb748f1cc6a673dfbeca22fd, Windows26300.10075, DXC1.9.2602.17.python -B tests/startup_compute_readfirstlane_check.pyand--dispatch <dxc> <offscreen_check> <backend>passed on both in-box WARP10.0.26100.10068and physical RTX 407032.0.16.2124, without skips. The invariant waterfall matched all 320 words at each active-lane count from zero to four and for the uniform-key case. The mutated value changed exactly one word on each backend. D3D12 debug errors and warnings were zero. I used the MSVC Release runner after checking that its native and HLSL source trees matched this head.Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-26T04:41:38Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
f2061ffℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-26T04:46:09Z.
Code review location:
tools/startup/gfx2hlsl.py; line 2790This now accepts compute waterfalls with key-independent scalars live at exit, but
docs/experiments.md:15744-15747still requires temporary scalars to be dead and lists any live scalar as a refusal. The published support boundary therefore contradicts the newly accepted fixture. Update that section to distinguish invariant from key-dependent live-outs, as required by the public-capability documentation rule inAGENTS.md.AGENTS.md reference: AGENTS.md:L315-L316
Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T04:49:01Z.
Code review location:
tools/startup/gfx2hlsl.py; line 2790Fixed in
132d59c4.docs/experiments.md(waterfall section) now separates the two cases: a live-out scalar written only from constants or loop-invariant inputs (no read of the key or of a key-dependent scalar) is accepted, while a live-out that depends on the key stays refused. It also names the fixtures: the accepted invariant case with the D3D12 WARP readback, and the refused key-dependent cases.Commands run locally:
git diff --check(clean),python3 tests/startup_compute_waterfall.py(exit 0, docs-only change on top off2061ff0).AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T05:13:13Z.
Review: APPROVED
The proof propagates key-dependent reads through the body and treats body loads as dependent. Live-out reads are accepted only for invariant writes, and the docs now state that boundary. I reran the Release dispatch both from the exact source and combined with current scalar tracking. WARP and RTX 4060 Laptop matched all 320 words for active counts 0–4 and uniform keys. Each wrong-value control still returned its expected mismatch.
precise, so RDNA 1 drops the sign of a -0 product (startup_gfx2hlsl_fma_mix_dispatch_hardware) #2721