startup: copy descriptor words into vcc as the upper half of s[104:107] (Part of #2023) #2661
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2669"
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 Leyukaka on 2026-11-26T01:36:42Z.
Part of #2023, Item L (takeover). Builds on #2057's descriptor
s_loadintos[104:107].What the requests do. On a local capture (counts and instruction shape only), 41 of the 43
mask from descriptor datahits arevccis used only ass106/s107, the upper half of a descriptor read throughs[104:107].Change (
tools/startup/gfx2hlsl.py):s_mov_b64 vcc, s[n:n+1], withneven and both registers holding descriptor words, records the two words as the symbols ofs106/s107and emits no code. It marksvcclost the way the #2057 path does (now shared asmark_vcc_descriptor), so a later read ofvccas a mask before it is redefined raisesvcc read after a descriptor load into s106/s107, on straight-line code and on branch paths.Stage.onenow checksvcc/vcc_hireads up front whilevccis lost, and on the error path of a branchy program it runscheck_vcc_paths, so the refusal is thevccone (a lostvccread, or a descriptor without a matching load on every path) rather than the handler's.s[104:107]whoses104holds a descriptor word must hold four consecutive words of the same descriptor. This also applies to the #2057 path; its tests are unchanged and pass.execfrom descriptor data,s_mov_b32 vcc_lo/s_and_b64 vccfrom descriptor data, and an odd or partly non-descriptor pair stay refused.exec_hi/vcc_hidestinations now get the samemask from descriptor datarefusal; before, a descriptor source there reachedreg_range(dname)[1]onNone.Tests (Windows 11, Python 3.14, DXC from the Windows SDK 10.0.26100), on main
7287979plus this commit:tests/startup_gfx2hlsl_desc_vcc_check.py: ok. It checks:s106/s107after the source registers are overwritten, novcc =is emitted, and the last four HLSL lines match the direct load.vcc:v_cndmask, the carry-in ofv_add_co_ci/v_sub_co_ci/v_subrev_co_ci,v_div_fmas, VOPC e32/e64/SDWA sources, a VOP3 source,s_and_saveexec_b64,s_mov_b32 s, vcc_lo, ands_cbranch_vccz/vccnz.v_cndmaskafter a branch that skips the redefinition and av_div_fmasat a branch target are refused; a redefinition by a compare is accepted.s[104:107]descriptors.draw <dxc> <offscreen_check> warpandhardware: ok on WARP (Microsoft Basic Render Driver) and an NVIDIA GeForce RTX 5080. The direct and aliased pixel shaders are compiled with DXC and both read back the same four words.b0, so the fixture replaces the SRV with an HLSL function over the same bytes, after checking the translated resource key and the load count.startup_gfx2hlsl_sload_s104_check(controls and WARP draw),startup_gfx2hlsl_join_symbols_check,startup_translator_check,startup_gfx2hlsl_refusals_check,startup_gfx2hlsl_mask_data_check,startup_mesh57_skeleton_check,docs_links_check,bidi_controls_check.Mutation checks, run by hand. Each fails the controls, which the draw variants run first (a refusal or a wrong symbol, not a pixel change):
vcclost marking.Measured on the same capture with this branch on
7287979: of the 42 requests that stopped atmask from descriptor data, 41 now pass it. They stop at later, unrelated refusals: 64-bit literal sources,s_lshl*_add_u32ands_nand_b64on a lane mask,v_ldexp_f32,s_bfm_b32, and another descriptor operand without a symbol. So none of them translates fully yet. One stays refused forexecfrom descriptor data.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T02:54:58Z.
Review: COMMENTED
Update for #2669 (head
9bba71f3).What I added: only a merge of origin/main into the branch (no rebase, no force-push). One conflict in tools/startup/gfx2hlsl.py, in Stage's scalar handler: kept both the new
s_mov_b64 vccdescriptor copy and main's TG_SIZE refusal block. No other change to the author's code.Review of the code (fixtures only):
mark_vcc_descriptorsharing, the up-front vcc check inStage.oneand the malformeds[104:107]refusals match the PR description.startup_gfx2hlsl_desc_vcc_<adapter>, registered in CMakeLists.txt), next to the offline check. Mutation: renaming themark_vcc_descriptor()call makes the offline check fail with an AttributeError.Commands executed:
python3 -B tests/startup_gfx2hlsl_desc_vcc_check.pyok,startup_gfx2hlsl_sload_s104_check.pyok,startup_gfx2hlsl_desc_ptr_prop_check.pyok,startup_compute_tg_size_check.pyok.x2w_pipe.py win2025 2669 --patch <merge diff> --regex 'startup_gfx2hlsl_desc_vcc|startup_gfx2hlsl_sload|tg_size|startup_gfx2hlsl_desc_ptr': dev 15/15 passed, release /O2 15/15 passed, Windows Python checks ok.The description says it is motivated by a capture of the title. We have no way to check that claim, so the merge is left to @R0Y00 or MasterDomino, who can verify it. CI needs to run on the new head.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T05:13:25Z.
Review: APPROVED
The previous Windows failure came from duplicated Pass fields on the old main. This synchronization retains the VCC descriptor-word tracking and the lost-mask, malformed-range and branch refusals. The Python controls and the direct versus VCC-aliased FXC/DXC shader readbacks passed on WARP and RTX 4060 Laptop using synthetic buffer data in the shader helper.