mesh: preserve a scalar shift across a wave64 EXEC-zero branch #2593

Merged
RavenCurseBurg merged 2 commits from upstream-pr/2601 into main 2026-11-25 23:05:03 +00:00
RavenCurseBurg commented 2026-11-25 22:44:44 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T22:44:44Z.


Refs #2413. This implements the scalar-shift slice from the tracking issue.

The slot 57 mesh translator now recognizes the first post-count branch when a full-EXEC unsigned compare selects threads below a literal limit, an adjacent save narrows EXEC, and s_cbranch_execz skips one s_lshl_b32 to the full-EXEC restore. For that contiguous prefix, the 64-lane guest wave is empty exactly when its first thread is at or above the limit. The generated branch therefore takes the same path for all 64 guest lanes regardless of the desktop wave size.

The fixture makes six threads active in the first wave and none in the second. After EXEC widens, thread 39 must see the shifted value from the first wave. Vertices in the second wave must still see the previous, nonzero scalar. The CPU checks the full 32×32 image. A separately compiled per-lane branch changes exactly 66 pixels and matches its independently predicted image. Source-built controls also reject a scalar memory load, an unproven thread register, a path entering the shift and a delayed full-EXEC restore.

The GPU results below use e9346b1a. The final assembly spelling is verified at 847109a2.

  • All 80 related Python and documentation checks passed at the GPU build. The initial local LLVM wrapper used the target default. Upstream LLVM 15 correctly refused the explicit vcc_lo spelling under wave64. Commit 847109a2 uses vcc; it encodes the same instruction bytes (86 00 88 7d). The full guest program now matches in explicit wave64 mode and all three upstream CI jobs passed, including python -B tests/startup_mesh57_skeleton_check.py binary llvm-mc-15.

  • ctest --preset release --no-tests=error -R '^startup_mesh57_skeleton' -V. The new cases are startup_mesh57_skeleton_wave_shift_warp and startup_mesh57_skeleton_wave_shift_hardware. The original draw, request exchange and skeleton controls use the same filter.

  • The exact-head Windows Server 2025 Release build passed the host test and all three WARP tests. On Windows 11 build 26100.9711 I verified the artifact digests and relocated the original seven CTest registrations. With an RTX 4060 (32.0.15.9579) all seven passed. With Intel UHD 770 (32.0.101.5973) the host and three WARP tests passed, and all three hardware tests skipped on mesh tier (77). The desktop debug layer was unavailable. Both WARP and RTX produced exactly 66 differing pixels for the per-lane mutation, and zero against the mutation's own CPU prediction.

  • An additional source-built check assembled thread limits 0, 1, 63, 64, 65, 70 and 128 and enumerated the active threads on the CPU. The seven full images matched on both WARP and RTX using the earlier verified renderer from #2576.

