Skip to content

docs/d3d12_vulkan: measured why RADV cannot alias a slot-133 section view's pages - #13

Open
GustawMatuszewski wants to merge 1 commit into
ProjectLeonidaL:mainfrom
GustawMatuszewski:docs/d3d12-radv-host-pointer-import
Open

GustawMatuszewski wants to merge 1 commit into
ProjectLeonidaL:mainfrom
GustawMatuszewski:docs/d3d12-radv-host-pointer-import

Conversation

@GustawMatuszewski

Copy link
Copy Markdown

Claimed in the coordination issue as: n/a — this repository has no "Coordinating who works on what" issue, so the item is described here in full.

Depends on: none.

What and why

docs/d3d12_vulkan.md says of the slot-133 (CreatePlacedResourceX) fallback texture that it reports the title's address from GetGPUVirtualAddress while "the image itself still does not alias the title's pages". It does not say why the aliasing cannot be had, which is the question anyone picking that work up will ask first.

This adds a measured paragraph to that section, from a source read plus strace of the layer's import:

  • the only route is the host-pointer import (VkImportMemoryHostPointerInfoEXT, HOST_ALLOCATION), and the layer's own checks (Resource::create_host_buffer) accept the range;
  • RADV refuses it in the kernel: radv_bo_from_ptr → radv_amdgpu_winsys_bo_from_ptr → ac_drm_create_bo_from_user_mem (src/amd/common/ac_linux_drm.c:952 in Mesa 26.0.8) → libdrm amdgpu_create_bo_from_user_mem (amdgpu/amdgpu_bo.c:587), which creates the userptr BO with AMDGPU_GEM_USERPTR_ANONONLY, and amdgpu_ttm_tt_get_user_pages() answers -EPERM for any userptr VMA that carries a vm_file (amdgpu_ttm.c, v7.0 lines 743-746);
  • a pagefile-backed section view is file-backed by construction, so no range of it imports (2 of 9 DRM_IOCTL_AMDGPU_GEM_USERPTR calls returned -EPERM, both from the vkAllocateMemory for the section view);
  • Mesa maps everything but -EINVAL to VK_ERROR_UNKNOWN, so the layer sees a failed allocation, reports E_OUTOFMEMORY and takes the ordinary committed buffer;
  • upstream, work item #15144 is closed and !40574 (merged) only normalises the VkResult; the refusal is unchanged and Mesa's own features.txt still lists VK_EXT_external_memory_host as DONE for RADV.

It closes with what the fallback still owes, since the addresses cannot be made to match (host 0x7f.. vs BDA 0xffff800100040000): register the fallback at the title's VA so every CPU-recorded call that names it resolves, and copy the committed pages in at creation and per submission (182 MiB for the retail buffer; dirty-page tracking would be the follow-up).

Tested

  • All 12 tests/test_docs_*.py — OK (including test_docs_repo_paths and test_docs_links for the new path and MR reference).

GPUs tested: AMD RX 9060 XT (RDNA4/GFX1200), RADV Mesa 26.0.8, Ubuntu 26.04 — the source read and the strace; the same refusal was seen on a Radeon 890M (RDNA3.5, RADV) for the follow-up work. Documentation only, nothing rebuilt for this pull request.

AI-assisted: yes (Claude Code). No game files, no shader dumps, no captures.

Checklist

  • Based on current main (6591ba9), one commit, merges cleanly.
  • One topic.
  • No game data, keys or decryption.
  • No new translator rule.

…view's pages

The slot-133 (CreatePlacedResourceX) fallback texture reports the title's address
from GetGPUVirtualAddress but its pixels do not alias the title's pages. Recorded
where the aliasing dies on RADV, from a source read plus strace of the layer's
import: radv_bo_from_ptr -> radv_amdgpu_winsys_bo_from_ptr ->
ac_drm_create_bo_from_user_mem (common/ac_linux_drm.c:952 in Mesa 26.0.8) ->
libdrm amdgpu_create_bo_from_user_mem (amdgpu/amdgpu_bo.c:587), which builds the
userptr BO with AMDGPU_GEM_USERPTR_ANONONLY; amdgpu_ttm_tt_get_user_pages() then
answers -EPERM for any userptr VMA that carries a vm_file (amdgpu_ttm.c, v7.0
lines 743-746). A pagefile-backed section view is file-backed by construction, so
no range of it imports; Mesa maps every error but -EINVAL to VK_ERROR_UNKNOWN and
the layer reports E_OUTOFMEMORY and falls back to the ordinary committed buffer.

Also records what the fallback still owes: registering it at the title's VA so
CPU-recorded calls that name it (root descriptors, IA views, immediate writes,
copies, dispatch arguments, SRVs built from that VA) resolve, and copying the
committed pages in at creation and per submission.

Tested: python -I on all 12 tests/test_docs_*.py, OK.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant