Skip to content

d3d12_fence_timing: compare GetCustomHeapProperties on the layer's adapter - #6948

Open
IxMxAMAR wants to merge 16 commits into
ItsNotRexed:mainfrom
IxMxAMAR:fence-timing-layer-adapter
Open

IxMxAMAR wants to merge 16 commits into
ItsNotRexed:mainfrom
IxMxAMAR:fence-timing-layer-adapter

Conversation

@IxMxAMAR

@IxMxAMAR IxMxAMAR commented Nov 23, 2026 •

Copy link
Copy Markdown

Claimed in the coordination issue as: D3D-667 (#6750 (comment))

Depends on: #4577 (this branch is its head 2ae764b plus one commit, 760442f, which is the whole change here). Overlaps #6569 and #4756 in the same function.

What and why

check_custom_heap_properties created its host device with D3D12CreateDevice(nullptr, ...), D3D12's default adapter. On a PC whose first adapter is an integrated GPU, that is not the GPU the layer runs on. Here (Intel iGPU first, layer on an RX 9070 XT) the check printed "the host adapter is UMA; not compared" and passed without comparing anything. The host now comes from hostadapter::reference, as #4577's fence comparisons get theirs, and the result line names it.

Tested

Windows 11 Pro 26200, AMD Radeon RX 9070 XT (AMD 26.11.2) plus an Intel Graphics iGPU (driver 101.8860) that is DXGI adapter 0, MSVC 19.50 RelWithDebInfo, default device selection:

  • Before: exit 0, "GetCustomHeapProperties: the host adapter is UMA; not compared".
  • After: exit 0, "... and node mask 2 match the host runtime on AMD Radeon RX 9070 XT".
  • With a planted layer bug that is not committed (MEMORY_POOL_L1 for node mask 2): exit 0 before, exit 1 after, with "node mask 2, heap type 2: ours 0/0/2/1/1, host 0/0/0/1/1".
  • With LEONIDA_HOST_ADAPTER=intel, and with the layer on the iGPU: "the host adapter is UMA; not compared", as before.
  • ctest without the window tests: 237 tests, the same 4 failures as on main 561b65a (vk_queue_query_sync, d3d12_texture_tiles, d3d12_indirect_dispatch_count, d3d12_heap_properties, each with an open fix or claim); d3d12_fence_timing passes.

AI-assisted: yes

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a, no translator rule)

gabrielsteglich and others added 15 commits November 22, 2026 21:02
Defer reserved-buffer tile updates and copies alongside held command batches and signals. Keep sparse backing alive, resolve source mappings at submission order, and carry waits past no-op or rejected binds.

Compare all tile readbacks with native D3D12 for CPU and COPY queue signals, and test wait forwarding with a fake incomplete Vulkan producer.
…'s adapter

The host device came from D3D12CreateDevice(nullptr), D3D12's default
adapter, which on a PC whose first adapter is an integrated GPU is not
the GPU the layer runs on. With an Intel iGPU first and the layer on an
RX 9070 XT the check printed "the host adapter is UMA; not compared" and
passed without comparing. Take the host from hostadapter::reference, as
the fence comparisons do, and name it in the result line.
@thehollowedone

Copy link
Copy Markdown

Independent native Windows check of 760442fe on the published #4577 stack. RTX 3080 Ti, NVIDIA 621.35, MSVC 19.44, Vulkan SDK 1.4.363.0.

With no host-adapter override, the native D3D12 device and Vulkan-backed proxy selected the same RTX 3080 Ti and returned the same adapter identifier (LUID). For DEFAULT, UPLOAD, and READBACK with node mask 0, all five heap-property fields matched native D3D12. The layer also passed all six expected-value checks across node masks 0 and 1. The focused d3d12_fence_timing fixture ran the heap-property queries with zero skips and zero Khronos core or synchronization validation errors.

AI-assisted.

@devnull34 devnull34 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified on AMD Radeon RX 7900 GRE (Windows 11):

  • Built d3d12_fence_timing_test cleanly with MSVC.
  • d3d12_fence_timing_test.exe passed:
    • GetCustomHeapProperties: DEFAULT, UPLOAD, READBACK, CUSTOM, unknown type, and node mask 2 correctly matched the host runtime on AMD Radeon RX 7900 GRE rather than falling back to default/UMA bypass.
    • Multi-fence waits, CPU/queue rewinds, and clock calibration all verified.
  • CTest target 162: d3d12_fence_timing passed 100% (2.02s).
  • Whitespace clean (git diff HEAD~1..HEAD --check).

@ErayOzdayioglu

Copy link
Copy Markdown