AI-assisted with Codex (GPT-6.2 Astra, xhigh).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6615281292 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2601). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T22:44:44Z. --- Refs #2413. This implements the scalar-shift slice from [the tracking issue](https://github.com/R0Y00/Xbox2Windows/issues/2413#issuecomment-7176303054). The slot 57 mesh translator now recognizes the first post-count branch when a full-EXEC unsigned compare selects threads below a literal limit, an adjacent save narrows EXEC, and `s_cbranch_execz` skips one `s_lshl_b32` to the full-EXEC restore. For that contiguous prefix, the 64-lane guest wave is empty exactly when its first thread is at or above the limit. The generated branch therefore takes the same path for all 64 guest lanes regardless of the desktop wave size. The fixture makes six threads active in the first wave and none in the second. After EXEC widens, thread 39 must see the shifted value from the first wave. Vertices in the second wave must still see the previous, nonzero scalar. The CPU checks the full 32×32 image. A separately compiled per-lane branch changes exactly 66 pixels and matches its independently predicted image. Source-built controls also reject a scalar memory load, an unproven thread register, a path entering the shift and a delayed full-EXEC restore. The GPU results below use `e9346b1a`. The final assembly spelling is verified at `847109a2`. - All 80 related Python and documentation checks passed at the GPU build. The initial local LLVM wrapper used the target default. Upstream LLVM 15 correctly refused the explicit `vcc_lo` spelling under wave64. Commit `847109a2` uses `vcc`; it encodes the same instruction bytes (`86 00 88 7d`). The full guest program now matches in explicit wave64 mode and [all three upstream CI jobs passed](https://github.com/R0Y00/Xbox2Windows/actions/runs/45716557501), including `python -B tests/startup_mesh57_skeleton_check.py binary llvm-mc-15`. - `ctest --preset release --no-tests=error -R '^startup_mesh57_skeleton' -V`. The new cases are `startup_mesh57_skeleton_wave_shift_warp` and `startup_mesh57_skeleton_wave_shift_hardware`. The original draw, request exchange and skeleton controls use the same filter. - The [exact-head Windows Server 2025 Release build](https://github.com/RavenCurseBurg/Xbox2Windows/actions/runs/45714990947) passed the host test and all three WARP tests. On Windows 11 build 26100.9711 I verified the artifact digests and relocated the original seven CTest registrations. With an RTX 4060 (32.0.15.9579) all seven passed. With Intel UHD 770 (32.0.101.5973) the host and three WARP tests passed, and all three hardware tests skipped on mesh tier (77). The desktop debug layer was unavailable. Both WARP and RTX produced exactly 66 differing pixels for the per-lane mutation, and zero against the mutation's own CPU prediction. - An additional source-built check assembled thread limits 0, 1, 63, 64, 65, 70 and 128 and enumerated the active threads on the CPU. The seven full images matched on both WARP and RTX using the earlier verified renderer from #2576. AI-assisted with Codex (GPT-6.2 Astra, xhigh).
tedin7 commented 2026-11-25 23:02:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T22:53:17Z.

Review: COMMENTED


Review of head 847109a2 against origin/main (8 commits behind, no conflict).

Findings: none blocking.

  • tools/startup/gfx2hlsl.py: the shift branch is only accepted as the first post-count branch, s_cbranch_execz over exactly one s_lshl_b32 to a full-EXEC restore, with the preceding v_cmp_gt_u32 on the proven thread register under full EXEC. For a contiguous prefix, a 64-lane guest wave is empty exactly when its first thread is at or above the limit, so (tid & ~63u) >= limit is the right wave-level condition.
  • Sibling checks are covered by the source-built controls (scalar load, unproven thread register, path into the shift, delayed restore).
  • The new CTest startup_mesh57_skeleton_wave_shift_{warp,hardware} is registered next to its sibling draw tests and checks the full image against a CPU reference. It also compiles a per-lane branch and checks that it gives a different image.
  • Docs paragraph added in docs/experiments.md. No other open or merged PR covers this slice.

Commands run:

  • python3 -B tests/startup_mesh57_skeleton_check.py: passed
  • python3 tests/docs_links_check.py: passed
  • python3 tests/bidi_controls_check.py: passed
  • git diff --check origin/main...HEAD: clean
  • Mutation: dropping the thread-register proof makes the check fail with the expected refusal message.
  • Mutation: replacing (tid & ~63u) by tid is not caught on Linux. Only the GPU draw test can catch it, so the Win2025 readback is the real guard here. Result to follow.

