Skip to content

design: runtime model for the console's unified CPU/GPU memory (copies vs direct use of title memory) #1914

Backlog

Description

@MasterDomino

Design decision needed. This changes how every GPU-visible title allocation is backed on desktop, so it cuts across xmem, the D3D12 stand-in, storage and the translators. Opened from the gap summary on #874, so the decision has its own record. No implementation is proposed here, and none should start before a direction is agreed.

Background

The console has one physical memory shared by CPU and GPU. A title uses the same addresses for both, within a 40-bit range:

A title therefore writes GPU-visible data and GPU addresses straight into its own memory: vertex and constant data, descriptors, acceleration-structure inputs and destinations, upload memory from the command list (slot 148, #1758). It expects the GPU to see them, and expects to see what the GPU writes back.

How the runtime handles it today (measured on main df40e4bc, RX 9070 XT, the first-run UI and the post-confirm load)

Path What happens Evidence
Placed resources (device slot 133) Aliased with title memory only when the title range is one private committed allocation (OpenExistingHeapFromAddress). Otherwise a separate committed desktop buffer is used. 67 aliased, 3,508 not aliased of 3,575 placements in one run. Title pages are mostly mapped sections (MEM_MAPPED), which this path refuses.
Data reached by GPU address (root descriptors, fetch tables) Copied per use into a 256 MiB desktop upload ring (upload_from_title) every translated draw
Textures Uploaded and detiled into desktop textures about 1,370 textures, about 5.4 GiB in the #870 runs
Title GPU view X2W_XMEM_GPU_MIRROR maps each physical page section into both the CPU and GPU reservations docs/startup-runtime.md
Addresses the title hands to consumers Title CPU addresses, used directly; only placement is constrained #1860 (opt-in placement below 2^40)

The building blocks for direct use exist and are tested in isolation:

Why the copy model is reaching its limits (observed)

  1. Addresses. The title's own addresses reach consumers that check them: the package BVH builder's 40-bit check (startup-runtime: the package BVH builder throws an HRESULT during the post-confirm load #1758). Placement fixes the width (xmem: opt-in placement of 0x283 startup blocks below 2^40 #1860), but the consumer still gets a title CPU address, not a desktop GPU VA.
  2. Upload memory from the command list (slot 148). A pointer the title writes and the GPU reads; it needs a defined lifetime and a CPU/GPU address relation (gpu: establish the D3D12ConfigureVirtualMemoryX startup contract #874 task, startup: exercise upload arena allocation contract #1774 arena).
  3. Direct command writes (hypothesis from reading the builder, not yet reached in a run): the BVH builder appears to write command packets straight into the command-list object's buffer at fixed offsets.
  4. Coherence. A copy taken at bind or upload time misses CPU writes made later before execution, and GPU writes the title reads back. Not measured yet; it becomes visible once loading produces GPU-written data.
  5. Memory doubling. Peak commit is 14.6–16.2 GiB during the post-confirm load, against roughly 10–13 GiB attributable to the title (P0: main executable startup progress #870). Title pages and their desktop copies coexist, and the default -MemoryGiB 14 cap is not enough.
  6. Silent failure paths. Refused storage requests leave destinations untouched while the title only polls IsComplete (startup-runtime: loading-phase DirectStorage requests read past a file end and at non-zlib data #1198). A copy taken from such a destination can carry stale data into GPU work without any error.

Options to decide between

A. Keep copies, make them exact.

  • Copy or translate per use; add the missing contracts one by one (slot 148, placement, coherence points).
  • Pro: no change to memory backing; works on any adapter.
  • Con: memory doubling stays; every new consumer of a title address needs its own translation. Coherence relies on choosing the right copy points.

B. Back GPU-visible title memory directly (heap from file mapping or address, placed desktop resources over it).

  • Pro: one copy of the bytes; GPU writes land in title memory.
  • Con:
    • desktop GPU VAs still differ from title addresses, so every embedded address needs translation (descriptors, root and indirect arguments, AS instance and BLAS references);
    • system memory over the bus is slower for GPU-heavy data;
    • textures still need detiling copies (desktop layouts are opaque);
    • OpenExistingHeapFromFileMapping behaviour differs by adapter (RX 590 fails vm_copy_queue);
    • sections and placeholder splitting constrain heap boundaries.

C. Hybrid.

  • Direct backing for buffers the title addresses itself: upload memory, AS inputs and destinations, constant and structured data. Copies for textures and render targets.
  • Translation for embedded addresses.
  • Needs a per-allocation policy, based on attributes and observed use.

The choice also fixes who translates title addresses (the stand-in at bind time, the translators at lowering time, or both), and how the 40-bit address domain is kept on desktop.

Measurements that would inform the decision (proposed, aggregate only)

  • Use by allocation: per title allocation shape (XMem attributes, page size), whether the GPU reads, writes or never touches it, and whether the CPU rewrites it after submission.
  • Copied volume: how much is copied per frame and per load through each path above, and how much of it could be shared.
  • Embedded addresses: how many embedded GPU addresses appear in title-written GPU data, by kind (descriptors, root and indirect arguments, AS references).
  • Adapter matrix: heap from file mapping and from address, on the adapters reported in gpu: establish the D3D12ConfigureVirtualMemoryX startup contract #874.

Ask

@R0Y00, which direction should the runtime take, and which measurements do you want first? The concrete #874 rows (placement, slot 148) stay as scoped; this issue is only for the overall model.

AI-assisted.

Activity

  1. R0Y00 commented on Nov 24, 2026

    @R0Y00
    Owner

    We'll use a hybrid model, starting with one ordinary linear CPU-written, GPU-read buffer. Keep the current production backing as the default. Opt-in eligibility depends on the allocation's use, mapped extent, the adapter actually creating the shared backing, and whether the path can meet the synchronization contract. Acceleration structures, textures and render targets are outside this first slice. If sharing fails, use a copy only when it can preserve the same visibility and lifetime guarantees. Otherwise return a diagnosable failure.

    XMem owns guest allocation identity, mappings, byte offsets and lifetime. D3D12 owns desktop backing, resource state, queues and fences. Resolve each known address field to a desktop GPU VA through the same range- and generation-checked mapping. Translators declare the types of address fields they know, and the runtime binds or relocates them. Refuse dynamic layouts with unrecognized address fields. Storage publishes the range it actually wrote on success and preserves the error on failure. The 40-bit constraint stays with the specified guest address domain.

    This first comparison is available to claim here. Reuse the source-built heap and cross-queue controls in #874. Run the same buffer through real sharing, forced copying and forced sharing failure. Bind A, write B before submission, and verify the GPU reads B. In a separate GPU-write case, wait for the fence and verify the CPU alias sees the result. Hold one submission in flight and check that its backing isn't reused. Missing refresh and readback before fence completion should expose stale data or a defined refusal. Report the commit, commands, adapter/driver, bytes copied, backing usage and actual HRESULTs, with skips separate. Unsynchronized concurrent writes are outside the contract.

    Once both paths agree on bytes and lifetime, the first buffer change can be reviewed independently. The existing scoped placement work in #1860 and slot 148 ownership are unchanged.

  2. MasterDomino commented on Nov 24, 2026

    @MasterDomino
    CollaboratorAuthor

    Thanks for the direction. Claiming the first comparison as scoped: one ordinary linear CPU-written, GPU-read buffer, run source-built through real sharing, forced copying and forced sharing failure, reusing the heap and cross-queue controls from #874 (vm_translation, vm_copy_queue, era_gpu_alias).

    Cases (each on all three paths):

    1. CPU write after bind. Bind A, write B before submission; the GPU must read B.
    2. GPU write. Wait for the fence; the CPU alias must see the result.
    3. In flight. Hold one submission in flight; its backing must not be reused.
    4. Negative. A missing refresh, or a readback before fence completion, must expose stale data or a defined refusal.

    Reported: commit, commands, adapter and driver (WARP and RX 9070 XT), bytes copied, backing used, the actual HRESULTs, and skips separately.

    No change to the production default. Unsynchronized concurrent writes stay out of scope, and so do acceleration structures, textures and render targets. #1860 and slot 148 are unchanged. I'll post the comparison here before proposing the first buffer change.

    AI-assisted.

  3. Leyukaka commented on Nov 24, 2026

    @Leyukaka
    Collaborator

    A static read of main at ba0449c against the issue text and the claimed first comparison. Nothing was built or run for this. Bare :N refers to src/startup_stubs/d3d12_xs_device.cpp at ba0449c.

    One correction to the background table. OpenExistingHeapFromFileMapping is exercised by vm_page_provenance_* (SectionPage, tests/vm_copy_queue_check.cpp:191-221, dispatched at :706 of that file) and by tests/vm_translation_check.cpp:522. The vm_copy_queue_* tests order a tile remap of a reserved buffer across a COPY and a DIRECT queue, and open no file-mapping heap. The RX 590 failure in #874 is that remap row, and the same report has Page Provenance passing on the RX 590. So it is not evidence that file-mapping heaps differ by adapter. src/ has no call to OpenExistingHeapFromFileMapping at ba0449c.

    Rows the four cases can pass without exercising, depending on how the fixture is built:

    • The production backing. XMem physical pages are 64 KiB slots of 256 MiB pagefile sections, mapped as views (src/xmem_mapped_pages.cpp:74-157), and slot 133 only aliases MEM_PRIVATE ranges (:2972). A fixture over a private VirtualAlloc range, or over a fresh one-page section, does not cover:
      • a view of a larger section at a non-zero offset;
      • a run across a placeholder split;
      • a reused slot, which is zero-filled on reuse (src/xmem_mapped_pages.cpp:83-91).
    • The copy point. Production copies at root-SRV bind (upload_from_title, :2245) and at draw record (frame_copy, d3d12_draw.inl:615, called at :1098), both before ExecuteCommandLists. A harness that copies at submit passes "bind A, write B" by construction. Naming the copy point under test, and using a bind-time copy as the "missing refresh" negative, would make the forced-copy row match production.
    • In-flight reuse. The upload ring advances and wraps with no fence or in-flight tracking (reserve_upload_ring, :1719-1754, wrap at :1750-1751). A forced-copy path that allocates a fresh buffer per submission never reuses, so the in-flight case passes unless reuse is forced: a ring wrap for the copy path, and a free and slot reuse in XMem for the shared path.
    • The negative case. On a shared heap, a CPU read before the fence can already see the GPU write, so "stale data" is not a deterministic outcome there. Ordering the early read with queue Wait/Signal, as vm_copy_queue does (tests/vm_copy_queue_check.cpp:152-158), removes the timing assumption. On the sharing path, a defined refusal is the stable oracle.
    • Forced sharing failure. On a failed placement, slot 133 creates a committed default-heap buffer, logs not aliased and returns success (:2996-3026), and it does not copy the title's bytes into that buffer. The failure row could tell this apart from a copy that preserves visibility: the outcome to catch is a success whose backing holds neither the title's bytes nor a refusal.

    Also from the code:

    • Slot 133 calls OpenExistingHeapFromAddress (:2982) without querying D3D12_FEATURE_EXISTING_HEAPS; src/era_gpu_alias.cpp:41-42 does query it.
    • existing_heaps caches heaps by raw allocation base and has no removal (:2902, :2976-2985). A later allocation at the same base would be placed on the heap opened for the earlier one. That is read from the code, not observed. The range- and generation-checked mapping in the direction above would replace it.

    AI-assisted.

  4. MasterDomino commented on Nov 24, 2026

    @MasterDomino
    CollaboratorAuthor

    The first comparison is up as #1942. It is test-only: tests/unified_buffer_paths_check.cpp changes no production backing and changes no stand-in's default behaviour.

    Result (WARP 10.0.26100.9818 and RX 9070 XT, driver 32.0.31044.16, Windows 11 build 26300, debug layer off and on; identical on both, no skips): 40 cases pass on share, copy and fallback for both pools.

    • Where the paths agree: on bytes and lifetime at the points the contract names, submit and fence completion.
    • Where they don't: at the copy points production uses today. A copy refreshed at bind (upload_from_title) or at draw record (frame_copy) hands the GPU the stale A, while sharing reads B. Today's copy points therefore can't stand in for sharing when the title writes between bind and ExecuteCommandLists.
    • Slot 133 on title memory: the fallback model returns S_OK with zero-filled, non-aliased backing. The oracle catches it in both cases.

    How Leyukaka's review points are covered:

    1. Attribution: the PR credits file-mapping heaps to vm_page_provenance_* and vm_translation_range_* and makes no claim of an adapter difference.
    2. Production-shaped backing: a 256 MiB pagefile section of 64 KiB slots. Each allocation is two page views on a placeholder split, and the GPU region straddles the split. The buffer sits at heap offset 0x30000 on a reused slot that must read zero first. The private VirtualAlloc pool runs alongside.
    3. Copy point named per row: bind and record are the missing-refresh negatives (d1b and d1r).
    4. Reuse forced: the copy path wraps a two-slot ring onto an in-flight slot and is refused with 0x887A000A. The shared path frees a slot and reallocates it while its submission is held.
    5. Early read ordered: the read goes through a queue Wait on a CPU-signalled gate, with the 0x887A000A refusal as the oracle.
    6. Silent success caught: both slot 133 section rows are caught.
    • Mutant controls: skip-refresh, skip-copy-back and reuse-early each fail every case they target (4/4, 8/8 and 6/6).

    Measured but not asserted:

    • OpenExistingHeapFromAddress accepted a MEM_MAPPED view of the section on both adapters, with CPU and GPU writes visible both ways. On the first view of a split run, it gives only a 64 KiB heap.
    • While a heap opened from a private range is alive, VirtualFree of that range fails with error 87 for both release and decommit. So with an uncleared existing_heaps, the observed hazard is the title's free failing, not a stale read. The generation-checked mapping from the decision would remove it either way.

    The first buffer change will be proposed separately, against these rows.

    AI-assisted.

  5. legacy-code-archaeologist commented on Nov 24, 2026

    @legacy-code-archaeologist
    Contributor

    Adapter-matrix data point for the first comparison: #1942 at its head 0e81481, run on two GPU families that are not covered yet, plus WARP. Windows 11 Pro 26100.9168, MSVC 19.52, dev preset, unified_buffer_paths_check <warp|hardware>. The adapter was selected with XBOX2WINDOWS_ADAPTER. The debug layer is not installed here (0x887a002d), so all runs are debug layer off.

    Adapter Driver D3D12_FEATURE_EXISTING_HEAPS Result
    WARP (1414:008c) 10.0.26100.8972 1 PASS: 40 passed, 0 skipped, 2 stand-ins caught
    NVIDIA Quadro M1000M (Maxwell, 10de:13b1) 32.0.15.7371 1 PASS: 40 passed, 0 skipped, 2 stand-ins caught
    Intel HD Graphics 530 (Gen9, 8086:191b) 31.0.101.2111 0 SKIP (77): 26 passed, 12 skipped, 4 stand-ins caught, 0 failed

    ctest -R '^unified_buffer_paths_' passes 5/5 (hardware = the Quadro, the high-performance adapter). The three mutant controls fail as required.

    Quadro (Maxwell): it behaves like your WARP and RX 9070 XT runs.

    • OpenExistingHeapFromAddress accepted the 128 KiB MEM_MAPPED view of the 256 MiB section at +0x30000. The GPU read the CPU writes (1024/1024), and a GPU write was seen through the split run.
    • The first view of a split run gives a 64 KiB heap, and the 128 KiB buffer across the split is refused (0x80070057).
    • While the cached heap is alive, VirtualFree (release and decommit) fails with error 87. After the heap is released, it succeeds.

    Intel HD 530 (Gen9) has no existing-heap support at all.

    • D3D12_FEATURE_EXISTING_HEAPS reports 0.
    • Every share row, 6 for the section pool and 6 for the private pool, skips with open=0x887a0004 (DXGI_ERROR_UNSUPPORTED).
    • OpenExistingHeapFromAddress on the section view returns 0x80070057. The placement probes and the stale-heap probe do not run.
    • The copy and fallback rows pass.

    The point for the model: the slot 133 stand-in falls back on this adapter even for private title memory. Both private slot133 rows are caught as committed default buffer, not aliased, no copy, with share_hr=0x887a0004. On WARP, the Quadro and your adapters, slot 133 aliases private memory, and only the section rows are caught.

    So on a Gen9 Intel GPU, every slot 133 placement takes the silent-success path you described. The new backing holds zeros, not the title's bytes. This matches Leyukaka's note that slot 133 calls OpenExistingHeapFromAddress without querying D3D12_FEATURE_EXISTING_HEAPS.

    For the eligibility rule in the direction above, "the adapter actually creating the shared backing", this is a concrete adapter where the answer is always no. The copy path that preserves visibility, or a diagnosable failure, is then the only valid option. I have not run the production runtime here, so this is the fixture's model of slot 133, not a measured title run.

    Full outputs per adapter are available if useful. I made no code change.

  6. MasterDomino commented on Nov 24, 2026

    @MasterDomino
    CollaboratorAuthor

    Thanks for the matrix. The Gen9 row is the most useful data point so far.

    • Maxwell: it matches WARP and the RX 9070 XT row for row, including the MEM_MAPPED view acceptance, the 64 KiB first-view heap and the VirtualFree error 87 while the heap lives. That makes three hardware families plus WARP agreeing on those probes.
    • Gen9 (D3D12_FEATURE_EXISTING_HEAPS = 0): this is an adapter where sharing is never available. On it the slot 133 model takes the silent-success path even for private memory, which today's adapters avoid. So the eligibility rule has to be decided per adapter from the feature query before any open is attempted. On a "no", the only valid outcomes are the copy path that keeps visibility or a diagnosable refusal. Slot 133's missing feature query (Leyukaka's note) is then not cosmetic. I'll carry that into the first buffer-change proposal as a requirement, with your Gen9 row as the case it must handle.
    • Exit code: the run exits 77 on Gen9 although the 26 copy and fallback cases passed. That keeps CTest from showing the share rows as passing, but it also hides those 26 passes. If maintainers prefer, a follow-up could report the share skips per row and let the non-share rows pass on their own. I'd rather not change it without a preference here.

    AI-assisted.

  7. R0Y00 commented on Nov 24, 2026

    @R0Y00
    Owner

    The test-only comparison in #1942 has merged at cd5508e9. The Gen9 report gives the copy path a useful adapter without existing-heap support. The production slice is available for one contributor: wire the existing comparison to one ordinary linear CPU-written, GPU-read buffer, keeping the current backing as the default.

    Reuse #1942 for the A-to-B write before submit, GPU write and fence before alias readback, and backing reuse only after completion. Report real sharing, forced copying and host sharing refusal separately, with actual HRESULTs and bytes copied. If the copy path cannot meet the same visibility and lifetime guarantees on a case, report that refusal. Please claim the buffer here before changing the production path. Textures, acceleration structures and command-list slot 148 can continue in their existing threads.

  8. MasterDomino commented on Nov 25, 2026

    @MasterDomino
    CollaboratorAuthor

    I'll take the production slice: one ordinary linear CPU-written, GPU-read buffer, with the current backing kept as the default.

    Plan:

    • Reuse gpu: compare one linear buffer through sharing, copying and refused sharing #1942's cases: the A-to-B write before submit, the GPU write and fence before alias readback, and backing reuse only after completion.
    • Report three outcomes separately: real sharing, forced copying and host sharing refusal, each with the actual HRESULTs and bytes copied.
    • Gate sharing per adapter on D3D12_FEATURE_EXISTING_HEAPS before any open is attempted. The Gen9 row is the case where sharing must be refused. A copy that can't keep the same visibility and lifetime guarantees reports a refusal instead of returning success.

    Textures, acceleration structures and slot 148 stay out of scope. I'll post the PR here.

    AI-assisted.

  9. MasterDomino commented on Nov 25, 2026

    @MasterDomino
    CollaboratorAuthor

    PR for the production slice: #2218. The switch is opt-in, X2W_D3D12_LINEAR_BUFFERS=1; unset, slot 133 is unchanged. It covers slot 133 buffers in COMMON state with row-major or unknown layout.

    • Sharing: only for a private committed range at a 64 KiB-aligned offset, after D3D12_FEATURE_EXISTING_HEAPS reports support.
    • XMem views are copied, not shared. A heap opened from a view makes XMem's own unmap fail with error 87 until the heap is released (measured).
    • Copying happens at submit inside the queue wrapper, never at bind or record. Staging is reused only after its fence completes.
    • Any case the new path can't guarantee keeps today's backing and records the refusal. That covers a GPU-written buffer that can't be shared, a split or unaligned buffer, and no submit fence. The refusal HRESULT goes in the log line, the fixture info and the totals, and slot 133 doesn't fail. A refresh that can't be staged still runs the submission and marks the buffer stale.

    Why the last point: an earlier revision returned the refusal, and the title faulted at 1.76 s on its first GPU-written placement, because on the console CreatePlacedResourceX doesn't fail.

    On this revision, a matched title pair on the RX 9070 XT reached the same slot 148 stop: 294.1 s with the switch on, 290.1 s off. The frame rate was within 1% (29.6 against 29.8 fps). Placements: 3,094 copied at submit, 64 shared, 507 kept the default backing with the refusal recorded.

    The fixture linear_buffer_backing_* reuses #1942's cases over XMem pages and a private range. It covers six paths, the Gen9 refusal simulated with the feature forced to 0, and five mutants, on WARP and the RX 9070 XT with the debug layer off and on. 22/22 pass with the comparison tests.

    Not fixed by this slice: the 506 GPU-written XMem buffers (856 MiB in that run) still have the default backing, now recorded. They need a copy-back point or a releasable shared backing.

    AI-assisted.

  10. MasterDomino commented on Nov 25, 2026

    @MasterDomino
    CollaboratorAuthor

    Heads-up for anyone running the #1942 fixture repeatedly: unified_buffer_paths_check leaves about 1.8 GiB of system commit per run until reboot. The cause is OpenExistingHeapFromFileMapping retaining its section after process exit, which I measured on Windows 11 build 26300 on WARP and the RX 9070 XT. The details and the fix are in #2234.

    AI-assisted.

  11. 28 remaining items

  12. lukaslw-lab commented on Nov 26, 2026

    @lukaslw-lab
    Contributor

    Field result for #2218's X2W_D3D12_LINEAR_BUFFERS=1 in a main-executable run: on this host the submit-time copy halves translated draws, shows brief visual glitches that the default backing does not, and does not reduce held memory.

    Windows 10 22H2, RTX 3080 Ti (driver 32.0.16.1047), release build of main a6967446 plus #2611, warm shader cache, same recorded input. All runs: X2W_D3D12_BUDGET=1 X2W_D3D12_RELEASE_RETIRED=1 X2W_D3D12_RELEASE_RETIRED_VIEWS=1 X2W_D3D12_RETIRE_REASONS=1, 600 s. The only difference is the switch.

    Run Linear buffers Frames Translated draws Held never-class buffers Glitches seen
    A off 10,049 344k 1.00 GB none
    B off (repeat) 10,165 339k 0.91 GB none (watched throughout)
    C on 6,143 174k 1.21 GB yes
    D on, local trace 7,340 184k 1.09 GB yes, 6 noted
    • Backing: 21,415 of 21,472 linear buffers are copied at submit and 57 are shared. The rest fail the 64 KiB offset rule (share=E_INVALIDARG), so on this title the copy path is the normal path.
    • The glitches are not stale refreshes. Run D logged every refresh failure: 0 in 600 s (19,208 refreshes, 16 MiB copied, 71,733 submissions). Run C logged a few 0x887a000a stale refreshes, but only after ~510 s.
    • 5 of the 6 glitch times noted in run D (most lasted a single frame) fall at the start of a burst of refreshes: the count per 5 s jumps from ~30–130 to 260–390, consistent with the title rewriting many buffers at once. Hypothesis, not proven: a title write after ExecuteCommandLists and before the GPU reaches the work is visible with the default backing but missed by the copy taken at submit.
    • The cost is not the bytes copied (16 MiB in the whole run). From reading the code, it may be the per-submission walk over all ~21k records in LinearBuffers under one mutex. I have not profiled this.

    Aggregate counts only; no addresses or title data. AI-assisted (Claude); I ran the runs and noted the glitch times.

  13. MasterDomino commented on Nov 26, 2026

    @MasterDomino
    CollaboratorAuthor

    Thanks, @lukaslw-lab. This is the field result #2218 needed, and both readings fit how the opt-in works:

    • Cost: only 57 of 21,472 buffers meet the 64 KiB rule for sharing, so the submit-time copy is the normal path on this title. Every submission then compares each copied buffer with its upload record under mutex_, about 21 k records per submission across about 72 k submissions, whatever was written. That's far more likely to be the cost than the 16 MiB copied. A per-buffer dirty signal, such as a write watch on the title pages or a generation counter set by the XMem write paths, would make the walk proportional to what changed. I haven't profiled it either, so that's a hypothesis until a trace shows it.
    • Glitches: the copy is a snapshot taken at ExecuteCommandLists, which is the visibility rule agreed in design: runtime model for the console's unified CPU/GPU memory (copies vs direct use of title memory) #1914. A title that writes a buffer after submitting and before the GPU reaches the work relies on unified memory, and the aliasing backing gives it that, but a submit-time copy can't. Your bursts lining up with the glitches fit that. A deterministic case would settle it: submit a read gated on a fence, write B from the CPU, then signal. The aliased backing reads B, while the copy reads A by design.

    The default backing is unchanged, so nothing regresses without the switch. I'll take the two follow-ups:

    1. Profile the per-submission walk with a matched run on the RX 9070 XT, and try the dirty-signal version.
    2. Add the gated write-after-submit case, so the semantic gap is pinned and documented as a known limit of the copy path.

    Each would come as its own PR. Before I start: @R0Y00, is a write-after-submit gap acceptable for the opt-in as long as it's documented, or should that pattern be refused or warned about in the copy path?

    AI-assisted.

  14. R0Y00 commented on Nov 26, 2026

    @R0Y00
    Owner

    Keep the current opt-in contract for this slice: the copy captures bytes at submission. A workload that depends on writes after submission needs a backing path that can provide that visibility. Please take the gated fixture and the separate profiling work. For the fixture, hold GPU consumption behind a queue wait, write B on the CPU, then signal and read back after completion. Report the measured shared and forced-copy results separately, and keep the write-before-submit control where both should read B. Document the confirmed limit with the fixture. Leave the default backing and fallback behavior in place. A runtime warning or refusal would need evidence that the implementation can actually identify the unsupported ordering.

  15. added
    priority: P0
    on Nov 30, 2026
  16. RomainROCH commented on Nov 30, 2026

    @RomainROCH

    I put together an independent MIT-licensed CPU replay that may complement the WARP cases in #1942 and #2332. It records the backing generation captured at submit, the current mapping at read, and the last writer of each byte range.

    In the synthetic case, compute waits for a copy ticket submitted later. The view is rebound while compute is blocked. Once the producer retires, the captured backing receives 10 20 30 40. A one-byte CPU overwrite leaves 10 ee 30 40 through the surviving alias, and the new backing remains zero. A separate test allows a CPU read while a disjoint write is still pending.

    From the pinned lab snapshot, run python gpumemorylab.py examples/remap.json --explain. The replay reports one blocked step and the writer event for each returned range. It models backing capture at submission. Your gated WARP test can separately distinguish a submit-time byte snapshot from a later read of live backing. Would the mapping event and last-writer ranges help label mismatches in that fixture?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: P0

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions