Repository navigation
Conversation
…-IMPORT-OFFSET) The retail title places small buffers 32 bytes apart through slot 133 (one at +0xc60 of a page, measured on an RTX 5080). create_host_buffer imported the page that holds the address and bound the buffer at its offset in it, which Vulkan refuses off the buffer's alignment (64 on that card), so such a buffer was declined and became a shadow. A 32-byte buffer near the end of a page (+0xfe0) was declined too: its memory requirement (64 bytes) ran past the imported pages. The Vulkan buffer now starts at the page and binds the imported memory at 0; the D3D12 buffer is ResourceBinding::buffer_offset into it and its device address is offset to match (the title VA alias and the arena checks see the buffer's own address, as before). When the memory requirement reaches past the buffer's pages, the import takes the next pages too if they are committed and writable, by the same rules as the buffer's own, and declines as before when they are not. d3d12_xmem_placed_test places a 64-byte buffer at +0xc60 of a committed page and checks that it is an import (one more title_host_imports) and that a GPU copy reads the CPU's writes at the title's address. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, @Coderlord, and thanks for the +0xc60 measurement. Closing this as a duplicate of #1192 (
AI-assisted (Claude Code, Claude Opus 5.5). |
|
Review (code read; not built): this now conflicts with main in AI-assisted (Claude Code, Claude Opus 5.5). |
|
Independent verification of head Windows 11 Pro, RTX 4070 SUPER (NVIDIA 621.01), MSVC 19.52.37029, RelWithDebInfo.
Diff read: the Vulkan buffer now starts at the page and the D3D12 buffer is No game files used. AI-assisted (Claude Code). |
Claimed in the coordination issue as: RT-SLOT133-IMPORT-OFFSET (#1608 (comment))
What and why
The retail title places small buffers 32 bytes apart through slot 133 (one at +0xc60 of a page, measured on an
RTX 5080).
create_host_bufferimported the page that holds the address and bound the buffer at its offset in thatpage, which Vulkan refuses off the buffer's alignment (64 on that card), so such a buffer was declined and became a
shadow. A 32-byte buffer near the end of a page (+0xfe0) was declined too: its memory requirement (64 bytes) ran
past the imported pages.
Now:
ResourceBinding::buffer_offsetinto it, and its device address is offset to match, so the title VA alias and thebelow-the-arena check see the buffer's own address as before;
committed and writable by the same rules as the buffer's own pages (no write-combine, no-cache or guard page,
writable), and declines as before when they are not. The pin covers the larger range.
Replay already honors
buffer_offseteverywhere a binding is used (the GPU address arena relies on it), so copies,clears, views and the VA lookup need no change.
Tested
On
mained94fbe plus this commit, Windows 11, RTX 5080, MSVC 2022 + Ninja, RelWithDebInfo:ctest -R "^(d3d12_xmem_placed|d3d12_existing_heap.*|d3d12_title_va.*|title_va_alias)$": 7/7 passed(
d3d12_existing_heap,_write_watch,_no_write_watch,d3d12_title_va,d3d12_title_va_shadow,d3d12_xmem_placed,title_va_alias). The newd3d12_xmem_placedcase prints "a 64-byte buffer at +0xc60 of apage is imported and the GPU reads the CPU's writes":
title_host_importsgoes up by one (a shadow would not) anda GPU copy of the buffer reads what the CPU wrote at that address.
removes ("offset 0xc60 in its page against alignment 0x40"); that buffer imported afterwards.
main(bcaa13d) on this card without this change ran 400 s to the first-run pages with nofault; a boot with it has not been run yet.
GPUs tested: NVIDIA GeForce RTX 5080, driver 621.24, Windows 11 Pro 26300 (MSVC 2022, Ninja, RelWithDebInfo)
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)