memory: inventory of application-memory paths and next steps for the #1914 hybrid model #3678
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#3678
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?
@Leyukaka on GitHub · 2026-12-01 00:14 UTC · original
Context
This issue does not reopen that decision. It lists the paths that exist on
maintoday, what a start-up run shows about them, and small work items that can be claimed separately.Inventory
Read from
mainatd5970858. Bare:Nissrc/startup_stubs/d3d12_xs_device.cpp;drawisd3d12_draw.inl,cdispisd3d12_compute_dispatch.inl, both insrc/startup_stubs/. "Desktop copy" means a separate D3D12 resource.:6688-6720D3D12_FEATURE_EXISTING_HEAPSquery on this path:6724-6732:6564-6608,draw:2002-2005frame_copydraw:1940, calldraw:4003draw:3919-3921); 256 MiB ringupload_from_title:3216-3221,:5238-5239X2W_TRANSLATED_TITLE_INPUT_SNAPSHOT)draw:2890-2902,cdisp:1514-1519X2W_D3D12_TITLE_COPY_SNAPSHOT)list_copy.inl:214-226X2W_D3D12_LINEAR_BUFFERS, #2218)ExecuteCommandListslinear_buffer_backing.h:3-30,linear_buffer_backing.h:473; hooks:5462,:5553COMMONstate only; no copy for GPU-written buffers (linear_buffer_backing.h:106-107); a write after submission is not seen (#1914)X2W_MESH86_XMEM_SRV,X2W_MESH_INDIRECT_XMEM; #2280, #2303)mesh_xmem_handoff.inl:6-12,mesh_xmem_handoff.inl:204d3d12_memory_srv.inl:358-372,d3d12_memory_srv.inl:399-449,d3d12_memory_srv.inl:336-343d3d12_memory_srv.inl:279-297)list_upload_pages.h:24-37X2W_TRANSLATED_INDIRECT_ADDRESS_ALIAS):6465-6500Two rules sit above the table.
MapandGetGPUVirtualAddressreturn the application's own memory and address when the resource has them (:5710-5725,:5737-5746). The desktop objects stay alive for the process unlessX2W_D3D12_RELEASE_RETIRED=1(:1239-1241, #2379), and buffers are outside that class (:1068).Not wired into the stand-in:
src/era_gpu_alias.h(one buffer over a whole allocation),src/era_title_va.h,src/era_title_gpu.h,src/title_va_lookup.hlsli.Observed gaps
One start-up run of 900 s on one adapter, aggregate counts only.
Measured
0x887A0006. The same run was stable for 900 s with that one compute program excluded.Read from the code
:3937-3939).QueryVideoMemoryInfois only logged (:8371);MakeResidentandEvictare forwarded (:1576-1585). Nothing bounds video memory (#2379).Inferred, not confirmed
:6618) matches their number, but the default log line prints neither the memory type nor the reason. #1914 says "mostly mapped sections" and its field report says "the rest fail the 64 KiB offset rule"; both classes exist, the second by count and the first by bytes.uploadcategory (resource_budget.h:9,resource_budget.h:156), so it cannot say.Proposed work items
Each is one small PR with a source-built test. Comment here to claim one.
Already taken, do not duplicate
a. Snapshot at submission (row 6). A PR is in preparation. Reserve at record, copy in
queue_executebeforeExecuteCommandLists(:5486-5493), under thedraw_lockalready held there.b. Placement and read-path census. Add
range.typeand the refusal reason to the default slot 133 line (:6733-6735), as the linear line already does (:6646-6650). Add a five-second line next to:8679:c. Split the
uploadbudget category by creator (follow-up to #3493). Creators onmain: ring and snapshot pool (:3153), slot 27/127 committed (:1161,:8167), slot 70 fallback (d3d12_memory_srv.inl:449), slot 148 pages (list_upload_pages.h:37), linear staging (linear_buffer_backing.h:1158), Mesh86 cache (mesh86_cache.inl:490).d. One adapter-facts line at start-up.
src/,tools/andtests/have noD3D12_FEATURE_ARCHITECTUREquery.existing_heaps=1.e. Design proposal, for the maintainer to accept or reject: one desktop buffer per existing heap. For a buffer below 64 KiB at an unaligned offset in an allocation whose heap is open, stop creating a fallback. Keep one buffer over the heap, as
era_gpu_aliasdoes, and give the placement an offset.GetDesc); state tracking becomes per heap; GPU reads go to system memory.f. Measure before coding.
Mapcalls on READBACK-heap resources, copies and resolves whose destination has application memory, and the refusals logged for copy destinations backed by application memory. Open an issue with the counts only if they are not zero.Hardware
Recommendations, not measured.
DispatchMesh.D3D12_FEATURE_EXISTING_HEAPSis 0, which leaves only the copy path.Refs #1914, #3642, #3476, #2379, #3641
@Not-Saii on GitHub · 2026-12-01 00:24 UTC · original
Claiming (b) placement and read-path census.
Environment: Windows 11 build 26300, NVIDIA GeForce RTX 4090 (driver 32.0.16.1088), Windows SDK 10.0.26100, plus WARP.
Scope: add
range.typeand the refusal reason to the default slot 133 placement line, and a five-secondx2w-d3d12 placed buffers by backingline (shared / unaligned / mapped / uncovered / create-failed, count and bytes, with the GPU-written share of each). Test: a source-built fixture that places one buffer of each class on WARP and checks the counters, with a negative control that misclassifies one class. Logging and counters only; no change to which path a placement takes. Leaves (a), (c), (d) and (e) alone. PR will targetmain.@legacy-code-archaeologist on GitHub · 2026-12-01 00:26 UTC · original
Claiming (d) one adapter-facts line at start-up.
Environment: Windows 11 Pro 10.0.26100, in-box WARP (the hardware adapters here are an NVIDIA Quadro M1000M at D3D12 FL 11_0 and an Intel HD 530), VS 2026 BuildTools, Windows SDK 10.0.26100.
Scope: query
D3D12_FEATURE_ARCHITECTURE1andD3D12_FEATURE_EXISTING_HEAPSonce where the runtime creates its desktop device. Log onex2w-d3d12 adapter facts:line with uma, cache_coherent_uma, existing_heaps, and the local and non-local video memory from the adapter. A fixture will check that the line appears exactly once on WARP withexisting_heaps=1. Rows 1–2 are not changed in this PR.AI-assisted.
@RomainROCH on GitHub · 2026-12-01 05:27 UTC · original · edited 2026-12-01 05:57 UTC
For item (e), an independent MIT-licensed D3D12 fixture provides a preliminary check of the proposed single-buffer geometry (not a claim or a runtime integration).
On Windows 11 build 26100, system WARP 10.0.26100.9818, one placed buffer over an existing 64 KiB heap exposes two overlapping logical byte ranges. CPU-to-GPU visibility passes, and after an explicit fence both GPU readback and direct CPU observation return
10111213a0a1a2a3a4a5a6a7. The one-byte shifted-write negative control fails both post-fence checks (exit 2). On this particular shared cross-adapter heap, omitting the resource cross-adapter flag also returns E_INVALIDARG despite existing-heaps support.Reproduction commands and scope · Raw log
This covers one queue and logical subranges, not two runtime placement wrappers, resource-state integration, physical adapters or Windows 10. It may be useful as an independent control for the proposed fixture.
Physical adapter follow-up for (e). On Windows 11 build 26100 and in-box D3D12 10.0.26100.9818, a GTX 970M (driver 32.0.15.8253) reproduced the WARP bytes in the original 64 KiB fixture. An Intel HD Graphics 530 (31.0.101.2115) reported feature level 12.1 and
EXISTING_HEAPS=0, so the test skipped it before allocation or queue submission.WARP and the GTX both passed a DIRECT → COPY → DIRECT handoff with explicit fences and
COMMONat each handoff. After the final fence and release, recommitting the same virtual address returned zeroed backing. The second generation read50515253e0e1e2e3e4e5e6e7through both paths. Shifting that write by one byte failed both checks while the first generation stayed clean. The scope is two logical ranges inside one buffer.Reproduction and capability matrix · Raw output
@lukaslw-lab on GitHub · 2026-12-01 05:46 UTC · original
Data point for row 12 / the
uncoveredclass, from one native Mesh86 run (main1c634037,X2W_REFUSE_FIXED_MESH=1,X2W_NATIVE_MESH86=1, 600 s, row 12 alias off):Two Mesh86 pipelines are refused at binding for a mesh
t0read through a descriptor table, root 1 at table offset0x40, 8 bytes needed:The descriptor's address is in application memory that no placement covers. This is not the #3642 shape (root 0,
0xAC0, a 174 MiB placed buffer). The same run's census line ends atuncovered 50/1094444, so these may be among those 50. Log lines are capped, so the counts are samples.I haven't tried
X2W_TRANSLATED_INDIRECT_ADDRESS_ALIASon it yet. Counts only.AI-assisted.
@SimSalabimse on GitHub · 2026-12-01 08:38 UTC · original
I'll take (c): split the
uploadbudget category by creator (upload ring / snapshot pool, slot 27/127, slot 70 fallback, slot 148 pages, linear staging, Mesh86 cache, plus an explicit other bucket so totals don't change). Each creator gets its own column in the budget log and instartup_resource_budget, with a sum check against the old total. I'll keep it clear of #3493's report line. Fork first, then a PR, plus a test-PC game run so we can see who owns the ~16,000 UPLOAD objects.AI-Assisted
@SimSalabimse on GitHub · 2026-12-01 08:46 UTC · original
I'll take the GPU-to-CPU half of (f): counters for Map calls on READBACK-heap resources, copies and resolves whose destination has application memory, and the refusals of those destinations (ResolveQueryData already refuses "destination has title memory"; Copy* currently forwards them). Logging and counters only; the #3642 top-10 GPU-written buffers stay with that trace. A source-built fixture will exercise each class, and a test-PC game run will show whether any count is non-zero (a follow-up issue only if so).
AI-Assisted
@timbot103 on GitHub · 2026-12-01 10:21 UTC · original
Claiming item (e) first PR (standalone fixture only): one desktop placed buffer over an existing 64 KiB+
MEM_PRIVATEheap exposing two unaligned overlapping logical buffer ranges, verifying bidirectional CPU->GPU and GPU->CPU visibility plus negative controls on both WARP and hardware (no runtime integration yet, per the design proposal above).Environment: Windows 11 (26200), MSVC 19.44, Ninja, Windows SDK 10.0.26100, NVIDIA GeForce RTX 5080 (driver 621.40) + WARP.
AI-assisted.
@timbot103 on GitHub · 2026-12-01 10:53 UTC · original
The standalone D3D12 fixture for item
(e)(no runtime integration) is up in #3725.Verified in both Debug and Release on WARP (
10.0.26100.9818) and NVIDIA GeForce RTX 5080 (32.0.16.2140, Windows 11 26200,D3D12_FEATURE_EXISTING_HEAPS=1; D3D12 debug layer unavailable on this host,0x887a002d): CPU→GPU, GPU→CPU, GPU→GPU UAV-barrier echo, and displaced-offset negative control (--offset-control/--corrupt-offsetexit code 3) all pass on both adapters.AI-assisted.