help wanted: GPU translation, part 2 (mesh shaders) #1991

Open
opened 2026-11-24 22:51:47 +00:00 by denn0x · 20 comments
denn0x commented 2026-11-24 22:51:47 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-24T22:51:47Z.


Follow-up to #1760. The source-built slices merged so far (#1913, #1779) cover bounded runtime geometry and multi-primitive lowering. A census of mesh-stage programs from a private corpus (aggregate counts only; about 4,000 distinct programs in the group form: LDS, group barriers, per-lane ranges, v_readfirstlane) shows which constructs still stop a translation. Each row is a separate piece of work that one person can take with a source-built fixture.

Constructs (pick one, say so in a comment)

Item Construct Programs stopped first by it Notes
A Branch on an SCC that depends on a wave lane mask ("any lane active") about 1,190 Needs a group-uniform form: each wave publishes its bit to shared memory, then a barrier, then a uniform branch with exec guards.
B Scalar spills: v_writelane_b32 / v_readlane_b32 used as spill slots for scalar registers, including saved exec masks about 220 A spill slot is per wave, not per lane. Only the constant-lane spill / reload idiom needs recognising; anything else can stay refused. #1543 covers cross-lane operations for compute only.
C Exec mask restored inside a per-lane range (non-spill forms: a copy made before the branch, moved between registers, or joined from several paths) about 120
D Descriptor identity that differs between the two arms of a join about 270 Typically a per-material view, or a null descriptor in one arm. Needs a bounded selection carried through the join.
E Sampler state loaded from a descriptor instead of a static sampler about 260 Related: #1143.
F Second position export (pos1): clip and cull distances about 200 Maps to SV_ClipDistance / SV_CullDistance; the component count comes from pipeline state.
G Scalar written inside a skipped range and live after it about 160
H Waves of one group reaching a different number of group barriers about 125
I Loops (back-edges through the LDS / barrier structure, loop-carried exec masks) about 720 programs contain loops; their first refusals are not yet separated from A-H A census of the loop-specific refusals is itself a useful contribution.

What a contribution needs

  • A source-built mesh pipeline (or a hand-assembled program) that contains the construct, with pixel or buffer read-back and a negative control. No bytes from any retail software.
  • A differential check against an independent CPU model of the wave where the construct changes control flow.
  • LLVM / Mesa semantics cited for each instruction lowered.
  • Refuse precisely what the change does not cover.

Notes

  • Fused and unfused multiply-adds must keep the console rounding (fused: one rounding; unfused: two). Otherwise positions differ between a depth pre-pass and the colour pass that tests depth EQUAL. Measured locally: letting the compiler choose gave differences of more than 1,000 ulp on a position component in one program; the explicit rule gave 0.
  • Counts are first refusals; closing one row exposes the next for some programs.

Related: #1760, #1759, #1541, #1543, #1143.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6593005732 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1998). Originally posted by [denn0x](https://github.com/denn0x) on 2026-11-24T22:51:47Z. --- Follow-up to #1760. The source-built slices merged so far (#1913, #1779) cover bounded runtime geometry and multi-primitive lowering. A census of mesh-stage programs from a private corpus (aggregate counts only; about 4,000 distinct programs in the group form: LDS, group barriers, per-lane ranges, `v_readfirstlane`) shows which constructs still stop a translation. Each row is a separate piece of work that one person can take with a source-built fixture. ## Constructs (pick one, say so in a comment) | Item | Construct | Programs stopped first by it | Notes | |---|---|---:|---| | A | Branch on an SCC that depends on a wave lane mask ("any lane active") | about 1,190 | Needs a group-uniform form: each wave publishes its bit to shared memory, then a barrier, then a uniform branch with exec guards. | | B | Scalar spills: `v_writelane_b32` / `v_readlane_b32` used as spill slots for scalar registers, including saved exec masks | about 220 | A spill slot is per wave, not per lane. Only the constant-lane spill / reload idiom needs recognising; anything else can stay refused. #1543 covers cross-lane operations for compute only. | | C | Exec mask restored inside a per-lane range (non-spill forms: a copy made before the branch, moved between registers, or joined from several paths) | about 120 | | | D | Descriptor identity that differs between the two arms of a join | about 270 | Typically a per-material view, or a null descriptor in one arm. Needs a bounded selection carried through the join. | | E | Sampler state loaded from a descriptor instead of a static sampler | about 260 | Related: #1143. | | F | Second position export (`pos1`): clip and cull distances | about 200 | Maps to `SV_ClipDistance` / `SV_CullDistance`; the component count comes from pipeline state. | | G | Scalar written inside a skipped range and live after it | about 160 | | | H | Waves of one group reaching a different number of group barriers | about 125 | | | I | Loops (back-edges through the LDS / barrier structure, loop-carried exec masks) | about 720 programs contain loops; their first refusals are not yet separated from A-H | A census of the loop-specific refusals is itself a useful contribution. | ## What a contribution needs - A source-built mesh pipeline (or a hand-assembled program) that contains the construct, with pixel or buffer read-back and a negative control. No bytes from any retail software. - A differential check against an independent CPU model of the wave where the construct changes control flow. - LLVM / Mesa semantics cited for each instruction lowered. - Refuse precisely what the change does not cover. ## Notes - Fused and unfused multiply-adds must keep the console rounding (fused: one rounding; unfused: two). Otherwise positions differ between a depth pre-pass and the colour pass that tests depth EQUAL. Measured locally: letting the compiler choose gave differences of more than 1,000 ulp on a position component in one program; the explicit rule gave 0. - Counts are first refusals; closing one row exposes the next for some programs. Related: #1760, #1759, #1541, #1543, #1143.
avt0m4t48 commented 2026-11-25 01:01:52 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by avt0m4t48 on 2026-11-24T23:11:03Z.


I’ll take item B, the constant-lane scalar spill and reload pattern in the bounded mesh path. The source-built wave64 fixture covers a selected lane outside EXEC and a saved EXEC high word that changes control flow. I’m checking pixel readback before submitting the patch.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147109731 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1998#issuecomment-7147109731). Originally posted by [avt0m4t48](https://github.com/avt0m4t48) on 2026-11-24T23:11:03Z. --- I’ll take item B, the constant-lane scalar spill and reload pattern in the bounded mesh path. The source-built wave64 fixture covers a selected lane outside EXEC and a saved EXEC high word that changes control flow. I’m checking pixel readback before submitting the patch.
avt0m4t48 commented 2026-11-25 01:01:52 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by avt0m4t48 on 2026-11-24T23:13:01Z.