Fixture and code review only; no executable results are claimed.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6066089566 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2601#pullrequestreview-6066089566). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T22:53:17Z. **Review:** COMMENTED --- Review of head 847109a2 against origin/main (8 commits behind, no conflict). Findings: none blocking. - `tools/startup/gfx2hlsl.py`: the shift branch is only accepted as the first post-count branch, `s_cbranch_execz` over exactly one `s_lshl_b32` to a full-EXEC restore, with the preceding `v_cmp_gt_u32` on the proven thread register under full EXEC. For a contiguous prefix, a 64-lane guest wave is empty exactly when its first thread is at or above the limit, so `(tid & ~63u) >= limit` is the right wave-level condition. - Sibling checks are covered by the source-built controls (scalar load, unproven thread register, path into the shift, delayed restore). - The new CTest `startup_mesh57_skeleton_wave_shift_{warp,hardware}` is registered next to its sibling draw tests and checks the full image against a CPU reference. It also compiles a per-lane branch and checks that it gives a different image. - Docs paragraph added in `docs/experiments.md`. No other open or merged PR covers this slice. Commands run: - `python3 -B tests/startup_mesh57_skeleton_check.py`: passed - `python3 tests/docs_links_check.py`: passed - `python3 tests/bidi_controls_check.py`: passed - `git diff --check origin/main...HEAD`: clean - Mutation: dropping the thread-register proof makes the check fail with the expected refusal message. - Mutation: replacing `(tid & ~63u)` by `tid` is not caught on Linux. Only the GPU draw test can catch it, so the Win2025 readback is the real guard here. Result to follow. Fixture and code review only; no executable results are claimed. AI-assisted; commands listed were executed locally.
Makto94 commented 2026-11-25 23:02:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Makto94 on 2026-11-25T22:56:16Z.


Additional hardware run at head 847109a2 (build exit code 0), with the debug layer enabled. The PR body reports an RTX 4060 run (7/7) without the desktop debug layer; this adds a second NVIDIA GPU with the layer on.

Environment: NVIDIA GeForce RTX 3070 Ti, driver 32.0.16.2101 (NVIDIA 621.01) and Windows 11 Pro build 26300.9974 as reported by the system, dev preset (MSVC). The runs were serial (-j1).

Command: ctest --preset dev --no-tests=error -j1 -V -R '^startup_mesh57_skeleton'

Result: 7/7 passed, 0 failed (startup_mesh57_skeleton, three _hardware tests: draw, wave_shift, exchange, and three _warp tests). 0 failures (***), 0 capability skips (77).

  • startup_mesh57_skeleton_exchange_hardware (test 1479) prints adapter: NVIDIA GeForce RTX 3070 Ti, debug layer enabled and driver: 32.0.16.2101, then covered=259: ['debug_errors=0 debug_warnings=0'].

  • startup_mesh57_skeleton_draw_hardware (test 1476) does not print the adapter. Its five lines end in ['debug_errors=0 debug_warnings=0'], for example vertices=12 primitives=1 first=0 flags=[] covered=66. A direct run of the same command under the wrapper reports adapter=NVIDIA GeForce RTX 3070 Ti for its first offscreen_check call.

  • startup_mesh57_skeleton_wave_shift_hardware (test 1477) does not print the adapter. It prints:

    • d98327ecde9a6d5d.ms57.cso: 0 pixels differ from the reference
    • per-lane.cso: 66 pixels differ from the reference
    • per-lane.cso: 0 pixels differ from the reference

    The first line is the translated shader against the expected image. The second is a mutant that replaces the wave predicate (tid & ~63u) >= 6u with a per-lane (exec & 1) == 0, against the expected image (it must differ). The third is the same mutant against its per-lane CPU prediction (it must match).

To identify the adapter for wave_shift, I ran tests/startup_mesh57_skeleton_check.py shift ... hardware directly with the first offscreen_check call's stdout printed. That call reports backend=hardware debug_layer=enabled, adapter=NVIDIA GeForce RTX 3070 Ti vendor=10de device=2482, driver=32.0.16.2101 and debug_errors=0 debug_warnings=0. The debug line covers that first call only. The script then prints the same three lines and ok.

