d3d12: report copy queue timestamp support from Vulkan queue capabilities #1154

Manually merged
github merged 2 commits from gh-pr/1154/head into gh-pr/1154/base 2026-11-26 09:40:34 +00:00
Owner

@⁠PyZikYG on GitHub · 2026-11-24 19:17 UTC · original
PyZikYG:copy-queue-timestamp-support → main · +122 −22 · 7 files · 2 commits · merged 2026-11-25 00:02 UTC

Claimed as D3D-COPY-TIMESTAMP-CAPS.

OPTIONS3 always reported copy queue timestamps as unsupported, even when a copy queue could write and resolve them on the graphics family. Heap creation used the graphics family's timestamp support even when a copy queue could be assigned a dedicated transfer family.

Use the same capability check for OPTIONS3 and COPY_QUEUE_TIMESTAMP heaps. Every family the copy queue can use must provide timestamp bits and permit query reset and resolve. GetTimestampFrequency and submission validation now check the queue's actual family, and clock calibration receives that family's timestamp width.

AI-assisted: yes.

**@⁠PyZikYG** on GitHub · 2026-11-24 19:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1154) `PyZikYG:copy-queue-timestamp-support` → `main` · +122 −22 · 7 files · 2 commits · merged 2026-11-25 00:02 UTC Claimed as [D3D-COPY-TIMESTAMP-CAPS](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14). OPTIONS3 always reported copy queue timestamps as unsupported, even when a copy queue could write and resolve them on the graphics family. Heap creation used the graphics family's timestamp support even when a copy queue could be assigned a dedicated transfer family. Use the same capability check for OPTIONS3 and COPY_QUEUE_TIMESTAMP heaps. Every family the copy queue can use must provide timestamp bits and permit query reset and resolve. GetTimestampFrequency and submission validation now check the queue's actual family, and clock calibration receives that family's timestamp width. AI-assisted: yes.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:40:31 +00:00
github manually merged commit be010a409c into gh-pr/1154/base 2026-11-26 09:40:34 +00:00
Author
Owner

@⁠KernelSmoker on GitHub · 2026-11-24 19:19 UTC · original · reviewed

Found a capability mismatch in DeviceState::copy_timestamps_supported() (runtime/shims/d3d12_vulkan_device.cpp, around lines 629–634). CreateCommandQueue can select a copy queue from copy_queues or fall back to command_queues when that pool is exhausted (around 5742–5769), but the capability currently checks only timestamp_bits_for(info.copy_family). If the dedicated family supports timestamps while the graphics fallback family has timestampValidBits == 0, OPTIONS3 and COPY_QUEUE_TIMESTAMP heap creation advertise support, yet a copy queue leased from the graphics family gets clock_for(graphicsFamily) with zero valid bits; GetTimestampFrequency then returns E_FAIL and timestamp execution is rejected. The caller-owned-device path also advertises support without checking the actual queue_family when command_queues is empty. Could the capability require support for every family a copy queue can use (including info.queue_family), and add regression coverage for both the dedicated/fallback mismatch and a legacy caller-owned queue with zero valid bits? I did not run the Windows D3D12 integration test; this finding follows the queue-selection and capability code paths.

**@⁠KernelSmoker** on GitHub · 2026-11-24 19:19 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1154#pullrequestreview-6045790443) · **reviewed** Found a capability mismatch in `DeviceState::copy_timestamps_supported()` (`runtime/shims/d3d12_vulkan_device.cpp`, around lines 629–634). `CreateCommandQueue` can select a copy queue from `copy_queues` or fall back to `command_queues` when that pool is exhausted (around 5742–5769), but the capability currently checks only `timestamp_bits_for(info.copy_family)`. If the dedicated family supports timestamps while the graphics fallback family has `timestampValidBits == 0`, OPTIONS3 and COPY_QUEUE_TIMESTAMP heap creation advertise support, yet a copy queue leased from the graphics family gets `clock_for(graphicsFamily)` with zero valid bits; `GetTimestampFrequency` then returns E_FAIL and timestamp execution is rejected. The caller-owned-device path also advertises support without checking the actual `queue_family` when `command_queues` is empty. Could the capability require support for every family a copy queue can use (including `info.queue_family`), and add regression coverage for both the dedicated/fallback mismatch and a legacy caller-owned queue with zero valid bits? I did not run the Windows D3D12 integration test; this finding follows the queue-selection and capability code paths.
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 19:21 UTC · original · approved these changes