I’m releasing my claim on item B so someone else can take it. The source-built CPU and DXIL checks passed locally. Pixel readback is still open.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147147674 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1998#issuecomment-7147147674). Originally posted by [avt0m4t48](https://github.com/avt0m4t48) on 2026-11-24T23:13:01Z. --- I’m releasing my claim on item B so someone else can take it. The source-built CPU and DXIL checks passed locally. Pixel readback is still open.
R0Y00 commented 2026-11-25 01:01:54 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T23:26:29Z.


Item B is available again. If the source-built spill/reload fixture is shareable, please link the source revision and its CPU/DXIL test commands here so the next contributor can start at the GPU readback. The remaining discriminator is a wave64 case that recovers a selected lane outside EXEC and a saved high word whose removal changes the fenced pixel result. Use the existing bounded mesh draw fixture and report capability skips separately.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147403030 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1998#issuecomment-7147403030). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T23:26:29Z. --- Item B is available again. If the source-built spill/reload fixture is shareable, please link the source revision and its CPU/DXIL test commands here so the next contributor can start at the GPU readback. The remaining discriminator is a wave64 case that recovers a selected lane outside EXEC and a saved high word whose removal changes the fenced pixel result. Use the existing bounded mesh draw fixture and report capability skips separately.
Leyukaka commented 2026-11-25 01:02:07 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-25T00:40:46Z.


Item F (clip and cull distance exports): what blocks it in the mesh tools, from reading tools/mesh_entry_aot.py and tools/mesh_dynamic_aot.py at 5a0b0aa. Nothing was run.

  • Where it stops. The export parser accepts prim, pos0 and param0 only (mesh_entry_aot.py, the export regex). Any other target raises "Unsupported mesh export". mesh_dynamic_aot.py inherits that parser through RuntimeWave(Wave).
  • What is missing. No pipeline register state reaches either lowerer.
    • decode_mesh takes the limits from PSV0 and the code from the DXIL chunk.
    • The static lowerer gets geometry words, limits and an optional vertex header.
    • The dynamic lowerer gets a geometry word count and limits.
    • A search of the tree for PA_CL, CLIP_DIST, CULL_DIST, CCDIST, ClipDistance or CullDistance finds nothing.
  • Why the export alone is not enough. Which position export carries distances, and which components are clip or cull, comes from PA_CL_VS_OUT_CNTL: CLIP_DIST_ENA_0..7, CULL_DIST_ENA_0..7, VS_OUT_CCDIST0/1_VEC_ENA, plus VS_OUT_MISC_VEC_ENA and the USE_VTX_* bits. As far as I know, in Mesa's layout pos1 is the misc vector (point size, layer, viewport) when that is enabled, and the distance vectors then move to pos2/pos3. So pos1 is not always a distance vector, and any guessed layout is wrong for some mix of enables. I have not checked whether the hardware mandates that numbering.
  • What would unblock it.
    • These tools are command-line lowerers with no request or cache key of their own. The state would have to be added to their inputs (a profile or manifest field), and to whatever calls them once they are wired to the runtime.
    • With the decoded enables, the lowerer could declare only the enabled SV_ClipDistanceN / SV_CullDistanceN fields, write the export operands in ascending index order, and refuse unknown or contradictory layouts with the target and reason.
    • The compute fallback's intermediate buffer (positions and PARAM0 at fixed offsets) would need room for the distances too.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7148763053 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1998#issuecomment-7148763053). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-25T00:40:46Z. --- Item F (clip and cull distance exports): what blocks it in the mesh tools, from reading `tools/mesh_entry_aot.py` and `tools/mesh_dynamic_aot.py` at `5a0b0aa`. Nothing was run. - **Where it stops.** The export parser accepts `prim`, `pos0` and `param0` only (`mesh_entry_aot.py`, the export regex). Any other target raises "Unsupported mesh export". `mesh_dynamic_aot.py` inherits that parser through `RuntimeWave(Wave)`. - **What is missing.** No pipeline register state reaches either lowerer. - `decode_mesh` takes the limits from PSV0 and the code from the DXIL chunk. - The static lowerer gets geometry words, limits and an optional vertex header. - The dynamic lowerer gets a geometry word count and limits. - A search of the tree for `PA_CL`, `CLIP_DIST`, `CULL_DIST`, `CCDIST`, `ClipDistance` or `CullDistance` finds nothing. - **Why the export alone is not enough.** Which position export carries distances, and which components are clip or cull, comes from `PA_CL_VS_OUT_CNTL`: `CLIP_DIST_ENA_0..7`, `CULL_DIST_ENA_0..7`, `VS_OUT_CCDIST0/1_VEC_ENA`, plus `VS_OUT_MISC_VEC_ENA` and the `USE_VTX_*` bits. As far as I know, in Mesa's layout `pos1` is the misc vector (point size, layer, viewport) when that is enabled, and the distance vectors then move to `pos2`/`pos3`. So `pos1` is not always a distance vector, and any guessed layout is wrong for some mix of enables. I have not checked whether the hardware mandates that numbering. - **What would unblock it.** - These tools are command-line lowerers with no request or cache key of their own. The state would have to be added to their inputs (a profile or manifest field), and to whatever calls them once they are wired to the runtime. - With the decoded enables, the lowerer could declare only the enabled `SV_ClipDistanceN` / `SV_CullDistanceN` fields, write the export operands in ascending index order, and refuse unknown or contradictory layouts with the target and reason. - The compute fallback's intermediate buffer (positions and PARAM0 at fixed offsets) would need room for the distances too. AI-assisted.
akimfomin commented 2026-11-25 02:02:05 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by akimfomin on 2026-11-25T01:11:30Z.


Item B independent GPU readback on Leyukaka's exact #2127 head 2dc58a8bdf7e. Thanks to avt0m4t48 for the earlier CPU/DXIL work and the requested inactive-lane and high-word controls. PortBridge used that request to prepare an independently generated fixture.

With only guest lane 0 active, the source saves EXEC_LO=1 and EXEC_HI=0x100 into inactive lanes 8 and 40. LLVM assembled and decoded the three gfx1013 guest Wave64 programs. On RTX 4070 Ti SUPER (driver 32.0.16.1714, Win11 build 28000), the complete spill drew all 1,024 expected green pixels. Zeroing either word left all 1,024 pixels clear as expected. The stale-pixels-only control kept the good export trace and produced the expected 1,024/1,024 mismatches. D3D12 debug layer was unavailable; the hardware device and fenced readback were verified.

The passing cases use inline selectors. A separate source-built case with known SGPR selectors still gets the documented refusal. Exact source, CPU/DXIL reproduction and hardware transcript · PortBridge Test Lab. AI-assisted with Codex.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7149297918 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1998#issuecomment-7149297918). Originally posted by [akimfomin](https://github.com/akimfomin) on 2026-11-25T01:11:30Z. --- Item B independent GPU readback on Leyukaka's exact #2127 head `2dc58a8bdf7e`. Thanks to avt0m4t48 for the earlier CPU/DXIL work and the requested inactive-lane and high-word controls. PortBridge used that request to prepare an independently generated fixture. With only guest lane 0 active, the source saves `EXEC_LO=1` and `EXEC_HI=0x100` into inactive lanes 8 and 40. LLVM assembled and decoded the three gfx1013 guest Wave64 programs. On RTX 4070 Ti SUPER (driver `32.0.16.1714`, Win11 build `28000`), the complete spill drew all 1,024 expected green pixels. Zeroing either word left all 1,024 pixels clear as expected. The stale-pixels-only control kept the good export trace and produced the expected 1,024/1,024 mismatches. D3D12 debug layer was unavailable; the hardware device and fenced readback were verified. The passing cases use inline selectors. A separate source-built case with known SGPR selectors still gets the documented refusal. [Exact source, CPU/DXIL reproduction and hardware transcript](https://github.com/akimfomin/PortBridge/blob/f84bdb3a2f61ad1d7df10873fdd438c807e372b8/research/rendering-night/xbox2windows-mesh-readback/REVIEW.md) · [PortBridge Test Lab](https://akimfomin.github.io/PortBridge/#/lab). AI-assisted with Codex.
tedin7 commented 2026-11-25 02:02:06 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:23:24Z.


Picking up Item A (branch on SCC any-lane-active in mesh) with unit + WARP/verification tests.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7149494722 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1998#issuecomment-7149494722). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T01:23:24Z. --- Picking up Item A (branch on SCC any-lane-active in mesh) with unit + WARP/verification tests.
tedin7 commented 2026-11-25 02:02:07 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:40:59Z.


Picking up Item C (non-spill exec mask restore inside a per-lane range) and Item G (scalar written inside a skipped range and live after it) as two separate PRs with mesh tests.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7149833393 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1998#issuecomment-7149833393). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T01:40:59Z. --- Picking up Item C (non-spill exec mask restore inside a per-lane range) and Item G (scalar written inside a skipped range and live after it) as two separate PRs with mesh tests.
tedin7 commented 2026-11-25 02:02:08 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:43:31Z.


Also picking up Item D (descriptor identity differing between the two arms of a join) as a separate PR with mesh verification tests.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7149882717 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1998#issuecomment-7149882717). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T01:43:31Z. --- Also picking up Item D (descriptor identity differing between the two arms of a join) as a separate PR with mesh verification tests.
R0Y00 commented 2026-11-25 03:01:22 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T02:36:04Z.


Item B landed in #2127 (498c23cc). The bounded translator now handles the constant-lane spill/reload with EXEC cleared and rejects an unwritten slot or mixed ordinary VGPR use. The final head passed the local CPU model, including both EXEC halves. The independent GPU report remains the reference for the fenced inactive-lane/high-word comparison. Keep runtime-geometry support and the other claimed items separate. Independent readback

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7150934695 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1998#issuecomment-7150934695). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T02:36:04Z. --- Item B landed in #2127 (498c23cc). The bounded translator now handles the constant-lane spill/reload with EXEC cleared and rejects an unwritten slot or mixed ordinary VGPR use. The final head passed the local CPU model, including both EXEC halves. The independent GPU report remains the reference for the fenced inactive-lane/high-word comparison. Keep runtime-geometry support and the other claimed items separate. [Independent readback](https://github.com/R0Y00/Xbox2Windows/issues/1998#issuecomment-7149297918)
roansystemlabs commented 2026-11-25 06:01:35 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-25T05:10:09Z.


I'd like to take item E, sampler state loaded from a descriptor in the bounded mesh path. If someone already has it in progress, I'll step back and review.

Scope: reuse the opt-in sampler table from #1217/#1237 (s0, space1, 16-byte descriptor stride) for mesh programs in tools/mesh_dynamic_aot.py, where the sampler is loaded with s_load from a heap base plus a constant or bounded offset. Anything else (unbounded index, sampler word changed after the load, mixed static and heap use in one join) stays refused by name.

Evidence: a source-built mesh pipeline assembled with LLVM 15 llvm-mc for gfx1013 that samples one texture through two different heap samplers (distinct address modes and LOD limits), drawn on WARP and an RTX 3070 with fenced pixel readback. Negative controls: swapped sampler entries and the default-sampler shortcut must change the readback; the guard removed must fail.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7153512926 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1998#issuecomment-7153512926). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-25T05:10:09Z. --- I'd like to take item E, sampler state loaded from a descriptor in the bounded mesh path. If someone already has it in progress, I'll step back and review. Scope: reuse the opt-in sampler table from #1217/#1237 (s0, space1, 16-byte descriptor stride) for mesh programs in tools/mesh_dynamic_aot.py, where the sampler is loaded with s_load from a heap base plus a constant or bounded offset. Anything else (unbounded index, sampler word changed after the load, mixed static and heap use in one join) stays refused by name. Evidence: a source-built mesh pipeline assembled with LLVM 15 llvm-mc for gfx1013 that samples one texture through two different heap samplers (distinct address modes and LOD limits), drawn on WARP and an RTX 3070 with fenced pixel readback. Negative controls: swapped sampler entries and the default-sampler shortcut must change the readback; the guard removed must fail. AI-assisted.
RavenCurseBurg commented 2026-11-25 07:01:15 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T06:59:03Z.


I'll take the early-exit slice of item H for the bounded two-wave64 mesh lowerers. AMD's RDNA 2 ISA §4.3 says a wave can terminate with S_ENDPGM and the remaining live waves can satisfy later barriers. Both current lowerers require identical barrier-PC lists even though Wave.run already requires each executed path to reach S_ENDPGM.

I'll exercise a common barrier followed by one wave terminating and the other continuing to a later barrier. Two live waves reaching different barrier PCs at the same phase must still be refused. The tests will use a source-built program, an independent two-wave arrival/termination reference and GPU readback; runtime LDS sharing and loops are outside this slice.

AMD RDNA 2 ISA, §4.3

AI-assisted (Codex, GPT-6.2 Astra xhigh).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7155362287 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1998#issuecomment-7155362287). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T06:59:03Z. --- I'll take the early-exit slice of item H for the bounded two-wave64 mesh lowerers. AMD's RDNA 2 ISA §4.3 says a wave can terminate with S_ENDPGM and the remaining live waves can satisfy later barriers. Both current lowerers require identical barrier-PC lists even though Wave.run already requires each executed path to reach S_ENDPGM. I'll exercise a common barrier followed by one wave terminating and the other continuing to a later barrier. Two live waves reaching different barrier PCs at the same phase must still be refused. The tests will use a source-built program, an independent two-wave arrival/termination reference and GPU readback; runtime LDS sharing and loops are outside this slice. [AMD RDNA 2 ISA, §4.3](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/instruction-set-architectures/rdna2-shader-instruction-set-architecture.pdf) AI-assisted (Codex, GPT-6.2 Astra xhigh).
R0Y00 commented 2026-11-25 08:05:04 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T07:04:44Z.


The item H early-exit slice is available and distinct from #2220. Please proceed with the existing bounded two-wave64 profile. Keep the common first barrier, then let one wave terminate while the survivor reaches its next barrier. Include both wave orders, a readback sentinel that detects a missing surviving-wave write, and a refusal when two live waves reach different barrier PCs. Please include the exact LLVM 15 assembly and WARP/hardware test commands in the PR, with capability skips reported separately.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7155463513 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1998#issuecomment-7155463513). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T07:04:44Z. --- The item H early-exit slice is available and distinct from #2220. Please proceed with the existing bounded two-wave64 profile. Keep the common first barrier, then let one wave terminate while the survivor reaches its next barrier. Include both wave orders, a readback sentinel that detects a missing surviving-wave write, and a refusal when two live waves reach different barrier PCs. Please include the exact LLVM 15 assembly and WARP/hardware test commands in the PR, with capability skips reported separately.
RavenCurseBurg commented 2026-11-25 08:05:04 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T07:14:10Z.


I also reproduced a separate input-path blocker while assembling the early-retirement fixture. #2241 can use a shared final S_ENDPGM. Giving the retiring wave its own reachable S_ENDPGM produces the same mesh exports at the wave-model entry point, but the normal stage-13 container extractor refuses the program before either CLI reaches the model. This is the mesh-stage exclusion noted in #721.

I’ll take the bounded two-exit mesh-container follow-up. I’ll check the two decoded exits under gfx1013 wave64, preserve the reachability and instruction-boundary checks, and run a real allocation/position/primitive-export fixture through both CLI entry points and a device readback. An incorrectly tagged compute program, an unreachable alternate path and additional exits will remain controls. I’ll keep it separate from #2241.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7155636434 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1998#issuecomment-7155636434). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T07:14:10Z. --- I also reproduced a separate input-path blocker while assembling the early-retirement fixture. #2241 can use a shared final S_ENDPGM. Giving the retiring wave its own reachable S_ENDPGM produces the same mesh exports at the wave-model entry point, but the normal stage-13 container extractor refuses the program before either CLI reaches the model. This is the mesh-stage exclusion noted in #721. I’ll take the bounded two-exit mesh-container follow-up. I’ll check the two decoded exits under gfx1013 wave64, preserve the reachability and instruction-boundary checks, and run a real allocation/position/primitive-export fixture through both CLI entry points and a device readback. An incorrectly tagged compute program, an unreachable alternate path and additional exits will remain controls. I’ll keep it separate from #2241.
RavenCurseBurg commented 2026-11-25 08:05:05 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T07:42:36Z.


#2241 now covers both requested retirement orders at 5bd2ea09. In the 320-byte reverse-order fixture, wave 0 allocates 68 vertices, writes vertices 0–63, and terminates. Wave 1 traverses the later barrier and supplies vertices 64–67. Both host evaluation orders yield the same barrier traces ([172] and [172, 184]) and primitive indices. The second primitive reads vertex 67.

The static and runtime CLI results matched all 1,024 pixels on WARP and a physical D3D12 adapter. Keeping vertex 67 at vertex 2’s position instead removes exactly 528 pixels on each adapter. Both live-wave mismatch refusals are still exercised. The PR description now includes the exact LLVM 15 and draw commands.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7156164184 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1998#issuecomment-7156164184). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T07:42:36Z. --- #2241 now covers both requested retirement orders at `5bd2ea09`. In the 320-byte reverse-order fixture, wave 0 allocates 68 vertices, writes vertices 0–63, and terminates. Wave 1 traverses the later barrier and supplies vertices 64–67. Both host evaluation orders yield the same barrier traces ([172] and [172, 184]) and primitive indices. The second primitive reads vertex 67. The static and runtime CLI results matched all 1,024 pixels on WARP and a physical D3D12 adapter. Keeping vertex 67 at vertex 2’s position instead removes exactly 528 pixels on each adapter. Both live-wave mismatch refusals are still exercised. The [PR description](https://github.com/R0Y00/Xbox2Windows/pull/2241) now includes the exact LLVM 15 and draw commands.
roansystemlabs commented 2026-11-25 09:04:12 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-25T08:31:04Z.


I'd like to take item F, the clip and cull distance exports, in the bounded mesh path. If someone already has it in progress, I'll step back and review.

Following the analysis above, the export alone can't say which position export carries the distances, so the first slice takes the PA_CL_VS_OUT_CNTL word as an explicit input of the lowerer instead of guessing a layout.

First slice (one PR):

  • tools/mesh_entry_aot.py, and the runtime wave in tools/mesh_dynamic_aot.py that inherits its export parser, accept pos1/pos2 only as the CCDIST0/CCDIST1 vectors the given word enables (CLIP_DIST_ENA_0..7, CULL_DIST_ENA_0..7, VS_OUT_CCDIST0/1_VEC_ENA), with the field layout from Mesa's gfx10 register table and the export order from Mesa's NGG code. The output vertex declares only the enabled SV_ClipDistance / SV_CullDistance components.
  • Refused by name: no state word given, the misc vector enabled (it would move the distances to later exports), a distance export that is not enabled or an enabled one that is missing, duplicate exports, the USE_VTX_* bits, and the compute fallback, whose intermediate buffer has no room for distances yet.
  • Reading the word from the slot 57 state stays out of this PR. @denn0x, if block A also holds PA_CL_VS_OUT_CNTL next to the words decoded in #2124, its position would let a second slice read it from the state; otherwise that stays a separate piece.

Evidence: source-built mesh programs assembled with LLVM 15 for gfx1013 that export a position plus clip and cull distances, drawn on WARP and an RTX 3070 with fenced pixel readback. A triangle crossing a clip plane must lose exactly the pixels where the interpolated distance is negative, and a primitive whose cull distances are all negative must disappear while its neighbour stays. On current main the same programs stop at "Unsupported mesh export". Negative controls: clip and cull components swapped, CCDIST0 and CCDIST1 swapped, one enabled component dropped, and the guard removed must each fail. Not tested: AMD or Intel GPUs and console hardware.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7157121794 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1998#issuecomment-7157121794). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-25T08:31:04Z. --- I'd like to take item F, the clip and cull distance exports, in the bounded mesh path. If someone already has it in progress, I'll step back and review. Following the analysis above, the export alone can't say which position export carries the distances, so the first slice takes the PA_CL_VS_OUT_CNTL word as an explicit input of the lowerer instead of guessing a layout. First slice (one PR): - tools/mesh_entry_aot.py, and the runtime wave in tools/mesh_dynamic_aot.py that inherits its export parser, accept pos1/pos2 only as the CCDIST0/CCDIST1 vectors the given word enables (CLIP_DIST_ENA_0..7, CULL_DIST_ENA_0..7, VS_OUT_CCDIST0/1_VEC_ENA), with the field layout from Mesa's gfx10 register table and the export order from Mesa's NGG code. The output vertex declares only the enabled SV_ClipDistance / SV_CullDistance components. - Refused by name: no state word given, the misc vector enabled (it would move the distances to later exports), a distance export that is not enabled or an enabled one that is missing, duplicate exports, the USE_VTX_* bits, and the compute fallback, whose intermediate buffer has no room for distances yet. - Reading the word from the slot 57 state stays out of this PR. @denn0x, if block A also holds PA_CL_VS_OUT_CNTL next to the words decoded in #2124, its position would let a second slice read it from the state; otherwise that stays a separate piece. Evidence: source-built mesh programs assembled with LLVM 15 for gfx1013 that export a position plus clip and cull distances, drawn on WARP and an RTX 3070 with fenced pixel readback. A triangle crossing a clip plane must lose exactly the pixels where the interpolated distance is negative, and a primitive whose cull distances are all negative must disappear while its neighbour stays. On current main the same programs stop at "Unsupported mesh export". Negative controls: clip and cull components swapped, CCDIST0 and CCDIST1 swapped, one enabled component dropped, and the guard removed must each fail. Not tested: AMD or Intel GPUs and console hardware. AI-assisted.
NiiRoZz commented 2026-11-25 09:04:13 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T08:51:39Z.


I'd like to take the census part of item I: separating the loop-specific first refusals from A–H.

Plan:

  • Run the bounded mesh lowerers in tools/mesh_*_aot.py at a named main revision over mesh-stage programs from a private corpus, in a mode that records the first refusal and, separately, every refusal inside a loop body.
  • Report aggregate counts only: programs with back-edges, loop shapes (back-edge through a group barrier or not, loop-carried exec, loop-carried scalars, trip count constant or data-dependent), and which construct stops each first, split into "already one of A–H" and "loop-specific".
  • Add a small source-built fixture per loop shape found, so each row of the table can be reproduced without the corpus, plus the script and the exact commands.

No lowering change in this slice. If the census isolates a loop shape that is small and unclaimed, I'll propose it here before starting.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7157562611 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1998#issuecomment-7157562611). Originally posted by [NiiRoZz](https://github.com/NiiRoZz) on 2026-11-25T08:51:39Z. --- I'd like to take the census part of item I: separating the loop-specific first refusals from A–H. Plan: - Run the bounded mesh lowerers in `tools/mesh_*_aot.py` at a named `main` revision over mesh-stage programs from a private corpus, in a mode that records the first refusal and, separately, every refusal inside a loop body. - Report aggregate counts only: programs with back-edges, loop shapes (back-edge through a group barrier or not, loop-carried `exec`, loop-carried scalars, trip count constant or data-dependent), and which construct stops each first, split into "already one of A–H" and "loop-specific". - Add a small source-built fixture per loop shape found, so each row of the table can be reproduced without the corpus, plus the script and the exact commands. No lowering change in this slice. If the census isolates a loop shape that is small and unclaimed, I'll propose it here before starting. AI-assisted (Claude Code).
R0Y00 commented 2026-11-25 09:04:14 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T09:01:43Z.


These are separate claims and can proceed in parallel. For item F, use the explicit state word and keep the slot 57 lookup separate. Please pin the public register table and export-order references. Test clipping a partly visible triangle separately from culling a whole primitive, and keep the two-vector swap and unsupported state controls.