This run covers NVIDIA and WARP only. Not covered: any test outside the filter above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7176958569 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2601#issuecomment-7176958569). Originally posted by [Makto94](https://github.com/Makto94) on 2026-11-25T22:56:16Z. --- Additional hardware run at head `847109a2` (build exit code 0), with the debug layer enabled. The PR body reports an RTX 4060 run (7/7) without the desktop debug layer; this adds a second NVIDIA GPU with the layer on. Environment: NVIDIA GeForce RTX 3070 Ti, driver 32.0.16.2101 (NVIDIA 621.01) and Windows 11 Pro build 26300.9974 as reported by the system, `dev` preset (MSVC). The runs were serial (`-j1`). Command: `ctest --preset dev --no-tests=error -j1 -V -R '^startup_mesh57_skeleton'` Result: 7/7 passed, 0 failed (`startup_mesh57_skeleton`, three `_hardware` tests: `draw`, `wave_shift`, `exchange`, and three `_warp` tests). 0 failures (`***`), 0 capability skips (77). - `startup_mesh57_skeleton_exchange_hardware` (test 1479) prints `adapter: NVIDIA GeForce RTX 3070 Ti, debug layer enabled` and `driver: 32.0.16.2101`, then `covered=259: ['debug_errors=0 debug_warnings=0']`. - `startup_mesh57_skeleton_draw_hardware` (test 1476) does not print the adapter. Its five lines end in `['debug_errors=0 debug_warnings=0']`, for example `vertices=12 primitives=1 first=0 flags=[] covered=66`. A direct run of the same command under the wrapper reports `adapter=NVIDIA GeForce RTX 3070 Ti` for its first `offscreen_check` call. - `startup_mesh57_skeleton_wave_shift_hardware` (test 1477) does not print the adapter. It prints: - `d98327ecde9a6d5d.ms57.cso: 0 pixels differ from the reference` - `per-lane.cso: 66 pixels differ from the reference` - `per-lane.cso: 0 pixels differ from the reference` The first line is the translated shader against the expected image. The second is a mutant that replaces the wave predicate `(tid & ~63u) >= 6u` with a per-lane `(exec & 1) == 0`, against the expected image (it must differ). The third is the same mutant against its per-lane CPU prediction (it must match). To identify the adapter for `wave_shift`, I ran `tests/startup_mesh57_skeleton_check.py shift ... hardware` directly with the first `offscreen_check` call's stdout printed. That call reports `backend=hardware debug_layer=enabled`, `adapter=NVIDIA GeForce RTX 3070 Ti vendor=10de device=2482`, `driver=32.0.16.2101` and `debug_errors=0 debug_warnings=0`. The debug line covers that first call only. The script then prints the same three lines and `ok`. This run covers NVIDIA and WARP only. Not covered: any test outside the filter above.
tedin7 commented 2026-11-25 23:02:09 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T23:01:52Z.