Tested 760442f on the mirror image of the PR's machine: here the discrete GPU is DXGI adapter 0 (NVIDIA GeForce RTX 5070, 617.42) and the iGPU is second (AMD Radeon Graphics, the Ryzen 5 7600's RDNA2 iGPU, 32.0.21042.62). Windows 11 26200, MSVC 14.51 (VS 2026), RelWithDebInfo, d3d12_fence_timing_test run directly: pass, and the change does what it says in this topology too.

layer on before (2ae764b, #4577's head) after (760442f)
RTX 5070 (LEONIDA_VK_DEVICE=5070, also the default) exit 0: "... node mask 2 match the host runtime" exit 0: "... node mask 2 match the host runtime on NVIDIA GeForce RTX 5070"
Radeon iGPU (LEONIDA_VK_DEVICE=radeon) exit 0: "... match the host runtime", where the host is the default adapter, i.e. the RTX 5070, not the GPU the layer runs on exit 0: "GetCustomHeapProperties: the host adapter is UMA; not compared"

So with the layer on the iGPU, the old code compared the layer's answers against the other GPU and reported a match. The new code picks the same adapter, as the GetAdapterLuid line confirms (00000000:0001329e is the DXGI adapter "AMD Radeon(TM) Graphics"), and then skips the comparison as UMA. Everything else in the test passes on both GPUs: the fence, rewind, cross-queue and calibration lines, and the WARP and standalone Vulkan sections.

A side observation, not a problem with this PR: since the old run "matched" a discrete host with the layer on a UMA iGPU, the layer's GetCustomHeapProperties answers look discrete-shaped on an iGPU. I haven't compared them with the iGPU's own D3D12 values (the test skips UMA by design).

AI-assisted: yes

@nnonno91

Copy link
Copy Markdown

AI-assisted verification of 760442f on the published #4577 stack. Windows 11 (build 26200), RTX 5090 (NVIDIA 617.42, Vulkan 1.4.351, subgroup 32..32), MSVC 19.51.36244 Release, with AMD Radeon integrated graphics available too.

I ran d3d12_fence_timing_test twice with automatic D3D12 host-adapter selection, choosing each Vulkan device in turn. Both runs exited 0.

  • RTX 5090: GetAdapterLuid identified the NVIDIA DXGI adapter. DEFAULT, UPLOAD, READBACK, CUSTOM, the unknown heap type, and node mask 2 all matched the native D3D12 runtime on the RTX 5090.
  • AMD Radeon integrated graphics: GetAdapterLuid identified the AMD DXGI adapter, and the heap comparison took its expected UMA skip.

Synthetic tests only.

@gutersohn

Copy link
Copy Markdown

Tested 760442fe1 on AMD Radeon RX 6600 (RDNA2, Navi 23, gfx1032), AMD Windows driver 26.10.1 (32.0.21045.16010, Vulkan 1.4.315), Windows 11 10.0.26200, single GPU: pass, no regressions against the merge base 4beffda8.

  • d3d12_fence_timing, with only one adapter: GetCustomHeapProperties: DEFAULT, UPLOAD, READBACK, CUSTOM, an unknown type and node mask 2 match the host runtime on AMD Radeon RX 6600, so the comparison runs instead of the UMA skip.
  • These tests passed 10/10 on both base and PR: d3d12_fence_timing, d3d12_fence_device_lost_counter, d3d12_fence_events, d3d12_fence_waiter, d3d12_queue_handover, d3d12_queue_share, d3d12_queue_wait, d3d12_buffer_tiles, d3d12_vulkan_device, vk_fence_dispatcher_sync. The PR's new vk_sparse_queue_order passed 10/10.
  • vk_queue_query_sync is intermittent on this card, 4/10 on both base and PR, so it is not caused by this PR.
  • Full ctest: base 252/258, PR 253/259 (the extra test is vk_sparse_queue_order). Both fail the same 6 tests: d3d12_texture_tiles, d3d12_indirect_dispatch_count, d3d12_pipeline_library_host, d3d12_m2_textured, d3d12_m2_formats, d3d12_m3_frame. Those also fail on main 1cc6e3c1 here.

Build: MSVC (VS 2022 Build Tools) RelWithDebInfo via scripts/build_runtime.ps1, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0, LEONIDA_VK_DEVICE=radeon. Counts only, no game files. AI-assisted (Claude Code).

@boboman-188

Copy link
Copy Markdown

Tested 760442fe1 against its parent 2ae764b0a on Windows 11 build 26300.9974 with AMD driver 26.11.2. I ran d3d12_fence_timing three times per commit per GPU. All 12 runs passed.

  • RX 6700 XT: Heap properties matched native D3D12 on both commits. The PR names the RX 6700 XT as the reference adapter.
  • Integrated Radeon: The parent reported a match against the Windows default D3D12 adapter, which I independently confirmed was the RX 6700 XT. The PR selected the integrated Radeon and correctly skipped the heap comparison because it uses unified memory. The fence and timing checks still passed.

Synthetic test only. AI-assisted testing.

…apter

# Conflicts:
#	runtime/test/d3d12_fence_timing_test.cpp
@IxMxAMAR

Copy link
Copy Markdown
Author

Merged main 867d922f into this branch (885f7067) to resolve the conflict with #6569, which changed the same function. The comparison now runs on the layer's adapter and keeps #6569's rule that the host's architecture must match the layer's (UMA on an integrated GPU, NUMA on a discrete one). #4577's commits are unchanged.

Re-tested on Windows 11 Pro 26200 with an RX 9070 XT (AMD 26.11.2) and Intel Graphics (Core Ultra 5 225, 101.8860), LEONIDA_VK_VALIDATION=1; D3D12's default adapter is the Intel iGPU here:

layer on main 867d922f this branch
RX 9070 XT not compared (the host is the default adapter: UMA, the layer NUMA) compared on the RX 9070 XT: DEFAULT, UPLOAD, READBACK, CUSTOM match
Intel iGPU compared on the default adapter, match compared on Intel(R) Graphics, match

AI-assisted.

@emreYilmaz28845

Copy link
Copy Markdown

Tested 885f706734b74275949ce3705ee4c87d17a8465d (d3d12_fence_timing: compare GetCustomHeapProperties on the layer's adapter) on RTX 5070 Ti (driver 621.1) and AMD Radeon RDNA2 iGPU gfx1036 (2.0.353, wave64), Windows 11: pass — the first external check of the merged head (all five earlier runs were at 760442fe), with validation on and a same-main baseline. AI-assisted. No game files used.

Windows 11, MSVC 14.44.35207 (VS Build Tools 2022, -G "Visual Studio 17 2022" -A x64, RelWithDebInfo), Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0. Worktree at the head as pushed (the merge of the branch with main 867d922f0), no extra commits; the head is still 885f7067 after the run.

ctest -R "^(d3d12_fence_timing|d3d12_fence_device_lost_counter|d3d12_queue_handover|d3d12_queue_share|d3d12_buffer_tiles|d3d12_vulkan_device|vk_fence_dispatcher_sync|vk_sparse_queue_order)$" RTX 5070 Ti Radeon iGPU gfx1036
validation off 7/8* 7/8*
LEONIDA_VK_VALIDATION=1 7/8*, 0 validation errors 7/8*, 0 validation errors

* the one failure is d3d12_vulkan_device at line 6583: tiles == 1 — the same pre-existing reserved-resource tile assertion that fails on plain main 867d922f0 (there at line 6574; this PR's +23/−14 to that test shifts the line), on both GPUs, validation off and on.

  • The PR's own delta, observed on both GPUs: d3d12_fence_timing on the gfx1036 prints on main "the host adapter is NUMA and the layer's UMA; not compared"; at the head it prints "GetCustomHeapProperties: DEFAULT, UPLOAD, READBACK, CUSTOM, an unknown type and node mask 2 match the host runtime on AMD Radeon(TM) Graphics" — the heap-property comparison now runs against the layer's own adapter, and the 5070 Ti run names its adapter the same way. (On main the 5070 Ti run also matched, but by comparing against the default host adapter; the head compares on the layer's adapter in both cases.)
  • vk_fence_dispatcher_sync and vk_sparse_queue_order, the stack's new CPU-mock tests, pass on both.
  • d3d12_queue_handover (594 layer / 589 host cases exact), d3d12_queue_share, d3d12_buffer_tiles, d3d12_fence_device_lost_counter: pass on both GPUs, also with the layer on.
  • The head carries the published fence/sparse stack, so this run covers the stack as pushed; a stack-level issue would have shown up here too, and none did.

Same-main baseline: the six pre-existing tests on plain main 867d922f0 (rebuilt at that commit): 5/6 pass on both GPUs with the identical line 6574: tiles == 1 failure — everything matches except the two new tests, and the fence_timing "not compared" → "match the host runtime on <adapter>" change above is this PR's intended and observed effect.

Commands: cmake -S runtime -B runtime/build -G "Visual Studio 17 2022" -A x64, cmake --build runtime/build --config RelWithDebInfo --target d3d12_fence_timing_test d3d12_fence_device_lost_counter_test d3d12_queue_handover_test d3d12_queue_share_test d3d12_buffer_tiles_test d3d12_vulkan_device_test vk_fence_dispatcher_sync_test vk_sparse_queue_order_test, then the ctest line above with LEONIDA_VK_DEVICE=NVIDIA|AMD and LEONIDA_VK_VALIDATION=1, one GPU at a time; the baseline from the main checkout with the same lines.

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.

9 participants