Skip to content

Runtime: compare fence and queue semantics with the host (D3D-48) - #497

Open
luisbaker wants to merge 1 commit into
ItsNotRexed:mainfrom
luisbaker:d3d-48-fence-compare
Open

luisbaker wants to merge 1 commit into
ItsNotRexed:mainfrom
luisbaker:d3d-48-fence-compare

Conversation

@luisbaker

Copy link
Copy Markdown
Contributor

D3D-48: compare fence and queue semantics with the host PC runtime.

Adds compare_fences to
untime/test/d3d12_vulkan_device_test.cpp, following the existing compare_footprints / compare_allocation_info pattern. It runs the same Signal / SetEventOnCompletion / GetCompletedValue sequence on both the shim and the host runtime and asserts their completed value and HRESULT agree.

A signal of an already-passed (lower) value is a documented deviation: the shim drops it and stays monotonic because a Vulkan timeline semaphore cannot go backwards (see Fence::claim in
untime/shims/d3d12_com.cpp). The host lowers the fence on some drivers, so that case is checked against the documented behaviour rather than the host.

No game files; runs on WARP or any D3D12/Vulkan GPU.

AI-assisted.

Tested: d3d12_vulkan_device_test on Intel(R) Graphics (Windows 11); all comparisons matched.

Claim: #374 (comment)

@NRXM

NRXM commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested fe0df80 on an NVIDIA RTX 4090 (621.24) and an AMD Radeon iGPU (2.0.353), Windows 11 (build 26300), MSVC 14.44, Vulkan SDK 1.4.363.0, clean Ninja build of runtime/: pass on both.

  • ctest 19/19 on each GPU
  • d3d12_vulkan_device_test (with the new fence checks) ends "…GetResourceAllocationInfo and fence semantics all matched" on both GPUs
  • d3d12_com_test, d3d12_descriptor_test, d3d12_uint_clear_test, d3d12_vulkan_device_test and vk_command_replay_test exit 0 on each GPU
  • everything ran with LEONIDA_VK_VALIDATION=1 and VK_LOADER_LAYERS_DISABLE=~implicit~: no validation-layer errors on either GPU (only loader notices); the AMD run used VK_LOADER_DRIVERS_SELECT=*amd*

(AI-assisted test run.)

@luisbaker

Copy link
Copy Markdown
Contributor Author

Note on CI and #459:

  • CI: the red checks (check, semantic-tests, linux-gpu-tools) are pre-existing on main (main@91b36cf is also red on the same jobs) - date-seeded translator fuzzer tests (seed 20261122), unrelated to this PR. The windows (MSVC) build passes, and this PR was rebased onto main (was conflicting after the merge round).
  • Overlap: this PR and Runtime: compare CheckFeatureSupport error HRESULTs with the host (D3D-50) #459 both add a comparison function to
    untime/test/d3d12_vulkan_device_test.cpp. Whichever merges first, the other will need a small rebase onto it.

AI-assisted.

@luisbaker

Copy link
Copy Markdown
Contributor Author

Thanks @NRXM for the GPU test reports (RTX 4090 + AMD iGPU) - appreciated! (The rebased head is b323888; the code is unchanged from fe0df80.)

@luisbaker

Copy link
Copy Markdown
Contributor Author

Rebased onto origin/main (c432cdc, latest).

Resolved a merge conflict in runtime/test/d3d12_vulkan_device_test.cpp (the PR and main both touched the comment block and the area around compare_resolves). The rebase keeps this PR's compare_fences() addition intact on top of current main.

No functional change to the D3D-48 logic itself — just brought it forward onto current main so the branch applies cleanly. CI checks (check, linux-gpu-tools, semantic-tests) were red before the rebase and appear pre-existing on main (same pattern on #525 which is already merged); happy to re-run if they turn green.

Ready for review when a maintainer has capacity — claim is in #374.

@luisbaker luisbaker closed this Nov 22, 2026
@luisbaker
luisbaker force-pushed the d3d-48-fence-compare branch from 46ec119 to 003e781 Compare November 22, 2026 14:36
@luisbaker luisbaker reopened this Nov 22, 2026
@luisbaker

luisbaker commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Reopened and cleanly rebased onto current main (4eb6155d) as e026c634 (earlier automated rebase accidentally pushed main with 0 commits, which auto-closed the PR).

Re-verified locally on Windows 11 / Intel(R) Graphics (MSVC 14.44, Vulkan SDK 1.4.363.0): d3d12_vulkan_device_test passes with and without LEONIDA_VK_VALIDATION=1 (0 validation errors). AI-assisted.

Add a comparison test that runs the same Signal/SetEventOnCompletion/GetCompletedValue sequence on both the shim and the host PC runtime and asserts their completed value and HRESULT agree. A signal of an already-passed (lower) value is a documented deviation (the shim stays monotonic because a Vulkan timeline cannot go back), so it is checked against the documented behaviour rather than the host. No game files; runs on WARP or any D3D12/Vulkan GPU.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@luisbaker
luisbaker force-pushed the d3d-48-fence-compare branch from e026c63 to fdbb95d Compare November 23, 2026 01:05
@luisbaker

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (03b09a08). It is still one commit, and it still changes only runtime/test/d3d12_vulkan_device_test.cpp.

main had added compare_check_feature_support() (the CheckFeatureSupport error paths) in the same places, so I kept both in all four conflicts:

  • compare_fences() now sits after compare_check_feature_support();
  • main() calls it right after that one;
  • the header comment and the final success line mention both.

main has no equivalent fence/queue comparison against the host:

  • d3d12_fence_events_test covers release and multi-fence events;
  • d3d12_node_mask_test only compares the queue's GetDesc;
  • Fence::claim still drops a lower signal, so the test's expectation holds.

Tested on Intel(R) Graphics (driver 32.0.101.6737), Vulkan SDK 1.4.363.0, MSVC 14.44, clean build:

  • d3d12_vulkan_device_test, d3d12_com_test and vk_command_replay_test exit 0 under LEONIDA_VK_VALIDATION=1 with 0 validation errors.
  • The fence comparison ran against the host D3D12 device with 0 mismatches.
  • ctest: 152/154. The two failures, d3d12_buffer_tiles and d3d12_buffer_uav (a typed clear, DXGI format 26), are separate binaries that don't build this file, so they fail the same way on main.

No game files. AI-assisted (Claude Code).

@Vonsek

Vonsek commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested fdbb95d on Windows 11 (MSVC BuildTools 2022, Ninja, RelWithDebInfo, -j 4; no Vulkan validation layer installed), one GPU at a time, device line confirmed: AMD Radeon RDNA2 iGPU (driver 26.10.1) and NVIDIA RTX 5080 (driver 616.92). Ran ctest -R d3d12_vulkan_device (the test this PR changes): pass on both GPUs (1/1 each). No game files.

AI-assisted.

@sh1shu1

sh1shu1 commented Nov 23, 2026

Copy link
Copy Markdown

Tested fdbb95d on NVIDIA RTX 4070 SUPER (driver 616.92), Windows 11 26200, MSVC 14.44, Vulkan SDK 1.4.363, RelWithDebInfo: pass, no regression against main 03b09a0.

  • ctest: 154/154 passed, same 9 skips as main 03b09a0
  • d3d12_vulkan_device: 1/1
  • run_gpu_tests (LEONIDA_VK_VALIDATION=1): 164/210 native, 195/210 with LEONIDA_W64_EMULATE=1, 0 failed; identical to main 03b09a0
    AI-assisted (Claude Code, Claude Fable 5.1).

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