Repository navigation
d3d12: on Intel the GPU reads a fresh host import before it is handed out (RT-INTEL-IMPORT-SETTLE) - #1259
Open
MalexAson wants to merge 1 commit into
Open
d3d12: on Intel the GPU reads a fresh host import before it is handed out (RT-INTEL-IMPORT-SETTLE)#1259MalexAson wants to merge 1 commit into
MalexAson wants to merge 1 commit into
Conversation
… out (RT-INTEL-IMPORT-SETTLE) Intel's Windows Vulkan driver (32.0.101.7092, Iris Xe) goes on working with a host import's pages after vkAllocateMemory has returned, and loses the device at the next vkQueueSubmit when the pages are freed before it is done, also when vkFreeMemory came first. d3d12_existing_heap opens existing heaps, releases them and frees their pages at once, so the device was already lost when the title-placed buffer's copy was submitted: "ExecuteCommandLists failed: unsupported", then a failed Signal, three times. On an Intel GPU, OpenExistingHeapFromAddress and a title-placed buffer (device slot 133) now copy four bytes out of the new import on the device's queue and wait for that (DeviceState::settle_host_import) before the object is handed out. Other vendors take the same path as before. d3d12_existing_heap gains check_pages_freed_at_once: three existing heaps and three placed buffers released with their pages freed at once, then a copy. On the Iris Xe it fails 10 of 10 times without the layer change and passes with it; an RTX 4060 passes either way. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Contributor
|
Independent synthetic verification on Intel UHD Graphics (i5-1334U), Intel 101.6314, native Windows, MSVC 19.50 RelWithDebInfo. I applied 2702cd3 privately on top of PR #1192 at 5ea4870 (rebased on main58be9cdf8), retaining the identical prefix fixture.
I am integrating it privately into our adapted #984 build as well; its allocation mutex must be released before settle_host_import allocates the scratch buffer, to avoid recursively taking that mutex. That adjustment is specific to the integration and is absent from these clean-main-derived test results. No duplicate PR planned. AI-assisted testing. |
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: RT-INTEL-IMPORT-SETTLE
What and why
d3d12_existing_heapfails with the layer on an Intel Iris Xe:[rt] d3d12: ExecuteCommandLists failed: unsupported; nothing was submitted, thenvulkan slot-133 buffer line 219: SUCCEEDED(queue->Signal(fence.p, 1)), three times. It passes on an RTX 4060 in the same machine. I reported it as a finding in #14 (comment) and guessed wrong there: the copy out of the title-placed buffer is not at fault.Which check says
unsupported. None of the replay checks.vkQueueSubmitreturnsVK_ERROR_DEVICE_LOSTfor the first copy,VulkanQueue::submitmarks the device lost, andexecute_nowreports a batch that was not submitted asunsupported. The second and third failure areexecute_nowrefusing at its entry because the device is lost.What loses the device. Not the title-placed buffer. With
open_casesskipped the test passes on the Iris Xe; with only its write-combined 64 KiB case or only its 2 MiB case it fails; with all cases but without theVirtualFreeat its end it passes.open_casesopens existing heaps, releases them and frees their pages at once. The heap frees its import inRelease, as it should, but Intel's driver is not done with the pages yet.A raw Vulkan program without the layer (
vkAllocateMemorywith a host pointer,vkFreeMemory,VirtualFree, then a copy between two ordinary buffers), Iris Xe, Intel 32.0.101.7092, runs that lost the device:vkDeviceWaitIdlebefore the freevkQueueSubmitwithout command buffers andvkQueueWaitIdlebefore the freeThe delay counts from
vkAllocateMemory, not fromvkFreeMemory: 100 µs between the import andvkFreeMemorywith the pages freed right after is 0 of 20 as well. No buffer has to be bound to the import for this. The memory type does not matter (type 1, flags 0x7, and type 2, flags 0xf, both lose it), nor doesVK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BITor writing to the pages before the import. The RTX 4060 (NVIDIA 621.40) lost its device in 0 of 20 runs at 64 KiB, 1 MiB and 64 MiB. On the Iris Xe's own D3D12 driver,OpenExistingHeapFromAddress,Release,VirtualFreeand a submitted copy keep the device in 10 of 10 runs at 1 MiB and at 64 MiB, so a title may do this.The first copy out of a fresh import takes 0.1 to 0.5 ms for 64 KiB and 1.3 to 2.5 ms for 64 MiB, on both drivers, so that is where a driver takes hold of the pages, and afterwards freeing them loses nothing.
The change.
DeviceState::settle_host_import: on an Intel GPU,OpenExistingHeapFromAddressand a title-placed buffer (device slot 133,create_host_buffer) copy four bytes out of the new import into a scratch buffer on the device's queue and wait for it, before the heap or buffer is handed out. It goes through the staging queue, asstaged_copydoes forWriteToSubresource. In the test it takes 0.3 to 0.8 ms per import on the Iris Xe. Other vendors run the same code as before.d3d12_existing_heap_testgainscheck_pages_freed_at_once: three existing heaps and three placed buffers (64 KiB, 1 MiB, 16 MiB), each released with its pages freed at once, then a copy andGetDeviceRemovedReason.docs/d3d12_vulkan.mdhas the measurements in the "Heaps and placed resources" row.Two things for a maintainer to decide.
VK_EXT_external_memory_host(the pages only have to stay valid while theVkDeviceMemorylives). I did not find a way to ask the driver whether it is done, so the read is what I measured to be enough, not something the specification promises.Not covered: Intel Arc and Intel on Linux get the read without having been measured, AMD does not get it and was not measured. The 14 GiB whole-region import of RT-TITLE-HOST-REGION is another code path and is not touched.
Overlap: #644, #1100, #1190 and #1192 change the same two source files. This merges cleanly with the current head of each (
git merge-tree), and it does not depend on any of them. #1192 reports thatd3d12_existing_heapfails on cleanmainon an Intel UHD at the first aligned copy; that is probably this.Tested
With MSVC 19.50 (Build Tools 2026), RelWithDebInfo, Windows 11 build 26100.6584, each on both GPUs through
LEONIDA_VK_DEVICE. The numbers without the change and the raw-program numbers above were taken onmain58be9cd, the numbers with the change onmain66d4f5a:d3d12_existing_heapwithout the change: fails on the Iris Xe in every run (the three lines above), passes on the RTX 4060. With it: 20 of 20 runs pass on each GPU.check_pages_freed_at_oncerun alone, through a local switch that is not in this pull request: without the read it fails in 10 of 10 runs on the Iris Xe, at itsqueue->Signal; with it in 0 of 10; on the RTX 4060 it passes 10 of 10.ctest -R "d3d12_existing_heap|d3d12_descriptor|d3d12_console_descriptor_heap|xmem"(xmem,d3d12_existing_heap,d3d12_xmem_placed,d3d12_descriptor,d3d12_console_descriptor_heap): 5 of 5 pass on both GPUs.python -I scripts/check_no_game_data.pyon the three changed files, andgit diff --check.ctest(only these five targets were built),LEONIDA_VK_VALIDATION=1(no validation layer on this PC), an AMD GPU, an Intel Arc, Linux or Wine.GPUs tested: Intel Iris Xe (Raptor Lake-P, 8086:a7a0), Intel 32.0.101.7092, Windows 11 build 26100.6584; NVIDIA GeForce RTX 4060 Laptop GPU, NVIDIA 621.40, Windows 11 build 26100.6584
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (not applicable: no translator change)🤖 Generated with Claude Code