d3d12: count slot 133 placements by backing #3679
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3679
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3677"
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?
@Not-Saii on GitHub · 2026-12-01 00:33 UTC · original
Not-Saii:claude/xbox2windows-issue-3676-df1c44→main· +369 −8 · 5 files · 3 commits · merged 2026-12-01 01:25 UTCChange
Item (b) of #3678: a census of how device slot 133 backs the buffers it places, so the "Use by allocation" measurement from #1914 can be read from any run. Logging and counters only. The backing slot 133 chooses for a buffer is unchanged.
placed_refusalinsrc/startup_stubs/placed_buffer_range.hreturns the first reason the default backing refuses the existing heap. The checks run in this order:mapped,uncovered,unaligned,acceleration-structure. The caller then checks the opt-in size cap (capped), keeping the region query short-circuited as before. Because of this order,unalignedmeans private, fully committed memory that is refused only by the 64 KiB offset rule. #3678 guesses that is why about 7,600 placements are not shared; this census can confirm or refute that.shared,copied-at-submit(linear backing), the five refusals, orcreate-failed(every precondition held, but D3D12 refused the heap or the placement). Each class keeps buffer count, requested bytes (Width), and the UAV-capable share (sanitizedALLOW_UNORDERED_ACCESSat creation, the linear line's definition; not an observed GPU write). Placements that fail withE_INVALIDARGare not counted.type=0x… backing=<class>. The fields are appended aftergpuva=sotriage_run.pyandstartup_direct_index_late_write_check.pystill match.x2w-d3d12 placed buffers by backing: shared N/bytes (uav-capable N/bytes), …. It lists every class, zeros included, with counts since the start (likeplaced_buffer_calls).x2w_d3d12_placed_backing_snapshot, returns the counts for tests.docs/startup-runtime.mddescribes the fields and the order.Shared interface: the slot 133 log line (appended fields only). Leaves (a), (c), (d) and (e) of #3678 alone.
Refs #3678, Refs #1914
Verification
Base: rebased on
mainata3bfd019. Build:cmake --preset dev, thencmake --build --preset dev --target startup_placed_backing_census_check startup_slot133_heap_cap_check d3d12_xs_shim xmem_shim, on Windows 11 build 26300 with Windows SDK 10.0.26100. Debug layer off.startup_placed_backing_census_warpstartup_placed_backing_census_hardwarestartup_slot133_heap_cap_warp_debug0startup_slot133_heap_cap_capped_warpNo capability skips. Both adapters print the same census:
tests/startup_triage_run_check.py: 0 failed.tests/docs_links_check.py: 195 files, 755 links checked.Negative control.
placed_refusalwas changed locally to test the offset first, andd3d12_xs.dllwas rebuilt.startup_placed_backing_census_warpthen failed 8 checks: the mapped and uncovered buffers, which sit at offsets that are not multiples of 64 KiB, were counted asunaligned 4/147456. The change was reverted before the runs above.Not run: the
X2W_D3D12_DEBUG=1variants,copied-at-submit(it needsX2W_D3D12_LINEAR_BUFFERS; the fixture clears it and checks 0), and any title run.Evidence and follow-up
The fixture
tests/startup_placed_backing_census_check.cppis source-built and uses onlyVirtualAllocand page-file section memory. It contains no title data.shared: a private, fully committed allocation, placed at aligned offsets.unaligned: the same allocation at +132 KiB and +140 KiB.acceleration-structure: the same allocation at +256 KiB, in RTAS state.mapped: a section view at +4 KiB.uncovered: 128 KiB at +4 KiB in a 256 KiB reservation of which only the first 64 KiB is committed.capped: a 260 MiB reservation with 64 KiB committed, withX2W_D3D12_CAP_EXISTING_HEAP=1.create-failed: a private, fully committed allocation madePAGE_READONLY. It passes every precondition, andOpenExistingHeapFromAddressrefuses it on both adapters above. That is an observed driver behaviour, not a documented contract.The test skips (77) on an adapter without
D3D12_FEATURE_EXISTING_HEAPS.Assumption:
mappedcovers every non-private type,MEM_IMAGEincluded. The line'stype=field separates them.Follow-up for #3678: the census does not record XMem attributes or page size, so it covers only part of the "Use by allocation" ask in #1914. Whether the CPU rewrites memory after submission is the dirty-signal work already claimed on #1914.
Checklist
This change was AI-assisted (Claude Code).
🤖 Generated with Claude Code
@R0Y00 on GitHub · 2026-12-01 01:12 UTC · original · requested changes
Please label these counts
UAV-capablethroughout the log, exported snapshot, and docs. Both paths useALLOW_UNORDERED_ACCESSto increment them at allocation time, which measures capability. The #3642 trace has a UAV-capable placement with changing application bytes and no GPU write observed on the desktop backing. Calling this countergpu-writtenwould misclassify that case during the producer investigation.@ -140,0 +176,4 @@{int n = std::snprintf(out, size, "x2w-d3d12 placed buffers by backing:");for (int i = 0; i < static_cast<int>(PlacedBacking::count) && n > 0 && static_cast<std::size_t>(n) < size; ++i)n += std::snprintf(out + n, size - n, "%s %s %lld/%lld (gpu-written %lld/%lld)", i ? "," : "",@R0Y00 on GitHub · 2026-12-01 01:12 UTC · original
These totals are computed from
ALLOW_UNORDERED_ACCESSwhen the buffer is placed. Useuav-capableso readers can tell the allocation flag from an observed GPU write.@Not-Saii on GitHub · 2026-12-01 01:16 UTC · original
On
src/startup_stubs/placed_buffer_range.hline 179 (outdated):Renamed in
eb0c3ca3:uav_buffers/uav_bytesinPlacedBackingCounts,(uav-capable N/bytes)in the census line, and the comment now says the share comes fromALLOW_UNORDERED_ACCESSat creation, not from an observed GPU write.@Not-Saii on GitHub · 2026-12-01 01:16 UTC · original
Addressed in
eb0c3ca3. The counts are labelleduav-capablethroughout: the census line, the exported snapshot (PlacedBackingCounts::uav_buffersanduav_bytes), the fixture's cases and expected strings, anddocs/startup-runtime.md. The doc now says the share comes fromALLOW_UNORDERED_ACCESSat creation and does not show that the GPU wrote the buffer. Nothing else changed. The linear backing's existinguse=gpu-written|gpu-readfield predates this PR and is unchanged. Not rebuilt locally after the rename; the Windows CI job builds it.@R0Y00 on GitHub · 2026-12-01 01:19 UTC · original · approved these changes
The revised head names the allocation flag
uav-capablein the log, the snapshot fields and documentation. I rechecked the formatting and both creation paths.ctest --test-dir <build> --no-tests=error -j1 -R '^startup_placed_backing_census_(warp|hardware)$' --output-on-failurepassed in the integration on WARP and RTX 4060 Laptop. The adapter and Mesh57 runtime regressions also passed.