Skip to content

gfx2hlsl: accept mask-preserving lane-mask writes in an execz block - #2723

Merged
MasterDomino merged 11 commits into
R0Y00:mainfrom
tedin7:x2w-execz-mask-preserve
Nov 26, 2026
Merged

MasterDomino merged 11 commits into
R0Y00:mainfrom
tedin7:x2w-execz-mask-preserve

Conversation

@tedin7

@tedin7 tedin7 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #1723

What this unblocks: compute shaders whose compiler-made i1 phi (a lane mask with a per-lane old value, s_andn2 + exec-masked compare + s_or) is defined in an s_cbranch_execz block and read per lane after the join now translate instead of being refused with definition of <M>, live where the block joins.

What changed

phi_mask_ok (extends the i1-phi rule from #2505) now accepts, for a 32-bit lane mask M (vcc_lo or one sN) written inside an execz block:

  • preserving writes, no zeroing needed: s_andn2_b32 M, M, exec_lo, and s_or_b32 M, M, T where T was written in the block by s_and_b32 T, X, exec_lo or a v_cmp;
  • a v_cmp (not v_cmpx) into M only when M was zeroed before the branch;
  • s_orn2_b32 M, X, exec_lo only when M was set to all ones (s_mov_b32 M, -1) before the branch.

Why it is exact: the model skips a lane when its exec bit is clear, and the exec proof (#2509) keeps that bit clear through the block. The wave runs the block when any lane is active. So the model equals the wave iff the block leaves a skipped lane's mask bit unchanged. Preserving writes always do; compare/exec-copy writes only after zeroing; s_orn2 only after all ones. Zeroing and all-ones writes are never mixed, any other write of M (including an offset s_movk into M) stays refused, and whole-mask reads after the join stay refused. The exhaustive 4-lane check is in the test file.

No overlap with #2557: it covers absorbed reads and an andn2-only narrowed mask; this PR covers the blend and the compare/orn2 set-up forms and does not touch those two rules.

Tests

  • tests/startup_gfx2hlsl_compute_check.py: acceptance of the blend, andn2-only, vcc blend, zeroed compare and all-ones orn2; refusals for each missing set-up, an unmasked term, M not the first source, mixed classes, and whole-mask reads; exhaustive 4-lane check check_execz_mask_exact.
  • New dispatch cases P (blend) and Q (all-ones orn2): group 0 skips with the whole wave, groups 1 and 2 enter with 3 and 6 lanes, group 3 with all 8; CPU reference per thread. New controls: p-dropped-andn2, p-dropped-or, p-block-entered, q-block-entered, q-not-all-ones (registered in CMake for warp and hardware).

Verification

Linux (this is Stage-1, no Windows run):

  • python3 -I tests/startup_gfx2hlsl_compute_check.py -> pass (new checks fail on origin/main with s_andn2_b32 inside a block s_cbranch_execz skips per lane: definition of s20, live where the block joins)
  • python3 -B tests/startup_gfx2hlsl_compute_check.py binary llvm-mc-19 -> fixture words match llvm-mc
  • expected output of cases P and Q checked against a wave-level simulation of the assembly: equal for all 4 groups
  • regression: the gfx2hlsl/pixel Linux checks give identical results on this branch and on origin/main
  • llc shapes (i1 phi with false / per-lane old / true, big arm so s_cbranch_execz is emitted): blend and true now translate, the others unchanged

Win2025 (dev + release, head 27ad219, merged with current main): x2w_pipe.py win2025 2723 --py-checks tests/startup_gfx2hlsl_compute_check.py --targets offscreen_check --regex startup_gfx2hlsl_compute: 45/45 passed, including dispatch cases P and Q on warp and hardware and the five new controls (p-dropped-andn2, p-dropped-or, p-block-entered, q-block-entered, q-not-all-ones), each rejected at its first bad word.

Build and run: cmake --build --preset dev --target offscreen_check then ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_compute' -V.

AI-assisted; commands listed were executed locally.

…ecz block

phi_mask_ok now also accepts s_andn2 M,M,exec_lo and s_or M,M,T with T exec-masked
(any M), a v_cmp into M when M was zeroed, and s_orn2 M,X,exec_lo when M was all
ones before the branch. Adds partial-wave dispatch cases P and Q, controls, refusal
controls and an exhaustive 4-lane check.
@tedin7
tedin7 marked this pull request as ready for review November 26, 2026 04:36
@tedin7

tedin7 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

@MasterDomino Ready for review on head 27ad219.

Independent gate review: main was merged into the branch first (CMake control list conflict resolved, both sides kept, no rebase, no force). Then I tried to break phi_mask_ok: a zeroed or all-ones mask overwritten before the branch, an unmasked term, exec widened inside the block before the s_andn2, s_orn2 with swapped sources, s_xor into the mask, a 64-bit s_andn2, an s_or into a different register read after the join, and whole-mask numeric reads of the mask or its term after the join (s_lshr, s_bcnt1, v_cvt, v_mov, s_and, s_add). All stay refused; only the blend, andn2-only, vcc blend, zeroed compare and all-ones orn2 forms translate. A break-it sweep of 166 shapes translates the same as origin/main.

Verification:

  • Linux: python3 -B tests/startup_gfx2hlsl_compute_check.py and ... binary llvm-mc-19 pass.
  • Win2025 (dev + release): x2w_pipe.py win2025 2723 --py-checks tests/startup_gfx2hlsl_compute_check.py --targets offscreen_check --regex startup_gfx2hlsl_compute: 45/45 passed, including the partial-wave dispatch cases P and Q (warp, hardware) and their wrong-value controls.

AI-assisted; commands listed were executed locally.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T04:42:21.627363Z 27ad219 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 27ad219ce0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Comment thread tools/startup/gfx2hlsl.py Resolved
Comment thread tools/startup/gfx2hlsl.py Resolved
@tedin7

tedin7 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit 9ab2828926e6760fc8b99545c3b21efe74214dff:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target d3d12_xs_device_obj -- -j 2): 0.73s (configure 0.00s)
    • Test (ctest --preset dev -R 'startup_gfx2hlsl_compute_(controls|warp)' --parallel 6 --no-tests=error --output-on-failure): 2/2 passed (2.27s: startup_gfx2hlsl_compute_controls 0.51s, startup_gfx2hlsl_compute_warp 2.15s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target d3d12_xs_device_obj -- -j 2): 2.28s (configure 1.79s)
    • Test (ctest --preset release -R 'startup_gfx2hlsl_compute_(controls|warp)' --parallel 6 --no-tests=error --output-on-failure): 2/2 passed (2.13s: startup_gfx2hlsl_compute_controls 0.46s, startup_gfx2hlsl_compute_warp 2.02s)
  • Windows Python checks: tests/mesh_heap_sampler_check.py ok (0.6s), tests/startup_buffer_address_check.py ok (0.4s), tests/startup_buffer_format_word3_table_check.py ok (0.1s), tests/startup_compute_image_store_check.py ok (0.5s), tests/startup_compute_image_store_d16_check.py ok (0.5s), tests/startup_compute_request_offline_check.py ok (0.5s), tests/startup_compute_store_format_xyzw_check.py ok (0.2s), tests/startup_compute_translate_check.py ok (0.2s), tests/startup_flat_param_check.py ok (0.1s), tests/startup_gfx2hlsl_add_sub_co_check.py ok (0.1s), tests/startup_gfx2hlsl_add_sub_co_ci_check.py ok (0.1s), tests/startup_gfx2hlsl_bfm_b64_check.py ok (1.1s), tests/startup_gfx2hlsl_bit_alu_check.py ok (0.6s), tests/startup_gfx2hlsl_capture_check.py ok (0.9s), tests/startup_gfx2hlsl_cmp16_check.py ok (0.2s), tests/startup_gfx2hlsl_cmp_class_f16_sdwa_check.py ok (27.5s), tests/startup_gfx2hlsl_compare_dst_check.py ok (0.1s), tests/startup_gfx2hlsl_compute_check.py ok (0.4s), tests/startup_gfx2hlsl_cselect_mask_check.py ok (0.1s), tests/startup_gfx2hlsl_cvt_alu_check.py ok (0.2s), tests/startup_gfx2hlsl_cvt_off_f32_i4_check.py ok (0.2s), tests/startup_gfx2hlsl_cvt_pk_int16_check.py ok (0.2s), tests/startup_gfx2hlsl_f32_lg_check.py ok (1.1s), tests/startup_gfx2hlsl_f32_nan_check.py ok (4.3s), tests/startup_gfx2hlsl_fma_mix_check.py ok (0.1s), tests/startup_gfx2hlsl_getpc_refusal_check.py ok (0.1s), tests/startup_gfx2hlsl_handler_arity_check.py ok (0.1s), tests/startup_gfx2hlsl_heap_record_check.py ok (0.2s), tests/startup_gfx2hlsl_image_arity_check.py ok (0.1s), tests/startup_gfx2hlsl_image_get_lod_check.py ok (0.2s), tests/startup_gfx2hlsl_int_med3_check.py ok (0.1s), tests/startup_gfx2hlsl_interp_p2_hi_check.py ok (0.2s), tests/startup_gfx2hlsl_join_symbols_check.py ok (0.2s), tests/startup_gfx2hlsl_loop_constants_check.py ok (0.1s), tests/startup_gfx2hlsl_mask_data_check.py ok (0.1s), tests/startup_gfx2hlsl_mask_overwrite_check.py ok (0.1s), tests/startup_gfx2hlsl_operand_count_check.py ok (0.3s), tests/startup_gfx2hlsl_pack_absdiff_check.py ok (2.1s), tests/startup_gfx2hlsl_pack_b32_f16_check.py ok (0.1s), tests/startup_gfx2hlsl_readfirstlane_recompute_check.py ok (0.1s), tests/startup_gfx2hlsl_readfirstlane_uniform_check.py ok (0.1s), tests/startup_gfx2hlsl_refusals_check.py ok (0.5s), tests/startup_gfx2hlsl_root_check.py ok (0.7s), tests/startup_gfx2hlsl_s_abs_check.py ok (0.1s), tests/startup_gfx2hlsl_s_bitset_check.py ok (0.1s), tests/startup_gfx2hlsl_s_ff0_check.py ok (0.1s), tests/startup_gfx2hlsl_s_ff1_check.py ok (0.1s), tests/startup_gfx2hlsl_s_flbit_check.py ok (0.1s), tests/startup_gfx2hlsl_s_quadmask_check.py ok (0.1s), tests/startup_gfx2hlsl_sad_check.py ok (0.3s), tests/startup_gfx2hlsl_sad_hi_msad_check.py ok (0.3s), tests/startup_gfx2hlsl_saveexec_same_reg_check.py ok (0.1s), tests/startup_gfx2hlsl_scalar_arity_check.py ok (0.2s), tests/startup_gfx2hlsl_scalar_brev_fold_check.py ok (0.1s), tests/startup_gfx2hlsl_scalar_m0_check.py ok (0.1s), tests/startup_gfx2hlsl_scalar_null_check.py ok (0.2s), tests/startup_gfx2hlsl_scalar_table_arity_check.py ok (0.3s), tests/startup_gfx2hlsl_sdwa_cndmask_check.py ok (0.2s), tests/startup_gfx2hlsl_sdwa_cvt_check.py ok (0.2s), tests/startup_gfx2hlsl_sgpr_spill_check.py ok (0.1s), tests/startup_gfx2hlsl_shift64_check.py ok (0.2s), tests/startup_gfx2hlsl_sload_const_offset_check.py ok (0.1s), tests/startup_gfx2hlsl_smem_offset_check.py ok (0.1s), tests/startup_gfx2hlsl_sop2_complement_check.py ok (4.7s), tests/startup_gfx2hlsl_sopk_accum_check.py ok (0.9s), tests/startup_gfx2hlsl_sopk_signext_check.py ok (0.1s), tests/startup_gfx2hlsl_spill_branches_check.py ok (0.8s), tests/startup_gfx2hlsl_swap_check.py ok (0.3s), tests/startup_gfx2hlsl_vopc_sdwa_check.py ok (3.6s), tests/startup_gfx2hlsl_waitcnt_depctr_check.py ok (0.1s), tests/startup_gfx2hlsl_watch_check.py ok (2.4s), tests/startup_image_2d_array_check.py ok (0.1s), tests/startup_image_3d_check.py ok (0.1s), tests/startup_image_gather_lz_check.py ok (0.5s), tests/startup_image_load_d16_check.py ok (0.8s), tests/startup_image_sample_a16_check.py ok (0.2s), tests/startup_image_sample_b_check.py ok (0.2s), tests/startup_image_sample_c_check.py ok (0.2s), tests/startup_image_sample_l_check.py ok (0.2s), tests/startup_image_sample_lod_check.py ok (0.5s), tests/startup_inline_sampler_check.py ok (0.1s), tests/startup_mesh57_depth_only_check.py ok (0.2s), tests/startup_mesh57_lane_spill_check.py ok (0.2s), tests/startup_mesh57_loop_check.py ok (0.2s), tests/startup_mesh57_loop_refusal_check.py ok (0.1s), tests/startup_mesh57_skeleton_check.py ok (0.9s), tests/startup_run_ps1_check.py ok (8.3s), tests/startup_run_sh_check.py skipped (0.1s), tests/startup_sampler_heap_check.py ok (0.1s), tests/startup_shader_cache_rekey_check.py ok (2.1s), tests/startup_smem_address_check.py ok (0.1s), tests/startup_stream_fetch_check.py ok (0.2s), tests/startup_stream_interface_check.py ok (0.2s), tests/startup_translator_check.py ok (0.3s)
  • sccache: 2/2 hits; wall 88.5s

Full-suite Win2025 run (dev + release, default pool) on the same head passed earlier: no failure other than a one-off startup_run_ps1_check failure under load on the first attempt, which passed on rerun (unrelated to this change).

AI-assisted; commands listed were executed locally.

@tedin7

tedin7 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

@MasterDomino #2723 is ready for review and merge. Head 9ab28289: both bot threads fixed and resolved (lane-bit inputs required for the new execz mask writes, docs updated). CI green, Win2025 WARP dev + release PASS on this exact head (receipt above, including startup_gfx2hlsl_compute_warp).

AI-assisted; commands listed were executed locally.

@MasterDomino MasterDomino left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 9ab28289.

The accepted forms look exact:

  • s_andn2 M, M, exec_lo, and s_or M, M, T with T exec-masked in the block, leave a skipped lane's bit unchanged.
  • A compare, an exec copy, or an s_and with a lane mask needs M zeroed first.
  • s_orn2 M, X, exec_lo needs M set to all ones.
  • Other writes stay refused, and the EXEC-clear proof is still checked on its own for every exec write in the block.

Two requests before merge:

  1. Compute cache revision. This change refuses a form main translated: s_mov_b32 M, 0, then s_and_b32 M, s7, exec_lo with s7 a group id, whose cached HLSL reads the wrong bit. The existing compute test that accepted it is flipped here. main is now at x2w-startup-shader-19cs (since #2708), so please move to 20cs, so that stale cache entries are re-keyed:
    • compute_key in gfx2hlsl.py;
    • compute_revision in d3d12_draw.inl;
    • tests/startup_compute_request_offline_check.py.
  2. Two controls. Two one-line mutants pass startup_gfx2hlsl_compute_check.py and the WARP dispatch: one that lets zero and ones writes mix, and one that accepts s_andn2_b32 M, M, X for any X. The existing mixed-class control uses s7, so it's refused for the lane-bit reason instead. Please add:
    • one mixed case with a compare-derived operand, for example v_cmp_gt_u32 vcc_lo, 3, v0; s_mov_b32 s20, exec_lo; s_orn2_b32 s20, vcc_lo, exec_lo, after s_mov_b32 s20, 0 and again after -1;
    • one s_andn2_b32 s20, s20, vcc_lo refusal.

Smaller points:

  • Lane-mask check: lane_bit_keys treats any s_and_b32 M, X, exec_lo before the branch as lane bits, without the lane-mask check that the block's writes now get. The generic lowering of s_and_b32 s20, s7, exec_lo has the same gap on main, so that can be its own issue.
  • Formatting: there's a collapsed line continuation in phi_mask_ok (or any().
  • Docs: they list "s_orn2 outside the lane mask above" among exec writes, but the new form writes M, not exec. They also mention only s_mov_b32 M, 0/-1, while the code accepts s_movk_i32 too.

Runs: Windows 11 build 26300; AMD Radeon RX 9070 XT (driver 32.0.32029.2010); WARP 10.0.26100.9818.

  • Targeted: ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_compute' 45/45, with cases P/Q and the five new controls on WARP and hardware.
  • Neighbours: ctest -R 'startup_gfx2hlsl|startup_compute_translate|startup_compute_request_offline' 277/278. The only failure is startup_gfx2hlsl_fma_mix_dispatch_hardware, as on main on this GPU (#2746).
  • Merged onto main: the controls and the dispatch pass (320 words, 0 mismatches on WARP and hardware), and each new dispatch control is rejected.

AI-assisted; commands listed were executed locally.

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original head accepted s_and_b32 s20, s7, exec_lo before a preserving execz block, even though the ordinary group ID is not a projected lane mask. The new control reproduces this on the old code and refuses it now. A proven VCC source still translates. Host mask/descriptor controls and the full WARP and RTX compute dispatch suites pass.

@MasterDomino

Copy link
Copy Markdown
Collaborator

@R0Y00, thanks. 1f0c65d3 closes the lane_bit_keys gap I noted (an s_and_b32 M, s7, exec_lo before the block) and adds the control for it.

My change request at 9ab28289 is still open on two points:

  1. Cache revision. This refuses a form that main translated with the wrong bit: s_mov_b32 M, 0, then s_and_b32 M, s7, exec_lo, with s7 a group id, inside a preserving execz block. The existing compute test that accepted it is flipped here. A shader cached under the current compute key keeps that wrong HLSL. This head still keys 18cs, and main is at 19cs. Do you want the bump past main (20cs), or is the stale entry acceptable to you? If it's fine without, I'll dismiss my request.
  2. Two controls for mutants that still pass:
    • zero and ones writes allowed to mix: needs a case with a compare-derived X, for example v_cmp_gt_u32 vcc_lo, 3, v0; s_mov_b32 s20, exec_lo; s_orn2_b32 s20, vcc_lo, exec_lo, after s_mov_b32 s20, 0 and again after -1;
    • s_andn2_b32 M, M, X accepted for any X: needs one refusal such as s_andn2_b32 s20, s20, vcc_lo.

AI-assisted.

c1 added 4 commits November 26, 2026 07:47
…rols for execz mask writes

The change refuses a compute form main translated, so cached compute HLSL must be re-keyed. Adds a zero+ones mix control and an s_andn2 M, M, vcc_lo refusal (both mutants now fail), docs wording and a line continuation fix.

@MasterDomino MasterDomino left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving 129fc835. Both points from my change request are addressed.

  1. Cache revision: both keys move to x2w-startup-shader-21 / 21cs. Against 1f0c65d3, the only other translator change is the line-continuation fix. startup_shader_cache_rekey_check.py and startup_shader_cache_key_check.py pass.

  2. Controls: both mutants that survived before are now caught by startup_gfx2hlsl_compute_check.py:

    • letting zero and ones writes mix (if stale or (...) → if stale:) fails on the new compare-derived mixed case;
    • accepting s_andn2_b32 M, M, X for any X fails on the new vcc_lo refusals.

    The new s_andn2_b32 s20, s20, vcc_lo word, 146a148a, matches llvm-mc 15 (binary mode: "fixture words match llvm-mc").

The head merges cleanly onto current main, and CI is green at the head.

Commands, on Windows 11 build 26300: python -B tests/startup_gfx2hlsl_compute_check.py (plus binary <llvm-mc 15>), startup_shader_cache_rekey_check.py, startup_shader_cache_key_check.py, startup_compute_request_offline_check.py and startup_gfx2hlsl_mask_overwrite_check.py: all exit 0.

Note for #2768, which also takes 21/21cs: once this lands, it needs 22/22cs.

AI-assisted; commands listed were executed locally.

@MasterDomino
MasterDomino merged commit f1a8db6 into R0Y00:main Nov 26, 2026
5 checks passed
@tedin7

tedin7 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit 129fc835bc599507d52e650093934c3cab537070:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check startup_indirect_draw_indexed startup_resource_retire_title startup_stream_consumer -- -j 2): 1.67s (configure 0.00s)
    • Test (ctest --preset dev -R '^startup_gfx2hlsl_compute|startup_compute_request_offline' --parallel 3 --no-tests=error --output-on-failure): 48/48 passed (7.35s: startup_gfx2hlsl_compute_mbcnt_warp 0.71s, startup_gfx2hlsl_compute_mbcnt_hardware 0.71s, startup_gfx2hlsl_compute_controls 0.69s, startup_gfx2hlsl_compute_dropped-store_warp 0.29s, startup_gfx2hlsl_compute_c-unpredicated_warp 0.30s, startup_gfx2hlsl_compute_warp 2.99s, startup_gfx2hlsl_compute_hardware 3.02s, startup_gfx2hlsl_compute_swapped-axes_warp 0.30s, startup_gfx2hlsl_compute_b-offset_warp 0.28s, startup_gfx2hlsl_compute_b-offset_hardware 0.28s, startup_gfx2hlsl_compute_c-unpredicated_hardware 0.28s, startup_gfx2hlsl_compute_dropped-store_hardware 0.29s, startup_gfx2hlsl_compute_swapped-axes_hardware 0.30s, startup_gfx2hlsl_compute_m-else-unswitched_hardware 0.28s, startup_gfx2hlsl_compute_n-dropped-broadcast_hardware 0.28s, startup_compute_request_offline 0.63s, startup_gfx2hlsl_compute_m-else-unswitched_warp 0.30s, startup_gfx2hlsl_compute_n-dropped-broadcast_warp 0.31s, startup_gfx2hlsl_compute_f-peer_warp 0.31s, startup_gfx2hlsl_compute_f-broadcast_hardware 0.29s, startup_gfx2hlsl_compute_o-mask-kept_warp 0.29s, startup_gfx2hlsl_compute_f-broadcast_warp 0.29s, startup_gfx2hlsl_compute_h-inner-unpredicated_hardware 0.30s, startup_gfx2hlsl_compute_k-block-entered_warp 0.31s, startup_gfx2hlsl_compute_n-unmasked_warp 0.32s, startup_gfx2hlsl_compute_f-peer_hardware 0.29s, startup_gfx2hlsl_compute_k-block-entered_hardware 0.30s, startup_gfx2hlsl_compute_h-inner-unpredicated_warp 0.28s, startup_gfx2hlsl_compute_g-swapped-offsets_hardware 0.27s, startup_gfx2hlsl_compute_n-unmasked_hardware 0.29s, startup_gfx2hlsl_compute_j-scalar-dropped_hardware 0.27s, startup_gfx2hlsl_compute_g-overlap_warp 0.30s, startup_gfx2hlsl_compute_g-swapped-offsets_warp 0.28s, startup_gfx2hlsl_compute_g-overlap_hardware 0.30s, startup_gfx2hlsl_compute_j-scalar-dropped_warp 0.30s, startup_gfx2hlsl_compute_o-mask-kept_hardware 0.29s, startup_gfx2hlsl_compute_f-second-fill_warp 0.30s, startup_gfx2hlsl_compute_p-dropped-andn2_warp 0.33s, startup_gfx2hlsl_compute_p-dropped-or_warp 0.32s, startup_gfx2hlsl_compute_p-block-entered_warp 0.33s, startup_gfx2hlsl_compute_q-block-entered_warp 0.30s, startup_gfx2hlsl_compute_q-not-all-ones_warp 0.30s, startup_gfx2hlsl_compute_f-second-fill_hardware 0.31s, startup_gfx2hlsl_compute_p-dropped-andn2_hardware 0.32s, startup_gfx2hlsl_compute_p-dropped-or_hardware 0.32s, startup_gfx2hlsl_compute_p-block-entered_hardware 0.32s, startup_gfx2hlsl_compute_q-block-entered_hardware 0.28s, startup_gfx2hlsl_compute_q-not-all-ones_hardware 0.28s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check startup_indirect_draw_indexed startup_resource_retire_title startup_stream_consumer -- -j 2): 7.36s (configure 0.00s)
    • Test (ctest --preset release -R '^startup_gfx2hlsl_compute|startup_compute_request_offline' --parallel 3 --no-tests=error --output-on-failure): 48/48 passed (7.87s: startup_gfx2hlsl_compute_mbcnt_warp 0.65s, startup_gfx2hlsl_compute_b-offset_warp 0.33s, startup_gfx2hlsl_compute_c-unpredicated_warp 0.32s, startup_gfx2hlsl_compute_controls 0.79s, startup_gfx2hlsl_compute_dropped-store_warp 0.29s, startup_gfx2hlsl_compute_dropped-store_hardware 0.33s, startup_gfx2hlsl_compute_warp 3.01s, startup_gfx2hlsl_compute_swapped-axes_hardware 0.30s, startup_gfx2hlsl_compute_hardware 3.05s, startup_gfx2hlsl_compute_swapped-axes_warp 0.29s, startup_gfx2hlsl_compute_b-offset_hardware 0.37s, startup_gfx2hlsl_compute_c-unpredicated_hardware 0.35s, startup_gfx2hlsl_compute_m-else-unswitched_warp 0.32s, startup_gfx2hlsl_compute_n-dropped-broadcast_warp 0.28s, startup_compute_request_offline 0.73s, startup_gfx2hlsl_compute_mbcnt_hardware 0.73s, startup_gfx2hlsl_compute_m-else-unswitched_hardware 0.44s, startup_gfx2hlsl_compute_n-dropped-broadcast_hardware 0.48s, startup_gfx2hlsl_compute_g-swapped-offsets_hardware 0.41s, startup_gfx2hlsl_compute_f-broadcast_warp 0.33s, startup_gfx2hlsl_compute_f-peer_warp 0.32s, startup_gfx2hlsl_compute_h-inner-unpredicated_warp 0.37s, startup_gfx2hlsl_compute_j-scalar-dropped_warp 0.36s, startup_gfx2hlsl_compute_k-block-entered_warp 0.39s, startup_gfx2hlsl_compute_k-block-entered_hardware 0.38s, startup_gfx2hlsl_compute_g-overlap_warp 0.36s, startup_gfx2hlsl_compute_g-swapped-offsets_warp 0.31s, startup_gfx2hlsl_compute_j-scalar-dropped_hardware 0.33s, startup_gfx2hlsl_compute_f-peer_hardware 0.30s, startup_gfx2hlsl_compute_h-inner-unpredicated_hardware 0.30s, startup_gfx2hlsl_compute_f-broadcast_hardware 0.31s, startup_gfx2hlsl_compute_g-overlap_hardware 0.29s, startup_gfx2hlsl_compute_f-second-fill_warp 0.30s, startup_gfx2hlsl_compute_n-unmasked_warp 0.29s, startup_gfx2hlsl_compute_o-mask-kept_warp 0.29s, startup_gfx2hlsl_compute_p-dropped-andn2_warp 0.31s, startup_gfx2hlsl_compute_p-dropped-or_warp 0.32s, startup_gfx2hlsl_compute_p-block-entered_warp 0.30s, startup_gfx2hlsl_compute_q-block-entered_warp 0.32s, startup_gfx2hlsl_compute_q-not-all-ones_warp 0.32s, startup_gfx2hlsl_compute_f-second-fill_hardware 0.29s, startup_gfx2hlsl_compute_o-mask-kept_hardware 0.27s, startup_gfx2hlsl_compute_n-unmasked_hardware 0.31s, startup_gfx2hlsl_compute_p-dropped-andn2_hardware 0.30s, startup_gfx2hlsl_compute_p-dropped-or_hardware 0.34s, startup_gfx2hlsl_compute_p-block-entered_hardware 0.32s, startup_gfx2hlsl_compute_q-block-entered_hardware 0.30s, startup_gfx2hlsl_compute_q-not-all-ones_hardware 0.27s)
  • Windows Python checks: tests/mesh_heap_sampler_check.py ok (0.7s), tests/startup_buffer_address_check.py ok (0.5s), tests/startup_buffer_format_word3_table_check.py ok (0.1s), tests/startup_compute_global_load_check.py ok (0.2s), tests/startup_compute_image_store_check.py ok (0.6s), tests/startup_compute_image_store_d16_check.py ok (0.5s), tests/startup_compute_request_offline_check.py ok (0.5s), tests/startup_compute_store_format_xyzw_check.py ok (0.2s), tests/startup_compute_translate_check.py ok (0.2s), tests/startup_flat_param_check.py ok (0.2s), tests/startup_gfx2hlsl_add_sub_co_check.py ok (0.1s), tests/startup_gfx2hlsl_add_sub_co_ci_check.py ok (0.2s), tests/startup_gfx2hlsl_bfm_b64_check.py ok (1.2s), tests/startup_gfx2hlsl_bit_alu_check.py ok (0.7s), tests/startup_gfx2hlsl_capture_check.py ok (1.2s), tests/startup_gfx2hlsl_cmp16_check.py ok (0.3s), tests/startup_gfx2hlsl_cmp_class_f16_sdwa_check.py ok (33.6s), tests/startup_gfx2hlsl_compare_dst_check.py ok (0.1s), tests/startup_gfx2hlsl_compute_check.py ok (0.6s), tests/startup_gfx2hlsl_const_copy_join_check.py ok (0.1s), tests/startup_gfx2hlsl_cselect_mask_check.py ok (0.1s), tests/startup_gfx2hlsl_cvt_alu_check.py ok (0.2s), tests/startup_gfx2hlsl_cvt_off_f32_i4_check.py ok (0.2s), tests/startup_gfx2hlsl_cvt_pk_int16_check.py ok (0.3s), tests/startup_gfx2hlsl_f32_lg_check.py ok (1.3s), tests/startup_gfx2hlsl_f32_nan_check.py ok (4.9s), tests/startup_gfx2hlsl_fma_mix_check.py ok (0.2s), tests/startup_gfx2hlsl_getpc_refusal_check.py ok (0.2s), tests/startup_gfx2hlsl_handler_arity_check.py ok (0.1s), tests/startup_gfx2hlsl_heap_record_check.py ok (0.2s), tests/startup_gfx2hlsl_heap_word_check.py ok (0.2s), tests/startup_gfx2hlsl_image_arity_check.py ok (0.1s), tests/startup_gfx2hlsl_image_get_lod_check.py ok (0.2s), tests/startup_gfx2hlsl_int_med3_check.py ok (0.1s), tests/startup_gfx2hlsl_interp_p2_hi_check.py ok (0.2s), tests/startup_gfx2hlsl_join_symbols_check.py ok (0.3s), tests/startup_gfx2hlsl_loop_constants_check.py ok (0.1s), tests/startup_gfx2hlsl_mask_data_check.py ok (0.1s), tests/startup_gfx2hlsl_mask_overwrite_check.py ok (0.1s), tests/startup_gfx2hlsl_operand_count_check.py ok (0.4s), tests/startup_gfx2hlsl_pack_absdiff_check.py ok (2.5s), tests/startup_gfx2hlsl_pack_b32_f16_check.py ok (0.2s), tests/startup_gfx2hlsl_readfirstlane_load_recompute_check.py ok (0.1s), tests/startup_gfx2hlsl_readfirstlane_recompute_check.py ok (0.1s), tests/startup_gfx2hlsl_readfirstlane_uniform_check.py ok (0.1s), tests/startup_gfx2hlsl_refusals_check.py ok (0.6s), tests/startup_gfx2hlsl_root_check.py ok (0.9s), tests/startup_gfx2hlsl_s_abs_check.py ok (0.1s), tests/startup_gfx2hlsl_s_bitset_check.py ok (0.1s), tests/startup_gfx2hlsl_s_ff0_check.py ok (0.1s), tests/startup_gfx2hlsl_s_ff1_check.py ok (0.1s), tests/startup_gfx2hlsl_s_flbit_check.py ok (0.1s), tests/startup_gfx2hlsl_s_quadmask_b64_check.py ok (0.1s), tests/startup_gfx2hlsl_s_quadmask_check.py ok (0.1s), tests/startup_gfx2hlsl_sad_check.py ok (0.4s), tests/startup_gfx2hlsl_sad_hi_msad_check.py ok (0.3s), tests/startup_gfx2hlsl_saveexec_same_reg_check.py ok (0.1s), tests/startup_gfx2hlsl_scalar_arity_check.py ok (0.3s), tests/startup_gfx2hlsl_scalar_brev_fold_check.py ok (0.2s), tests/startup_gfx2hlsl_scalar_m0_check.py ok (0.2s), tests/startup_gfx2hlsl_scalar_null_check.py ok (0.2s), tests/startup_gfx2hlsl_scalar_table_arity_check.py ok (0.4s), tests/startup_gfx2hlsl_sdwa_cndmask_check.py ok (0.2s), tests/startup_gfx2hlsl_sdwa_cvt_check.py ok (0.3s), tests/startup_gfx2hlsl_sgpr_spill_check.py ok (0.2s), tests/startup_gfx2hlsl_shift64_check.py ok (0.2s), tests/startup_gfx2hlsl_sload_const_offset_check.py ok (0.1s), tests/startup_gfx2hlsl_smem_offset_check.py ok (0.1s), tests/startup_gfx2hlsl_sop2_complement_check.py ok (5.8s), tests/startup_gfx2hlsl_sopk_accum_check.py ok (1.1s), tests/startup_gfx2hlsl_sopk_signext_check.py ok (0.1s), tests/startup_gfx2hlsl_spill_branches_check.py ok (1.1s), tests/startup_gfx2hlsl_swap_check.py ok (0.3s), tests/startup_gfx2hlsl_vopc_sdwa_check.py ok (4.5s), tests/startup_gfx2hlsl_waitcnt_depctr_check.py ok (0.1s), tests/startup_gfx2hlsl_watch_check.py ok (2.7s), tests/startup_image_2d_array_check.py ok (0.2s), tests/startup_image_3d_check.py ok (0.2s), tests/startup_image_gather_lz_check.py ok (0.6s), tests/startup_image_load_d16_check.py ok (1.0s), tests/startup_image_sample_a16_check.py ok (0.2s), tests/startup_image_sample_b_check.py ok (0.2s), tests/startup_image_sample_c_check.py ok (0.3s), tests/startup_image_sample_l_check.py ok (0.2s), tests/startup_image_sample_lod_check.py ok (0.6s), tests/startup_inline_sampler_check.py ok (0.2s), tests/startup_mesh57_depth_only_check.py ok (0.2s), tests/startup_mesh57_lane_spill_check.py ok (0.2s), tests/startup_mesh57_loop_check.py ok (0.2s), tests/startup_mesh57_loop_refusal_check.py ok (0.2s), tests/startup_mesh57_skeleton_check.py ok (1.2s), tests/startup_run_ps1_check.py ok (10.8s), tests/startup_run_sh_check.py skipped (0.1s), tests/startup_sampler_heap_check.py ok (0.2s), tests/startup_shader_cache_rekey_check.py ok (2.8s), tests/startup_smem_address_check.py ok (0.2s), tests/startup_stream_fetch_check.py ok (0.2s), tests/startup_stream_interface_check.py ok (0.2s), tests/startup_translator_check.py ok (0.5s)
  • sccache: 20/20 hits; wall 119.5s
  • Real GPU: tested on RTX 3090 through vkd3d-proton (Linux): 55/55 at 129fc835 (the PR tests, warp-named ones run on that GPU there, not on WARP)

@tedin7

tedin7 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

@MasterDomino both requests and the smaller points are done at head 129fc835b (merged with current main, on top of the lane-bit commit 1f0c65d37).

  1. Compute cache revision. The key moved to x2w-startup-shader-21cs in compute_key (gfx2hlsl.py), compute_revision (d3d12_draw.inl) and tests/startup_compute_request_offline_check.py (known-answer key 0x90041d02ef75b4e9). main is already at 20/20cs (shader: support BUF_FMT_2_10_10_10_UNORM fetch format in gfx2hlsl (Part of #1723) #2006), and startup_shader_cache_rekey_check.py requires the pixel and compute revisions to move together, so the pixel revision is 21 too, with its known-answer keys and literals in the other tests that spell it, and the note in docs/startup-runtime.md.
  2. Controls, in startup_gfx2hlsl_compute_check.py:
    • mixed classes with a compare-derived operand (v_cmp_gt_u32 vcc_lo, 3, v0; s_mov_b32 s20, exec_lo; s_orn2_b32 s20, vcc_lo, exec_lo) after s_mov_b32 s20, 0 and again after -1: refused;
    • s_andn2_b32 s20, s20, vcc_lo after 0, with no setting, and after -1: refused.
      I ran both of your mutants locally: allowing zero + ones to mix, and accepting s_andn2_b32 M, M, X for any X. Each now fails the check with accepted, expected a refusal naming 'definition of s20, live where the block joins'.
  3. Smaller points. The collapsed line continuation in phi_mask_ok is split. The docs now say s_orn2 into exec (the new form writes M), and mention s_movk_i32 M, 0. The lane_bit_keys gap stays out of this PR, as you suggested.

Commands run:

  • python3 -B tests/startup_gfx2hlsl_compute_check.py, startup_compute_request_offline_check.py, startup_shader_cache_rekey_check.py, startup_shader_cache_key_check.py, startup_gfx2hlsl_fract_check.py and the other tests that spell the revision -> pass
  • Windows Server 2025 dev + release on 129fc835b: ctest -R '^startup_gfx2hlsl_compute|startup_compute_request_offline' 48/48 on both, plus the full py-check list; receipt in the comment below

AI-assisted; commands listed were executed locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants