startup: accept single-wave TG_SIZE_EN wave-ID masking in compute #2432
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!2432
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2432/head"
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?
@triggered02 on GitHub · 2026-11-25 16:35 UTC · original
triggered02:startup/compute-tg-size→main· +483 −7 · 5 files · 2 commits · merged 2026-11-26 02:15 UTCImplements the unclaimed
TG_SIZE_ENitem from #2274 Part A intools/startup/gfx2hlsl.py.What changed
tools/startup/gfx2hlsl.py:ComputePipeline.__init__acceptsCOMPUTE_PGM_RSRC2.TG_SIZE_EN(bit 10) whenx * y * z <= 32(one wave per workgroup), decoding the base registers viaentry_registers(rsrc2 & ~(1 << 10))and placingtg_size_sgpr = user + len(groups). Groups> 32threads withTG_SIZE_ENremain refused.Stage.setup_compute_entrytagsself.sym[tg_size_sgpr] = ('tg_size',).Stage.scalaraccepts only unmodifieds_and_b32 R, TG, 0xfc0(either operand order,Ra plain SGPR<= 105, includingR == TG), emittingR = 0u; scc = false;and trackingRas('const', 0)sov_mbcnt_lo_u32_b32acceptsRas a known zero base.Stage.SandStage.scalarrefuse every other read of an untouched('tg_size',)register by name (other masks, moves, arithmetic, vector instructions, or directv_mbcnt_lo); overwritingTGrestores ordinary scalar behavior.tools/compute_store_aot.pycontinues to refuseTG_SIZE_EN.tests/startup_compute_tg_size_check.py,CMakeLists.txt,docs/experiments.md, andtests/startup_gfx2hlsl_compute_check.py(updated theTG_SIZE_ENrefusal fixture group size from(1, 1, 1)to(8, 4, 2)).Measured checks (
1fbdd4fdonorigin/mainb442b57f)tests/startup_compute_tg_size_check.py(pure Python): PASS (SGPR placement,s_and_b32 0xfc0,v_mbcnt_lobase,>32-thread & disallowed-read refusals, overwrite recovery,execz/ join behavior).tests/startup_compute_tg_size_check.py dispatch <dxc> <offscreen_check> warp(Microsoft Basic Render Driver1414:008c,10.0.26100.9818, DXCcs_6_0): PASS (two4x2x2groups,320words compared,0mismatches).tests/startup_compute_tg_size_check.py control {dropped-base,swapped-mask} <dxc> <offscreen_check> warp: PASS (dropped-baserejected at word 5,swapped-maskrejected at word 8).startup_gfx2hlsl_*,startup_compute_*,compute_entry_layout_check.py,startup_translator_check.py,docs_links_check.py,bidi_controls_check.py): 74 passed, 0 failed (2 CLI-binary compute checks skipped standalone).tools/startup/gfx2hlsl.py(offsettingtg_size_sgpr, dropping<= 32check, accepting0x3f, droppingStage.Srefusal): all 4 caught (exit 1).Not established
hardwaredispatch was not run here (WARP only).Refs #2274. AI-assisted (Gemini).
@chatgpt-codex-connector[bot] on GitHub · 2026-11-25 16:35 UTC · original · edited 2026-11-25 16:39 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
1fbdd4fℹ️ 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.
@tedin7 on GitHub · 2026-11-25 18:23 UTC · original · reviewed
Review of head
1fbdd4fd(comment only, no merge action).What I checked
gfx2hlsl.pyentry placement of TG_SIZE (user + len(groups)), the<= 32threads guard, the narrows_and_b32 R, TG, 0xfc0fold, and the refusal of every other read of an untouched TG register. Logic is sound and additive.R == TG, overwrite recovery, the> 32refusal and a WARP dispatch with CPU reference. The two control cases (dropped-base,swapped-mask) are wired into CTest for warp and hardware. The sibling refusal fixture instartup_gfx2hlsl_compute_check.pywas updated correctly.1fbdd4fd, the same SHA I reviewed. I did not run Windows tests myself. Hardware dispatch was not run by the author either, as they say.Commands run locally (Linux)
python3 -B tests/startup_compute_tg_size_check.py: passpython3 -B tests/startup_gfx2hlsl_compute_check.py: passpython3 tests/docs_links_check.py: passpython3 tests/bidi_controls_check.py: passgit diff --check origin/main...HEAD: cleantg_size_sgproffset by +1. The test fails (exit 1).0xfc0changed to0x3f. The test fails (exit 1).No blocking findings.
AI-assisted; commands listed were executed locally.
@Leyukaka on GitHub · 2026-11-25 23:08 UTC · original
Review of head
8d58e787, by reading the diff against main (not run).s_cselect_b64reaches the TG_SIZE SGPR without the new guard. With 7 user SGPRs and no TGIDs enabled, TG_SIZE iss7:scalar_select(mainfc97ade,gfx2hlsl.py:3551-3576) reads only the low registers of a 64-bit pair and emitss21 = 0u, soS(7)is never called and the guard this PR puts inS()andscalar()does not see the read. The translation leavesv3at 0. The mechanism is older than this PR (a TGID in the high half is dropped the same way on main), but TG_SIZE becomes reachable here only with this change. The test docstring says every other read of the untouched TG_SIZE SGPR is refused; a refusal control with this sequence would hold the PR to that.A smaller fix than changing
scalar_select: refuse a 64-bits_cselectwhose source pair includes the TG_SIZE SGPR.AI-assisted.
@tedin7 on GitHub · 2026-11-26 02:13 UTC · original
Pushed
c8348bc08: a merge of main into this branch (no force, no rebase) so the PR is mergeable again. No code changes from me.Two conflicts, both kept on both sides:
tools/startup/gfx2hlsl.py: this branch'sscalar(base, ops, mods)call, followed by main's news_addc_u32block.CMakeLists.txt: thestartup_compute_tg_size_*tests and main'sstartup_compute_lds_b128_*tests, each with its own controls.Commands executed locally:
python3 -I tests/startup_compute_tg_size_check.py,tests/startup_gfx2hlsl_compute_check.py,tests/startup_gfx2hlsl_shift64_check.py: passpython3 x2w_pipe.py win2025 2432 --patch <merge diff> --regex 'startup_compute_tg_size|startup_compute_lds_b128'(default slots): 22/22 passed on WARP and hardware, including the dropped-base and swapped-mask controlsAI-assisted; commands listed were executed locally.