Carry formatted buffer loads through byte-address windows to main #3232
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3232"
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 RonLogic on 2026-11-28T00:11:17Z.
Change
Carries JB2WIN’s merged #3034 from
cpp-migrationtomain, preserving the original author and commit reference. Refs #3023 and #3063.The direct Compute frontend uses the byte-window SRV for an MTBUF load through a rewritten buffer descriptor. The current
mainheap replay generator runs the existing raw cases and the new formatted-load cases. This is the first prerequisite for the typed-heap carry from #3042.Verification
Tested
6fb2316cover7fcde81fon Windows 11 build 26300.10075, DXC 1.9.2602.17, RTX 4070 driver 32.0.16.2124 and WARP.non-contiguous resource descriptoron clean main at7fcde81f. On this branch the complete window compiles and the missing byte-count control still refuses.b1e92256, #3221 and #3227. The docs link check passed.Evidence
The MIT-licensed, source-built fixtures and their limitations are documented in the heap replay experiment. The changes cover compiler and replay behavior. The live heap contract is tracked in #3023.
I used Codex to prepare the carry and ran verification locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-28T00:45:10Z.
Review: CHANGES_REQUESTED
I independently reproduced this at
6fb2316cc9merged over main86beae95(tree 93bdcd0f1f75b9a201b16f9d6bc1fdf4673773e5). Debug and Release /O2 each gave three passes (MTBUF, direct container, RTX 4060 Laptop heap replay) and one inbox WARP wave32 capability skip (77). Windows 11 26200.9974, NVIDIA driver 32.0.16.1656, WARP 10.0.26100.9818.The remaining gap is the ordinary table manifest route. The new lowering accepts an MTBUF byte window without proving its DST_SEL, emits a generic srv buf table line for it, and the runtime reads and bounds that view without checking the identity contract described by the new documentation. The replay inputs all use identity. Please make the boundary explicit in code. Either keep this carry on the explicit offline replay route, or check the required identity before the runtime uses the generated table manifest and add a source-built table dispatch with a non-identity refusal/control. The existing byte-count and cross-slot controls should stay.
Imported from R0Y00/Xbox2Windows. Originally posted by akimfomin on 2026-11-28T02:03:28Z.
The data-path distinction in shadPS4 #5753 would make a good extra reference test for this port: use two SRV views selected by opposite branches, one raw and one formatted, and check the same underlying dword across the selection. That separates typed conversion from byte-window selection without requiring either implementation to use the other's code.
Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-28T06:07:36Z.
Rebased to
587fc6d2onmain9e32722b. The only conflict was in the heap experiment note. Both the original #3034 measurements and the newer offset-add measurements are retained, and JB2WIN remains the patch author.I rebuilt
offscreen_check,native_store_replay,native_global_srv_heap_replay, andcompile_dxilin all three configurations. The affected CTest selection included both heap replay adapters, MTBUF, direct containers, andnative_heap_offset_add. Stock Debug and Release each had four passes and the expected in-box WARP wave32 skip. Full Agility 1.620.2 plus app-local WARP 1.0.22 passed 5/5. The table replay checked all 54 words and guards, and the heap replay retained both the cross-slot mismatch control and the new offset-add cases. The tested commit merged cleanly into newermain6a1968a1.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-28T06:27:14Z.
Review: COMMENTED
I checked the rebased diff at
587fc6d2. It still lowers a zero-stride MTBUF source asbyte_window_srv, and the publishedsrv buf tableroute reachesindirect_table_buffer, which sizes the range from words 0–2 without checking DST_SEL in word 3. No runtime binding or manifest discriminator was added in the rebase. The prior request about the ordinary table route still applies. The offline and identity-fixture results are useful and can be retained in either approach.Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-28T07:06:50Z.
Addressed the published table-route finding in
80952189. The MTBUF byte-window binding now carries its identity requirement through cache serialization and emitssrv 0 buf table 1 0 identity_dst_sel. Dispatch checks the hardware descriptor's DST_SEL or the buffer SRV token's D3D12 component mapping before binding its raw range.I reproduced the original issue at
587fc6d2: the old generic manifest recorded a Dispatch with swapped X/Y selectors on both RTX 4070 and WARP 1.0.22, and the readback still had the identity order. The new fixture compares all 320 words through the ordinary slot 67/14 route. Five complete pairs match, the partial pair at the 44-byte edge and six later pairs return zero, and all guards match. Both the hardware descriptor and SRV token pass with identity and refuse with swapped X/Y before writing output. Cold and warm manifests match.Stock Debug and Release each had nine passes and two in-box WARP wave32 capability skips. Agility 1.620.2 with app-local WARP 1.0.22 passed 11/11. The original 54-word, byte-count and cross-slot controls are included.
Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-28T08:03:13Z.
Thanks for the quick follow-up. I did a static review of
80952189(no build, Wine or GPU run). It looks mergeable with the notes below, but it still needs R0Y00's re-review: the latest review is the COMMENTED one on587fc6d2, andreviewDecisionis still CHANGES_REQUESTED.identity_dst_selmanifest marker, and a runtime check runs before binding:(words[3] & 0xfffu) != 0xfacufor the hardware descriptor andShader4ComponentMapping != D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPINGfor the slot 18 token.startup_compute_mtbuf_window_check.pyrefuses swapped X/Y for both forms (SWAPPED_XY = 0x0103efa5,mapping='swapped'). The byte-count and cross-slot controls are still there.git merge-tree --write-tree c3204a9c 80952189gives rc=0. The 8 newer commits on main touch 6 of the same files, and I found no interaction. No positional initializer shifts.ctest --preset prran 73 tests.grep -con the Windows log returns 0 for native_mtbuf, native_global_srv_heap, native_direct_container and startup_compute_mtbuf_window, so only local Windows runs cover the affected tests.getDimensions72 andrawBufferLoad139 are reused. DST_SEL 0xfac/0xfa5 and the default mapping 0x1688 check out.docs_links_check.pyon the merged tree printsChecked 148 Markdown files and 671 links.SHOULD
git grep -Fover tests/ finds neither "a writable MTBUF byte window has no verified view contract" nor "an MTBUF byte window requires a buffer SRV". If the first were removed, the binding would becomeraw_buffer_uav, whose manifest line has no marker, and the suite would stay green. Two cases would cover them: a compile-only refusal in native_direct_container_check.py, and a CBV-token (slot 17) run in startup_compute_mtbuf_window_check.py.NIT
2. Pre-existing: an MTBUF load outside a byte window binds as
raw_vector_srvwith no DST_SEL check, yet the header comment edited in gfx1013_compute_mtbuf.inl says "Only the runtime-checked identity raw SRV is used". Either reword it or pass the flag for every MTBUF resource.3. native-global-srv-heap-replay.md: after the new table-route bullets, the next bullet still ends with "none of this reaches a title run (#3023)". That should be limited to the heap route.
4. The PR body still says it was tested on
6fb2316cand doesn't mention the runtime/manifest change. It should be updated before a squash merge.This comment was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-28T08:30:58Z.
Thanks for the work here. This branch no longer merges with current
main(c6f23813):git merge-tree --write-tree origin/main 80952189exits 1 with a conflict insrc/direct_compute_cache.cpp.Could you merge or rebase current
maininto the branch, resolve that conflict, and re-run the tests this PR adds, so reviewers can look at the refreshed head?This comment was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-28T08:52:26Z.
Fixed
Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-28T12:16:53Z.
Thanks for pointing out the two gaps in the test coverage. Both controls are now in
5399a2d8, tested at the refreshed head1b3ee66181c59ea4c8cbfa7f4b4cf3ef15175f6bon main052abe6f.a writable MTBUF byte window has no verified view contractbefore producing either DXIL or a manifest. The older587fc6d2hit a later, genericnon-contiguous resource descriptorrefusal on this fixture.an MTBUF byte window requires a buffer SRVand preserves all 320 guard words on RTX 4070 and WARP. Dropping justidentity_dst_selfrom the generated manifest let the same view dispatch on both adapters and change the first 24 words.The original identity, swapped X/Y, byte-count and selected-heap cases still pass. Debug and Release each passed 12/12 with Agility 1.620.2 and app-local WARP 1.0.22 on Windows 26300.10075. The RTX 4070 used driver 32.0.16.2124. The refreshed branch merges cleanly with
mainand #3305.@R0Y00 the published route now has controls for both additional cases and is ready for another review. I used Codex to prepare the tests and ran the verification locally.
Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-28T19:22:26Z.
@RonLogic I'd like to bring the rest of
cpp-migrationto main: the #3042 typed-load carry, then #3063 (the GPU-selected heap slot bucket in #3224 is 330 shaders / 4.67 M dispatches in Leyukaka's 900 s run, and main can't use any of it yet).Merging
cpp-migrationas is would bring back the #3034 route without theidentity_dst_selcheck R0Y00 asked for here, so I'd rather stack a #3042 port on this branch and rebase it on whatever #3232 lands as. Is that OK with you, or are you already porting #3042? I won't start on the overlapping files until you answer.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-28T21:30:18Z.
Review: CHANGES_REQUESTED
Reviewed
1b3ee661by its diff, againstmain8ecd30fe.mainingfx1013_compute_mtbuf.inl,d3d12_compute_dispatch.inl,d3d12_draw.inlandnative_mtbuf_check.py.maininsertedUINT alignmentas the sixth parameter ofindirect_table_buffer, so keeping the PR's call unchanged still compiles but passes the old arguments one position off, giving alignment 1 and dropping the DST_SEL check. The call needs(..., 16u << 20, D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT, true, slot.requires_identity_dst_sel).gfx1013_direct_graphics.inl:1960), so a pixel-shader byte-windowtbufferload should now compile (by reading; no test covers it), but the graphics manifest (direct_compute_cache.cpp:911-913) drops the identity-DST_SEL marker and the graphics binder (d3d12_draw.inl:2986) does not check it. Either refuse a flagged binding in the graphics manifest formatter or limit the byte window to compute, with a pixel-shader refusal case.(words[3] & 0xfffu) != 0xfacu→(words[3] & 0x3fu) != 0x2cuatd3d12_draw.inl:2422passes the suite (by reading); the same holds for the mapping check at:2390. An xyzw load with a Z/W swap control would catch both.Note for the census on #3224: this does not change
direct resource-heap load requires the selected GPU slot and its view type(333 shaders there); that refusal fires when the runtime passes no heap contract (gfx1013_direct_compute.inl:344).Request changes for 1-3.
Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-28T21:52:23Z.
@RonLogic no answer since my question above and no activity for about 9 hours, so under the 2-hour rule I'm taking over the main port from here.
Plan:
main, keeping your commits and authorship. Theindirect_table_buffercall will passalignmentexplicitly as Leyukaka describes in point 1, so the DST_SEL check stays in place. I'll rerun the tests listed in the PR body plus the new controls.I'll open the result as a new PR that refs this one, so this PR stays as it is. If you're back before then and want to keep it, say so and I'll stack on yours instead.
AI-assisted.