startup: accept the structured-to-raw descriptor conversion for vertex buffer stores #2562

Merged
NiiRoZz merged 2 commits from upstream-pr/2570 into main 2026-11-25 21:34:57 +00:00
NiiRoZz commented 2026-11-25 21:24:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T21:24:54Z.


What

No affected request translates end to end yet: all 32 now pass the store and stop at a later vertex-stage
instruction (s_load with a register offset through ('resheap',)).

op_buffer_store_vs refused every vertex-stage buffer store whose descriptor was modified before the store
(buffer store through a modified descriptor). All refused local graphics requests of this kind (32: 19 base
requests and 13 render-target variants of the same programs) use one modification form, the clamped
structured-to-raw conversion that #2546 accepts for compute stores:

s_bfe_u32 sA, sD1, 0xe0010       ; stride DW1[29:16]
s_max_u32 sA, sA, 1              ; at least 1
s_and_b32 sD1, sD1, 0xc000ffff   ; clear the stride
s_and_b32 sD3, sD3, 0xcfffffff   ; clear OOB_SELECT DW3[29:28]
s_mul_i32 sD2, sD2, sA           ; NUM_RECORDS in bytes
s_or_b32  sD3, sD3, 0x30000000   ; OOB_SELECT = 3 (raw)
buffer_store_dwordx3 v[1:3], off, s[D0:D3], sOff

