gpu: alias shared heap pages for translated indexed draws #2258
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2266"
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 R0Y00 on 2026-11-25T08:54:15Z.
Refs #1759. Stacked on #2262.
Add an opt-in read-only existing-heap binding for unregistered index views and vertex stream zero in translated indexed indirect draws. The requested span must fit a committed 64 KiB page in a private allocation whose external heap was already opened by slot 133. Refuse an overlapping registered GPU alias, an unproven or foreign heap, an extent beyond the underlying heap, and a view crossing the page. Both inputs on one page share the exact desktop resource. The argument buffer and existing GPU validator are used as before.
Enable with
X2W_TRANSLATED_INDIRECT_ADDRESS_ALIAS=1alongsideX2W_TRANSLATED_INDIRECT_DRAW=1. Keep the allocation live for the startup device's lifetime and keep input bytes and alias ownership stable through GPU execution. The binding retains at most 64 pages and applies only to the index and vertex stream zero. Ordinary registered placements and recording uploads keep their existing paths.Windows 26200.9974, MSVC 19.51.36244.0 Release, D3D12 debug layer on WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656.
22/22 CTests passed with zero skips. The new fixture seeds a second page through slot 133, then uses an eight-byte R16 index view and a disjoint vertex view on the first page. The R32 case changes the argument offset and uses a nonzero base. All pixels and original argument words match. Unproven heap, overlapping alias, cross-page view and opt-out controls all leave the target clear.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T09:01:05Z.
Review: COMMENTED
Review of head
08875b4f979c5d77b66fc40b49fb8c053e41a550(comment only).Scope: 6 files, +250/-26 (two stacked commits: recording-upload index, then the opt-in existing-heap alias).
Commands executed locally
git diff --stat origin/main...HEAD, targeted reads ofd3d12_xs_device.cpp,d3d12_draw.inl,d3d12_capture.inl, the fixture andCMakeLists.txtpython3 tests/docs_links_check.py-> self-test passed, 18 Markdown files, 432 links OKpython3 tests/bidi_controls_check.py-> 1546 files, no bidirectional controlsgit diff --check origin/main...HEAD-> cleanpython3 x2w_pipe.py win2025 2266 --targets startup_indirect_draw_indexed --regex '^startup_indirect_translated_indexed(_upload|_alias(_off)?)?_(warp|hardware)$'-> Release: build OK, WARP 4/4 passed (translated_indexed, _upload, _alias, _alias_off). The four_hardwarevariants were skipped for capability on that node, so they are not counted as passes.PR is mergeable, title is neutral, no CI checks are reported on the branch. No Linux-runnable code is touched (Windows-only C++), so a source mutation could not be built or killed here. I did not run a mutation.
P1: none.
P2: none.
Checks that hold up
X2W_TRANSLATED_INDIRECT_ADDRESS_ALIAS=1and a known slot-133 heap. The_alias_offtest covers the off path.placed_buffer_range(..., aliases_only=true)), before the page cache is consulted.MEM_PRIVATEcoverage are all checked beforeCreatePlacedResource. The cache is capped at 64 pages and refuses when full.draw.indices.upload).Nits
d3d12_xs_device.cppindirect_address_alias:placed_buffer_rangeruns beforeplaced_mutexis taken, so the overlap check and the cache insert are not atomic. A placed alias registered between them is missed. The PR text says the caller must not activate an overlapping alias, so this is documented, but a short comment at the check would help.Pageresource is never released, andpagesis a function-local static. That is fine for a device-lifetime heap, but the 64-page limit is reached silently. A one-time log line onit == pages.end()would make the refusal easy to diagnose.validate_indexed_argumentsnow skips the finalrequire_state(... INDEX_BUFFER)for upload indices only. The aliased resource still gets the transition, so it ends the pass in INDEX_BUFFER state. Tests with two draws on the same page are debug-layer clean, so this looks fine. A comment on why alias differs from upload would help.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T09:15:54Z.
Review: COMMENTED
Re-review of head
e05fab9e759eda9021dc230cbb616fc16cbdb629(merge of main on top of the previous head; the PR's own diff is still 6 files, +158/-16).Commands executed locally:
git diff --stat origin/main...HEAD: CMakeLists.txt, docs/experiments.md, d3d12_capture.inl, d3d12_draw.inl, d3d12_xs_device.cpp, tests/startup_indirect_draw_indexed.cpppython3 tests/docs_links_check.py: pass (18 files, 435 links)python3 tests/bidi_controls_check.py: passgit diff --check origin/main...HEAD: cleanpython3 x2w_pipe.py win2025 2266 --targets startup_indirect_draw_indexed --regex startup_indirect_translated_indexed(WARP, dev + release /O2): build OK.alias_warpandalias_off_warppass in both presets, along with the existing translated_indexed, upload and rect WARP tests. The 5_hardwarevariants skip on capability (not counted as passes).Findings:
TypeError: 'NoneType' object is not an iterator, fromtools/mesh_entry_aot.pyand related checks). The PR touches no Python or tools, so these come in through the merged main content. Please confirm they fail the same way on main, or re-run, before Ready.placed_buffer_range(..., aliases_only)in d3d12_xs_device.cpp / d3d12_capture.inl checks onlyPlacement::aliased_bufferneighbours. A non-aliased placement overlapping the page (for example a texture placement) is not treated as a conflict. The tests cover only the aliased-buffer overlap (alias_overlaps). Either document this limit or add a case.pagesarray never frees entries. A full table silently returns "refused". A counter or log line would make that visible. It is already documented as a limit.alias_no_heap,alias_overlaps,alias_cross_pageandalias_offcases each map to a distinct early-return inindirect_address_alias, so removing any of those checks should flip one of them.Positives: the route is opt-in (
X2W_TRANSLATED_INDIRECT_ADDRESS_ALIAS), requires a private committed page already in the slot-133 heap list, refuses cross-page spans, and is refused when a recording upload covers the address. Title is neutral, no clean-room concerns.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T09:57:50Z.
Review: COMMENTED
Re-review of head
bd05823b7d904083c497bc943a4df5478b7321c1(merge of main; the PR's own diff is still 6 files).Commands executed locally:
git diff --stat origin/main...HEAD: CMakeLists.txt, docs/experiments.md, d3d12_capture.inl, d3d12_draw.inl, d3d12_xs_device.cpp, tests/startup_indirect_draw_indexed.cpppython3 tests/docs_links_check.py: pass (18 files, 435 links)python3 tests/bidi_controls_check.py: passgit diff --check origin/main...HEAD: cleanpython3 x2w_pipe.py win2025 2266 --targets startup_indirect_draw_indexed --regex startup_indirect_translated_indexed(WARP, dev + release /O2): build OK, exit 0. 5 of 10 tests pass in both presets (the WARP ones, including the alias and alias_off cases). The 5_hardwarevariants skip on capability and are not counted as passes.Previous P2s:
TypeError: 'NoneType' object is not an iterator): RESOLVED. "Run platform-independent Python checks on Linux" passes on this head. "Assemble and translate gfx1013 fixtures" and "Build and test on Windows" were still pending when I checked.placed_buffer_range(..., aliases_only)considers onlyPlacement::aliased_bufferneighbours): STILL OPEN, now reduced to a doc/test gap. The docs now state that a page with a registered GPU alias is refused, which matches the code. A non-aliased placement overlapping the page (for example a texture) is still neither refused nor tested. Please document that limit or add a case.Findings on this head:
pagestable never frees entries. A full table silently refuses. A counter or log line would make it visible (documented as a limit).alias_no_heap,alias_overlaps,alias_cross_pageandalias_offeach map to a distinct early return inindirect_address_alias.Opt-in route, neutral title, no clean-room concerns.
AI-assisted; commands listed were executed locally.