diff options
| author | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-24 20:11:40 -0500 |
|---|---|---|
| committer | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-24 20:17:45 -0500 |
| commit | 255f17001705101aa2e484b9e2caaf1daab275e3 (patch) | |
| tree | 6886830a22b896907f137f7b0baeddde84322a14 /runtime/src/thread_stacks.cpp | |
| parent | 6fdeadfe509f37203317a967bf28e57fc75676b2 (diff) | |
xmem: map slot-31 copies at the GPU-only range's paired CPU view too
Applies the fix oscarlosu-lab proposed on #968:
https://github.com/ubiquitarianism/leonida/pull/968#issuecomment-7142206199
What was wrong: queue slot 31 (CopyPageMappingsBatchX) targets the title's
GPU-only reservation, but the D3D12 layer reads that memory at its paired CPU
view (title_gpu_views::to_cpu). copy_page_mappings mapped the pages only at the
GPU-only address, so the paired CPU view stayed reserved and the layer's reads of
that memory (the slot-70 views waiting for readable memory) never became
possible.
The change, in copy_page_mappings:
- when the destination is in a paired GPU-only range and its CPU range is a
physical-page window, every page mapped or unmapped at the destination is
mapped or unmapped at the CPU address as well, with that window's protection;
- a source page not mapped at a GPU-only address is looked up at its CPU
address.
Cost: a second view per copied page, so such a page is mapped at three
addresses (pool, GPU-only, CPU) and counts as aliased: the shadow tracker copies
it at every submission. Risk: the pairing is a heuristic (the CPU reservation of
the same size made just before the GPU-only one); if it is ever wrong, the
mirror replaces the title's own mappings in that CPU range.
The comment reports 9 alias checks but does not give them, so the test is new:
xmem_test's test_copy_page_mappings_cpu_view reserves a CPU + GPU-only pair and
checks that after a batch copy onto the GPU-only range the CPU range is
committed and shows the same bytes (and a write there is one memory with the
pool), that a GPU-only source mapped only at its CPU range is found there, and
that a null source unmaps both ranges.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/thread_stacks.cpp')
0 files changed, 0 insertions, 0 deletions