For item I, start with the aggregate census at a named revision. Count each program once by its first refusal, with separate totals for loop-local observations, and distinguish an observed back edge from a proved loop trip count. Start with a minimal source-built example for each distinct refusal that affects the ordering of fixes. Keep the private corpus, its code and raw logs local.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7157777947 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1998#issuecomment-7157777947). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T09:01:43Z. --- These are separate claims and can proceed in parallel. For item F, use the explicit state word and keep the slot 57 lookup separate. Please pin the public register table and export-order references. Test clipping a partly visible triangle separately from culling a whole primitive, and keep the two-vector swap and unsupported state controls. For item I, start with the aggregate census at a named revision. Count each program once by its first refusal, with separate totals for loop-local observations, and distinguish an observed back edge from a proved loop trip count. Start with a minimal source-built example for each distinct refusal that affects the ordering of fixes. Keep the private corpus, its code and raw logs local.
NiiRoZz commented 2026-11-25 11:02:28 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T10:06:52Z.


Item I, census part. Counts only; the corpus, its code and the raw logs stay local.

Short version. At the revisions below, no program of this corpus is stopped by a loop: every program with a back-edge is refused before its first loop, by both bounded lowerers. So loop-specific refusals still cannot be separated from A-H by running the lowerers. What can be measured is the static shape of the loops and what stands in front of them.