Win2025 WARP receipt for head 847109a2.

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

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2): 0.36s (configure 0.00s)
    • Test (ctest --preset dev -R '^startup_mesh57_skeleton.*_warp$' --parallel 2 --no-tests=error --output-on-failure): 3/3 passed (2.73s: startup_mesh57_skeleton_wave_shift_warp 0.62s, startup_mesh57_skeleton_draw_warp 2.14s, startup_mesh57_skeleton_exchange_warp 1.87s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2): 2.74s (configure 0.00s)
    • Test (ctest --preset release -R '^startup_mesh57_skeleton.*_warp$' --parallel 2 --no-tests=error --output-on-failure): 3/3 passed (2.80s: startup_mesh57_skeleton_wave_shift_warp 0.53s, startup_mesh57_skeleton_draw_warp 2.09s, startup_mesh57_skeleton_exchange_warp 2.01s)
  • Windows Python checks: tests/mesh_heap_sampler_check.py ok (0.9s), tests/startup_buffer_address_check.py ok (0.6s), tests/startup_buffer_format_word3_table_check.py ok (0.1s), tests/startup_compute_request_offline_check.py ok (0.6s), tests/startup_compute_translate_check.py ok (0.3s), 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_bit_alu_check.py ok (0.9s), tests/startup_gfx2hlsl_capture_check.py ok (2.8s), tests/startup_gfx2hlsl_cmp16_check.py ok (1.9s), tests/startup_gfx2hlsl_compare_dst_check.py ok (0.2s), tests/startup_gfx2hlsl_compute_check.py ok (0.6s), tests/startup_gfx2hlsl_cselect_mask_check.py ok (0.1s), tests/startup_gfx2hlsl_cvt_alu_check.py ok (0.1s), tests/startup_gfx2hlsl_cvt_off_f32_i4_check.py ok (0.3s), tests/startup_gfx2hlsl_f32_lg_check.py ok (1.7s), tests/startup_gfx2hlsl_f32_nan_check.py ok (6.5s), 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_image_arity_check.py ok (0.1s), tests/startup_gfx2hlsl_image_get_lod_check.py ok (0.1s), 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_overwrite_check.py ok (0.1s), tests/startup_gfx2hlsl_operand_count_check.py ok (0.4s), tests/startup_gfx2hlsl_pack_absdiff_check.py ok (3.2s), 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.8s), tests/startup_gfx2hlsl_root_check.py ok (0.9s), tests/startup_gfx2hlsl_sad_check.py ok (0.5s), tests/startup_gfx2hlsl_saveexec_same_reg_check.py ok (0.3s), tests/startup_gfx2hlsl_scalar_arity_check.py ok (0.3s), 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_table_arity_check.py ok (0.3s), 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 (7.9s), tests/startup_gfx2hlsl_sopk_accum_check.py ok (1.2s), tests/startup_gfx2hlsl_sopk_signext_check.py ok (0.2s), tests/startup_gfx2hlsl_swap_check.py ok (0.4s), tests/startup_gfx2hlsl_vopc_sdwa_check.py ok (6.0s), tests/startup_gfx2hlsl_waitcnt_depctr_check.py ok (0.1s), tests/startup_gfx2hlsl_watch_check.py ok (2.8s), tests/startup_image_2d_array_check.py ok (0.2s), tests/startup_image_3d_check.py ok (0.1s), tests/startup_image_gather_lz_check.py ok (0.7s), tests/startup_image_load_d16_check.py ok (1.2s), 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.3s), tests/startup_image_sample_lod_check.py ok (0.8s), tests/startup_inline_sampler_check.py ok (0.2s), tests/startup_mesh57_skeleton_check.py ok (0.5s), tests/startup_run_ps1_check.py ok (14.0s), 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.5s), tests/startup_smem_address_check.py ok (0.1s), tests/startup_stream_fetch_check.py ok (0.3s), tests/startup_stream_interface_check.py ok (0.6s), tests/startup_translator_check.py ok (0.6s)
  • sccache: 12/134 hits; wall 82.7s

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7177065512 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2601#issuecomment-7177065512). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T23:01:52Z. --- Win2025 WARP receipt for head 847109a2. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `847109a227fd5ecb91aed81d1ea1ddf86a712483`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2`): `0.36s` (configure `0.00s`) - Test (`ctest --preset dev -R '^startup_mesh57_skeleton.*_warp$' --parallel 2 --no-tests=error --output-on-failure`): **3/3 passed** (`2.73s`: `startup_mesh57_skeleton_wave_shift_warp` `0.62s`, `startup_mesh57_skeleton_draw_warp` `2.14s`, `startup_mesh57_skeleton_exchange_warp` `1.87s`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2`): `2.74s` (configure `0.00s`) - Test (`ctest --preset release -R '^startup_mesh57_skeleton.*_warp$' --parallel 2 --no-tests=error --output-on-failure`): **3/3 passed** (`2.80s`: `startup_mesh57_skeleton_wave_shift_warp` `0.53s`, `startup_mesh57_skeleton_draw_warp` `2.09s`, `startup_mesh57_skeleton_exchange_warp` `2.01s`) - **Windows Python checks**: `tests/mesh_heap_sampler_check.py` ok (`0.9s`), `tests/startup_buffer_address_check.py` ok (`0.6s`), `tests/startup_buffer_format_word3_table_check.py` ok (`0.1s`), `tests/startup_compute_request_offline_check.py` ok (`0.6s`), `tests/startup_compute_translate_check.py` ok (`0.3s`), `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_bit_alu_check.py` ok (`0.9s`), `tests/startup_gfx2hlsl_capture_check.py` ok (`2.8s`), `tests/startup_gfx2hlsl_cmp16_check.py` ok (`1.9s`), `tests/startup_gfx2hlsl_compare_dst_check.py` ok (`0.2s`), `tests/startup_gfx2hlsl_compute_check.py` ok (`0.6s`), `tests/startup_gfx2hlsl_cselect_mask_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_cvt_alu_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_cvt_off_f32_i4_check.py` ok (`0.3s`), `tests/startup_gfx2hlsl_f32_lg_check.py` ok (`1.7s`), `tests/startup_gfx2hlsl_f32_nan_check.py` ok (`6.5s`), `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_image_arity_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_image_get_lod_check.py` ok (`0.1s`), `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_overwrite_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_operand_count_check.py` ok (`0.4s`), `tests/startup_gfx2hlsl_pack_absdiff_check.py` ok (`3.2s`), `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.8s`), `tests/startup_gfx2hlsl_root_check.py` ok (`0.9s`), `tests/startup_gfx2hlsl_sad_check.py` ok (`0.5s`), `tests/startup_gfx2hlsl_saveexec_same_reg_check.py` ok (`0.3s`), `tests/startup_gfx2hlsl_scalar_arity_check.py` ok (`0.3s`), `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_table_arity_check.py` ok (`0.3s`), `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 (`7.9s`), `tests/startup_gfx2hlsl_sopk_accum_check.py` ok (`1.2s`), `tests/startup_gfx2hlsl_sopk_signext_check.py` ok (`0.2s`), `tests/startup_gfx2hlsl_swap_check.py` ok (`0.4s`), `tests/startup_gfx2hlsl_vopc_sdwa_check.py` ok (`6.0s`), `tests/startup_gfx2hlsl_waitcnt_depctr_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_watch_check.py` ok (`2.8s`), `tests/startup_image_2d_array_check.py` ok (`0.2s`), `tests/startup_image_3d_check.py` ok (`0.1s`), `tests/startup_image_gather_lz_check.py` ok (`0.7s`), `tests/startup_image_load_d16_check.py` ok (`1.2s`), `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.3s`), `tests/startup_image_sample_lod_check.py` ok (`0.8s`), `tests/startup_inline_sampler_check.py` ok (`0.2s`), `tests/startup_mesh57_skeleton_check.py` ok (`0.5s`), `tests/startup_run_ps1_check.py` ok (`14.0s`), `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.5s`), `tests/startup_smem_address_check.py` ok (`0.1s`), `tests/startup_stream_fetch_check.py` ok (`0.3s`), `tests/startup_stream_interface_check.py` ok (`0.6s`), `tests/startup_translator_check.py` ok (`0.6s`) - `sccache`: 12/134 hits; wall `82.7s` AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-26 00:00:53 +00:00
ChazY11 commented 2026-11-26 00:01:09 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-25T23:06:09Z.


