mesh: join descriptor tables selected by a constant-buffer predicate #2143
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2151"
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:46:52Z.
Part of #1998
What this unblocks: mesh programs (Item D) whose scalar descriptor differs between the two arms of a uniform join, such as a per-material view or a null descriptor in one arm, now lower instead of stopping at "Dynamic scalar predicate".
Scope: Item D only. Items A, C and G are separate PRs.
What changes
s_cmp_{eq,lt,gt}_u32on a constant-buffer word now produces a predicate expression instead of a refusal.s_cbranch_scc0on that predicate runs both arms (an optional trailings_branchgives the else arm) and merges every scalar register as a select on the predicate.s_buffer_load_*reads through the selected descriptor: the two constant tables, or a zero (null) descriptor that reads as0.0f.mesh_dynamic_aot.pyinherits the change through the shared wave model; its check still passes.Refused: nested joins, geometry tables in an arm, vector, export, barrier or branch instructions in an arm, a register defined in only one arm, scalar ALU on a joined register, and EXEC/VCC/M0 changes in an arm.
Verification
Linux, executed locally:
python3 -B tests/mesh_join_descriptor_check.py: lowering, emitted ternary and 5 refusal controls passed.python3 -B tests/mesh_dynamic_aot_check.py: passed.python3 -B tests/mesh_dynamic_geometry_check.py: passed.python3 -B tests/mesh_entry_check.pysource()function: passed.python3 -B tests/docs_links_check.pyandtests/run_checks_parallel_check.py: passed.Not run yet (Draft until done): the D3D12 draw part of the new test,
ctest --preset dev --no-tests=error -R "^mesh_join_descriptor_" -V, on Win2025 WARP. It draws both arms of a per-material join and a null arm, compares the mesh export trace and all 1,024 pixels, and uses the existing trace-mismatch control. Also not run locally: the LLVM 15 basedmesh_entry_check.pybinary mode, since LLVM 15 is not installed here.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T01:58:04Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
8d8d5e3594ℹ️ 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-25T01:49:16Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
8d8d5e3ℹ️ 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-25T01:58:04Z.
Code review location:
tools/mesh_entry_aot.py; line 253When the true arm changes EXEC/VCC/M0 and the false arm restores its original value, checking only after both arms lets forbidden changes cancel. For example, table arms ending in
s_mov_b64 exec, 1ands_mov_b64 exec, -1are accepted, and vector ALU immediately after the join is evaluated for all lanes even when the runtime true path has only lane 0 active. Restoring EXEC later still leaves incorrectly computed vertex values. Execute each arm from the saved special-register state and validate its result before executing the other arm.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T01:58:04Z.
Code review location:
tools/mesh_entry_aot.py; line 266When a vector load is pending before the branch and only one arm executes
s_waitcnt vmcnt(0), that arm clears the sharedself.pending_vthroughexec_range(). Because this state is neither restored for the other arm nor merged here, post-join code can consume an unwaited VGPR on the other path. Abuffer_load_dwordbefore the join followed byv_readfirstlane_b32after it is accepted with a dynamic selector, while forcing the non-waiting branch raisesVector load used before wait. Snapshot each arm's vector pending state and union the results alongside scalar pending state.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:55:09Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:55:11Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:55:09Z.
Code review location:
tools/mesh_entry_aot.py; line 253Fixed in
08b98aaa.s_mov_b64 exec, 1/s_mov_b64 exec, -1are now refused (it was accepted before the fix).buffer_load_dwordbefore the join, waited in one arm only, thenv_readfirstlane_b32after the join, is refused with "Vector load used before wait".Commands executed locally:
python3 -B tests/mesh_join_descriptor_check.py,mesh_dynamic_aot_check.py,mesh_dynamic_geometry_check.py,mesh_multi_check.py,mesh_shadow_check.py,mesh_amplification_refusal_check.py,docs_links_check.py,bidi_controls_check.py,run_checks_parallel_check.py: PASSx2w_pipe.py win2025 2151(WARP, 12 mesh tests incl.mesh_join_descriptor_warp): dev 12/12 PASS, release 12/12 PASSAI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:55:11Z.
Code review location:
tools/mesh_entry_aot.py; line 266Fixed in
08b98aaa.s_mov_b64 exec, 1/s_mov_b64 exec, -1are now refused (it was accepted before the fix).buffer_load_dwordbefore the join, waited in one arm only, thenv_readfirstlane_b32after the join, is refused with "Vector load used before wait".Commands executed locally:
python3 -B tests/mesh_join_descriptor_check.py,mesh_dynamic_aot_check.py,mesh_dynamic_geometry_check.py,mesh_multi_check.py,mesh_shadow_check.py,mesh_amplification_refusal_check.py,docs_links_check.py,bidi_controls_check.py,run_checks_parallel_check.py: PASSx2w_pipe.py win2025 2151(WARP, 12 mesh tests incl.mesh_join_descriptor_warp): dev 12/12 PASS, release 12/12 PASSAI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-25T05:58:15Z.
Ran head
b4c8735e. 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_join_descriptor_{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.
Imported from R0Y00/Xbox2Windows. Originally posted by alvaroolt on 2026-11-25T09:16:09Z.
The mesh checks on
mainfail since this merge (54830b1d). They pass on its parentc4309205and still fail on07c1c20f. Every case fails the same way:Cause. The refactor moved the body of
Wave.stepsintoexec_range, and theyieldats_barriermoved with it (now line 713).stepsno longer contains ayield, so it is a plain function that returnsNone, andrun_groupcallsnext(None).exec_rangeis now a generator. That has two consequences:steps,if self.exec_range(...)is always true (a generator object), so the wave returns without executing anything.join_arms(line 304),self.exec_range(..., arm=True)creates the generator and drops it, so the arm is never executed.Failing checks on the PR runs merged into
54830b1d(for example run 45581905589):mesh_heap_sampler,mesh_dynamic_geometry,mesh_dynamic_aot,mesh_lane_spill,mesh_join_descriptor,pso_readiness(blocked withmesh_lowering_rejected: lowering failed unexpectedly: TypeError).mesh_entry,mesh_dynamic_geometry,mesh_two_exits,mesh_heap_sampler,mesh_indexed,mesh_multi,mesh_descriptor_swap,mesh_lit,mesh_shadow.A minimal change that restores them (tested locally on
07c1c20f, not submitted):arm=Truealready refusess_barrier, so an arm never yields. The loop only drains the generator and keeps the refusal in place if that changes.Results on Windows 11 26300 with Python 3.12, LLVM 15.0.7
LLVM-C.dll,llvm-mc15.0.7 andllvm-objcopy15.0.7:binary <llvm-mc> <llvm-objcopy> <LLVM-C.dll>: all exit 1 with theTypeErroron07c1c20f, and all exit 0 with the change.mesh_heap_sampler_check.pyexits 1 on54830b1dand 0 onc4309205.I did not run the D3D12 mesh draws or the full ctest suite with this change.
AI-assisted (Claude Code); I reviewed the diagnosis and the test results.