Reviewed and verified. Robust handling of copy queue timestamp capabilities in D3D12/Vulkan layer. Accurately evaluates \ imestamp_bits_for\ and queue family resolve capabilities (distinguishing transfer-only families from graphics/compute fallbacks) and aligns \OPTIONS3.CopyQueueTimestampQueriesSupported\ and \COPY_QUEUE_TIMESTAMP\ heap creation with hardware capability. Verified with \d3d12_timestamp_test. 100% clean-room.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 19:21 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1154#pullrequestreview-6045826783) · **approved these changes** Reviewed and verified. Robust handling of copy queue timestamp capabilities in D3D12/Vulkan layer. Accurately evaluates \ imestamp_bits_for\ and queue family resolve capabilities (distinguishing transfer-only families from graphics/compute fallbacks) and aligns \OPTIONS3.CopyQueueTimestampQueriesSupported\ and \COPY_QUEUE_TIMESTAMP\ heap creation with hardware capability. Verified with \d3d12_timestamp_test\. 100% clean-room.
Author
Owner

@⁠KernelSmoker on GitHub · 2026-11-24 19:25 UTC · original · reviewed

Follow-up on the updated head be010a409c: the new copy_queue_timestamp_families_supported() helper now checks the graphics family plus the optional dedicated copy family, and its constexpr cases cover both the fallback mismatch and caller-owned queue using a nonzero family index. I built vk_queue_test from this exact head in the project Vulkan tools container; CTest vk_queue passed 1/1. The explicit no-game-data scan passed on the five changed implementation/test files. This Linux check validates the helper and queue-selection tests only: I could not run the Windows-only d3d12_query_rules_test / D3D12 query integration, and GitHub reports no checks on this head.

**@⁠KernelSmoker** on GitHub · 2026-11-24 19:25 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1154#pullrequestreview-6045889016) · **reviewed** Follow-up on the updated head be010a409c24c5732c3dc6122f28f2a493a5afc6: the new `copy_queue_timestamp_families_supported()` helper now checks the graphics family plus the optional dedicated copy family, and its constexpr cases cover both the fallback mismatch and caller-owned queue using a nonzero family index. I built `vk_queue_test` from this exact head in the project Vulkan tools container; CTest `vk_queue` passed 1/1. The explicit no-game-data scan passed on the five changed implementation/test files. This Linux check validates the helper and queue-selection tests only: I could not run the Windows-only `d3d12_query_rules_test` / D3D12 query integration, and GitHub reports no checks on this head.
Author
Owner

@⁠madhyn on GitHub · 2026-11-24 19:28 UTC · original

Tested a8ed98c23 on Arch Linux + Wine 11.22 + NVIDIA RTX 3060 Ti (595.58.03 / Vulkan):

  • d3d12_vulkan_device (Wine): Passed (8.01 s)
  • d3d12_query_rules (Wine): Passed (5.62 s)
  • vk_queue (Linux): Passed (0.54 s)

AI-assisted: yes

**@⁠madhyn** on GitHub · 2026-11-24 19:28 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1154#issuecomment-7142145112) Tested `a8ed98c23` on Arch Linux + Wine 11.22 + NVIDIA RTX 3060 Ti (595.58.03 / Vulkan): - `d3d12_vulkan_device` (Wine): **Passed** (8.01 s) - `d3d12_query_rules` (Wine): **Passed** (5.62 s) - `vk_queue` (Linux): **Passed** (0.54 s) AI-assisted: yes
Author
Owner

@⁠Deedlyy on GitHub · 2026-11-24 20:12 UTC · original

Recommendation: [MERGE]

Reasoning: Copy-queue timestamp support (OPTIONS3, COPY_QUEUE_TIMESTAMP heaps, GetTimestampFrequency) is now derived from the Vulkan families the copy queue can actually use, instead of hard-coded or the graphics family. KernelSmoker found a capability mismatch; the updated head addresses it with copy_queue_timestamp_families_supported(), and KernelSmoker confirmed. Verified on Wine + RTX 3060 Ti by madhyn. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 5/10

**@⁠Deedlyy** on GitHub · 2026-11-24 20:12 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1154#issuecomment-7143191664) **Recommendation:** [MERGE] **Reasoning:** Copy-queue timestamp support (OPTIONS3, COPY_QUEUE_TIMESTAMP heaps, `GetTimestampFrequency`) is now derived from the Vulkan families the copy queue can actually use, instead of hard-coded or the graphics family. KernelSmoker found a capability mismatch; the updated head addresses it with `copy_queue_timestamp_families_supported()`, and KernelSmoker confirmed. Verified on Wine + RTX 3060 Ti by madhyn. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 5/10
Author
Owner

@⁠QemmHD on GitHub · 2026-11-25 00:02 UTC · original

Merging.

Why merged: D3D-COPY-TIMESTAMP-CAPS: timestamp bits are tracked per queue family, and transfer-only families count as 0 bits because they can't reset or resolve queries. This was the first native Windows run of the fixed head; madhyn's Wine run was on an older head, and KernelSmoker ran vk_queue on Linux. Behaviour change: OPTIONS3.CopyQueueTimestampQueriesSupported can now be TRUE, and a copy queue that gets a transfer-only family returns E_FAIL from GetTimestampFrequency and GetClockCalibration instead of borrowing the graphics family's bits.

Why it's good: d3d12_vulkan_device, d3d12_query_rules, vk_queue, vk_queue_query_sync and vk_queue_constructor_oom: 5/5 both plain and under validation on the 4070 SUPER.

Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main 0f98d193c, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative with the rest of this batch on main 507029d1e: the repo-consistency set gives 578 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 317/318 with the usual 11 skips; the only failure is main's pre-existing d3d12_depth_resolve. All d3d12_* tests under validation: 119/120 with 0 VUIDs. The semantic suite has only the known environment-only failure. git merge-tree against current main 9c5e70661: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠QemmHD** on GitHub · 2026-11-25 00:02 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1154#issuecomment-7148073568) Merging. **Why merged:** D3D-COPY-TIMESTAMP-CAPS: timestamp bits are tracked per queue family, and transfer-only families count as 0 bits because they can't reset or resolve queries. This was the first native Windows run of the fixed head; madhyn's Wine run was on an older head, and KernelSmoker ran vk_queue on Linux. Behaviour change: OPTIONS3.CopyQueueTimestampQueriesSupported can now be TRUE, and a copy queue that gets a transfer-only family returns E_FAIL from GetTimestampFrequency and GetClockCalibration instead of borrowing the graphics family's bits. **Why it's good:** d3d12_vulkan_device, d3d12_query_rules, vk_queue, vk_queue_query_sync and vk_queue_constructor_oom: 5/5 both plain and under validation on the 4070 SUPER. Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main 0f98d193c, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative with the rest of this batch on main 507029d1e: the repo-consistency set gives 578 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 317/318 with the usual 11 skips; the only failure is main's pre-existing d3d12_depth_resolve. All d3d12_* tests under validation: 119/120 with 0 VUIDs. The semantic suite has only the known environment-only failure. git merge-tree against current main 9c5e70661: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.