Post-merge audit of cece3a36: six mutations, four caught — and the two survivors are the emitted wave predicate, which the fixture never looks at

python -B tests/startup_mesh57_skeleton_check.py   → ok

The change lets a scalar shift survive a wave64 EXEC-zero branch, but only under a proof: the branch must be the first one
after the count block, its target exactly two instructions later, the next instruction an s_lshl_b32, the target a full
s_mov_b64 exec, -1, and immediately before it a v_cmp_gt_u32_e32 vcc_lo, <limit>, v<thread> whose mask is the branch
itself. If all of that holds, the branch is re-emitted as (tid & ~63u) >= <limit>.

mutation caught
the target offset source + 2 → source + 3 caught
the next instruction no longer required to be s_lshl_b32 caught
the restore no longer required to be s_mov_b64 exec, -1 caught
the compare's thread register no longer checked against thread caught
the wave predicate no longer rewritten (term = ('branch', '(tid & ~63u) >= N', …) → pass) survived
cond_uniform no longer accepts off in wave_limits survived

The four catches are the proof's structural conditions, and each has a refusal case in the fixture. That is the part that
matters for correctness of the decision.

The two survivors are the same gap: the emitted text is unconstrained

Both of them change what gets emitted, not whether the shape is accepted:

  • replacing the rewritten term with pass leaves the branch as the original guest condition instead of
    (tid & ~63u) >= <limit>. The skeleton still accepts, the HLSL still compiles, and the guest lane mask is simply
    wrong — a scalar shift proceeds on lanes it should not.
  • dropping or off in wave_limits from cond_uniform demotes the branch back to divergent, which changes the shape of
    the emitted control flow.

