Repository navigation
Runtime: D3D12 copy and compute queues on their own Vulkan queues (D3D-21) - #306
Conversation
|
Tested e0fe014 on RTX 3060 Ti (Ampere), NVIDIA 621.24, Windows 11, MSVC 14.44, Vulkan SDK 1.4.363.1: pass.
AI-assisted (Claude Code). |
|
Tested e0fe014 on RTX 4090 (driver 621.14), Windows 11 26200, MSVC 19.44: pass
That includes the new No game files used. AI-assisted run (Claude Code). |
0xTehuti
left a comment
There was a problem hiding this comment.
Independent Windows Hardware Test & Review (D3D-21 / Milestone M4)
Tested and verified on Windows 11 with an NVIDIA GeForce RTX 2070 SUPER, answering the author's request for verification of the standalone device COM-level copy/compute queue test harness.
Hardware & Toolchain Environment
- OS: Windows 11 Pro 24H2 (x64)
- GPU: NVIDIA GeForce RTX 2070 SUPER (8203 MB dedicated VRAM)
- Driver: NVIDIA 595.79 (Vulkan 1.4.321, WDDM 3.2)
- Compiler: Microsoft (R) C/C++ Optimizing Compiler Version 19.44.35225 for x64 (MSVC 2022 v14.44)
- CMake & Ninja: CMake 3.31 / Ninja 1.13 (
RelWithDebInfo) - Flags:
/std:c++20 /W4 /permissive- /utf-8
Compilation Results
- 102 / 102 build targets compiled cleanly.
- Diagnostics: 0 errors, 0 warnings under
/W4 /permissive- /utf-8.
Test Execution Results
| Test Target / Suite | Status | Execution Summary |
|---|---|---|
d3d12_vulkan_device_test.exe |
PASSED | Standalone device COM section passed cleanly: detected queue families direct 0, compute 2, copy 1. Performed copy queue / allocator / list upload into a default-heap buffer, cross-queue fence Signal, direct queue Wait, and readback verification with 0 mismatches. |
| CTest Suite (14 / 14) | PASSED | 100% pass rate (loader, pe_loader, device_proxy, command_list, descriptor_table, bink_decode, bink_audio, xmem, xgameruntime, root_signature, root_signature_oracle, d3d12_gcl8, d3d12_state_map, gfx10_descriptors). |
d3d12_com_test.exe |
PASSED | COM list / queue / fence texels matched; queue wait held GPU. |
Execution Log Excerpt:
[rt] d3d12: Vulkan device: NVIDIA GeForce RTX 2070 SUPER (maxPushConstantsSize: 256 bytes; queue families: direct 0, compute 2, copy 1)
[rt] d3d12: default-heap buffers are not zero-filled yet; dimension 1
device: NVIDIA GeForce RTX 2070 SUPER
Vulkan device behind the Xbox-ABI proxy: clears, zero-filled first use, uploads, texture, buffer and BC copies, a resolve, GetCopyableFootprints and a copy-queue upload handed to the direct queue all matched
Clean, correct implementation of independent queue families and cross-queue timeline fence synchronization. LGTM!
AI-assisted verification following repository guidelines (AGENTS.md).
|
@IAmNotSiob, are you planning to rebase this? It conflicts with main in 4 files since D3D-97 (#1404) gave each live D3D12 queue its own leased graphics-family VkQueue, and docs/d3d12_vulkan.md:1357 still lists dedicated compute/transfer families as open. If you'd rather not, I can rebase it onto main (keeping #1404's queue leases, using your family picker and CONCURRENT sharing), keep you as co-author, and test it on an AMD RX 7600 (Windows, 26.11.2), which no one has run it on yet. Either way is fine. AI-assisted (Claude Code). |
|
yep, rebasing it now, on top of #1404's leases with my family picker + CONCURRENT sharing like you describe. ty for the offer! an RX 7600 run once it's up would be awesome, will ping here :) |
…lies (D3D-21), on top of D3D-97's leases
…an't clear; depth starts undefined there
e0fe014 to
faa42a6
Compare
|
rebased onto main (
tested on NVIDIA RTX 6000 Ada (families: direct 0 GCT, compute 2 CT, copy 1 T):
@Gabzinnn12 an RX 7600 run would be great, AMD's family layout differs from NVIDIA's :) TL;DR: rebased on top of #1404 instead of fighting it. copy/compute go on dedicated queue families when the GPU has them, and it passes on Windows and Linux. also fixed one real bug the rebase exposed (a texture clear that's illegal on a copy queue). AI-assisted (Claude Code). |
Serrambi
left a comment
There was a problem hiding this comment.
Tested rebased faa42a61 on NVIDIA GeForce RTX 5070 Ti (driver 610.88, Windows 11 Pro, MSVC 19.50.35719.0, Windows SDK 10.0.26100.0, Vulkan SDK 1.4.363.0, with LEONIDA_VK_VALIDATION=1) and reviewed the diff:
Hardware checks on faa42a61
vk_queue_test.exe(LEONIDA_VK_VALIDATION=1): passed (EXIT=0; detectedfamilies: direct 0 (GCT), compute 2 (CT), copy 1 (T);copy -> direct: buffer and texture upload read back, 0 bad bytes;direct -> compute: 0 bad bytes;validation errors: 0).d3d12_vulkan_device_test.exe(LEONIDA_VK_VALIDATION=1): passed (EXIT=0, 0 Vulkan validation errors, host comparisons matched).ctest --test-dir runtime/build --output-on-failure -j 4:111/113passed (8skipped/disabled; the only 2 failures are the pre-existingd3d12_computerefcount failure fixed in#1898andd3d12_drawbundle blend pixel failure from its base).
Code review findings on faa42a61
The lease integration (#1404), pick_queue_families (1x1x1 DMA granularity check + compute/copy split), DeviceState::share() (VK_SHARING_MODE_CONCURRENT across buffers, images, arena, and staging), and barrier stage narrowing (restrict_to_queue) look clean, with one real sharing-mode gap to be aware of:
- Internal helper buffers are still
VK_SHARING_MODE_EXCLUSIVE:runtime/src/vulkan_scratch.h:149(ScratchBuffers::make_chunk) creates scratch chunks asVK_SHARING_MODE_EXCLUSIVE, whilecontext_.scratch_(andspare_) is shared across allVulkanQueueinstances — includingCOPY(family 1), which now callszero_compressed_image()insideinitialize()forUNDEFINEDcolor images when!can_clear. Reusing a retiredspare_chunk betweenCOPY/COMPUTEandDIRECTwithout a queue-family ownership transfer violates Vulkan sharing rules.- Similarly, async-compute queues (
COMPUTE, nottransfer_only) do not skipdepth24_orbindless_prepare_or predication/resolves, yetOcclusionResolve::initialize(runtime/src/vulkan_backend.h:143),Depth24::make_chunk(runtime/src/vulkan_depth24.h:328),PredicateReducer(runtime/src/vulkan_predicate.h:63), andBindless::create(runtime/src/vulkan_bindless.h:664) all still createVK_SHARING_MODE_EXCLUSIVEbuffers (andd3d12_vulkan_device.cppstill configures predication withinfo.queue_family). Passing the device's sharing family list (whenfamilies.size() >= 2) to these internal buffers keeps them spec-safe if shared withCOMPUTE/COPY.
- Depth initialization on non-clear queues: as noted in the commit/description, depth/stencil textures first touched on a
COPY/COMPUTEqueue skip zero-fill (!can_clear && !color) and only transitionUNDEFINED -> layout. - Merge status: GitHub currently flags
faa42a61asCONFLICTINGagainst updatedmainagain, so a fresh rebase will be needed before merge.
|
Tested faa42a6 on AMD Radeon RX 7600 (RDNA3), AMD 26.11.2 (LLPC), Windows 11, MSVC 19.44, Vulkan SDK 1.4.363.0: vk_queue_test passed.
AI-assisted (Claude Code, reviewed with Codex). No game files. |
|
ayy ty for the RX 7600 run \o/ nice that the opposite family order picked right too |
# Conflicts: # runtime/test/vk_test_device.h
|
rebased again ( |
# Conflicts: # runtime/src/vulkan_backend.h
|
merged main again (1ace3ac): one conflict in VulkanQueue::execute, kept the transfer-only bindless skip + main's reused |
|
Independent Windows verification of head Hardware / environment. Windows 10 build 19045, VS 2026 Community (
Full
The AMD set is unchanged from On RTX 3060 the extra failure is The new This adds an RDNA2 iGPU with compute and copy sharing a family to the existing RDNA3 and Ada data points, and confirms the picker handles both layouts. No regression from this PR on either GPU. |
|
ty for testing ^^ |
|
Retested the current head 1ace3ac on the same AMD Radeon RX 7600 (RDNA3), AMD 26.11.2 (LLPC), Windows 11, MSVC 19.44, Vulkan SDK 1.4.363.0, llvm-mc 21.1.8: pass. Here compute and copy are separate families, unlike the 7600X iGPU above.
AI-assisted (Claude Code, reviewed with Codex). No game files. |
|
Independent Windows + NVIDIA run of the current head Hardware / build: Windows 11 x64, NVIDIA GeForce RTX 3070, driver 621.01, Vulkan 1.4.357, Vulkan SDK 1.4.363.0, MSVC 19.44, Ninja RelWithDebInfo. Full Family picker on this GPU:
The Windows+GPU COM-level section you could only compile-check: Full |
|
Independent Windows + Vulkan GPU verification of PR #306 at head One small integration gap: It adds |
D3D-21 in #156: copy and compute command queues with cross-queue fences (milestone M4).
What and why
Until now every D3D12 queue submitted to the one graphics
VkQueue, and non-direct command lists hit a stub (d3d12_vulkan_device.cpp: "Copy and compute queues share the one graphics VkQueue for now"). An open-world game streams assets on copy queues and runs async compute. This gives each queue type its own Vulkan queue.src/queue_families.h,leonida::pick_queue_families): compute → a compute-only family if there is one. Copy → a transfer-only family whose image transfer granularity is 1×1×1 (D3D12 copies any box), else the compute-only family, else graphics. One family is still correct, only not concurrent.VulkanDeviceInfogains optionalcompute_queue/copy_queue(null → the graphics queue, so existing callers are unchanged).CreateCommandQueueroutes by type, and COPY/COMPUTE allocators and lists are accepted. Bundle and video types still stub. Buffers and images are createdVK_SHARING_MODE_CONCURRENTacross the families in use, so resources move between queues with no ownership transfers.VulkanQueue::Kind: copy and compute queues refuse render-target and depth clears (ReplayResult::unsupported, nothing submitted), as D3D12 does.ReplayFunctions::queue_stages,restrict_to_queue): every barrier half recorded on a copy or compute queue is narrowed to the stages and accesses its family has. A D3D12 state likeGENERIC_READwould otherwise put graphics stages into a barrier on a transfer queue, which Vulkan rejects. Graphics queues are unchanged (queue_stages0).Cross-queue
Signal/Waitneeded no change: they were already timeline semaphores.Tested
vk_queue_test, built on Linux like the othervk_*tools and added to the CI tool check. It covers the picker on four synthetic family layouts, a copy queue uploading a buffer and a texture (footprint copy into a tracked, undefined texture) then signalling, the direct queue waiting on the GPU and reading both back, direct → compute the other way, and copy/compute refusing a render-target clear.LEONIDA_VK_VALIDATION=1→ 0 validation errors.vk_command_replay_teststill passes with validation on both.d3d12_vulkan_device_testgains a COM-level section on the standalone device: COPY queue/allocator/list upload into a default-heap buffer,Signal, direct-queueWait, readback. This one I could only compile-check through CI: it needs Windows plus a GPU. Testers in Coordinating who works on what (moved to #374) #156 with one, please run it.Notes
COMMONonly isn't enforced, just honoured by the tracker's implicit promotion.VkQueue; one lock is correct, slightly conservative).d3d12_vulkan_device.cpp/d3d12_com.cppwith other open D3D PRs. Rebased onmainat83d0637.No game data.