help wanted: GPU translation, part 2 (mesh shaders) #1991
Open
opened 2026-11-24 22:51:47 +00:00 by denn0x
·
20 comments
No Branch/Tag specified
main
codex/indirect-large-backed-views
codex/word3-preflight-check
codex/vertex-table-two-records
codex/live-index-alias
codex/copied-vertex-buffer-srv
codex/windows-stage-test-output
codex/preserve-live-srv-retirement
codex/share-render-target-tracking
codex/sgd5-negative-offset-fixture
coverage-dashboard
codex/mesh-loose-root
codex/mesh86-cache-padding
codex/xmem-scatter-preflight
codex/mesh-depth-ps
codex/indirect-dispatch-refresh
codex/compute-container-index
codex/startup-compute-formatted-load
codex/compute-indirect-producer
codex/compute-atomic-soffset
codex/mesh-dual-handoff
codex/startup-run-sh-watcher-control
codex/queue31-page-alias
codex/indexed-indirect-compute-root
codex/typed-buffer-view-metadata
codex/translated-indexed-address-alias
codex/fixed-mesh-create-result
codex/xmem-section-lease
codex/startup-slot86-mesh-cache
codex/restore-mesh-barrier-iteration
codex/translated-indirect-upload-index
codex/xapu-completion-opt-in
codex/translated-indexed-rect
codex/translated-indexed-indirect
codex/startup-mesh-lds-integration
codex/startup-console-ms24
codex/startup-slot57-mesh-request
codex/indirect-copy-provenance
codex/present-color-producer-trace
codex/compute-dispatch-binding-trace
codex/translated-indirect-table-buffers
codex/indirect-copy-provenance-base
codex/mix-half-literal-source
codex/translated-indirect-draw
codex/xmem-scatter-diagnostics
codex/slot148-recording-upload
codex/slot70-loading-art-verified
codex/command-list-upload-arena
codex/recover-failed-command-list
codex/startup-heap-timing-notes
codex/align-audio-input-timeline
codex/synthetic-depth-export-control
codex/startup-texture1d-on-windows
codex/1629-packed-position-fixture
codex/cpu-srv-refresh
codex/stream-root-srv-draw
codex/audio-mixer-timer
codex/startup-reload-published-shader
codex/priority-integrate-1284
codex/guest-sixteen-page-record
codex/aot-placed-dxr-batch
codex/guest-directory-selection
codex/gamesave-enumerate-read
codex/readme-archive-to-pixels
codex/pe-placed-view-draw
codex/archive-directory-gpu
codex/slot133-dxr-build
codex/materialize-placed-vertex-view
codex/dstorage-directory-offsets
codex/xg-nine-bc-copy
codex/xg-slot10-bc64-arrays
codex/dxr-guest-address-readback
codex/gpu-va-high-bits
codex/clarify-diagnostic-startup-scope
codex/xg-six-levels
codex/typed-derived-blend
codex/english-legal-text-progress
codex/address-bc-4ks
codex/dstorage-bounded-file-read
codex/wide-srv-offsets-menu
codex/startup-memory-srv
codex/bound-view-tail
codex/language-selector-readback
codex/setup-menu-progress
codex/cpu-plane-refresh
codex/startup-ubyte-vertex
codex/presenter-window-selection
codex/startup-uniform-buffer-lane
codex/intro-loop-timing
codex/static-clzero-loops
codex/document-rtx-intro
codex/startup-insertq
codex/nv12-startup-texture
codex/stream-stage-draw
codex/startup-null-uav-format
codex/startup-draw-capture
codex/shorten-windows-checks
codex/dstorage-rfc1950
codex/startup-dump-fence
codex/pr1135-review-base
codex/startup-stream-requests
codex/startup-chroma-view
codex/readme-graphics-pipeline-streams
codex/static-crt-free-tls
codex/arc-140t-rtx-5080-laptop-gpu-reports
codex/main-startup-progress-entry
codex/signed-dxil-catalogue
codex/reloc-free-preferred-base
codex/quad-dpp-bit-mask
codex/raw-srv-bounds
codex/rx9070-31044-hardware-report
codex/gpu-page-source-provenance
codex/runtime-placeholder-interior
codex/gpu-copy-queue-tile-order
codex/pe-pin-external-providers
codex/xmem-placeholder-reservations
codex/xmem-shared-physical-pages
codex/pe-package-startup
codex/xmem-tools-memory-query
codex/cpu-stack-output-import
codex/pe-load-security-cookie
codex/record-three-bvh-retests
codex/cpu-rbp-frame-anchor
codex/xmem-default-startup
codex/record-rtx-3050-ti-9597
codex/docs-readme-start-here
codex/check-compute-mad24-truncation
codex/docs-discord-community
codex/bound-rcx-branch-mutants
codex/rtx5060ti-bvh-62114
codex/837-neutral-readme-disclaimer
codex/record-rtx-3070-ti
codex/title-neutral-public-wording
codex/exe-shadow-frame-submissions
codex/exe-shadow-runtime-chain
codex/readme-polish
codex/gpu-coverage-nov23
codex/spirv-minlod
codex/shadow-shim-device
codex/exe-two-shadow-frames
codex/shim-dispatch-cleanup
codex/fix-spirv-cache-probe
codex/sampler-use
codex/ballot-bit-extract
codex/packed-fma-release
codex/cpu-packed-fma-o2
codex/publish-coverage-dashboard
codex/mesh-cbv-binding-order
codex/spirv-window-fixture
codex/ps-e32-float-uint
codex/ps-cbuffer-reads
codex/fixed-profile-rescan
codex/shim-compute-integration
codex/readme-visible-coverage
codex/readme-research-navigation
codex/integrate-pr-256
codex/indexed-mesh
codex/sampled-coverage
codex/first-ms
codex/dual-ps
codex/ps-attribute
codex/compute-first
codex/ps-export
codex/readme-research-status
codex/ps-layout
codex/blast-window
codex/chart-caption
codex/reviewer-roles
codex/blast-aot
codex/archive-program
codex/crc-stream-program
codex/exe-image-data-chain
codex/local-cpu-fixture-coverage
codex/exe-bound-frame-chain
codex/exe-mapped-comparison
codex/contribution-dependencies
codex/exe-entry-aot
codex/bink-frame-heap-integration
docs/hardware-seven-reports
codex/bink-custom-heap
codex/bink-heap-callers
codex/discussions-entry-points
codex/gpu-community-batch-64
codex/ffx-scratch-writers
codex/generic-project-documentation
codex/ffx-dispatch-rcas
codex/four-windows-gpu-reports
codex/title-neutral-project-wording
codex/community-coverage-provenance
codex/rcas-packed-texels
codex/community-gpu-retests
codex/community-build-and-gpu-reports
codex/ffx-provider-loop
codex/ffx-recurrent-views
codex/ffx-recurrent-resource
codex/amd-wave64-reports
codex/ffx-backend-slots
codex/upscaler-device-init
codex/ffx-context-lifecycle
codex/ffx-version-query
codex/ffx-provider-contract
codex/typed-object-callback
codex/cpu-ordinal-import
codex/chained-cpu-ranges
codex/cpu-import-call
codex/cpu-direct-call
codex/cpu-leaf-aot
codex/community-project-status
codex/script-state-path-replay
codex/script-state-evidence
codex/bc7-resident-tail
codex/bcpack-mip-tail
codex/bc7-texture-draw
codex/asset-ranges
codex/pixel-constants
codex/pixel-aot
codex/pre-exe-workloads
codex/root-signature-device-coverage
engineering/packed-bvh-leaves
engineering/bvh-build-and-update
engineering/intake-root-roundtrip
community/gpu-check-release
community/english-contributor-entry
gpu-check-v0.1.0
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 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)
v_writelane_b32/v_readlane_b32used as spill slots for scalar registers, including saved exec maskspos1): clip and cull distancesSV_ClipDistance/SV_CullDistance; the component count comes from pipeline state.What a contribution needs
Notes
Related: #1760, #1759, #1541, #1543, #1143.
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.
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.
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.
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.pyandtools/mesh_dynamic_aot.pyat5a0b0aa. Nothing was run.prim,pos0andparam0only (mesh_entry_aot.py, the export regex). Any other target raises "Unsupported mesh export".mesh_dynamic_aot.pyinherits that parser throughRuntimeWave(Wave).decode_meshtakes the limits from PSV0 and the code from the DXIL chunk.PA_CL,CLIP_DIST,CULL_DIST,CCDIST,ClipDistanceorCullDistancefinds nothing.PA_CL_VS_OUT_CNTL:CLIP_DIST_ENA_0..7,CULL_DIST_ENA_0..7,VS_OUT_CCDIST0/1_VEC_ENA, plusVS_OUT_MISC_VEC_ENAand theUSE_VTX_*bits. As far as I know, in Mesa's layoutpos1is the misc vector (point size, layer, viewport) when that is enabled, and the distance vectors then move topos2/pos3. Sopos1is 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.SV_ClipDistanceN/SV_CullDistanceNfields, write the export operands in ascending index order, and refuse unknown or contradictory layouts with the target and reason.AI-assisted.
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=1andEXEC_HI=0x100into inactive lanes 8 and 40. LLVM assembled and decoded the three gfx1013 guest Wave64 programs. On RTX 4070 Ti SUPER (driver32.0.16.1714, Win11 build28000), 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.
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.
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.
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.
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 readbackImported 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.
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).
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.
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.
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.
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):
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.
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:
tools/mesh_*_aot.pyat a namedmainrevision over mesh-stage programs from a private corpus, in a mode that records the first refusal and, separately, every refusal inside a loop body.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".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).
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.
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
tools/mesh_entry_aot.py(lower, 128 zero geometry words) andtools/mesh_dynamic_aot.py(enumerate_variants, 128 run-time words), once per program, each program counted once by its first refusal.mainc4309205, and the lowerer sources ofmain77a204d6(#2276). The tables are identical at both. Between #2151 and #2276 both lowerers raisedTypeErroron every program, so nothing can be measured there.llvm-mcfor gfx1013 wave64, not the LLVM C library (not available on the machine used).s_cbranch_scc1 65533). The census reads it signed. The lowerers do not: a decoded back-edge raisesKeyErrorinstead of "Expected a forward mesh branch" (separate small fix, PR to follow).Coverage
One local extraction of one build. The 309 excluded containers are not de-duplicated and may hold loops.
Loops (CONFIRMED, static)
s_cbranch_scc0/s_cbranch_scc1/s_cbranch_execnz/s_cbranch_vcczFirst refusal (CONFIRMED)
As decoded, both lowerers:
Unsupported scalar instruction s_setreg_imm32_b324,274 of 4,458 programs (95.9%) stop at the flat-scratch setup: two
s_setreg_imm32_b32writes toHW_REG_FLAT_SCR_LOandHW_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 ascratch_*,flat_*orglobal_*instruction or ans_getreg_b32, so nothing in them observes the write.tools/pixel_aot.pyandtools/compute_store_aot.pyalready 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:Unknown descriptor table or offsetScalar ALU requires concrete operandsScalar not written on this wave (skipped range) is usedKeyErrorats_load_dwordx4: an SGPR the entry state does not define (an exception, not a named refusal)Unsupported scalar instruction s_bitset1_b32Unproven runtime geometry word(dynamic only)s_sub_i32,s_brev_b32,KeyErrorats_mov_b32,IndexErroratv_nop, undefined branch predicate)All 836 programs with loops are still refused before their first loop.
A-H or loop-specific
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.
What I would propose next
FLAT_SCR_LO/HI; refuse the program if it holds anyscratch_*orflat_*instruction or ans_getreg_b32of those registers). I found no open issue or PR for it. I can take it if nobody has it.AI-assisted (Claude Code).
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_b32writes toHW_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.pyaccepts the same write): accept a whole-register immediate write toFLAT_SCR_LO/HI, and refuse the program, by a scan of the whole decoded text and not only the executed path, if it holds anyscratch_*orflat_*instruction or ans_getreg_b32of those registers. A field write and thes_setreg_b32form stay refused. Each refusal case gets a negative control. If you are already on it, ignore this.AI-assisted.
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:
tools/mesh_entry_aot.py,tools/mesh_dynamic_aot.py), accept a whole-register immediates_setreg_imm32_b32write toHW_REG_FLAT_SCR_LO/HI.scratch_*orflat_*instruction or ans_getreg_b32of those registers.s_setreg_b32form stay refused.AI-assisted.