shader: translate first-lane reads from a uniform buffer conversion #1215
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1222"
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 R0Y00 on 2026-11-24T04:22:08Z.
Refs #1137
The startup shader translator can now emit a scalar assignment for a narrowly proven first-active-lane read. In straight-line code with the entry mask, a VGPR produced by a signed integer conversion of a scalar buffer load at a fixed offset has the same value in every active lane. A write to the VGPR invalidates that proof. Branching shaders and changed execution masks remain outside this profile.
On Windows,
python -B tests/startup_uniform_lane_check.pyat65b0bb4passed the positive case and five rejection controls. The source-built gfx1013 inputs exercise the binary decoder, stage translator and emitted HLSL assignments. The controls change the source, destination, VGPR definition, mask or branch. This PR covers translation and rejection only. It includes no application files.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T04:28:16Z.
Review: COMMENTED
Reviewed commit
65b0bb42(CMakeLists.txt,docs/startup-runtime.md,tools/startup/gfx2hlsl.py,tests/startup_uniform_lane_check.py).Findings
s_buffer_load_dword*&v_cvt_i32_f32uniform tracking (tools/startup/gfx2hlsl.py):op_s_buffer_load_dwordtags destination SGPRs with('fixed_buffer_word',)only whennot modsand the offset operand is a literal (0x[0-9a-f]+|\d+).S()permits numeric reads offixed_buffer_word, and any subsequentset_swithoutsymclears the tag viaself.sym.pop(n, None).op_v_cvt_i32_f32keeps the priorVEC_Ubehavior (uint(int(F(...))), rejecting modifiers) and addsdsttoself.uniform_vonly whenself.exec_knownandsrcis an SGPR tagged('fixed_buffer_word',).set_vdiscardsnfromself.uniform_von any VGPR write, andop_v_readfirstlane_b32requiresnot mods,not self.has_branches,self.exec_known, an SGPR destination, andsrcinself.uniform_v.tests/startup_uniform_lane_check.pycovers the positive path and five rejection controls (per-lane source, different VGPR, clobbered VGPR, modifiedexec_lo, and branch target).docs/startup-runtime.mdis title-neutral and accurately describes the profile.Checks (Linux)
/root/.local/share/x2w-rev-venv/bin/python -B tests/startup_uniform_lane_check.py: passed (fixed scalar buffer value translated; five unproven reads rejected)./root/.local/share/x2w-rev-venv/bin/python -B tests/pixel_aot_check.py: passed./root/.local/share/x2w-rev-venv/bin/python -B tests/form_coverage_check.py: passed (form coverage checks passed)./root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py: passed (self-test passed; 16 Markdown files, 276 links)./root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py: passed (self-test passed; 1029 files).git diff HEAD~1 --check: passed.LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so /root/.local/share/x2w-rev-venv/bin/python -B tests/rdna2_tools_check.py: 129 tests run, 2 skipped, 10 failures, 1 error (environment lacksllvm-mc-15/llvm-objcopy-15and LLVM 19 DPP output differs from LLVM 15 onv_cndmask_b32_dpp; unrelated to this PR).Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T04:26:46Z.
Rasptum has a working Windows 10 glyph branch on top of denn0x's wide-descriptor fix. Please reuse its root-signature handling and SDWA work. The overlap here is only
v_readfirstlane_b32: that branch emits the current lane unconditionally, while this PR proves a uniform source and tests rejection of varying values, register clobbers, changed masks and branches. A single implementation with these controls would cover both contributions.Author's branch at 95304976 · Windows 10 report · Descriptor fix. Blend decoding is already claimed in #1216.