The fixture asserts the refusal messages (seven of them, quoted by text) and that the accepted shape translates; it does
not compare the emitted predicate or the block's uniformity. So a regression in either would pass CI.

The cheap fix is to assert the translated text for the accepted case contains (tid & ~63u) >= <the limit from the compare> — the same way startup_gfx2hlsl_sload_s104_check.py asserts u('vcc_lo') == 'vcc' for its accepted case.

Note on one of my own rows

My first attempt at the target-offset mutation was a no-op: I wrote the same string for both sides of the replacement, so
ReplOnce returned unchanged text and the row read as "survived". Re-run with source + 2 → source + 3 it is caught.
The table above reports the corrected row; the earlier no-op said nothing about this PR.

AI-assisted; pure Python, Windows 11 build 26300, no DXC or GPU for the rows above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7177148290 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2601#issuecomment-7177148290). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-25T23:06:09Z. --- ## Post-merge audit of `cece3a36`: six mutations, four caught — and the two survivors are the emitted wave predicate, which the fixture never looks at ```text python -B tests/startup_mesh57_skeleton_check.py → ok ``` The change lets a scalar shift survive a wave64 EXEC-zero branch, but only under a proof: the branch must be the first one after the count block, its target exactly two instructions later, the next instruction an `s_lshl_b32`, the target a full `s_mov_b64 exec, -1`, and immediately before it a `v_cmp_gt_u32_e32 vcc_lo, <limit>, v<thread>` whose mask is the branch itself. If all of that holds, the branch is re-emitted as `(tid & ~63u) >= <limit>`. | mutation | caught | |---|---| | the target offset `source + 2` → `source + 3` | **caught** | | the next instruction no longer required to be `s_lshl_b32` | **caught** | | the restore no longer required to be `s_mov_b64 exec, -1` | **caught** | | the compare's thread register no longer checked against `thread` | **caught** | | the wave predicate no longer rewritten (`term = ('branch', '(tid & ~63u) >= N', …)` → `pass`) | survived | | `cond_uniform` no longer accepts `off in wave_limits` | survived | The four catches are the proof's structural conditions, and each has a refusal case in the fixture. That is the part that matters for correctness of the *decision*. ### The two survivors are the same gap: the emitted text is unconstrained Both of them change what gets **emitted**, not whether the shape is accepted: - replacing the rewritten term with `pass` leaves the branch as the original guest condition instead of `(tid & ~63u) >= <limit>`. The skeleton still accepts, the HLSL still compiles, and the guest lane mask is simply wrong — a scalar shift proceeds on lanes it should not. - dropping `or off in wave_limits` from `cond_uniform` demotes the branch back to divergent, which changes the shape of the emitted control flow. The fixture asserts the *refusal messages* (seven of them, quoted by text) and that the accepted shape translates; it does not compare the emitted predicate or the block's uniformity. So a regression in either would pass CI. The cheap fix is to assert the translated text for the accepted case contains `(tid & ~63u) >= <the limit from the compare>` — the same way `startup_gfx2hlsl_sload_s104_check.py` asserts `u('vcc_lo') == 'vcc'` for its accepted case. ### Note on one of my own rows My first attempt at the target-offset mutation was a no-op: I wrote the same string for both sides of the replacement, so `ReplOnce` returned unchanged text and the row read as "survived". Re-run with `source + 2` → `source + 3` it is caught. The table above reports the corrected row; the earlier no-op said nothing about this PR. AI-assisted; pure Python, Windows 11 build 26300, no DXC or GPU for the rows above.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!2593
No description provided.