Method

  • Lowerers: tools/mesh_entry_aot.py (lower, 128 zero geometry words) and tools/mesh_dynamic_aot.py (enumerate_variants, 128 run-time words), once per program, each program counted once by its first refusal.
  • Revisions: main c4309205, and the lowerer sources of main 77a204d6 (#2276). The tables are identical at both. Between #2151 and #2276 both lowerers raised TypeError on every program, so nothing can be measured there.
  • Decoding: LLVM 15 llvm-mc for gfx1013 wave64, not the LLVM C library (not available on the machine used).
  • Loops are found statically, independent of the lowerers: every backward branch is counted as an observed back-edge, body from the branch target to the branch. No control flow graph is built and no trip count is proved.
  • LLVM 15 prints a negative branch offset unsigned (s_cbranch_scc1 65533). The census reads it signed. The lowerers do not: a decoded back-edge raises KeyError instead of "Expected a forward mesh branch" (separate small fix, PR to follow).

Coverage

Count
Mesh-stage containers in the local extraction 9,282
Excluded by the container extractor ("Unverified multi-exit program"), not analysed 309
Duplicates (same declared limits and decoded text) 4,515
Distinct programs analysed 4,458

One local extraction of one build. The 309 excluded containers are not de-duplicated and may hold loops.

Loops (CONFIRMED, static)

Count
Programs with at least one back-edge 836 of 4,458
Back-edges 2,151
Programs with 1 / 2 / 3 or more back-edges 85 / 539 / 212
Nested back-edges 0
Latch s_cbranch_scc0 / s_cbranch_scc1 / s_cbranch_execnz / s_cbranch_vccz 2,011 / 29 / 109 / 2
Barrier in body LDS access in body Body writes EXEC Latch tests EXEC Loop-carried scalar Constant trip pattern Back-edges Body instructions (min / median / max)
no no yes no yes no 1,081 46 / 64 / 225
no no no no yes no 959 3 / 92 / 95
no no yes yes yes no 103 10 / 10 / 10
no no yes yes no no 6 7 / 7 / 7
no no no no no no 2 68 / 68 / 68
  • No back-edge has a group barrier or an LDS access in its body. Item I's wording ("back-edges through the LDS / barrier structure") is not observed here: the loops sit between barriers.
  • No back-edge matches the constant pattern (constant start, constant step, compare against a constant, no second exit). The others are not classified further: no trip count is proved constant, bounded or data-dependent.
  • "Body writes EXEC" is an upper bound on a loop-carried EXEC: a save/restore pair inside the body counts too.
  • "Loop-carried scalar" means an SGPR read in the body before the body writes it, in body order.

First refusal (CONFIRMED)

As decoded, both lowerers:

First refusal Programs with loops Loop-free
Unsupported scalar instruction s_setreg_imm32_b32 828 3,446
anything else before the first loop (one loop-free program is lowered by the entry lowerer) 8 176
at a latch or in a loop body 0 -

4,274 of 4,458 programs (95.9%) stop at the flat-scratch setup: two s_setreg_imm32_b32 writes to HW_REG_FLAT_SCR_LO and HW_REG_FLAT_SCR_HI, the second and third instructions of every one of them. That is none of A-H. None of the 4,458 programs holds a scratch_*, flat_* or global_* instruction or an s_getreg_b32, so nothing in them observes the write. tools/pixel_aot.py and tools/compute_store_aot.py already accept an unobserved whole-register write of these two registers; the mesh lowerers do not.

With those two writes replaced by s_nop (the census does this itself; nothing else is skipped), entry lowerer, dynamic lowerer in brackets where it differs:

First refusal Programs with loops All programs
Unknown descriptor table or offset 374 1,565 (1,563)
Scalar ALU requires concrete operands 272 1,204
Scalar not written on this wave (skipped range) is used 129 (127) 1,045 (971)
KeyError at s_load_dwordx4: an SGPR the entry state does not define (an exception, not a named refusal) 53 538
Unsupported scalar instruction s_bitset1_b32 8 (1) 44 (18)
Unproven runtime geometry word (dynamic only) (9) (145)
other (s_sub_i32, s_brev_b32, KeyError at s_mov_b32, IndexError at v_nop, undefined branch predicate) 0 61 (19)
lowered 0 1 (0)
at a latch or in a loop body 0 -

All 836 programs with loops are still refused before their first loop.

A-H or loop-specific

  • Loop-specific first refusals: 0. CONFIRMED at these revisions; it says nothing about what the loops will need once they are reached.
  • Mapping the messages to items is INFERRED from the message text, not from the constructs: the skipped-range message is item G's; the descriptor message belongs to the descriptor items (D or E, not separated). The flat-scratch setup, the concrete-operand scalar ALU refusal, the undefined entry SGPR and the unsupported scalar instructions are not in the A-H table.
  • These numbers cannot be compared row by row with the table at the top: A, B, E, H and parts of D and G have merged since it was made, and I do not know whether it was counted with the flat-scratch setup skipped. How was it produced? That would tell whether the two extractions agree.

Reproducing without the corpus

The script and a check with one hand-assembled loop per shape (14 programs, 14 category-boundary mutants, loop-free and barrier-outside controls) are ready as a PR.

python -B tools/mesh_loop_census.py <directory of containers> --llvm-mc <llvm-mc>
python -B tests/mesh_loop_census_check.py
python -B tests/mesh_loop_census_check.py binary <llvm-mc> <llvm-objcopy>

What I would propose next

  • Not a loop, but the measured first blocker: accept the flat-scratch setup in the mesh lowerers, with the rule the pixel and compute lowerers already use (a whole-register immediate write to FLAT_SCR_LO/HI; refuse the program if it holds any scratch_* or flat_* instruction or an s_getreg_b32 of those registers). I found no open issue or PR for it. I can take it if nobody has it.
  • The only small loop shape is the "latch tests EXEC" pair of rows: 109 back-edges in 63 programs, bodies of exactly 7 or 10 instructions, 3 distinct instruction sequences, and 56 of those programs have no other loop. INFERRED, not proved by the census: they look like the compiler's loop over distinct per-lane values (take the first live lane's value, handle the lanes that share it, drop them from EXEC, repeat), which would bound the trip count by the wave size and make the loop equal to straight-line per-lane code. No program reaches one at this revision, and the 10-instruction form selects a descriptor per lane, so it leans on the descriptor items. I would propose it as the first loop slice once the programs get that far, starting from a source-built fixture.
  • The other 2,042 back-edges are large (median body 64 and 92 instructions, with loads and sampling in the body) and none has a recognisable constant bound. I see no small sound slice there yet.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7159243592 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1998#issuecomment-7159243592). Originally posted by [NiiRoZz](https://github.com/NiiRoZz) on 2026-11-25T10:06:52Z. --- Item I, census part. Counts only; the corpus, its code and the raw logs stay local. **Short version.** At the revisions below, no program of this corpus is stopped by a loop: every program with a back-edge is refused before its first loop, by both bounded lowerers. So loop-specific refusals still cannot be separated from A-H by running the lowerers. What can be measured is the static shape of the loops and what stands in front of them. ### Method - Lowerers: `tools/mesh_entry_aot.py` (`lower`, 128 zero geometry words) and `tools/mesh_dynamic_aot.py` (`enumerate_variants`, 128 run-time words), once per program, each program counted once by its first refusal. - Revisions: `main` c4309205, and the lowerer sources of `main` 77a204d6 (#2276). The tables are identical at both. Between #2151 and #2276 both lowerers raised `TypeError` on every program, so nothing can be measured there. - Decoding: LLVM 15 `llvm-mc` for gfx1013 wave64, not the LLVM C library (not available on the machine used). - Loops are found statically, independent of the lowerers: every backward branch is counted as an observed back-edge, body from the branch target to the branch. No control flow graph is built and no trip count is proved. - LLVM 15 prints a negative branch offset unsigned (`s_cbranch_scc1 65533`). The census reads it signed. The lowerers do not: a decoded back-edge raises `KeyError` instead of "Expected a forward mesh branch" (separate small fix, PR to follow). ### Coverage | | Count | |---|---:| | Mesh-stage containers in the local extraction | 9,282 | | Excluded by the container extractor ("Unverified multi-exit program"), not analysed | 309 | | Duplicates (same declared limits and decoded text) | 4,515 | | Distinct programs analysed | 4,458 | One local extraction of one build. The 309 excluded containers are not de-duplicated and may hold loops. ### Loops (CONFIRMED, static) | | Count | |---|---:| | Programs with at least one back-edge | 836 of 4,458 | | Back-edges | 2,151 | | Programs with 1 / 2 / 3 or more back-edges | 85 / 539 / 212 | | Nested back-edges | 0 | | Latch `s_cbranch_scc0` / `s_cbranch_scc1` / `s_cbranch_execnz` / `s_cbranch_vccz` | 2,011 / 29 / 109 / 2 | | Barrier in body | LDS access in body | Body writes EXEC | Latch tests EXEC | Loop-carried scalar | Constant trip pattern | Back-edges | Body instructions (min / median / max) | |---|---|---|---|---|---|---:|---:| | no | no | yes | no | yes | no | 1,081 | 46 / 64 / 225 | | no | no | no | no | yes | no | 959 | 3 / 92 / 95 | | no | no | yes | yes | yes | no | 103 | 10 / 10 / 10 | | no | no | yes | yes | no | no | 6 | 7 / 7 / 7 | | no | no | no | no | no | no | 2 | 68 / 68 / 68 | - No back-edge has a group barrier or an LDS access in its body. Item I's wording ("back-edges through the LDS / barrier structure") is not observed here: the loops sit between barriers. - No back-edge matches the constant pattern (constant start, constant step, compare against a constant, no second exit). The others are not classified further: no trip count is proved constant, bounded or data-dependent. - "Body writes EXEC" is an upper bound on a loop-carried EXEC: a save/restore pair inside the body counts too. - "Loop-carried scalar" means an SGPR read in the body before the body writes it, in body order. ### First refusal (CONFIRMED) As decoded, both lowerers: | First refusal | Programs with loops | Loop-free | |---|---:|---:| | `Unsupported scalar instruction s_setreg_imm32_b32` | 828 | 3,446 | | anything else before the first loop (one loop-free program is lowered by the entry lowerer) | 8 | 176 | | at a latch or in a loop body | 0 | - | 4,274 of 4,458 programs (95.9%) stop at the flat-scratch setup: two `s_setreg_imm32_b32` writes to `HW_REG_FLAT_SCR_LO` and `HW_REG_FLAT_SCR_HI`, the second and third instructions of every one of them. That is none of A-H. None of the 4,458 programs holds a `scratch_*`, `flat_*` or `global_*` instruction or an `s_getreg_b32`, so nothing in them observes the write. `tools/pixel_aot.py` and `tools/compute_store_aot.py` already accept an unobserved whole-register write of these two registers; the mesh lowerers do not. With those two writes replaced by `s_nop` (the census does this itself; nothing else is skipped), entry lowerer, dynamic lowerer in brackets where it differs: | First refusal | Programs with loops | All programs | |---|---:|---:| | `Unknown descriptor table or offset` | 374 | 1,565 (1,563) | | `Scalar ALU requires concrete operands` | 272 | 1,204 | | `Scalar not written on this wave (skipped range) is used` | 129 (127) | 1,045 (971) | | `KeyError` at `s_load_dwordx4`: an SGPR the entry state does not define (an exception, not a named refusal) | 53 | 538 | | `Unsupported scalar instruction s_bitset1_b32` | 8 (1) | 44 (18) | | `Unproven runtime geometry word` (dynamic only) | (9) | (145) | | other (`s_sub_i32`, `s_brev_b32`, `KeyError` at `s_mov_b32`, `IndexError` at `v_nop`, undefined branch predicate) | 0 | 61 (19) | | lowered | 0 | 1 (0) | | at a latch or in a loop body | 0 | - | All 836 programs with loops are still refused before their first loop. ### A-H or loop-specific - Loop-specific first refusals: 0. CONFIRMED at these revisions; it says nothing about what the loops will need once they are reached. - Mapping the messages to items is INFERRED from the message text, not from the constructs: the skipped-range message is item G's; the descriptor message belongs to the descriptor items (D or E, not separated). The flat-scratch setup, the concrete-operand scalar ALU refusal, the undefined entry SGPR and the unsupported scalar instructions are not in the A-H table. - These numbers cannot be compared row by row with the table at the top: A, B, E, H and parts of D and G have merged since it was made, and I do not know whether it was counted with the flat-scratch setup skipped. How was it produced? That would tell whether the two extractions agree. ### Reproducing without the corpus The script and a check with one hand-assembled loop per shape (14 programs, 14 category-boundary mutants, loop-free and barrier-outside controls) are ready as a PR. ```text python -B tools/mesh_loop_census.py <directory of containers> --llvm-mc <llvm-mc> python -B tests/mesh_loop_census_check.py python -B tests/mesh_loop_census_check.py binary <llvm-mc> <llvm-objcopy> ``` ### What I would propose next - Not a loop, but the measured first blocker: accept the flat-scratch setup in the mesh lowerers, with the rule the pixel and compute lowerers already use (a whole-register immediate write to `FLAT_SCR_LO`/`HI`; refuse the program if it holds any `scratch_*` or `flat_*` instruction or an `s_getreg_b32` of those registers). I found no open issue or PR for it. I can take it if nobody has it. - The only small loop shape is the "latch tests EXEC" pair of rows: 109 back-edges in 63 programs, bodies of exactly 7 or 10 instructions, 3 distinct instruction sequences, and 56 of those programs have no other loop. INFERRED, not proved by the census: they look like the compiler's loop over distinct per-lane values (take the first live lane's value, handle the lanes that share it, drop them from EXEC, repeat), which would bound the trip count by the wave size and make the loop equal to straight-line per-lane code. No program reaches one at this revision, and the 10-instruction form selects a descriptor per lane, so it leans on the descriptor items. I would propose it as the first loop slice once the programs get that far, starting from a source-built fixture. - The other 2,042 back-edges are large (median body 64 and 92 instructions, with loads and sampling in the body) and none has a recognisable constant bound. I see no small sound slice there yet. AI-assisted (Claude Code).
Leyukaka commented 2026-11-25 19:04:14 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-25T18:36:17Z.


@NiiRoZz, about the flat-scratch setup in the mesh lowerers from your census comment above (the two s_setreg_imm32_b32 writes to HW_REG_FLAT_SCR_LO/HI, first refusal for 4,274 of 4,458 programs). You offered to take it if nobody had it. Do you still plan to take it? If not, I can.

The rule would be the one you described, the same as compute_store_aot.py (pixel_aot.py accepts the same write): accept a whole-register immediate write to FLAT_SCR_LO/HI, and refuse the program, by a scan of the whole decoded text and not only the executed path, if it holds any scratch_* or flat_* instruction or an s_getreg_b32 of those registers. A field write and the s_setreg_b32 form stay refused. Each refusal case gets a negative control. If you are already on it, ignore this.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7171138209 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1998#issuecomment-7171138209). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-25T18:36:17Z. --- @NiiRoZz, about the flat-scratch setup in the mesh lowerers from your census comment above (the two `s_setreg_imm32_b32` writes to `HW_REG_FLAT_SCR_LO`/`HI`, first refusal for 4,274 of 4,458 programs). You offered to take it if nobody had it. Do you still plan to take it? If not, I can. The rule would be the one you described, the same as `compute_store_aot.py` (`pixel_aot.py` accepts the same write): accept a whole-register immediate write to `FLAT_SCR_LO`/`HI`, and refuse the program, by a scan of the whole decoded text and not only the executed path, if it holds any `scratch_*` or `flat_*` instruction or an `s_getreg_b32` of those registers. A field write and the `s_setreg_b32` form stay refused. Each refusal case gets a negative control. If you are already on it, ignore this. AI-assisted.
Leyukaka commented 2026-11-25 19:04:16 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-25T18:48:12Z.


No reply to my question above and no PR or update on the mesh flat-scratch setup since the census comment, so I'm taking it. @NiiRoZz, if you already have work on it, say so and I'll hand it back and review instead.

Scope, as described above:

  • In the bounded mesh lowerers (tools/mesh_entry_aot.py, tools/mesh_dynamic_aot.py), accept a whole-register immediate s_setreg_imm32_b32 write to HW_REG_FLAT_SCR_LO/HI.
  • Refuse the program if its whole decoded text, not only the executed path, holds any scratch_* or flat_* instruction or an s_getreg_b32 of those registers.
  • A field write and the s_setreg_b32 form stay refused.
  • Each refusal case gets a negative control.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7171420965 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1998#issuecomment-7171420965). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-25T18:48:12Z. --- No reply to my question above and no PR or update on the mesh flat-scratch setup since the census comment, so I'm taking it. @NiiRoZz, if you already have work on it, say so and I'll hand it back and review instead. Scope, as described above: - In the bounded mesh lowerers (`tools/mesh_entry_aot.py`, `tools/mesh_dynamic_aot.py`), accept a whole-register immediate `s_setreg_imm32_b32` write to `HW_REG_FLAT_SCR_LO`/`HI`. - Refuse the program if its whole decoded text, not only the executed path, holds any `scratch_*` or `flat_*` instruction or an `s_getreg_b32` of those registers. - A field write and the `s_setreg_b32` form stay refused. - Each refusal case gets a negative control. AI-assisted.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows#1991
No description provided.