startup: accept a stride-cleared descriptor for compute buffer stores #2312
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2320"
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-25T12:10:54Z.
Change
A compute
buffer_store_dwordthrough a descriptor whose dword 1 was ANDed with0xc000ffffis now accepted. Theoperation clears the stride field (bits 29:16) and keeps the base address bits 15:0 and bits 31:30, which is the raw
descriptor a byte-address store already assumes. Refs #2274, Refs #2302.
stride0word, compute stage only). Every other modification is recordedseparately and still refuses the store: another mask, another dword, a repeated modification (clear twice, clear
then
s_or,s_orthen clear) and the same clear on an image store.read (
s_cselect*,s_cmov*,s_cbranch_scc*) reachable before a fresh compare. No new check was added; thereproducer (clear, then
s_cselect_b32/s_cbranch_scc1) is pinned as a refusal, and a compare in between ispinned as accepted with
sccassigned.Not covered, unchanged by this PR: gaps 1 and 2 of #2302 (a store at a loop head with later descriptor writes; a
branch-skipped reload) exist on main and stay.
AI-assisted (Claude Code).
Verification
Base
5e6563d9(origin/main), head6335767b. Windows 11 build 26300, Python 3.13.python -B tests/startup_gfx2hlsl_*_check.py,tests/startup_translator_check.py,tests/docs_links_check.py,tests/bidi_controls_check.py: all pass.git diff --check origin/main...HEAD: clean.ctest --preset release --no-tests=error -R "^startup_gfx2hlsl|^startup_translator|^startup_tools_lint|^startup_compute":121 passed, 0 skipped, 0 failed (WARP and an RTX 5090, driver 32.0.16.2135, debug layer on as in the execz run; adapter strings not re-read this run).
expected words as A.
Negative controls (pure Python,
tests/startup_gfx2hlsl_compute_check.py): another mask (0xc000fff0), the same maskon dword 2, clear twice, clear then or, or then clear, the existing "off form is refused" assertion (untouched), and
the SCC readers after the clear.
Limits
measured on hardware.
llvm-mclocally).Checklist
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:15:32Z.
Review: COMMENTED
Review of head
6335767b1fad0637c28bb8b3616cdbf685e2cd99(base origin/main).Result: no P1, no P2. Two nits.
Semantics: for an offen store the index is 0, so the stride (bits 29:16 of dword 1) does not enter the address. Clearing it with mask
0xc000ffffkeeps base bits 15:0 and bits 31:30, so accepting it as the raw byte-address descriptor is consistent. Marking it as its ownstride0word and recording every other change inother_modifiedkeeps the refusals for other masks, other dwords, repeated edits, and image stores. Loads still see the descriptor as modified throughpipe.modified. SCC is covered by the existing stale-SCC rule, and the new controls pin both the refusal and the accepted-after-compare case.Commands run locally in the PR worktree:
git diff --stat origin/main...HEAD: 3 files, +68/-14python3 -B tests/startup_gfx2hlsl_*_check.py(all),tests/startup_translator_check.py,tests/docs_links_check.py,tests/bidi_controls_check.py: all rc=0git diff --check origin/main...HEAD: cleanMutations (both reverted with
git checkout -- .):key in self.pipe.modified and not stride0_okclause (replaced byFalse): tests still pass. The only caller always passesstride0_ok=True, so the clause is unreachable.own[3] % 4 == 1dword-1 guard when markingstride0: tests still pass. The store check (k == 1inword_ok) already refuses other dwords, so the guard is redundant defense.Nits:
tools/startup/gfx2hlsl.pystore_descriptor: thestride0_ok=Falsepath and itspipe.modifiedclause have no caller and no test. Drop the parameter or add a test for it.tools/startup/gfx2hlsl.py(stride0 marking):getattr(self.pipe, 'other_modified', set())silently discards the add for a pipeline without the attribute.ComputePipelinedefines it, so a plain attribute access would fail loudly instead.AI-assisted; commands listed were executed locally.