shader: lower v_sub_co_ci_u32, v_subrev_co_ci_u32 and s_flbit_i32_b32 in gfx2hlsl (Part of #1723) #2041
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!2041
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2041/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?
@tedin7 on GitHub · 2026-11-24 23:32 UTC · original
tedin7:x2w-r21-scalar-twins-b→main· +239 −3 · 7 files · 2 commits · closed without mergingPart of #1723
What this unblocks: Run 21 census, the predicted RDNA2 twins
v_sub_co_ci_u32,v_subrev_co_ci_u32ands_flbit_i32_b32.Branch:
x2w-r21-scalar-twins-b(commit e64b04fa, local, not pushed).Changes in
tools/startup/gfx2hlsl.py:v_sub_co_ci_u32:D = S0 - S1 - carry_in, borrow outS0 < S1 + carry_in, written to vcc or an SGPR mask (bit 0, one lane).v_subrev_co_ci_u32: same with S0 and S1 swapped.s_flbit_i32_b32:S0 == 0u ? 0xffffffffu : 31u - firstbithigh(S0), SCC unchanged. Word-only: lane masks are refused, as fors_pack_hh_b32_b16.Verification:
python3 -I tests/startup_gfx2hlsl_sub_co_ci_flbit_check.py-> PASS (new test, registered in CMakeLists.txt asstartup_gfx2hlsl_sub_co_ci_flbit).origin/maintools -> fails withUnsupported: v_sub_co_ci_u32.python3 -I tests/startup_gfx2hlsl_sop2_complement_check.py-> PASSpython3 -I tests/startup_gfx2hlsl_vcvt_omod_check.py-> PASSpython3 -I tests/startup_gfx2hlsl_bit_alu_check.py-> all lines okv_sub_co_ci,v_subrev_co_ciors_flbitintools/startup/on main.AI-assisted; commands listed were executed locally.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:32 UTC · original · edited 2026-11-24 23:38 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
e64b04fℹ️ 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.
@ -2829,2 +2829,4 @@add_test(NAME startup_gfx2hlsl_sopk_accum COMMAND "${INTAKE_PYTHON}" -B"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_sopk_accum_check.py")add_test(NAME startup_gfx2hlsl_sub_co_ci_flbit COMMAND "${INTAKE_PYTHON}" -B"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_sub_co_ci_flbit_check.py")@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:38 UTC · original
This adds three previously refused startup-translator instruction forms and a new reproduction test, but neither
README.mdnordocs/experiments.mdis updated.AGENTS.mdexplicitly requires updating one of those documents when a public capability or reproduction command changes. Record the supported forms, refusal boundaries, and regression command, distinguishing the CPU-only verification from unmeasured Windows/GPU behavior.AGENTS.md reference: AGENTS.md:L210-L211
Useful? React with 👍 / 👎.
@ -1784,0 +1822,4 @@self.sym.pop(out_n, None)self.masks.add(out_n)store = 's%d = %s;' % (out_n, borrow)self.emit('{ uint ca = %s, cb = %s, ci = %s & 1u; %sv%d = ca - cb - ci; %s }' % (a, b, borrow_in, guard, d, store))@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:38 UTC · original
For vertex shaders that start with the modeled fetch call,
Pipeline.hlsl_vs()recognizes definitions only when an emitted line starts withvN =. This block-form line instead makes that scan count the destination as a read, so an unconditional subtraction into a fresh VGPR is incorrectly refused. Using the existing stream-fetch fixture,v_sub_co_ci_u32_e32 v12, vcc_lo, v4, v5, vcc_lofails withvertex stage reads v12even though both inputs are fetched; initializingv12beforehand makes it translate. The reverse form fails identically. Update the definition tracking to recognize these writes while preserving the temporary snapshots needed for aliasing.Useful? React with 👍 / 👎.
@ -2829,2 +2829,4 @@add_test(NAME startup_gfx2hlsl_sopk_accum COMMAND "${INTAKE_PYTHON}" -B"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_sopk_accum_check.py")add_test(NAME startup_gfx2hlsl_sub_co_ci_flbit COMMAND "${INTAKE_PYTHON}" -B"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_sub_co_ci_flbit_check.py")@tedin7 on GitHub · 2026-11-25 00:59 UTC · original
Fixed in 00544511 (rebased on current main, pending push to this branch). Docs: new section in docs/experiments.md, plus the check in AGENTS.md and the CI list. Definite-assignment: the borrow-chain block now counts as an unconditional write of its destination, with a translator case in tests/startup_stream_fetch_check.py. CPU-only; Windows/GPU behavior not measured.
AI-assisted; commands listed were executed locally: python3 -B tests/startup_gfx2hlsl_sub_co_ci_flbit_check.py, tests/startup_stream_fetch_check.py, tests/startup_translator_check.py, tests/docs_links_check.py.
@ -1784,0 +1822,4 @@self.sym.pop(out_n, None)self.masks.add(out_n)store = 's%d = %s;' % (out_n, borrow)self.emit('{ uint ca = %s, cb = %s, ci = %s & 1u; %sv%d = ca - cb - ci; %s }' % (a, b, borrow_in, guard, d, store))@tedin7 on GitHub · 2026-11-25 00:59 UTC · original
Fixed in 00544511 (rebased on current main, pending push to this branch). Docs: new section in docs/experiments.md, plus the check in AGENTS.md and the CI list. Definite-assignment: the borrow-chain block now counts as an unconditional write of its destination, with a translator case in tests/startup_stream_fetch_check.py. CPU-only; Windows/GPU behavior not measured.
AI-assisted; commands listed were executed locally: python3 -B tests/startup_gfx2hlsl_sub_co_ci_flbit_check.py, tests/startup_stream_fetch_check.py, tests/startup_translator_check.py, tests/docs_links_check.py.
@tedin7 on GitHub · 2026-11-25 13:50 UTC · original
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.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:38 UTC · original · reviewed
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
e64b04fa4bℹ️ 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".
Pull request closed