startup: accept the structured-to-raw descriptor conversion for vertex buffer stores #2562
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2570"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by 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_vsrefused 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 baserequests 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:
The vertex stage now recognizes the same word expressions (
raw_descriptor_alu) and, when the storedescriptor is marked modified, checks it with the compute helper (
store_descriptorwith the stride clear andthe 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_modifiedset, as compute pipelines do.Why it is correct
The store is the
offform (noidxen, nooffen): the address is base + soffset + immediate whatever thestride. 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
New cases in
startup_gfx2hlsl_buffer_store_check.py(source-built instruction words, decoded and checkedagainst the captured spelling):
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.
buffer store through a modified descriptor: clamp of 2, NUM_RECORDSnot 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_u32on the table pointer.The last two pass (wrongly accepted) when the vertex-stage load tag is reverted, so they test that tag.
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)
uavlines, so no translated vertexstore runs. Matching out-of-range behavior would need a UAV view sized to the converted byte count.
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.
uavline, as the unmodified vertex store already does.🤖 Generated with Claude Code
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.
store_descriptor(..., stride0_ok=True, raw_conversion_ok=True)(tools/startup/gfx2hlsl.py,op_buffer_store_vs).raw_descriptor_aluand the load tag are extended fromcstocs/vs.other_modifiedis initialised inPipeline.__init__, so unproved descriptor writes still refuse.tests/startup_gfx2hlsl_buffer_store_check.pycover the three accepted forms (HLSL and manifest equal to the plain store), a second load through the same untouched pointer, and 8 refusal controls.vertex buffer store descriptor conversion; #2069 is a different pointer-propagation item).Commands run locally:
python3 tests/startup_gfx2hlsl_buffer_store_check.py-> all okpython3 tests/docs_links_check.py-> ok (488 links)python3 tests/bidi_controls_check.py-> okgit diff --check origin/main...HEAD-> cleanraw_conversion_ok=True->Falsein the vertex store call: the new test fails.'vs'from theraw_descriptor_alucondition: 4 conversion tests fail.'vs'from the load-tag condition: both "after a pointer add" refusal tests fail.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T21:34:47Z.
Win2025 WARP receipt for head
78a85ed0after updating with main.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
78a85ed08325f2de7e37656bc129ad78eaf69629:--preset dev):cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2):0.24s(configure0.00s)ctest --preset dev -R '^startup_gfx2hlsl_buffer_store$' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (0.62s:startup_gfx2hlsl_buffer_store0.49s)/O2(--preset release):cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2):0.63s(configure0.00s)ctest --preset release -R '^startup_gfx2hlsl_buffer_store$' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (0.58s:startup_gfx2hlsl_buffer_store0.46s)tests/mesh_heap_sampler_check.pyok (0.7s),tests/startup_buffer_address_check.pyok (0.4s),tests/startup_buffer_format_word3_table_check.pyok (0.1s),tests/startup_compute_request_offline_check.pyok (0.5s),tests/startup_compute_translate_check.pyok (0.2s),tests/startup_flat_param_check.pyok (0.1s),tests/startup_gfx2hlsl_add_sub_co_check.pyok (0.1s),tests/startup_gfx2hlsl_add_sub_co_ci_check.pyok (0.2s),tests/startup_gfx2hlsl_bit_alu_check.pyok (0.6s),tests/startup_gfx2hlsl_capture_check.pyok (1.0s),tests/startup_gfx2hlsl_cmp16_check.pyok (0.2s),tests/startup_gfx2hlsl_compare_dst_check.pyok (0.1s),tests/startup_gfx2hlsl_compute_check.pyok (0.4s),tests/startup_gfx2hlsl_cselect_mask_check.pyok (0.1s),tests/startup_gfx2hlsl_cvt_alu_check.pyok (0.1s),tests/startup_gfx2hlsl_cvt_off_f32_i4_check.pyok (0.1s),tests/startup_gfx2hlsl_f32_lg_check.pyok (1.2s),tests/startup_gfx2hlsl_f32_nan_check.pyok (4.7s),tests/startup_gfx2hlsl_fma_mix_check.pyok (0.1s),tests/startup_gfx2hlsl_getpc_refusal_check.pyok (0.1s),tests/startup_gfx2hlsl_handler_arity_check.pyok (0.1s),tests/startup_gfx2hlsl_image_arity_check.pyok (0.1s),tests/startup_gfx2hlsl_image_get_lod_check.pyok (0.1s),tests/startup_gfx2hlsl_int_med3_check.pyok (0.1s),tests/startup_gfx2hlsl_join_symbols_check.pyok (0.2s),tests/startup_gfx2hlsl_loop_constants_check.pyok (0.1s),tests/startup_gfx2hlsl_mask_overwrite_check.pyok (0.1s),tests/startup_gfx2hlsl_operand_count_check.pyok (0.3s),tests/startup_gfx2hlsl_pack_absdiff_check.pyok (2.3s),tests/startup_gfx2hlsl_readfirstlane_recompute_check.pyok (0.1s),tests/startup_gfx2hlsl_readfirstlane_uniform_check.pyok (0.1s),tests/startup_gfx2hlsl_refusals_check.pyok (0.5s),tests/startup_gfx2hlsl_root_check.pyok (0.7s),tests/startup_gfx2hlsl_sad_check.pyok (0.3s),tests/startup_gfx2hlsl_saveexec_same_reg_check.pyok (0.1s),tests/startup_gfx2hlsl_scalar_arity_check.pyok (0.2s),tests/startup_gfx2hlsl_scalar_brev_fold_check.pyok (0.1s),tests/startup_gfx2hlsl_scalar_m0_check.pyok (0.1s),tests/startup_gfx2hlsl_scalar_table_arity_check.pyok (0.3s),tests/startup_gfx2hlsl_sdwa_cvt_check.pyok (0.2s),tests/startup_gfx2hlsl_sgpr_spill_check.pyok (0.1s),tests/startup_gfx2hlsl_shift64_check.pyok (0.1s),tests/startup_gfx2hlsl_sload_const_offset_check.pyok (0.1s),tests/startup_gfx2hlsl_smem_offset_check.pyok (0.1s),tests/startup_gfx2hlsl_sop2_complement_check.pyok (5.3s),tests/startup_gfx2hlsl_sopk_accum_check.pyok (0.8s),tests/startup_gfx2hlsl_sopk_signext_check.pyok (0.1s),tests/startup_gfx2hlsl_swap_check.pyok (0.3s),tests/startup_gfx2hlsl_vopc_sdwa_check.pyok (4.1s),tests/startup_gfx2hlsl_waitcnt_depctr_check.pyok (0.1s),tests/startup_gfx2hlsl_watch_check.pyok (2.4s),tests/startup_image_2d_array_check.pyok (0.2s),tests/startup_image_3d_check.pyok (0.1s),tests/startup_image_gather_lz_check.pyok (0.5s),tests/startup_image_load_d16_check.pyok (0.8s),tests/startup_image_sample_a16_check.pyok (0.1s),tests/startup_image_sample_b_check.pyok (0.1s),tests/startup_image_sample_c_check.pyok (0.2s),tests/startup_image_sample_l_check.pyok (0.2s),tests/startup_image_sample_lod_check.pyok (0.6s),tests/startup_inline_sampler_check.pyok (0.2s),tests/startup_mesh57_skeleton_check.pyok (0.2s),tests/startup_run_ps1_check.pyok (9.3s),tests/startup_run_sh_check.pyskipped (0.1s),tests/startup_sampler_heap_check.pyok (0.1s),tests/startup_shader_cache_rekey_check.pyok (1.6s),tests/startup_smem_address_check.pyok (0.1s),tests/startup_stream_fetch_check.pyok (0.2s),tests/startup_stream_interface_check.pyok (0.2s),tests/startup_translator_check.pyok (0.4s)sccache: -13/-1186 hits; wall52.7sAI-assisted; commands listed were executed locally.
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 caughtReading this as a coverage statement about
main, not a review request.The recognizer (
gfx2hlsl.py:731) is a symbolic matcher: it names a descriptor word only when the exact instruction andconstant 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.
0xe0010→0xe000f(s_bfe_u32)0xc000ffff→0xc000fff00xcfffffff→0xcffffff00x300000→0x300001(s_or_b32)1→0(s_max_u32)s_mul_i32→s_mul_u32loaded = 5 …→loaded = 4)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
loadeddistinction is what separates "a descriptor word read by ones_load" from "a descriptor word read by ones_loadand 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
plaintrue 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 touchinganything, 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.pyis CRLF. Two of my anchors missed on the first pass purely because of that (and one because Ihad quoted the source line from memory rather than from the file) — a
\nanchor 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\ndance 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.