mesh: keep scalars written in a skipped range undefined (Part of #1998) #2144
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2152"
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 tedin7 on 2026-11-25T01:47:15Z.
Part of #1998
Item G: a scalar written inside a skipped range and live after it.
What this unblocks: mesh programs whose wave 1 skips a scalar write (for example the saved allocation word) and later reads that register in scalar ALU code now translate, instead of stopping on an unwritten register.
What changed
tools/mesh_entry_aot.py: an SGPR that no executed instruction has written on a wave is tracked as undefined. A range skipped bys_cbranch_execzleaves its scalar writes undone, so the register keeps a stale hardware value that nothing visible may depend on.s_cselectfollows only the selected arm).exec,vcc,m0, a descriptor address, or a never-written register read.tools/mesh_dynamic_aot.pyinherits the change through its wave class (signature only).tests/mesh_entry_check.py: new modesskipped(CPU) anddraw-skipped(WARP draw plus negative controls), registered asmesh_entry_skipped_scalar_cpuandmesh_entry_skipped_scalar_draw_<adapter>inCMakeLists.txt. Docs indocs/experiments.md.Tests
v_cndmaskmask, branch,exec,m0, never-written register). The new CPU check fails on the previous tools (KeyError on the unwritten register) and passes now.Verification:
Linux, all rc=0:
Windows Server 2025 (Build 26100, MSVC 14.44.35207, D3D12 WARP) at
95677d11:ctest --preset devand--preset release -R "^(mesh_entry_skipped_scalar_|mesh_entry_draw_|mesh_dynamic_aot_)"both 8/8 passed, includingmesh_entry_skipped_scalar_draw_warpandmesh_entry_skipped_scalar_cpu.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T02:38:14Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
4e45866724ℹ️ 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".
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T02:28:30Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
4e45866ℹ️ 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.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T02:38:14Z.
Code review location:
tools/mesh_entry_aot.py; line 235When an operand is
UNDEF, this return bypasses the unsupported-opcode check below. This accepts instructions with implicit effects, such ass_xor_saveexec_b64 s[34:35], s[32:33], as if they only wrote the named SGPR destination. In the triangle fixture, skipping the initialization of s33 while setting s32 to 1 makesloweremit exactly the original HLSL and leave EXEC unchanged, even though the XOR necessarily clears lane 0. The explicit-destination guard inputcannot catch this implicit EXEC write. Validate the supported scalar opcode before propagating UNDEF so unsupported control-state changes are refused rather than silently mistranslated.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T02:38:14Z.
Code review location:
tools/mesh_entry_aot.py; line 210For dynamic mesh translation, this new comparison handling is bypassed:
RuntimeWave.scalar_opstill evaluatess_cmp_eq_u32operands usingmap(super().scalar, args)withallow_undef=False. Writing s32 inside the existing wave-0-only allocation range, then addings_add_u32 s33, s32, 1and a deads_cmp_eq_u32 s33, 0before exit, makes dynamic translation fail on wave 1. The static translator accepts that program, and changing the comparison tos_cmp_gt_u32also makes the dynamic translator accept it. Update the runtime equality override to perform undefined-aware reads so an unused comparison leaves SCC undefined instead of rejecting the shader.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T02:38:14Z.
Code review location:
tools/mesh_dynamic_aot.py; line 57For the dynamic mesh path, forwarding this parameter does not give
v_cndmaskthe new no-live-lane behavior:RuntimeWave.vector_opcallsself.scalar(predicate)before checking for live lanes. If a skipped write leaves the mask undefined on a wave whose EXEC is zero, translation still raisesUNDEFINED_SCALAR, although no lane reads that mask and the baseWave.vector_opaccepts the same program. This is reproducible by appending an EXEC clear, a skipped mask initialization and a masked-offv_cndmask_b32_e64to the existing runtime fixture. Check for an empty execution mask before resolving the predicate.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T03:14:01Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T03:14:03Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T03:14:06Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T03:14:01Z.
Code review location:
tools/mesh_entry_aot.py; line 235Fixed in
fcb84186: unsupported scalar opcodes are now refused before an undefined operand is propagated (regression in mesh_entry_check skipped; also pso_readiness_check updated).Verified locally: mesh_entry_check skipped, mesh_dynamic_aot_check, mesh_dynamic_geometry_check, docs_links_check on Linux; x2w_pipe win2025 2152 PASS dev + release (28/28 each). New tests fail before the fix.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T03:14:03Z.
Code review location:
tools/mesh_entry_aot.py; line 210Fixed in
fcb84186: the runtime equality override reads operands undefined-aware, so a dead compare leaves SCC undefined (regression in mesh_dynamic_aot_check).Verified locally: mesh_entry_check skipped, mesh_dynamic_aot_check, mesh_dynamic_geometry_check, docs_links_check on Linux; x2w_pipe win2025 2152 PASS dev + release (28/28 each). New tests fail before the fix.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T03:14:06Z.
Code review location:
tools/mesh_dynamic_aot.py; line 57Fixed in
fcb84186: the runtime conditional-mask read is skipped when EXEC is empty (regression in mesh_dynamic_aot_check).Verified locally: mesh_entry_check skipped, mesh_dynamic_aot_check, mesh_dynamic_geometry_check, docs_links_check on Linux; x2w_pipe win2025 2152 PASS dev + release (28/28 each). New tests fail before the fix.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-25T05:58:16Z.
Ran head
4b89c7e6. Windows 11 build 26100, debug layer unavailable. Adapters: WARP 10.0.26100.8972, NVIDIA Quadro M1000M 32.0.15.7371, Intel HD Graphics 530 31.0.101.2111, the hardware ones selected withXBOX2WINDOWS_ADAPTER.mesh_entry_skipped_scalar_cpumesh_entry_skipped_scalar_draw_{warp,hardware}mesh_shader_tier=unsupportedmesh_shader_tier=unsupportedNeither older GPU has mesh shaders, so the hardware rows are capability skips, not results. Only WARP drew.
AI-assisted.