The vertex stage now recognizes the same word expressions (raw_descriptor_alu) and, when the store
descriptor is marked modified, checks it with the compute helper (store_descriptor with the stride clear and
the raw conversion allowed). All four words must come from one descriptor load. The emitted store and the
manifest are those of the unmodified descriptor. Stores through an unmodified descriptor keep the existing path.
The stride clear alone (#2320) is accepted too, because the compute helper admits it; no captured vertex program
uses it, and it has its own positive case.

As in the compute stage (second commit of #2546), a descriptor load through a pointer other than the untouched
pair is now tagged with its own load in the vertex stage too, so the conversion cannot take NUM_RECORDS from one
load and the stride from another. Graphics pipelines now keep the other_modified set, as compute pipelines do.

Why it is correct

The store is the off form (no idxen, no offen): the address is base + soffset + immediate whatever the
stride. The conversion only changes the range check (stride 0, NUM_RECORDS in bytes, raw OOB_SELECT), and the
translation does not model the range check for any vertex store. So the HLSL equals the plain store's, as in
compute. Field positions follow docs/pixel_mubuf_contract.md.

Tests

python -B tests/startup_gfx2hlsl_buffer_store_check.py      -> ok (36 checks)
every other tests/*.py that imports gfx2hlsl (103 files)    -> 94 pass; 9 exit 1 identically on unmodified
    main because they need arguments or build outputs (address_srv, d16_srv, draw_depth_target,
    logical_view, r8_uint, stream, stream_rasterizer, stream_viewport, vertex_fetch_formats)
python -B tests/startup_gfx2hlsl_compute_check.py           -> pass
python -B tests/startup_gfx2hlsl_sload_const_offset_check.py -> 0 failed
python -B tests/startup_buffer_address_check.py             -> passed
python -B tests/startup_smem_address_check.py               -> passed
python -B tests/startup_translator_check.py                 -> 0 failed
python -B tests/startup_gfx2hlsl_smem_offset_check.py       -> 0 failed
python -B tests/startup_stream_fetch_check.py               -> pass
python -B tests/docs_links_check.py                         -> pass
python -B tests/bidi_controls_check.py                      -> pass
git diff --check                                            -> clean

New cases in startup_gfx2hlsl_buffer_store_check.py (source-built instruction words, decoded and checked
against the captured spelling):

  • Positive: the clamped conversion, the unclamped conversion and the stride clear give the same HLSL and
    manifest as the plain store. With the table high word set to 0 as captured programs do, a stride taken from a
    second load through the same untouched pointer is accepted with the same HLSL.
  • Negative controls, each refused with buffer store through a modified descriptor: clamp of 2, NUM_RECORDS
    not scaled, NUM_RECORDS scaled by a constant, OOB_SELECT 2, stride not cleared, another bit field
    (0xe0011), and the stride or NUM_RECORDS taken from a second load after s_add_u32 on the table pointer.
    The last two pass (wrongly accepted) when the vertex-stage load tag is reverted, so they test that tag.
  • The existing refusal for a changed base address is unchanged.

Local measurement (offline translation of the affected requests only, 4 workers): before, 32/32 refused at
buffer store through a modified descriptor; after, 0 refused there. All 32 now stop at a later instruction:
s_load with a register offset through ('resheap',) (32). No translation completes yet.

What stays unverified (AI-assisted change)

  • No GPU or runtime run: the runtime still rejects version 2 manifests and uav lines, so no translated vertex
    store runs. Matching out-of-range behavior would need a UAV view sized to the converted byte count.
  • The load tag now also applies to vertex-stage descriptor loads. Loads through a 32-bit table pointer whose
    high word is a known constant (the captured pattern) share one tag, so equal loads still merge at joins.
    Loads through a moved pointer or an unknown high word get a per-instruction tag: equal loads of those at
    different instructions on two branch arms are no longer kept at the join (as in compute). The wider graphics
    corpus was not re-measured.
  • A conversion done entirely on a load through a moved pointer would still report the plain table offset in its
    uav line, as the unmodified vertex store already does.
  • No cache revision bump (as in #2546): earlier failures were refusals, not translations.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6614055250 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2570). Originally posted by [NiiRoZz](https://github.com/NiiRoZz) on 2026-11-25T21:24:54Z. --- ### What No affected request translates end to end yet: all 32 now pass the store and stop at a later vertex-stage instruction (`s_load with a register offset through ('resheap',)`). `op_buffer_store_vs` refused every vertex-stage buffer store whose descriptor was modified before the store (`buffer store through a modified descriptor`). All refused local graphics requests of this kind (32: 19 base requests and 13 render-target variants of the same programs) use one modification form, the clamped structured-to-raw conversion that #2546 accepts for compute stores: ``` s_bfe_u32 sA, sD1, 0xe0010 ; stride DW1[29:16] s_max_u32 sA, sA, 1 ; at least 1 s_and_b32 sD1, sD1, 0xc000ffff ; clear the stride s_and_b32 sD3, sD3, 0xcfffffff ; clear OOB_SELECT DW3[29:28] s_mul_i32 sD2, sD2, sA ; NUM_RECORDS in bytes s_or_b32 sD3, sD3, 0x30000000 ; OOB_SELECT = 3 (raw) buffer_store_dwordx3 v[1:3], off, s[D0:D3], sOff ``` The vertex stage now recognizes the same word expressions (`raw_descriptor_alu`) and, when the store descriptor is marked modified, checks it with the compute helper (`store_descriptor` with the stride clear and the raw conversion allowed). All four words must come from one descriptor load. The emitted store and the manifest are those of the unmodified descriptor. Stores through an unmodified descriptor keep the existing path. The stride clear alone (#2320) is accepted too, because the compute helper admits it; no captured vertex program uses it, and it has its own positive case. As in the compute stage (second commit of #2546), a descriptor load through a pointer other than the untouched pair is now tagged with its own load in the vertex stage too, so the conversion cannot take NUM_RECORDS from one load and the stride from another. Graphics pipelines now keep the `other_modified` set, as compute pipelines do. ### Why it is correct The store is the `off` form (no `idxen`, no `offen`): the address is base + soffset + immediate whatever the stride. The conversion only changes the range check (stride 0, NUM_RECORDS in bytes, raw OOB_SELECT), and the translation does not model the range check for any vertex store. So the HLSL equals the plain store's, as in compute. Field positions follow docs/pixel_mubuf_contract.md. ### Tests ``` python -B tests/startup_gfx2hlsl_buffer_store_check.py -> ok (36 checks) every other tests/*.py that imports gfx2hlsl (103 files) -> 94 pass; 9 exit 1 identically on unmodified main because they need arguments or build outputs (address_srv, d16_srv, draw_depth_target, logical_view, r8_uint, stream, stream_rasterizer, stream_viewport, vertex_fetch_formats) python -B tests/startup_gfx2hlsl_compute_check.py -> pass python -B tests/startup_gfx2hlsl_sload_const_offset_check.py -> 0 failed python -B tests/startup_buffer_address_check.py -> passed python -B tests/startup_smem_address_check.py -> passed python -B tests/startup_translator_check.py -> 0 failed python -B tests/startup_gfx2hlsl_smem_offset_check.py -> 0 failed python -B tests/startup_stream_fetch_check.py -> pass python -B tests/docs_links_check.py -> pass python -B tests/bidi_controls_check.py -> pass git diff --check -> clean ``` New cases in `startup_gfx2hlsl_buffer_store_check.py` (source-built instruction words, decoded and checked against the captured spelling): - Positive: the clamped conversion, the unclamped conversion and the stride clear give the same HLSL and manifest as the plain store. With the table high word set to 0 as captured programs do, a stride taken from a second load through the same untouched pointer is accepted with the same HLSL. - Negative controls, each refused with `buffer store through a modified descriptor`: clamp of 2, NUM_RECORDS not scaled, NUM_RECORDS scaled by a constant, OOB_SELECT 2, stride not cleared, another bit field (0xe0011), and the stride or NUM_RECORDS taken from a second load after `s_add_u32` on the table pointer. The last two pass (wrongly accepted) when the vertex-stage load tag is reverted, so they test that tag. - The existing refusal for a changed base address is unchanged. Local measurement (offline translation of the affected requests only, 4 workers): before, 32/32 refused at `buffer store through a modified descriptor`; after, 0 refused there. All 32 now stop at a later instruction: `s_load with a register offset through ('resheap',)` (32). No translation completes yet. ### What stays unverified (AI-assisted change) - No GPU or runtime run: the runtime still rejects version 2 manifests and `uav` lines, so no translated vertex store runs. Matching out-of-range behavior would need a UAV view sized to the converted byte count. - The load tag now also applies to vertex-stage descriptor loads. Loads through a 32-bit table pointer whose high word is a known constant (the captured pattern) share one tag, so equal loads still merge at joins. Loads through a moved pointer or an unknown high word get a per-instruction tag: equal loads of those at different instructions on two branch arms are no longer kept at the join (as in compute). The wider graphics corpus was not re-measured. - A conversion done entirely on a load through a moved pointer would still report the plain table offset in its `uav` line, as the unmodified vertex store already does. - No cache revision bump (as in #2546): earlier failures were refusals, not translations. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-25 22:02:09 +00:00
tedin7 commented 2026-11-25 22:02:09 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T21:26:38Z.

Review: COMMENTED


Review of head dde87eec (comment only, no game run, Linux checks only).

Result: sound, no blocking findings.

  • Change: the vertex-stage buffer store now accepts the same descriptor edits the compute store accepts (stride clear, structured-to-raw conversion) by calling store_descriptor(..., stride0_ok=True, raw_conversion_ok=True) (tools/startup/gfx2hlsl.py, op_buffer_store_vs). raw_descriptor_alu and the load tag are extended from cs to cs/vs. other_modified is initialised in Pipeline.__init__, so unproved descriptor writes still refuse.
  • Tests: the new cases in tests/startup_gfx2hlsl_buffer_store_check.py cover the three accepted forms (HLSL and manifest equal to the plain store), a second load through the same untouched pointer, and 8 refusal controls.
  • Sibling check: the compute path and the vertex path now share the same helper; no other table needed an edit. No other open or merged PR covers this slice (searched vertex buffer store descriptor conversion; #2069 is a different pointer-propagation item).
  • Scope: offline translation only; the docs state the runtime still refuses version 2 manifests. No startup claim is made, so none is judged here.

Commands run locally:

  • python3 tests/startup_gfx2hlsl_buffer_store_check.py -> all ok
  • python3 tests/docs_links_check.py -> ok (488 links)
  • python3 tests/bidi_controls_check.py -> ok
  • git diff --check origin/main...HEAD -> clean
  • Mutation 1: raw_conversion_ok=True -> False in the vertex store call: the new test fails.
  • Mutation 2: drop 'vs' from the raw_descriptor_alu condition: 4 conversion tests fail.
  • Mutation 3: drop 'vs' from the load-tag condition: both "after a pointer add" refusal tests fail.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6065205859 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2570#pullrequestreview-6065205859). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T21:26:38Z. **Review:** COMMENTED --- Review of head dde87eec (comment only, no game run, Linux checks only). Result: sound, no blocking findings. - Change: the vertex-stage buffer store now accepts the same descriptor edits the compute store accepts (stride clear, structured-to-raw conversion) by calling `store_descriptor(..., stride0_ok=True, raw_conversion_ok=True)` (`tools/startup/gfx2hlsl.py`, `op_buffer_store_vs`). `raw_descriptor_alu` and the load tag are extended from `cs` to `cs`/`vs`. `other_modified` is initialised in `Pipeline.__init__`, so unproved descriptor writes still refuse. - Tests: the new cases in `tests/startup_gfx2hlsl_buffer_store_check.py` cover the three accepted forms (HLSL and manifest equal to the plain store), a second load through the same untouched pointer, and 8 refusal controls. - Sibling check: the compute path and the vertex path now share the same helper; no other table needed an edit. No other open or merged PR covers this slice (searched `vertex buffer store descriptor conversion`; #2069 is a different pointer-propagation item). - Scope: offline translation only; the docs state the runtime still refuses version 2 manifests. No startup claim is made, so none is judged here. Commands run locally: - `python3 tests/startup_gfx2hlsl_buffer_store_check.py` -> all ok - `python3 tests/docs_links_check.py` -> ok (488 links) - `python3 tests/bidi_controls_check.py` -> ok - `git diff --check origin/main...HEAD` -> clean - Mutation 1: `raw_conversion_ok=True` -> `False` in the vertex store call: the new test fails. - Mutation 2: drop `'vs'` from the `raw_descriptor_alu` condition: 4 conversion tests fail. - Mutation 3: drop `'vs'` from the load-tag condition: both "after a pointer add" refusal tests fail. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 22:02:20 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T21:34:47Z.


Win2025 WARP receipt for head 78a85ed0 after updating with main.

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

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2): 0.24s (configure 0.00s)
    • Test (ctest --preset dev -R '^startup_gfx2hlsl_buffer_store$' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (0.62s: startup_gfx2hlsl_buffer_store 0.49s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2): 0.63s (configure 0.00s)
    • Test (ctest --preset release -R '^startup_gfx2hlsl_buffer_store$' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (0.58s: startup_gfx2hlsl_buffer_store 0.46s)
  • Windows Python checks: tests/mesh_heap_sampler_check.py ok (0.7s), tests/startup_buffer_address_check.py ok (0.4s), tests/startup_buffer_format_word3_table_check.py ok (0.1s), tests/startup_compute_request_offline_check.py ok (0.5s), 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.2s), tests/startup_gfx2hlsl_bit_alu_check.py ok (0.6s), tests/startup_gfx2hlsl_capture_check.py ok (1.0s), tests/startup_gfx2hlsl_cmp16_check.py ok (0.2s), 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.1s), tests/startup_gfx2hlsl_cvt_off_f32_i4_check.py ok (0.1s), tests/startup_gfx2hlsl_f32_lg_check.py ok (1.2s), tests/startup_gfx2hlsl_f32_nan_check.py ok (4.7s), 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_join_symbols_check.py ok (0.2s), 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.3s), tests/startup_gfx2hlsl_pack_absdiff_check.py ok (2.3s), 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_sad_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_table_arity_check.py ok (0.3s), 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.1s), 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.3s), tests/startup_gfx2hlsl_sopk_accum_check.py ok (0.8s), tests/startup_gfx2hlsl_sopk_signext_check.py ok (0.1s), tests/startup_gfx2hlsl_swap_check.py ok (0.3s), tests/startup_gfx2hlsl_vopc_sdwa_check.py ok (4.1s), 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.2s), 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.1s), tests/startup_image_sample_b_check.py ok (0.1s), 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.6s), tests/startup_inline_sampler_check.py ok (0.2s), tests/startup_mesh57_skeleton_check.py ok (0.2s), tests/startup_run_ps1_check.py ok (9.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 (1.6s), 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.4s)
  • sccache: -13/-1186 hits; wall 52.7s

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7175264364 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2570#issuecomment-7175264364). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T21:34:47Z. --- Win2025 WARP receipt for head 78a85ed0 after updating with main. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `78a85ed08325f2de7e37656bc129ad78eaf69629`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2`): `0.24s` (configure `0.00s`) - Test (`ctest --preset dev -R '^startup_gfx2hlsl_buffer_store$' --parallel 2 --no-tests=error --output-on-failure`): **1/1 passed** (`0.62s`: `startup_gfx2hlsl_buffer_store` `0.49s`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2`): `0.63s` (configure `0.00s`) - Test (`ctest --preset release -R '^startup_gfx2hlsl_buffer_store$' --parallel 2 --no-tests=error --output-on-failure`): **1/1 passed** (`0.58s`: `startup_gfx2hlsl_buffer_store` `0.46s`) - **Windows Python checks**: `tests/mesh_heap_sampler_check.py` ok (`0.7s`), `tests/startup_buffer_address_check.py` ok (`0.4s`), `tests/startup_buffer_format_word3_table_check.py` ok (`0.1s`), `tests/startup_compute_request_offline_check.py` ok (`0.5s`), `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.2s`), `tests/startup_gfx2hlsl_bit_alu_check.py` ok (`0.6s`), `tests/startup_gfx2hlsl_capture_check.py` ok (`1.0s`), `tests/startup_gfx2hlsl_cmp16_check.py` ok (`0.2s`), `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.1s`), `tests/startup_gfx2hlsl_cvt_off_f32_i4_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_f32_lg_check.py` ok (`1.2s`), `tests/startup_gfx2hlsl_f32_nan_check.py` ok (`4.7s`), `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_join_symbols_check.py` ok (`0.2s`), `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.3s`), `tests/startup_gfx2hlsl_pack_absdiff_check.py` ok (`2.3s`), `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_sad_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_table_arity_check.py` ok (`0.3s`), `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.1s`), `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.3s`), `tests/startup_gfx2hlsl_sopk_accum_check.py` ok (`0.8s`), `tests/startup_gfx2hlsl_sopk_signext_check.py` ok (`0.1s`), `tests/startup_gfx2hlsl_swap_check.py` ok (`0.3s`), `tests/startup_gfx2hlsl_vopc_sdwa_check.py` ok (`4.1s`), `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.2s`), `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.1s`), `tests/startup_image_sample_b_check.py` ok (`0.1s`), `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.6s`), `tests/startup_inline_sampler_check.py` ok (`0.2s`), `tests/startup_mesh57_skeleton_check.py` ok (`0.2s`), `tests/startup_run_ps1_check.py` ok (`9.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 (`1.6s`), `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.4s`) - `sccache`: -13/-1186 hits; wall `52.7s` AI-assisted; commands listed were executed locally.
ChazY11 commented 2026-11-25 22:02:20 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-25T21:37:02Z.


Post-merge audit of b0eb6faa: eight mutations of the structured-to-raw recognizer, all caught

Reading this as a coverage statement about main, not a review request.

python -B tests/startup_gfx2hlsl_buffer_store_check.py    → ok
startup_gfx2hlsl_* family: 77 checks, 0 red on current main

The recognizer (gfx2hlsl.py:731) is a symbolic matcher: it names a descriptor word only when the exact instruction and
constant that produced it appear. That is the easiest kind of code to get subtly wrong — one digit in a mask and the
match silently never fires, keeping every refusal in place and quietly refusing work that should be accepted. So I mutated
the constants themselves.

mutation caught
stride bitfield constant 0xe0010 → 0xe000f (s_bfe_u32) caught
stride-clear mask 0xc000ffff → 0xc000fff0 caught
OOB-clear mask 0xcfffffff → 0xcffffff0 caught
OOB_SET constant 0x300000 → 0x300001 (s_or_b32) caught
stride floor constant 1 → 0 (s_max_u32) caught
byte_count source instruction s_mul_i32 → s_mul_u32 caught
the compute load tag degrades (loaded = 5 … → loaded = 4) caught

All seven are caught by the one fixture, which means the fixture assembles every one of these word expressions and
asserts the resulting classification rather than only the final verdict. The last row is the one I care most about: the
loaded distinction is what separates "a descriptor word read by one s_load" from "a descriptor word read by one
s_load and tagged with the compute load ordinal". Collapsing it would let a compute tag masquerade as a plain read,
and dropping it from the recognizer makes plain true for tagged words — the fixture notices.

One number worth recording

startup_gfx2hlsl_* is now 77 checks, all green on this commit. I run the whole family each round before touching
anything, so a survivor I report later cannot be a family-wide breakage I failed to notice.

Method note that applies to anyone patching this file

tools/startup/gfx2hlsl.py is CRLF. Two of my anchors missed on the first pass purely because of that (and one because I
had quoted the source line from memory rather than from the file) — a \n anchor never matches and the "anchor miss"
looks exactly like a mutation that was caught by nothing. Splice with the read-\r\n→\n, patch, write-back-\r\n
dance and print the anchor miss explicitly, as I do here.

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

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7175315804 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2570#issuecomment-7175315804). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-25T21:37:02Z. --- ## Post-merge audit of `b0eb6faa`: eight mutations of the structured-to-raw recognizer, all caught Reading this as a coverage statement about `main`, not a review request. ```text python -B tests/startup_gfx2hlsl_buffer_store_check.py → ok startup_gfx2hlsl_* family: 77 checks, 0 red on current main ``` The recognizer (`gfx2hlsl.py:731`) is a symbolic matcher: it names a descriptor word only when the exact instruction and constant that produced it appear. That is the easiest kind of code to get subtly wrong — one digit in a mask and the match silently never fires, keeping every refusal in place and quietly refusing work that should be accepted. So I mutated the constants themselves. | mutation | caught | |---|---| | stride bitfield constant `0xe0010` → `0xe000f` (`s_bfe_u32`) | **caught** | | stride-clear mask `0xc000ffff` → `0xc000fff0` | **caught** | | OOB-clear mask `0xcfffffff` → `0xcffffff0` | **caught** | | OOB_SET constant `0x300000` → `0x300001` (`s_or_b32`) | **caught** | | stride floor constant `1` → `0` (`s_max_u32`) | **caught** | | byte_count source instruction `s_mul_i32` → `s_mul_u32` | **caught** | | the compute load tag degrades (`loaded = 5 …` → `loaded = 4`) | **caught** | All seven are caught by the one fixture, which means the fixture assembles every one of these word expressions and asserts the resulting classification rather than only the final verdict. The last row is the one I care most about: the `loaded` distinction is what separates "a descriptor word read by one `s_load`" from "a descriptor word read by one `s_load` **and tagged with the compute load ordinal**". Collapsing it would let a compute tag masquerade as a plain read, and dropping it from the recognizer makes `plain` true for tagged words — the fixture notices. ### One number worth recording `startup_gfx2hlsl_*` is now **77 checks, all green** on this commit. I run the whole family each round before touching anything, so a survivor I report later cannot be a family-wide breakage I failed to notice. ### Method note that applies to anyone patching this file `tools/startup/gfx2hlsl.py` is CRLF. Two of my anchors missed on the first pass purely because of that (and one because I had quoted the source line from memory rather than from the file) — a `\n` anchor never matches and the "anchor miss" looks exactly like a mutation that was caught by nothing. Splice with the read-`\r\n`→`\n`, patch, write-back-`\r\n` dance and print the anchor miss explicitly, as I do here. 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!2562
No description provided.