compute: size an output token's view against the record, not the desktop header #3510
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3510"
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 KelboLive on 2026-11-29T19:50:37Z.
Change
compute_token_output()judged a slot-19 UAV view by comparing the guest record's width withsizeof(D3D12_UNORDERED_ACCESS_VIEW_DESC). The record isViewRecord::uav_desc_bytes(40 bytes)whatever the build's headers are, but the Agility SDK 1.620.2 header makes that struct 48 bytes.
Under an Agility configuration every output token was therefore judged unmaterialized,
record_translated_dispatch()refused the dispatch with "an output token lacks a materializedexplicit counterless UAV", and the UAV kept its sentinel fill.
Compare against the record width and copy only the bytes the record carries into the zero-initialised
view, so the check no longer depends on the build's headers.
docs/experiments/agility-compute-views.mddocuments the same 40/48 difference for the SRV/UAVtemporary description (#3223). This is the same trap on the output-token path.
Verification
Base:
upstream/main5b86df1d6. The behaviour was measured on the fork's tree with369143792merged, using the agility configuration (
-DOFFSCREEN_AGILITY_620_DIRand-DOFFSCREEN_WARP_DIR,Agility SDK 1.620.2, WARP 1.0.22) on an RTX 4070 Ti SUPER.
Before:
After:
No in-box regression (default
devpreset, no Agility):All 15 hardware twins of the formerly-skipped capability set pass in the agility tree, with one
correct skip:
bvh_wave64_hardware(the adapter has no 64-lane waves).Evidence and follow-up
Not measured by CI: both Windows jobs build the in-box configuration, where
sizeof(D3D12_UNORDERED_ACCESS_VIEW_DESC)is already 40. The change is a no-op there, so a greencheck cannot confirm the Agility behaviour; the before/after above is the evidence.
The fixture is the existing
tests/startup_compute_indexed_atomic_uav_check.pyand its typed-buffertwin. The guest record format is unchanged at 40 bytes; only the comparison width changed.
Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-29T20:58:35Z.
Review: COMMENTED
Read the diff against
main. It looks right to me: the output-token path was the last place that compared a view record against the build's ownsizeof(D3D12_UNORDERED_ACCESS_VIEW_DESC). The input-texture UAV path (record_translated_dispatch, aroundd3d12_compute_dispatch.inl:952) and both SRV paths already compare againstViewRecord::*_desc_bytes, and thestatic_asserts at:793-794guarantee the desktop struct is at least 40 bytes.One small suggestion. The copy could use the same form as the sibling path:
ViewRecord::descis 64 bytes, andnote_viewstores whateverdesc_bytesthe caller passed. If a record ever carried more than 40 bytes,min(desc_bytes, sizeof(view))would copy up to 8 bytes past the guest's 40-byte layout into the 48-byte Agility struct. Copying exactlyuav_desc_byteskeeps the 40-byte guest layout as the only input, matches:953, and drops thecopylocal. That case doesn't happen today as far as I can see, so it's a nit, not a blocker.I agree CI can't show this, since both jobs build in-box headers where the change is a no-op. Your before/after on the Agility tree is the evidence.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T23:06:15Z.
Review: APPROVED
Read at
7c52ab9e(diff only). The copy and the gate incompute_token_outputnow both useViewRecord::uav_desc_bytes(src/startup_stubs/d3d12_compute_dispatch.inl:701-702and:711), the same form as the sibling path at:957-958and as #3523. The copy stays in bounds: thestatic_assertat:799keeps the desktop struct at least as wide as the record, andview{}(:675) leaves the tail zero.As with #3523, no CI test can fail on revert: with the in-box header the struct is 40 bytes and the change is a no-op, so the evidence is the Agility before/after run in the description.