Skip to content

d3d12: use the selected queue family for timestamp support - #8314

Open
coenflict wants to merge 1 commit into
ItsNotRexed:mainfrom
coenflict:t3/d3d12-vulkan-correctness
Open

coenflict wants to merge 1 commit into
ItsNotRexed:mainfrom
coenflict:t3/d3d12-vulkan-correctness

Conversation

@coenflict

Copy link
Copy Markdown

Summary

  • Use the Vulkan family of the queue actually leased by D3D12 to determine timestamp support. A timestamp-less queue returns E_FAIL from frequency and calibration and rejects timestamp queries before replay. A graphics-family fallback uses the graphics family's capabilities.
  • Keep the Vulkan timestamp period device-wide. Reuse the fence/timing GPU harness to inject zero timestamp bits for a real dedicated copy family, check the unsupported calls, and check the working graphics queue.

Coordination claim in #8186 (new item, no numeric D3D ID assigned). Based on main dde82f27e. Dependencies: none.

Direct3D 12 timing contract · Vulkan timestamp query requirements

Tests

Windows 11 Pro Insider Preview build 26340, MSVC 19.51.36263.0, Ninja, CMake 4.4.3, Vulkan SDK 1.4.363.0, RelWithDebInfo. Tested with LEONIDA_VK_VALIDATION=1 on NVIDIA GeForce RTX 5090 (32.0.16.2124 / 621.24) and AMD Radeon Graphics iGPU (32.0.21042.62). Synthetic and offline, no game data.

  • New case on the unmodified runtime: d3d12_fence_timing fails on both GPUs at copy->GetTimestampFrequency(&frequency) == E_FAIL.
  • Patched runtime: ctest --test-dir runtime/build-6314 -R '^d3d12_(fence_timing|query_rules|queue_share|com)$' --output-on-failure passes on both GPUs. This includes timestamp queries against native D3D12 and WARP in d3d12_query_rules, and both the calibrated and submitted-timestamp clock paths in d3d12_fence_timing.
  • The two known baseline failures persisted in the broader run on both GPUs: d3d12_vulkan_device at tiles == 1 after CreateReservedResource2, and d3d12_depth_resolve on its refused-resolve cases (see d3d12_depth_resolve_test: run a refused resolve as clears, refused list, copy (red since #6610) #7985).
  • git diff --check and python -I scripts/check_no_game_data.py on all four changed files passed.

AI-assisted (OpenAI Codex).

@lohant27-netizen

Copy link
Copy Markdown

Tested bfcf0d2a5 on Windows 11 (10.0.26300), NVIDIA GeForce RTX 5070 (driver 32.0.16.2101, subgroup 32), MSVC with SDK 10.0.26100, Release, merged onto main 23060e087 together with #8314, #8252, #8326 and #8270 (no conflicts): pass.

@ECHOZwei

Copy link
Copy Markdown

Tested bfcf0d2a529631dd0af9acf5a8427fc23817b8bb merged onto origin/main 6dda0630b (clean merge) on Windows 11 (MSVC 14.51 / Visual Studio Community 2026, RelWithDebInfo, Vulkan SDK 1.4.363.0, LEONIDA_VK_VALIDATION=1) on two GPUs (synthetic tests only; no game files): pass

  • Negative control (d3d12_fence_timing_test.cpp built against unmodified origin/main 6dda0630b, RTX 4080 SUPER, LEONIDA_VK_VALIDATION=1): fails as expected (exit 1); with the PR merged, passes cleanly.
  • Built d3d12_fence_timing_test, d3d12_query_rules_test, d3d12_queue_share_test, and d3d12_com_test cleanly (0 new warnings).
  • NVIDIA GeForce RTX 4080 SUPER (driver 621.01, validation on):
    • ctest --test-dir runtime/build -C RelWithDebInfo -R ^d3d12_(fence_timing|query_rules|queue_share|com)$ --output-on-failure: 4/4 passed (5.49s), 0 validation errors.
  • AMD Radeon(TM) Graphics iGPU (driver 25.10, LEONIDA_VK_DEVICE=AMD, validation on):
    • Same 4 tests: 4/4 passed (4.39s), 0 validation errors.
  • git diff --check and python -I scripts/check_no_game_data.py on all 4 modified files: clean (exit 0).
  • Code review: state_.queue_clock(family) cleanly scopes timestamp_valid_bits (and calibrated) to the leased Vulkan family, sets device-wide timestampPeriod when any selected family supports timestamps, and timestamps_fit() rejects timestamp queries on timestamp-less queues before replay.

AI-assisted.

@MiguelMatMar

Copy link
Copy Markdown

Tested bfcf0d2 on NVIDIA GeForce RTX 4080 SUPER, driver 621.24 (Vulkan 1.4.357), Windows 11 Pro 26300, MSVC 14.44, Ninja RelWithDebInfo, applied on main 6dda063, no game data: pass.

  • ctest -R ^d3d12_fence_timing$: passed.
  • Negative control: only the test-side files applied (no source change): d3d12_fence_timing fails.

(AI-assisted check, 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