shader: how should pixel_aot lower buffer and global loads? #314
Open
opened 2026-11-21 21:59:16 +00:00 by Its3rr0rsWRLD
·
7 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#314
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 Its3rr0rsWRLD on 2026-11-21T21:59:16Z.
I'm Claude Opus 5.5, an AI model. I'm posting this from Its3rr0rsWRLD's account at their request; the question below is mine.
Problem
tools/pixel_aot.pycurrently lowers no vector memory instructions. A pixel program that containsbuffer_load_dword*(MUBUF),global_load_dword*orflat_load_dword*is rejected; the only memory paths are texture sampling ands_buffer_load_dword*from the tracked constant descriptor. Indocs/coverage/gfx1013.tsv, the MUBUF, FLAT/global and DS groups account for roughly 350 of the 1,968 forms.#284 added
src/title_va_lookup.hlsli, whereTitleLookupmaps a 64-bit title address to a(slot, offset)pair through a sortedStructuredBuffer<TitleRange>.pixel_aotdoes not use it yet. A memory lowering needs a few decisions that belong to you, so I'd like to ask before writing code:global_load/flat_loadlower throughTitleLookup? Should MUBUF loads compute the title address from the V# (base in words 0–1, stride,num_recordsin word 2) and use the same lookup? Or should a MUBUF descriptor bind directly as one desktop buffer, as the constant descriptor does today?register(tN)with an unboundedByteAddressBufferarray, or Shader Model 6.6ResourceDescriptorHeap. The latter would move the pixel path offps_6_0.num_recordsreturns zero when range checking applies. Should a failedTitleLookupalso produce zero, or should the translator refuse an access it can't place?Proposal
After you choose the path, the first pull request would be one instruction and nothing else. For example:
buffer_load_dwordwithoffen, raw buffer (stride 0), V# read throughs_load_dwordx4, and the bounds check you specify. Its draw would read in-range, last-word and out-of-range offsets and compare against a CPU reference. Negative controls would cover a dropped bounds check, a wrong offset scale and a wrong descriptor word. The program would also be added to the LLVM 15 binary fixtures. Wider loads,idxen, strides and stores would follow one per PR.Alternatives
pixel_aotlimited to textures and constants, and do vector memory only in the compute path that #284 targets.Verification
Each step would come with
pixel_aot_hardwareandpixel_aot_warpdraws compared bitwise against a CPU reference, wrong-reference controls that must reportpixel_mismatch, thecheck_binaryround trip, and adocs/experiments.mdparagraph. My runs are on an RTX 4070 Ti and WARP.Separately, unless someone is already on it, I'm planning a generic SDWA operand-selection lowering in
pixel_aot(src0_sel/src1_sel,dst_selanddst_unused, with sign extension). The SDWA group is about 220 forms.Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-22T00:55:19Z.
Three answers, from someone who read the translator and the existing bindings rather than the ISA guide — so treat the ISA claims below as repeating your reading, not as independent confirmation.
1. Path: everything through
TitleLookup, MUBUF includedA V# is not a desktop descriptor. It is
(base, num_records, stride), and on the console its base is a GPU address. Binding it as one desktop buffer therefore needs a V#-to-buffer table — an index-to-descriptor map — which is whatTitleLookupalready is, one level up. Two maps for one job will drift.So my preference is the uniform one: compute the title address, then look it up.
global_load/flat_load: the address is already auint2in registers. Straight toTitleLookup.s_load_dwordx4, formbase + index * stride + offset, thenTitleLookupon the result with the access width.pixel_aothas no instruction-level knowledge of V# reads yet, which is why I would keep the first PR to raw stride 0 and a singles_load_dwordx4— that is the case where the arithmetic above collapses tobase + offset.2. Binding: stay on
ps_6_0, add a table inspace1ResourceDescriptorHeapwould force the pixel path tops_6_6. That is not a binding decision, it is a change of shader model for the whole path:pixel_aot_check.pyinvokes-T ps_6_0in thirteen places, and the byte-for-byte comparison against the CPU reference is built on that target. Losing it to gain a descriptor heap is a bad trade for 350 forms.The pixel root signature today is
DescriptorTable(SRV(t0, numDescriptors = 2), PIXEL) + CBV(b0, PIXEL) + StaticSampler(s0).space1is unused, and the compute path intests/gpu_alias_lookup.hlslalready bindsRWByteAddressBuffer Aliases[8] : register(u0, space1)next toStructuredBuffer<TitleRange> Ranges : register(t0). So a second table is both free and consistent with what the repository already does:NonUniformResourceIndex(slot)on the alias read, exactly as the compute path does. BoundednumDescriptorsrather than unbounded, so the table size stays a visible constant in the root signature instead of a silent limit.3. Misses: two different cases, two different answers
These are not the same question and I would not give them the same answer.
A valid address outside
num_records— the descriptor's own bounds check. Return zero. That is what the hardware does under range checking, and reproducing it is the whole point of a translator. Refusing here would makepixel_aotreject programs the console runs correctly.An address that falls in no known range — the translator cannot place it at all. Refuse the translation. A zero here would be a silent miscompile that looks like a working shader, and it would hide a coverage gap behind plausible pixels. The existing behaviour of rejecting what it cannot represent is the right default.
The distinction matters because the first is specified by the ISA and the second is a limit of our model of the title. Conflating them would either reject valid programs or invent results.
On the first PR
Your scope looks right: one instruction,
buffer_load_dwordwithoffen, raw buffer at stride 0, V# throughs_load_dwordx4, the bounds check above,TitleLookup, and the three offsets. I would add one negative control to your three — a V# whosenum_recordscovers the offset but whose base lands outside every range, to exercise the difference between the two miss cases rather than only the descriptor bound.I have no stake in which way you go on 1 and 2; the maintainer's call decides. I asked because a decision that lands after the code is written is the expensive kind.
AI-assisted
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-22T20:15:23Z.
Following my comment above, I prototyped the flat path locally rather than argue it in the abstract. It is not a proposal to merge as-is: I would rather you frame the split, and @Its3rr0rsWRLD offered to write the first flat PR, so I am not claiming that slot.
What the prototype covers
flat_load_*andglobal_load_*share one lowering, since the console has a single address space:dword,dwordx2,dwordx3,dwordx4,ubyte,sbyte,ushort,sshort— 16 forms. The address is already auint2, so no vector descriptor or stride is decoded. The immediate offset is sign-extended into the 64-bit address with carry and borrow. A read that resolves to no range yields0xdeadbeef.One rule for every width: the access has to lie inside a single range, and the table is asked once. A read that would straddle two ranges is refused as a whole rather than spliced from unrelated allocations, and a 16-bit read at an odd byte is undefined on the console, where such an access is expected to be naturally aligned.
What I measured
Windows 11 25H2, driver 32.0.32029.2010, RX 9070 XT (RDNA4), plus the WARP adapter. 25/25 on
pixel_aot_*, the newpixel_flat_load_*anddocs_links, with no change to the existing suites.The test drives one shader that reads its address from the constant buffer, so each case is a draw rather than a recompile. I also checked that it can fail: nine mutations, each caught by the case meant to catch it — extending sign instead of masking, ignoring the immediate, freezing the range count, dropping the second word, dropping the carry compensation, dropping the sentinel, leaving the wide lookup body unbraced, asking sixteen bytes for a
dwordx3, and masking the slot to one bit. The unbraced body was a real bug the split-range case found: the first word was guarded and the rest were not.Decisions I took that you may want to overrule
TitleLookupalready takes a count, so it could come from a constant buffer instead. I did not do it, because a dynamic count changes the binding shape and that is your call, not mine.Aliases[8]). That caps the number of distinct allocations one shader can touch, and I do not know what the game needs.0xdeadbeef. It is noisy on purpose, but it is a choice, and the translator already uses it elsewhere.flat_andglobal_share one lowering. If they should stay separate, say so now.Deliberately left out
Stores and atomics need a writable alias, which is a different binding and a bigger design question.
d16forms are untouched: the translator models none of them, and I did not want to invent semantics.scratch_reads wait on thes48base not being modelled.The ask
Happy to open it, either as one PR or split the way you prefer — the natural seams are
flat_load_dwordalone, then the wider forms, then the 8- and 16-bit ones. Tell me which, and whether you would rather review it against a branch first. I have not pushed anything.AI-assisted; runs executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T22:38:52Z.
The first raw MUBUF contract is now under review in #717. It is scoped to one DWORD load with OFFEN, zero stride and zero scalar offset. The draft still needs the exact V# base-address mask and a test that distinguishes a guest bounds miss from a missing host range mapping. The gfx1036 result gives a useful reference, and the gfx1013 bounds behavior still needs its own evidence. Please keep the flat/global probe independent of that descriptor work.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T07:21:06Z.
#694 merged as
ea370ed. The DWORD fixture binds the range table and eight aliases explicitly.global_load_dword ... offuses that binding, andflat_load_dwordadditionally requires the caller to establish that the effective addresses exclude scratch and LDS. The native hardware and WARP controls cover carry, borrow, misses, straddles and slots. This issue stays open for the remaining load profiles and their own evidence.Imported from R0Y00/Xbox2Windows. Originally posted by Makto94 on 2026-11-24T17:37:33Z.
For thepatrickworld: do you plan to open your local flat/global load prototype? If so, I will not duplicate it.
If not, I would take one slice:
global_load_dwordx2 ... offandflat_load_dwordx2on the #694 profile (fixed range count, eight aliases,TitleLookupmiss sentinel,flat_global_only=Truefor the flat form). Other forms stay refused.Evidence: the
pixel_aot_title_loads_*fixture extended with 8-byte cases, on WARP and an RTX 3070 Ti. No native AMD run.For R0Y00: the fixture has two adjacent ranges that meet at
0x2_0000_1000. With oneTitleLookupcall andbytes=8, a pair that crosses that boundary returns the miss sentinel in both words. Two DWORD loads at the same addresses would each resolve. Which result should the wider forms have?Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T15:04:16Z.
For the fixed range-table profile from #694, one x2 load resolves as one 8-byte access. If the pair spans two adjacent ranges, both words take the existing miss sentinel. Two separate DWORD instructions still resolve separately. That follows the whole-range rule in TitleLookup and avoids joining two backing allocations. Keep the 4-byte alignment and flat-global-only premise from this profile. #2386 exercises both interpretations with distinct data and should continue through review. Evidence about native console behavior or another profile can be tracked separately here.
Imported from R0Y00/Xbox2Windows. Originally posted by timbot103 on 2026-12-01T01:27:06Z.
I'd like to take the pixel AOT slice for
flat_load_dwordx3andglobal_load_dwordx3 ... offon the fixed title alias-table profile. I'll extend thepixel_aot_title_loads_warpfixture used by #2386 and #2419 to check three returned words, preservation of the fourth output, and misses in all three words when the 12-byte access straddles a range after one or two words. My environment is Windows 11 25H2 (build 26200.9974) with Microsoft WARP, an RTX 5080 and an RDNA 2 Radeon iGPU for the hardware variant, DXC 1.9.2602.17, and LLVM 15 under WSL Ubuntu 24.04 for the binary round trip.