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>
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>
LEONIDA_DRED=2 adds a progress marker after every D3D12 operation, on top of ItsNotRexed#3293's per-list breadcrumbs (LEONIDA_DRED=1), so a device-lost report and D3D12's *pLastBreadcrumbValue say how many of a started list's operations the GPU finished. - Ring: four words per slot (begin, end, progress, padding). mark() gives each list a range of 32-bit op numbers (never 0, never spanning 0) and notes each operation's IR command index; emit() writes first + k at BOTTOM_OF_PIPE after operation k, between commands where no rendering scope is open. Only a word inside the list's own range counts, so anything foreign reads as "none finished", never as more. - Slot reuse: at level 2 a slot is taken over only once its previous owner wrote its end word, so no older list can still write into it whatever the op count in between. With every slot held by unfinished lists, the new list gets list markers only and its progress is unknown. A failed submission frees its slot. - Unknown is said as such: at level 1, or without a safe slot, a started list's progress is "not recorded", not 0 completed; *pLastBreadcrumbValue stays 0 there as a lower bound. NODE and NODE1 share the count, history and value. - The per-op command positions are dropped at submission; the history keeps one uint32 per operation, as before. - Cost on an RTX 4060 Ti: level 1 about free, level 2 about 0.4 us of GPU time per operation (twice the GPU time for 10,000 small copies), hence its own level. - Tests: vk_breadcrumbs (GPU: several operations, reset and reuse, held batches, two queues, 1026-list wrap, op numbers across 2^32, list markers only; cost table), vk_device_lost (no progress claimed after a loss, marker counts, every slot busy), d3d12_dred_test (synthetic partial progress, node-by-node NODE/NODE1), and the new d3d12_dred_ops (LEONIDA_DRED=2). - Docs: docs/d3d12_vulkan.md section 4.11. Depends on ItsNotRexed#3293. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DoubleD17
left a comment
There was a problem hiding this comment.
The all-slots-busy fallback can make a later list's per-operation progress unreliable across queues.
At 160a72d66486cf82078ebb6ed60f0818512cd959, BreadcrumbRing::mark() leaves progress_safe false when all slots are busy, but still replaces owner_[m.slot]. The fallback list still writes its end tag via record_end().
Consider a full ring where an earlier list A still holds a slot on queue 1. An overflow list B takes it on queue 2 and writes its end tag. A subsequent list C now sees B's end tag match owner_ and gets progress_safe = true, although A can still write into the slot. When A resumes, its older operation tag can overwrite C's progress word. C's range check then reports zero completed operations even if its first marker was already visible. This needs no sequence wrap.
Can the overflow lists use CPU-only history, leaving the GPU slot owner in place until its actual writer finishes? The regression case needs an overflow list that finishes before the old owner, followed by another reservation. I traced the pinned source and verified the ordering with an independent CPU model of the marker words. I did not build or execute the PR or test this ordering on a GPU.
No game files. AI-assisted.
|
Thanks @DoubleD17, the trace holds. At The same overwrite also drops A's own entry from I'm fixing it along the lines you suggest. An overflow list keeps CPU-only history: it gets no begin, end or per-op markers, |
Kam471
left a comment
There was a problem hiding this comment.
Head 160a72d66. git diff --check clean. Delta reviewed: abd80129..160a72d6 (BUILD-1655, 10 files, +444/-46); the rest of the diff vs main is #3293.
- Configured with vcvars64 + Ninja and the stated Vulkan 1.4.363 options; built
d3d12_dred_test,vk_breadcrumbs_test,vk_device_lost_test. LEONIDA_VK_DEVICE='RTX 5070 Ti' ctest -R "vk_breadcrumbs|vk_device_lost|d3d12_dred" --output-on-failure-> 5/5 passed.- Output includes
breadcrumbs: per-operation progress over 3 + 1 operations and a reset list ok,... across the 32-bit wrap of op numbers ok,breadcrumbs: 1026 lists across a ring wrap ok,breadcrumbs: 0 validation errors;d3d12_dred_off/on/opsall passed. python -I tests/test_docs_*.pyandtest_boot_trace.pyOK.
Verdict: approve the BUILD-1655 delta; blocked on #3293, which is open. This branch is #3293's abd80129 + one commit, so it cannot merge on its own without carrying #3293's ~2.1k-line diff. Partial progress inside a list is synthetic only (a real list cannot be held on the GPU between its own ops), as the PR says.
Review of ItsNotRexed#5314 (DoubleD17): with every slot held by an unfinished list, mark() left progress_safe false but still overwrote owner_[slot], and the overflow list still recorded its begin and end markers. Its end tag made the slot look free while the slot's real owner, possibly on another queue, could still write into it. A later list then took the slot and read too little progress, and the unfinished owner dropped out of the device-lost report. - A list that finds no slot whose owner is seen finished takes none (kNoSlot). It records no GPU marker at all, changes no owner_ and no next_slot_, and is kept as CPU history with its GPU progress unknown: no D3D12 node, and "every breadcrumb slot was busy" in the report, counted apart from the lists that did not complete. A slot is used again as soon as its owner's end word shows. - A failed submission frees only a slot it really took. - History: the oldest list that no longer holds a slot is dropped first. A list that still holds its slot, finished or not, stays; up to 64 others are kept besides. - The begin marker of a list with per-op markers clears the progress word, so the previous owner's last op number does not sit there. - Tests: vk_breadcrumbs slot_ownership() runs the A/B/C order on a ring whose GPU writes are the test's own (it fails at 160a72d), plus failed submissions, history and CPU only. Also the marker counts in vk_device_lost, and the no-slot entry (no node) and a 0-op node in d3d12_dred_test. - Docs, section 4.11: the fallback, and what the Vulkan spec guarantees about marker order (per queue, execution only toward the host). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@DoubleD17, fixed in
Thanks for the careful trace. |
BUILD-1655 (claim), a follow-up to D3D-264.
Depends on: #3293. This branch is #3293's head
abd80129plus one commit. Until #3293 is merged, the diff below includes it; the BUILD-1655 part alone isabd80129...160a72d6.Why
#3293 tells which command lists the GPU started and finished. Its
*pLastBreadcrumbValueis always 0, because it doesn't know how far a started list got. With a list of thousands of draws, "list X was running" is a weak lead. This PR records progress per D3D12 operation, so a node says how many of the list's operations the GPU finished.What
Three levels (
LEONIDA_DRED, read once):1(#3293)TOP_OF_PIPE, end word atBOTTOM_OF_PIPE2(this PR)Level 2 is its own level, not part of
=1, because it roughly doubles GPU time for small operations (table below).=1stays cheap enough to leave on.How the progress is recorded (
vulkan_breadcrumbs.h,vulkan_replay.hemit(),vulkan_backend.h):mark()notes each D3D12 operation of a list together with the index of the IR command it stands for, and gives the list a range of 32-bit op numbers under the ring's lock. Numbers are never 0, and a range never spans 0.emit()writesfirst + kinto the list's slot word atBOTTOM_OF_PIPEonce operation k's command is recorded. The marker goes in at the top of the next loop step, or after the loop, where no rendering scope is open: every draw and clear opens and ends its own.BOTTOM_OF_PIPEwrites only after every earlier command of the queue has finished, so the word counts operations finished in order. Only a word in the list's own range counts (word - first < count, unsigned). The initial 0, an older range, or one across the 32-bit wrap reads as "none finished", never as more.uint32per operation, as at level 1. The ring is 1024 slots × 16 bytes.D3D12 outputs (
d3d12_dred.h):BreadcrumbCount: the list's operations.pCommandHistory: theirD3D12_AUTO_BREADCRUMB_OPs, in order.*pLastBreadcrumbValue: the number the GPU finished, at level 2.*pLastBreadcrumbValuestays 0. D3D12 has no "unknown", so 0 is a lower bound, never a guess.Report (stderr): a started list reads one of:
VK_AMD_buffer_marker.Docs:
docs/d3d12_vulkan.md§4.11.Tests
Observed on the GPU, with validation and synchronization validation:
vk_breadcrumbs:0xfffffffd;d3d12_dred_off,d3d12_dred_onand the newd3d12_dred_ops(LEONIDA_DRED=2).Mocks, with markers counted and not written, and a controlled loss (
vk_device_lost):Synthetic, not observed on a GPU:
BreadcrumbCount,pCommandHistoryorder and*pLastBreadcrumbValue, node by node in NODE and NODE1;A list can't be held on the GPU between two of its own operations without risking a hang, so partial progress is only tested this way.
Full
ctest, RelWithDebInfo (MSVC),LEONIDA_VK_VALIDATION=1plus synchronization validation, implicit layers off. RTX 4060 Ti, driver 621.01, Windows 11 26200:LEONIDA_DREDunset=1=2abd80129The only new test is
d3d12_dred_ops, and the validation output matchesabd80129's. The same 8 tests skip (no game package, corpus,LEONIDA_FIRST_LIGHT_DIRor RGB9E5 RTVs), andgameinputis disabled by default.Cost
Lists of N operations, each a 16-byte copy and a copy → copy barrier, best of 7, three runs. These are tiny operations, so the cost per operation dominates. Record is
execute()on the CPU; wait is the GPU finishing after it. NVIDIA only so far: other drivers may implement buffer markers differently.Limits
ExecuteBundlecopies the bundle's commands into the calling list, so the history lists the bundle's own operations. The host runtime lists oneEXECUTEBUNDLEinstead. The progress is right, but finer than on the host. Recording the bundle boundary is a possible follow-up.ExecuteIndirect. One operation, whatever its argument buffer holds.No game files.
AI-assisted (Claude Code).
🤖 Generated with Claude Code