Skip to content

d3d12: an integrated GPU reports UMA and refuses MEMORY_POOL_L1 heaps, as the host does - #6569

Open
sheepiiHD wants to merge 3 commits into
ItsNotRexed:mainfrom
sheepiiHD:d3d12-uma-on-integrated-gpus
Open

sheepiiHD wants to merge 3 commits into
ItsNotRexed:mainfrom
sheepiiHD:d3d12-uma-on-integrated-gpus

Conversation

@sheepiiHD

Copy link
Copy Markdown

Item: new, claimed in #6414 (#6414 (comment)).

Depends on: #4877

Also edits heap_desc_refusal, as #5808 does for its separate cross-adapter rule; whichever lands second rebases.

What and why

D3D12_FEATURE_ARCHITECTURE answered UMA = FALSE on every GPU (d3d12_vulkan_device.cpp, "A discrete desktop GPU"), while docs/d3d12_vulkan.md §4.1 asks for the host GPU's UMA property ("Start truthful") and question 11 calls the answer the truthful host architecture. On an integrated GPU, that is not what the host runtime answers. Here is a probe of the host D3D12 runtime on this laptop (no Leonida code):

Adapter UMA CacheCoherentUMA GetCustomHeapProperties pools (DEFAULT, UPLOAD, READBACK, GPU_UPLOAD) CUSTOM heap in L1
RTX 5070 Laptop (617.42) 0 0 L1, L0, L0, L1 accepted (except WRITE_BACK)
Radeon 780M (32.0.13030.13001) 1 0 L0, L0, L0, L0 E_INVALIDARG for every page property
WARP 1 1 L0, L0, L0, L0 E_INVALIDARG

With the layer on the 780M, a title got the discrete-GPU table and could create L1 heaps that the host refuses there.

What changed

  • DeviceState::uma is set from VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU, where the LUID is read.
  • CheckFeatureSupport(ARCHITECTURE/ARCHITECTURE1): UMA follows it. CacheCoherentUMA stays FALSE: the AMD iGPU measured reports 0, and FALSE only steers a title to write-combined uploads, which every UMA adapter accepts.
  • GetCustomHeapProperties: on UMA every pool is L0, with the same pages as before.
  • heap_properties_refusal (used by CreateHeap and CreateCommittedResource) refuses a custom heap in MEMORY_POOL_L1 on UMA, as the host does.
  • The memory pool is never used to choose memory (cpu_visible() reads only the page property), so no allocation changes on any GPU, and nothing at all changes on a discrete GPU.
  • d3d12_fence_timing_test expects the table for the architecture the layer reports, and compares with a host of the same architecture. d3d12_heap_properties_test gets an updated comment; its logic from d3d12_heap_properties: compare with the layer's adapter; L1 on a UMA host is not comparable #4877 already compares when the UMA answers agree. docs/d3d12_vulkan.md is updated to match.

Tested

Windows 11 Home 26200, MSVC 14.44 (VS 2022 Build Tools), Ninja RelWithDebInfo, Vulkan-Headers via -DLEONIDA_VULKAN_HEADERS_FETCH=ON. One laptop: NVIDIA GeForce RTX 5070 Laptop GPU (617.42) + AMD Radeon 780M (AMD 24.30.30.13 LLPC, Windows driver 32.0.13030.13001). D3D12's default adapter is the RTX 5070. No game files.

