startup: handle vertex fetch with invalid input layout in gfx2hlsl (Part of #1723) #1995
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2002"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T22:55:31Z.
Part of #1723
What this unblocks: Completes 3 graphics pipelines blocked on vertex fetch without an input layout.
Change
A stream vertex shader that starts with the fetch-routine call was refused whenever the pipeline had no input layout ("vertex stage calls a fetch routine and the pipeline declares no input layout"). The stand-in published nothing for a layout with zero elements, so that case and an unreadable layout looked the same.
ia1 0(it is hashed into the cache key like any other layout).gfx2hlsl.pyacceptsia1 0. Each fetch record then has no source, and its registers are set to zero. No vertex-buffer slot or stride entry is requested for it.Shortcut: the zero default for an input without a vertex buffer is an assumption, not a measurement.
Verification
Executed locally (Linux, translator checks only; no Windows draw was run):
python3 tests/startup_stream_fetch_check.pyon this branch: exit 0. The new case "an empty declared layout reads every fetched input as zero" passes, and all existing refusals (no layout, unwritten, masked write, bypassed write, wqm, exec_hi, slot 8, per-instance, format 10, record kind 7) still pass.origin/main: fails withunsupported: invalid input layout requestat the new case.startup_stream_fetch_check.py <consumer> <backend>; it needs the Windows build.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T23:00:45Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
2379a3cd0dℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T22:57:17Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
2379a3cℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T23:00:46Z.
Code review location:
src/startup_stubs/d3d12_draw.inl; line 227For a stream declaring
NumElements == 0, this now publishes a hashedia1 0request and enables translation, but the public documentation remains unchanged.docs/startup-runtime.md:53–55still says that only non-empty layouts affect the cache key, and its fetch description does not cover this zero-fill path.AGENTS.mdrequires updating the README ordocs/experiments.mdwhen a public capability changes. Document the explicit-empty versus absent/unreadable distinction, the unmeasured zero default, and the translator-only reproduction command, and correct the stale cache-key description so contributors can reproduce and interpret this behavior accurately.AGENTS.md reference: AGENTS.md:L206-L207
Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T00:55:51Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T23:24:53Z.
The new behaviour is well covered — four mutations caught — but merging this branch as is would revert #1987
Windows 11 build 26300.9974, device-free:
ia1regex goes back to refusing0emptyentriesat += 5→at += 4for theia1 0lineSo the
ia1 0path, both halves of it (publish and consume), is pinned. Good.The merge hazard
git diff origin/main review-2002 -- src/startup_stubs/d3d12_draw.inlcontains, besides your change:Counted directly on both refs:
That is #1987's fix being undone. #1987's whole point was that
InterlockedIncrement(&counter) <= Nkeeps counting past 2^31, turns negative, andfrom then on logs every call — "millions of lines a minute and stalled the process" in the description. Your branch predates that merge, so this is
staleness rather than a decision, but a merge today would restore the flood at two sites and nothing in the diff calls it out.
A rebase onto current
mainfixes it and should be all that is needed — theia1hunks are in different lines of the same file.Same pattern as two other open PRs
#2014 would revert
ed7d09a4(the SMEM guard shape), and #2012 would collide with #1995 which has now merged. Three PRs in one week whose diffs carrysomeone else's reverted work. It is not a problem with any author: the branches are simply older than
main, andgit diffis the wrong tool to readthem with. Rebase before requesting review, or read
git diff $(git merge-base origin/main HEAD).What this PR is actually worth
Publishing a declared-but-empty input layout as
ia1 0, instead of nothing, distinguishes "no layout declared" from "layout declared with zero elements"— which is what unblocks the three pipelines. Reading the fetched registers as zero is stated in the code as an assumption, not a measurement, which
is the right framing: no fixture can prove what the GPU would do, because the stand-in is the model.
Notes
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T00:55:51Z.
Code review location:
src/startup_stubs/d3d12_draw.inl; line 227Fixed in
cfe39e75(branch rebased onto current main, so #1987's counter fix is preserved; the host force-pushes it). docs/startup-runtime.md now says: a layout declared with zero elements publishesia1 0and is part of the cache key; absent or unreadable layouts publish nothing and are still refused; the zero default is an assumption, not a measurement; translator-only reproduction ispython -B tests/startup_stream_fetch_check.py.Verification:
python3 -B tests/startup_stream_fetch_check.pyexit 0 on the rebased tree. The Win2025 C++ build was attempted but failed on an sccache connection reset (infrastructure, before any test ran).AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-25T03:48:17Z.
Ran the fetch check on hardware, head
cfe39e75— RX 9070 XT, driver 32.0.32029.2010:So the generated fetch reads the layout's slots in the order the container asks for, on the card, including the base-vertex term in the indexed draw; both mutations land on the TEXCOORD rectangles as predicted, which is what makes the exact check meaningful; and the missing
INPUT_LAYOUTcase is still refused rather than drawn by accident.Limits: AMD only, no NVIDIA card here.
startup_stream_consumerhad to be built for the run.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T11:54:34Z.
Thank you @thepatrickworld for the RX 9070 XT hardware run at
cfe39e75: all 32 pixels exact, both mutations caught, and the missingINPUT_LAYOUTcase still refused. Recorded as extra evidence for this PR.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:05:35Z.
Thank you @ChazY11, good catch. The branch was older than
main, so the diff carried the old counters.I merged
origin/maininto the branch (a merge, no rebase). New head:9b761e9d. Old head was6433805e.src/startup_stubs/d3d12_draw.inl:first_callsuses = 22 (the #1987 helper is kept). OldInterlockedIncrement(&tr->logged...)uses = 0.git diff origin/main HEAD -- src/startup_stubs/d3d12_draw.inlhas nofirst_callslines, so the diff against main is only theia1 0change (4 files, +30/-4).python3 -B tests/startup_stream_fetch_check.pyexits 0.Commands run:
git merge origin/main,grep -c first_calls,grep -c 'InterlockedIncrement(&tr->logged',git diff origin/main HEAD --stat,python3 -B tests/startup_stream_fetch_check.py.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T13:51:29Z.
Closing this PR for now to keep the Windows test queue short. Nothing is wrong with it and the branch stays as it is.
We will reopen it once the queue is clear, re-run the Win2025 WARP checks at its head, and post the result here.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T23:18:58Z.
Review: CHANGES_REQUESTED
The three
startup_stream_fetchRelease tests pass on WARP and RTX. They show the translator distinguishes a declaredia1 0from an absent layout and that its generated shader supplies zero. The new code labels zero as an assumption. Since this changes the production stream path, please add an independent reference for the value of a fetched input when the layout is declared with zero elements, or narrow the support to a path that explicitly selects zero-fill as an experimental policy while the production default still refuses the unverified fetch. Keep the strong color/position controls and the absent or malformed layout refusals. Any actual startup claim should cite the exact candidate and measured stage.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T00:58:51Z.
Review: APPROVED
The latest revision addresses the compatibility finding. The default leaves the empty declared layout unpublished and refuses the fetch;
X2W_STREAM_ZERO_FILL=1publishesia1 0under the layout-specific key. Windows Release passed 3/3 (ctest --preset release --no-tests=error -j 1 -R '^startup_stream_fetch($|_)' -V), including WARP and RTX 4060 Laptop. Both adapters refused the default case and matched the opt-in collapsed-geometry readback and existing vertex controls. The source-built run establishes the experimental behavior; guest zero-fill remains unmeasured.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T00:43:45Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
b8f1272494aa2a48aa1e464bb8fc20b86838115a:--preset dev):cmake --build --preset dev --target startup_stream_consumer cpu_placed_provider d3d12_xs_shim d3d12_xs_device_obj startup_stream_setup_obj -- -j 2):24.85s(configure1.90s)ctest --preset dev -R '^startup_stream_fetch_' --parallel 6 --no-tests=error --output-on-failure): 3/3 passed (1.35s:startup_stream_fetch_translate0.25s,startup_stream_fetch_hardware1.16s,startup_stream_fetch_warp1.23s)/O2(--preset release):cmake --build --preset release --target startup_stream_consumer cpu_placed_provider d3d12_xs_shim d3d12_xs_device_obj startup_stream_setup_obj -- -j 2):49.74s(configure1.93s)ctest --preset release -R '^startup_stream_fetch_' --parallel 6 --no-tests=error --output-on-failure): 3/3 passed (1.31s:startup_stream_fetch_translate0.20s,startup_stream_fetch_warp1.21s,startup_stream_fetch_hardware1.20s)tests/mesh_heap_sampler_check.pyok (0.6s),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.4s),tests/startup_compute_store_format_xyzw_check.pyok (0.2s),tests/startup_compute_translate_check.pyok (0.2s),tests/startup_flat_param_check.pyok (0.1s),tests/startup_gfx2hlsl_add_sub_co_check.pyok (0.1s),tests/startup_gfx2hlsl_add_sub_co_ci_check.pyok (0.1s),tests/startup_gfx2hlsl_bit_alu_check.pyok (0.6s),tests/startup_gfx2hlsl_capture_check.pyok (0.9s),tests/startup_gfx2hlsl_cmp16_check.pyok (0.2s),tests/startup_gfx2hlsl_compare_dst_check.pyok (0.1s),tests/startup_gfx2hlsl_compute_check.pyok (0.3s),tests/startup_gfx2hlsl_cselect_mask_check.pyok (0.1s),tests/startup_gfx2hlsl_cvt_alu_check.pyok (0.2s),tests/startup_gfx2hlsl_cvt_off_f32_i4_check.pyok (0.2s),tests/startup_gfx2hlsl_cvt_pk_int16_check.pyok (0.2s),tests/startup_gfx2hlsl_f32_lg_check.pyok (1.1s),tests/startup_gfx2hlsl_f32_nan_check.pyok (4.1s),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_interp_p2_hi_check.pyok (0.2s),tests/startup_gfx2hlsl_join_symbols_check.pyok (0.2s),tests/startup_gfx2hlsl_loop_constants_check.pyok (0.1s),tests/startup_gfx2hlsl_mask_data_check.pyok (0.1s),tests/startup_gfx2hlsl_mask_overwrite_check.pyok (0.1s),tests/startup_gfx2hlsl_operand_count_check.pyok (0.2s),tests/startup_gfx2hlsl_pack_absdiff_check.pyok (2.0s),tests/startup_gfx2hlsl_pack_b32_f16_check.pyok (0.1s),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.6s),tests/startup_gfx2hlsl_s_abs_check.pyok (0.1s),tests/startup_gfx2hlsl_s_bitset_check.pyok (0.1s),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.2s),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.2s),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 (4.8s),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.2s),tests/startup_gfx2hlsl_vopc_sdwa_check.pyok (3.7s),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.1s),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.2s),tests/startup_image_sample_b_check.pyok (0.2s),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.5s),tests/startup_inline_sampler_check.pyok (0.1s),tests/startup_mesh57_loop_refusal_check.pyok (0.1s),tests/startup_mesh57_skeleton_check.pyok (0.4s),tests/startup_run_ps1_check.pyok (9.8s),tests/startup_run_sh_check.pyskipped (0.1s),tests/startup_sampler_heap_check.pyok (0.1s),tests/startup_shader_cache_rekey_check.pyok (2.0s),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.3s)sccache: 6/16 hits; wall130.4sImported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T00:43:46Z.
@R0Y00 thank you for the review. I took your second option: narrow the support to an explicit experimental policy, with the production default still refusing.
New head:
b8f1272494aa2a48aa1e464bb8fc20b86838115a(a merge oforigin/main, then one fix commit; no rebase).src/startup_stubs/d3d12_draw.inl: a layout declared with zero elements publishes nothing by default, so the fetch is refused and not drawn, as before this PR. Only withX2W_STREAM_ZERO_FILL=1isia1 0published and the translation zero-filled.tests/startup_stream_fetch_check.py: new default case (no.iafile, not drawn). The zero-fill draw now runs only with the opt-in. The color/position controls and the absent-layout and malformed-layout refusals are unchanged.docs/startup-runtime.md: says the zero value is an assumption, not a measurement, and that no startup claim rests on it. I do not claim any startup stage from this change.Commands run on Win2025 (WARP) at that head:
x2w_pipe.py win2025 2002 --keep-release --regex "^startup_stream_fetch_". Dev and release:startup_stream_fetch_translate,startup_stream_fetch_warp,startup_stream_fetch_hardwarepassed (3/3 each). Linux:python3 -B tests/startup_stream_fetch_check.pyexits 0. CI is green. The receipt is in the next comment.I am re-requesting your review. @MasterDomino for merge once @R0Y00 is satisfied.
AI-assisted; commands listed were executed locally.