Repository navigation
Conversation
With LEONIDA_DRED=1 the Vulkan layer records per-command-list breadcrumbs (VK_AMD_buffer_marker; CPU-only with UNKNOWN progress without it), reads VK_EXT_device_fault on a loss, prints one report, and answers ID3D12DeviceRemovedExtendedData/1/2 as the host runtime does. Off by default; the Xbox-ABI device proxy is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts in runtime/src/vulkan_backend.h: main's event functions and the two optional DRED functions both stay in the device function list; after submit(), main's wait clean-up runs first, then the breadcrumbs keep the marks only if the submission succeeded. main's SetName now keeps the name apart from the private data (Object::debug_name()), so ExecuteCommandLists takes the DRED names from there; the GetPrivateData-based dred_debug_name() is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested
No game files. AI-assisted (Claude Code). |
|
Thanks for the independent run on RDNA2/RADV, @crastinator. That's the first non-NVIDIA result for this branch. For the record: on Linux, the two new tests are One thing a pass doesn't tell apart: if the device doesn't expose LEONIDA_VK_VALIDATION=1 ctest --test-dir <build> -R 'vk_breadcrumbs|vk_device_lost' -VThe line I'm after is |
|
Verified against main 3faac55: DRED remains a documented stub there (docs table: stubs, verified), so nothing in this PR is superseded; it conflicts only in vulkan_backend.h's device-function list, where both sides extended the same macro — mechanical to rebase, mind the continuation backslashes. Review of the ~2k added lines found no game data and a clean opt-in design, but this host builds no C++, has no GPU and never runs wine, so vk_device_lost_test, vk_breadcrumbs_test and the fault-info capture are unverified here — and CI is currently red on both linux-gpu-tools and windows (re-confirmed today), which should be green or explained before review effort. Also touches d3d12_com.cpp alongside #3298. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
|
Thanks @memorypressure. Here's where each point stands, measured locally. Conflict. As you say, the only one is the device-function list in Red CI on
#3298. Merged against the right base (this branch plus What has been run. All runs on an RTX 4060 Ti, driver 621.01, Windows 11, MSVC,
Prepared locally, not pushed yet:
AI-assisted (Claude Code). |
Preserve the optional Vulkan DRED hooks alongside main's new device functions and adapt deferred command-list batches to keep their original diagnostic names. Fix stale queue-name reuse and protect DRED snapshots under their own mutex. Add regression coverage for deferred batches and reused object addresses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested abd8012 on NVIDIA GeForce RTX 4080, driver 617.42, Windows 11 (clang-cl cross-build): vk_breadcrumbs_test and vk_device_lost_test exit 0 with "0 validation errors" (seven checks ok each, including "1026 lists across a ring wrap" and "eight threads at once, one report, no deadlock"). d3d12_dred_test exits 0 with LEONIDA_DRED unset ("3 backend(s) passed") and with LEONIDA_DRED=1 ("3 backend(s) passed"); the LEONIDA_DRED=1 run prints "page fault VA 0x10040". Real-driver marker and fault contents are not verified here. AI-assisted. |
D3D-264 (claim, correction after measuring the host runtime). No dependencies. Written on
main16282101, merged withmainf847748cand then3faac557(merge commits, no rebase).Why
When the GPU faults or hangs, the Vulkan layer has only
VK_ERROR_DEVICE_LOST/DXGI_ERROR_DEVICE_REMOVED. It can't tell which command list was running or which address faulted, and that's the first question on a boot crash. Nothing onmainimplements DRED.What
Everything is opt-in with
LEONIDA_DRED=1. Unset, no extension is enabled, no ring exists, and the hot paths only pay a null check.GPU breadcrumbs per command list (
runtime/src/vulkan_breadcrumbs.h).execute()writes twovkCmdWriteBufferMarkerAMDmarkers around each list's commands, atTOP_OF_PIPEandBOTTOM_OF_PIPE, into a host-visible ring of 1024 slots. Each list gets a unique non-zero tag, so slots need no clearing and an older tag never passes for progress. The states are:vkQueueSubmitsucceeded, which is CPU knowledge only;Replay and
emit()are unchanged.CPU fallback. Without
VK_AMD_buffer_marker, or without host-visible memory for it, the ring keeps only the submitted lists and their queues, and every state is UNKNOWN. Nothing is reported as started or completed.VK_EXT_device_fault(withdeviceFault) is read once after the loss for the description and addresses. Vendor binary data is never requested.One report on the loss (stderr), whichever path sees it first:
mark_device_lost()(afternotify_device_lost()), oris_device_lost()after the fence waiter set the flag.ID3D12DeviceRemovedExtendedData,…1,…2(runtime/shims/d3d12_dred.h): a tear-off of the device, with the device's identity and reference count. It follows the host runtime as measured on WARP and an RTX 4060 Ti; both behave the same.QueryInterfacefor the threeDXGI_ERROR_UNSUPPORTEDDXGI_ERROR_NOT_CURRENTLY_AVAILABLERemoveDeviceDXGI_ERROR_UNSUPPORTEDS_OK, no node,PageFaultVA0GetDeviceStateUNKNOWNUNKNOWNAfter a real loss the outputs are taken once and stay valid for the device's lifetime:
D3D12_AUTO_BREADCRUMB_OPs and*pLastBreadcrumbValue0 (list granularity);PageFaultVAis the first invalid-access address minus the arena's device address, the same wayGetGPUVirtualAddresscomputes VAs.Debug names.
ExecuteCommandListscopies the list's and queue'sSetNamenames into the ring, only when DRED is on. They're read from theWKPDID_D3DDebugObjectNameWprivate data, under the object's lock. They show up in the report and in the nodes'pCommand{List,Queue}DebugName{W,A}.pCommandListandpCommandQueuestay null, because nothing keeps those objects alive after the call.mainholds on the CPU behind an unsignalledWaitcopies the names when it is held. When it's released, it is marked under the application's list address, which is only shown as an id and never dereferenced or looked up.vkQueueSubmit.Xbox-ABI device proxy: unchanged. It answers only the Xbox device chain it models. DRED isn't in that chain and its Xbox layout hasn't been measured, so the game's device still refuses the three interfaces. The stderr report doesn't depend on them.
Docs:
docs/d3d12_vulkan.md§4.11, and the stub-table row.Tests
vk_breadcrumbs:vk_device_lost: a controlled loss on an idle device.vkQueueSubmitreturnsVK_ERROR_DEVICE_LOSTwithout reaching the driver, the marker call is counted, andvkGetDeviceFaultInfoEXTis a mock. It checks:d3d12_dred_off/d3d12_dred_oncompare the host runtime on WARP and the first hardware adapter with the Vulkan device:QueryInterfaceand its identity;ExecuteCommandListsand afterRemoveDevice;on, a controlled loss through D3D12: the named list comes back as a node with its queue's name, andPageFaultVAis the buffer's VA + 0x40.d3d12_dred_offalso passes withLEONIDA_DRED=1set globally.Full
ctest, RelWithDebInfo (MSVC),LEONIDA_VK_VALIDATION=1plus synchronization validation, implicit layers off. RTX 4060 Ti, driver 621.01, Windows 11 26200:main3faac5573faac557)LEONIDA_DRED=1for every testThe only difference from
mainis the four new tests. In the validation output, the only new lines are their two "0 validation errors". The same 8 tests skip in all three runs, andgameinputis disabled by default, as onmain:shader_library_corpus,bink_decode,bink_play_headless,fsr_dispatch,bvh_builder,bink_audio;d3d12_first_lightneedsLEONIDA_FIRST_LIGHT_DIR;d3d12_rgb9e5_rtvskips because the adapter has no RGB9E5 render targets.Earlier bases, same setup:
f847748c:main132/132, this PR 136/136;16282101: 121/121 and 125/125;On AMD, @crastinator ran
db77d45on an RX 6700 XT (RADV, Linux): ctest 43/43 andrun_gpu_tests.pyas onmain. That covers the normal path; whether the GPU-marker part ofvk_breadcrumbsran there hasn't been confirmed.Merge with
3faac557.vulkan_backend.h: main's pipeline-cache functions and the two DRED functions both stay.mainneeded adapting:SetNamewent back to private data (55a07318), so the names are read throughGetPrivateData;Fixes from an audit, each with a test:
db77d45;The CI failures on
db77d45came frommainat the time:windows:d3d12_msaa_drawandd3d12_geometryhad no skip without a GPU;mainhas since added one.linux-gpu-tools: ctest passed 41/41, but a later step failed whenllvm-mcrejectedps_sdwa_f16_const.Not covered / follow-ups
GetDeviceStatestaysUNKNOWN, and there are no allocation nodes or breadcrumb contexts.No game files.
AI-assisted (Claude Code).
🤖 Generated with Claude Code