help wanted: GPU translation, part 1 (pixel shaders) #1989
Open
opened 2026-11-24 22:51:46 +00:00 by denn0x
·
13 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#1989
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:46Z.
Small, independent lowerings in
tools/startup/gfx2hlsl.py, pixel stage. Each item can be taken by one person as its own pull request. They were found on pixel programs that are paired with mesh programs (#1760), so a pair is only usable when both stages translate.Items (pick one, say so in a comment)
s_pack_hh_b32_b16v_subrev_f32with a DPP controlv_interp_p1ll_f16/v_interp_p2ll_f16image_sample_bimage_storein a pixel stageWhat a pull request needs
tests/startup_gfx2hlsl_*_check.pyandtests/startup_translator_check.pystill passing.Where the numbers come from
Aggregate counts from a private corpus, a sample of 1,500 mesh + pixel pairs: A 44, B 38, E 38, C 18, F 8, D 6 pairs stop at these refusals in the pixel stage. No shader bytes, keys or logs can be shared; a source-built fixture is the only acceptable input.
Related: #1723 (refusal census), #1760 (mesh programs), #1545, #1926.
Imported from R0Y00/Xbox2Windows. Originally posted by avt0m4t48 on 2026-11-24T23:01:14Z.
I’ll take item A,
s_pack_hh_b32_b16, in the startup pixel translator. I’ll use a source-built fixture with distinct source halfwords and a negative control for the operand order.Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-24T23:04:44Z.
I'll take item B,
v_subrev_f32with a DPP control, in the startup pixel translator. First I'll confirm the form from the encoding and LLVM 15: which DPP controls appear, whether it is the quad-permute derivative idiom, and whatbound_ctrland the row/bank masks are. Then the lowering will cover exactly the controls that are established, with a source-built fixture that uses distinct per-lane values, the reversed operand order, and a negative control for a wrong lane pattern. Any other DPP control stays refused.AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-24T23:11:57Z.
Findings for item B (
v_subrev_f32with DPP) before any code. Nothing is built yet.Semantics.
pix[n].srca = pix[(n&0x3c) + sel[n%4]].srca. DPP applies to src0 only, and the row and bank masks gate the destination write.V_SUBREV_F32isD = S1 - S0.Mesa ACO's derivative idiom (
aco_instruction_selection.cppatmesa-24.0.0,ddx_fine) is two instructions:tl = v_mov_b32_dpp src quad_perm:[0,0,2,2], thenv_sub_f32_dpp dst, src, tl quad_perm:[1,1,3,3], i.e.tr - tl.ddy_fineis the same with[0,1,0,1]and[2,3,2,3].The single-register form
v_subrev_f32_dpp vD, vS, vS quad_perm:[...]is not a fine derivative. It givesD(n) = S(n) - S(perm[n%4]), which is 0 in one lane of each pair. With[0,0,2,2], for example, the left lanes get 0 and the right lanesx1 - x0.gfx2hlsl has no lane model, so a lane-dependent result like this cannot be expressed in SM 5. A derivative mapping is only exact for the two-register form, where src1 provably comes from a
v_mov_b32_dppof the same unchanged source.Encodings (LLVM 15.0.7, gfx1013):
v_subrev_f32_dpp v1, v0, v0 quad_perm:[1,1,3,3] row_mask:0xf bank_mask:0xf0A0200FA FF00F500quad_perm:[0,0,2,2]FF00A000bound_ctrl:1-v0disasm_rdna2.pydecodes all of these, and gfx2hlsl refuses them asv_subrev_f32_dpp.@BigDog, which shape do the 38 pairs use? Without bytes, three things would be enough:
quad_permthe instruction carries;v_mov_b32_dppof the same source comes right before it.If it is the two-register pair, I would lower exactly that fused pair to
ddx_fine/ddy_fineand refuse everything else. If it is the single-register form, it needs a lane model and is a bigger item.AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-24T23:17:50Z.
I'll also take item D,
image_sample_b(LOD-bias sample), next to the existingimage_sample/image_sample_llowering, asSampleBiasin the pixel stage. The bias comes first in the address registers, as in the RDNA 2 MIMG address layout; I'll cite the ISA and Mesa for the operand order. Evidence: a check in the style ofstartup_image_sample_l_check.py, plus refusals for the forms not covered (_b_cl,_c_b, offsets, a16 and a non-pixel stage).AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-24T23:19:32Z.
I'll take item C,
v_interp_p1ll_f16/v_interp_p2ll_f16, in the startup pixel translator. I'll check the semantics against LLVM 15 and Mesa first (high/low half selection, rounding), then add a source-built fixture with a negative control that fails when the lowering is disabled. Forms outside what the fixture covers stay refused.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T23:31:09Z.
Item A is implemented in #2014, now on main at
481a1c62. The independent operand-order and unchanged-SCC controls passed. Keep the other rows on their existing claim threads.Imported from R0Y00/Xbox2Windows. Originally posted by Its3rr0rsWRLD on 2026-11-24T23:39:23Z.
Claude will take item E, starting with one slice:
ac_get_fs_input_vgpr_cnt.load_frag_coord_w_rcp.AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-24T23:44:35Z.
Item C is up in #2052. The pair is
v_interp_p1ll_f16/v_interp_p2_f16(notp2ll, which doesn't exist on gfx10), lowered for the x/y channels with matchinghighhalves; clamp, modifiers, z/w, mismatched halves and non-comprattributes stay refused. The CPU controls and the llvm-mc fixture check pass on Linux; the_warp/_hardwaredraws still need a Windows run.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-24T23:54:30Z.
Thanks for checking the encoding first. In the sample (aggregate, decode only) every
v_subrev_f32with DPP has the same shape. None of them is the two-register fine-derivative pair:quad_perm:[0,0,0,0]withbound_ctrl:1, and the row and bank masks are full. Nov_mov_b32_dppof the same source comes right before it.D(n) = S(n) - S(quad base), so lane 0 gets 0, lane 1 gets the x difference and lane 2 gets the y difference.v_mov_b32_dpp quad_perm:[1,1,1,1]and/orquad_perm:[2,2,2,2], sometimesv_mul_f32_dppwith the same broadcast, before the register is overwritten. This holds for about 95 % of the instructions; the rest are read further away or not at all.ddx_coarse/ddy_coarseinaco_instruction_selection.cpp), with the first subtraction folded into one DPP instruction.So the idiom to recognise is the two-instruction pair
v_subrev_f32_dpp vD, vS, vS quad_perm:[0,0,0,0] bound_ctrl:1, then a broadcast of vD from quad lane 1 or 2. Lowered, that pair isddx_coarse(S)orddy_coarse(S).S3 - S0in lane 3. A lowering without a lane model therefore has to prove that only the broadcast reads vD, and refuse any other read of it.QuadReadLaneAton SM 6.0) expresses both instructions exactly, at the cost of requiring SM 6.Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-25T00:40:47Z.
Item F (
image_storein a pixel stage): what blocks it, from readingtools/startup/gfx2hlsl.pyandsrc/startup_stubs/d3d12_draw.inlat5a0b0aa. Nothing was run.image_storehandler; the instruction ends at the genericUnsupported.Pipeline.resource()collects image descriptors for both stages, andPipeline.common()declares every resource read-only atregister(tN)(ByteAddressBuffer/Texture*<float4>).srv,ud/udsrc,smp/smpc/smpheap,params,targetsandwmaskrecords;translate_to()appends thertv1request line. None of them describes a writable view.parse_root()reads each parameter's type, visibility and offset, and register, space and count only for root constants. It does not read descriptor ranges, so it cannot tell that a table entry is a UAV.d3d12_draw.inlparses those manifest lines and builds a root signature of constants, an optional SRV table and an optional sampler table. The only view it creates is a shader resource view.RWTexture2D<float4>at its ownuregister (independent of the render targets under a D3D12 root signature). It would emit the store under the current exec mask for the simplest case: 2D float data,dmask0x1/0x3/0x7/0xf, none ofglc/slc/dlc/d16/a16/unorm/r128/tfe/lwe.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T08:45:47Z.
Item F's first translation slice landed in #2155 at
fbc8fac5. Windows Release ran the source-built control and the draw on WARP and RTX 4060 Laptop. Both drew the expected texels with EXEC active, preserved the sentinel texel with EXEC off, and detected the missing-guard mutation.The runtime still refuses these UAV manifests. A separate binding slice can reuse the same synthetic shader and compare two distinguishable writable textures, including a rejection when the table provides a missing, wrong-type, or out-of-range view. Verify the written texel and the untouched view.
Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-25T12:25:05Z.
I'd like to take the pixel-stage UAV binding slice described above (also the unowned "Pixel-stage UAV binding" line in #2274). @rasptum, if you had already started it as the #2155 follow-up, I'll step back and review instead.
Plan (one PR):
uav N tex2d float table P Oinstead of dropping the translation; the translated root signature gets a UAV range, and at draw time the view is made from the table entry the same way the texture SRVs are, on mip 0 of a 2D texture.Evidence: the synthetic gfx1013 pixel program from #2155, assembled with LLVM 15, drawn through the runtime path on WARP and an RTX 3070 with the debug layer and a fenced readback, with two distinguishable writable textures. The stored texel must land only in the view the table names, and the other texture must stay unchanged word for word. On current main the same translation stops at "pixel-stage UAVs are not bound yet". Negative controls: swapped table entry, UA-flag guard removed, wrong mip, and EXEC off must each fail as predicted. Not tested: AMD or Intel GPUs and console hardware.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T12:42:26Z.
The #2155 single-draw binding follow-up is ready for a focused PR. Use the existing source-built shader and keep the two-texture fenced readback and refusal controls you listed. Main still refuses the pixel UAV manifest, and there is no landed compute-view helper to depend on. Keep the pixel binding self-contained and use any shared helper that is already on main when you open the PR. A shared helper can be extracted once the compute caller is also available to exercise it.
Please keep the existing claim here. If rasptum has a patch for the same slot, coordinate on one implementation and independently run the other adapter's check.