d3d12_heap_properties, before (#4877 head f6affa5b) and after:

layer (LEONIDA_VK_DEVICE) host before after
RTX 5070 layer's adapter (UMA 0) 561 compared, 0 mismatches same
Radeon 780M layer's adapter (UMA 1) layer says UMA 0: 544 compared, 17 not compared layer says UMA 1: 546 compared, 0 not compared, 0 mismatches; the L1 heap: ours 0x80070057, host 0x80070057
Radeon 780M warp (UMA 1) — 546 compared, 0 mismatches
Radeon 780M nvidia (UMA 0) — 544 compared, 2 not comparable (L1 on a NUMA host), 0 mismatches
RTX 5070 radeon / warp (UMA 1) 544 compared, 17 not comparable same

It's 546, not 561, because with L1 refused on both sides that case has no resource properties to read.

d3d12_fence_timing, d3d12_vulkan_device, d3d12_r9g9b9e5_uav and d3d12_buffer_tiles pass on both GPUs, before and after. With the layer on the 780M, fence_timing's GetCustomHeapProperties check now asserts the UMA table, which matches the host probe above. It skips the host comparison because D3D12's default adapter here is the NUMA RTX 5070.

Merged with main 561b65a8 (clean merge): d3d12_heap_properties and d3d12_vulkan_device pass on both GPUs with the same counts. d3d12_fence_timing fails there with the layer on the 780M, at CreateCommandQueue of queue_b in check_held_cpu_signal. main alone fails the same way on this GPU (3 of 3 runs; posted as a finding in #6414), and the custom-heap part of the test passes.

git diff --check is clean, and tests/test_docs_*.py, test_i18n_index.py, test_text_encoding.py, test_ctest_registration.py and test_text_write_line_endings.py pass.

Not measured: an Intel iGPU's CacheCoherentUMA (this PR answers FALSE on every integrated GPU), and how a title's upload path reacts to UMA = TRUE (§4.1's "log the game's reaction"; that needs the executable).

AI-assisted: Claude Code wrote the change and ran the tests on my laptop.

imranakki and others added 3 commits November 23, 2026 01:00
…host is not comparable

The host was D3D12's default adapter (D3D12CreateDevice(nullptr)), which on
a PC with an iGPU listed first is not the GPU the layer runs on. Create it
on the layer's adapter through host_adapter.h, which gains a LUID overload
for tests whose layer device is the standalone one (GetAdapterLuid);
LEONIDA_HOST_ADAPTER still picks another adapter, and "warp" WARP.

D3D12 refuses MEMORY_POOL_L1 on a UMA adapter, while the layer answers
UMA = FALSE on every GPU, so on a UMA host (an iGPU, WARP) the CUSTOM L1
case is reported as not comparable instead of a mismatch. On a NUMA host
it is compared as before.

AI-assisted (Claude Code).
Without a DXGI factory, or without an adapter for the pass
(LEONIDA_HOST_ADAPTER=warp on a PC without WARP), the test fell back to
D3D12's default adapter and compared the layer with a GPU it may not run
on. Report "not compared" instead.

AI-assisted (Claude Code).
…, as the host does

D3D12_FEATURE_ARCHITECTURE answered UMA = FALSE on every GPU, although docs/d3d12_vulkan.md (4.1, question 11)
asks for the host GPU's architecture. On an integrated GPU the host runtime answers UMA 1, CacheCoherentUMA 0,
puts every custom heap equivalent in MEMORY_POOL_L0 and refuses custom heaps in L1 (Radeon 780M, AMD
32.0.13030.13001; WARP refuses L1 the same way). The layer now does the same when the Vulkan device is
VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU. Memory is still chosen by the CPU page property, so no allocation changes.

d3d12_fence_timing_test expects the table for the architecture the layer reports and compares with a host of
that architecture; d3d12_heap_properties now compares the L1 cases on an integrated GPU (546 values, 0 skipped).
@dcastell1

Copy link
Copy Markdown
Contributor

Tested on RTX 5090, 621.24, Windows 11: pass. Built the runtime from this tree and ran the two tests it touches → 2/2 passed (d3d12_fence_timing 1.71 s, d3d12_heap_properties 0.98 s).

Caveat, so nobody reads more into it than it says: this box is a discrete GPU, so the new integrated/UMA branch is not the one being exercised here. What the green run does show is that the discrete answer and the tests that already pinned it did not move.

@jmorrison102-dev

Copy link
Copy Markdown

Tested 242881c2 merged onto main 1cc6e3c1 on both GPUs of one PC, an AMD Radeon iGPU and an RTX 4090: pass, no regressions. This PR is stacked on #4877 (head f6affa5b, not on main yet), so the run covers both. On the iGPU the layer now answers UMA and refuses CUSTOM heaps in MEMORY_POOL_L1, matching the host on the same adapter; on the 4090 nothing changes.

Conditions: Windows 11 Home 26H2 build 26300.10075, Ryzen 9 7950X, Vulkan SDK 1.4.363.0, MSVC 14.44.

  • AMD Radeon(TM) Graphics (gfx1036, 0x1002:0x164e), AMD Windows driver 32.0.21042.62 (Vulkan driver 2.0.353, Vulkan 1.4.315, subgroup 32..64), LEONIDA_VK_DEVICE=radeon, native.
  • NVIDIA GeForce RTX 4090, driver 621.24 (Vulkan 1.4.357, subgroup 32), LEONIDA_VK_DEVICE=4090, native and LEONIDA_W64_EMULATE=1.
  • LEONIDA_HOST_ADAPTER unset, so the host side is the layer's own adapter.

Commits: this PR 242881c2 (contains #4877 f6affa5b), main 1cc6e3c1. "merged" is 1cc6e3c1 with 242881c2 merged locally (git merge --no-commit, clean, not pushed).

ctest, pass / fail / skip (each main / merged pair ran back to back):

AMD iGPU native RTX 4090 native RTX 4090 W64
main 243 / 6 / 12 248 / 1 / 12 248 / 1 / 12
merged 243 / 6 / 12 248 / 1 / 12 248 / 1 / 12

d3d12_heap_properties with LEONIDA_D3D49_VERBOSE=1:

main merged
AMD iGPU pass; CUSTOM L1 buffers created (ours 0x0 host 0x0), host = D3D12's default adapter; 561 values, 0 mismatches pass; host AMD Radeon(TM) Graphics (UMA 1, the layer's UMA 1); CUSTOM L1 refused by both (ours 0x80070057 host 0x80070057); 546 values (15 fewer: the refused L1 buffer's 16 read-back values become one "not created" value), 0 mismatches
RTX 4090 pass; L1 accepted; 561 values, 0 mismatches pass; host NVIDIA GeForce RTX 4090 (UMA 0, the layer's UMA 0); L1 accepted; 561 values, 0 mismatches

Findings:

Scope: ctest only, since the PR changes the runtime and its tests; run_gpu_tests.py, build.py / check.py and tests/semantic not run.

Tested with AI assistance (Claude Code).

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.

4 participants