help wanted: GPU translation, part 6 (cross-lane operations) #2117
Open
opened 2026-11-25 00:55:06 +00:00 by denn0x
·
10 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#2117
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-25T00:55:06Z.
The startup translator models one lane, so every instruction that reads another lane is refused. In a private executable's pixel programs (decode only, aggregate counts), 695 programs use DPP (19,902 instructions), and none of those reads the lane itself. Hundreds more use
v_readlane/v_writelane/v_permlanex16.Each item below is one PR. Each needs the ISA or LLVM 15 semantics cited, a source-built fixture, and a negative control that fails when the lane is wrong.
quad_perm:[0,0,0,0],[1,1,1,1],[2,2,2,2](withbound_ctrl)ddx_coarse/ddy_coarse, orQuadReadLaneAtin SM 6.0+ pixel stagesquad_perm:[1,0,3,2],[2,3,0,1],[3,2,1,0]QuadReadAcrossX/QuadReadAcrossY/QuadReadAcrossDiagonal(SM 6.0)[1,1,3,3],[0,0,2,2],[2,3,2,3],[0,1,0,1]QuadReadLaneAtrow_mirror,row_half_mirror,v_permlanex16_b32 ..., 0, 0,v_readlane_b32 ..., 31WaveActiveMin/Max/Sum; refuse partial shapesv_writelane_b32 vN, sM, k...v_readlane_b32 sM, vN, kwith constant kNotes:
v_readlanereads a lane whatever EXEC says. Any proof that a value is uniform must cover lanes outside the entry mask, or the lane select must be shown to be active. See the question on #2032.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:23:23Z.
Picking up Items A (quad broadcast DPP), B (quad swap DPP), and C (pair broadcast DPP) as separate small PRs with WARP readback tests.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:36:42Z.
Picking up Item E (constant-lane SGPR spill/reload
v_writelane_b32/v_readlane_b32in pixel stages) with unit + D3D12 WARP readback tests.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:47:18Z.
Picking up Item D DPP slice (row_mirror / row_half_mirror wave reductions) on top of the merged DPP base; v_permlanex16/v_readlane remain in #2032.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:48:13Z.
Releasing the Item D row_mirror / row_half_mirror claim: these read lanes outside the 2x2 quad, and the translator can only prove whole-quad EXEC, so a sound lowering needs a whole-wave EXEC proof (or the whole-reduction recognition) first. Free for anyone with a plan for that.
Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-25T05:06:51Z.
I'd like to take item D, the wave reductions, with a plan for the whole-wave EXEC problem raised when it was released. If someone already has it in progress, I'll step back and review.
Plan: recognise the complete reduction rather than lowering its instructions one by one.
First slice (one PR):
Later slices, each its own PR: float min/max with the NaN rules already used in the translator, then wave64 if the census shows it.
Evidence: source-built chains assembled with LLVM 15 llvm-mc for gfx1013 (encodings checked on the bytes), translated and compiled with DXC ps_6_0, drawn on WARP and an RTX 3070 with fenced readback against a CPU reference per desktop wave (the lane count is read and reported per adapter, not assumed). Partly covered quads exercise helper lanes. Negative controls: every partial chain refused with its reason, and mutations (Sum for Max, wrong identity, readlane 30, one mirror step removed, guard removed) must fail. Not tested: AMD hardware and console wave64.
@denn0x, if the census can share the aggregate shape of these chains (step order, operations, whether EXEC is saved first), I'll match the first slice to it; otherwise it follows the documented Mesa and LLVM form and says so.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-25T05:26:20Z.
Thanks for taking item D. Here is the aggregate shape from our census of a private executable's pixel programs: decode only, distinct pixel programs counted once, numbers only.
How many:
v_permlanex16_b32. Most of those pairs have other blockers as well.EXEC: every chain starts with
s_or_saveexec ..., -1, so all lanes are enabled. All 725 do; none runs at the entry EXEC.Step order: the steps run in the same order in every chain:
quad_perm:[1,0,3,2]quad_perm:[2,3,0,1]row_half_mirrorrow_mirrorv_permlanex16_b32 ..., 0, 0The first two steps are DPP16 quad swaps on the same operation. Your plan starts at the mirrors, so it would need to accept those two steps as part of the chain.
Operations: only three appear.
v_or_b32v_min_u32, thenv_max_u32on the same inputv_min_u32alonev_min_u32+v_max_u32+v_or_b32in one stretchThe min-then-max chains run back to back: the second saves EXEC again before its own reduction.
We see no
v_add_nc_u32, no signed min/max and no float operations. Sov_or_b32(WaveActiveBitOr) is the most common case here, and it is not in the first slice as written.s_or_saveexec_b32)s_mov_b32 exec_lo, ..., thenv_readlane_b32 ..., 31s_or_saveexec_b64)v_readlane_b32 ..., 0, and..., 63in the min/max chains; EXEC restored withs_mov_b64 exec, ...So wave64 is about a quarter of the chains.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-25T05:42:26Z.
@denn0x thank you, this is exactly what the first slice needed. I'll change it to match the census before running the final checks:
s_or_saveexec_b32 ..., -1and includes the twoquad_permswaps ([1,0,3,2], then[2,3,0,1]) beforerow_half_mirror,row_mirror,v_permlanex16_b32 ..., 0, 0andv_readlane_b32 ..., 31, with EXEC restored bys_mov_b32 exec_lo, ....v_or_b32toWaveActiveBitOr, andv_min_u32/v_max_u32toWaveActiveMin/WaveActiveMax, including the min-then-max pair run back to back with its own saveexec.v_add_nc_u32and the signed forms come out of this slice, since the census has none.readlane 0/63,s_mov_b64 exec) becomes the second slice.One open point decides whether the lowering is sound: the instructions between
s_or_saveexec ..., -1and the firstquad_perm. With every lane enabled, the lanes that were inactive on entry must hold the operation's identity (0 for OR, UINT_MAX for min, 0 for max), or the reduction picks up stale values. If the census can show the aggregate shape of that stretch (for example av_cndmaskon the saved mask, av_movunder the entry EXEC, or nothing), I'll accept exactly that form and refuse the rest by name. Until then the translator keeps refusing these chains.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Miffedrandir on 2026-11-26T10:25:36Z.
@roansystemlabs answering your open point on item D, from a local capture of graphics pipeline requests (decode only, aggregate counts, distinct pixel programs counted once; 578 programs, 225 with chains, 614 chains: 574 wave32, 40 wave64).
The stretch between
s_or_saveexec_b32 ..., -1and the firstquad_permis always exactly onev_cndmask_b32_e64 vT, <identity>, vSrc, sSaved, wheresSavedis the saveexec destination and the identity is0forv_or_b32(214 chains),-1forv_min_u32(180) and0forv_max_u32(180). All 574 wave32 chains match one of three exact shapes:s_or_saveexec_b32 s, -1→v_cndmask_b32_e64 vT, 0, vX, s→v_or_b32_dpp vT, vT, vTwithquad_perm:[1,0,3,2],quad_perm:[2,3,0,1],row_half_mirror,row_mirror(allrow_mask:0xf bank_mask:0xf fi:1) →v_permlanex16_b32 vU, vT, 0, 0→v_or_b32_e32 vT, vU, vT→s_mov_b32 exec_lo, s→v_readlane_b32 sR, vT, 31immediately.-1. Its readlane is not immediate: afters_mov_b32 exec_lo, scomes av_cndmask_b32_sdwa, then the next chain'ss_or_saveexec_b32 ..., -1, and only thenv_readlane_b32 sR, vT, 31.s_or_saveexec_b32 s', -1→ (the MIN'sv_readlane_b32 ..., 31) →v_cndmask_b32_e64 vT, 0, vX, s'→ the same four DPP steps →v_permlanex16_b32→v_max_u32_e32→s_mov_b32 exec_lo, s'→v_readlane_b32 ..., 31immediately.So a matcher that requires the readlane right after the restore would miss the 180 MIN chains, and one that requires the
v_cndmaskright after the saveexec would miss the 180 MAX chains. Other points:s_lshr_b32/s_lshl_b32,s_sub_i32) and usereadlane ..., 63. I didn't break them down further.s_ff1_i32_b32), and each lane gates its work on its own bit (v_bfe_u32 v, vMask, sBit, 1→v_cmpx_ne_i32). That supports your contract that per-pixel results don't depend on which pixels share a wave.Happy to run your branch against this capture and report the refusal counts before and after. AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-26T12:43:49Z.
@Miffedrandir thank you, this was the missing piece. Your three shapes match what the branch now recognises:
v_cndmask_b32_e64 vT, <identity>, vX, sSwith0/-1/0, under the saveexec's own SGPR; any other fill, constant or mask is refused by name;v_cndmask_b32_sdwa(lowered as usual), the MAX chain'ss_or_saveexec_b32 ..., -1, then the readlane, which the MAX chain carries before its fill. It is refused if anything in between rewrites the MIN'svT, if that readlane overwrites the MAX's saved EXEC, or if no MAX chain carries it.The DPP steps accept
fi:1(every lane is on, so it decides nothing), and the combine takesvT, vU, vTas in your shape 1. Wave64 stays out for the next slice.The PR is https://github.com/R0Y00/Xbox2Windows/pull/2835. We'd gladly take your offer: running the branch against your capture and posting the refusal counts before and after (graphics pipelines failing, and how many of them still stop first at a reduction chain) would be the best check of the shapes that we can't run ourselves.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-27T20:11:08Z.
Claiming the #2125 item D follow-up: wave32 reduction chains in pixel programs that also have branches. #2835 already accepts the straight-line OR, MIN and MAX shapes. This slice keeps that matcher and allows the same chain when the rest of the program has branches, provided the chain itself stays straight, has no branch target inside it, and EXEC is saved and restored as in the accepted shapes. Wave64 stays out of this PR. Tests will be source-built pixel fixtures with a uniform branch before and after the chain, a control that a branch into the chain stays refused, and WARP plus hardware readback against a CPU reduction.
AI-Assisted