Repository navigation
gpu: back slot 133 linear buffers by sharing or a submit-time copy (opt-in) - #2218
Conversation
1476946 to
60220de
Compare
tedin7
left a comment
There was a problem hiding this comment.
Review of head 14769462719628f1ce3bfd871eb43738d2c073aa (opt-in slot 133 linear-buffer backing).
Commands executed locally (Linux worktree)
git diff --stat origin/main...HEAD: 7 files, +2039/-21 (CMakeLists, docs x2, d3d12_xs_device.cpp, linear_buffer_backing.h/report.h, linear_buffer_backing_check.cpp).python3 tests/docs_links_check.py: passed (18 files, 410 links).python3 tests/bidi_controls_check.py: passed (1490 files).git diff --check origin/main...HEAD: clean.git merge-tree --write-tree --name-only origin/main HEAD: content conflicts indocs/startup-runtime.mdandsrc/startup_stubs/d3d12_xs_device.cpp.python3 x2w_pipe.py win2025 2218 --regex linear_buffer_backing(default 3-slot pool): dev 17/17 and release 17/17 passed on Win2025 + D3D12 WARP. The 5--mutatecontrols (skip-refresh, reuse-early, copy-gpu-writes, ignore-feature, refusal-silent) are WILL_FAIL tests and passed, so each mutant is killed by its case. Thehardwarevariants rely on SKIP_RETURN_CODE 77 where no hardware adapter exists; I did not see them exercised on real hardware.gh pr checks: no checks reported on the branch.
P1
- The PR is
CONFLICTINGwith main (files above). It needs a rebase, and the Win2025 result must be repeated on the rebased head, because the conflict is insided3d12_xs_device.cpp(thedevice_place_resource_x/queue_executehunks this PR rewrites).
P2
src/startup_stubs/linear_buffer_backing.hbefore_submit(about L315-405) holdsmutex_while it callstake_staging(waits up to 5000 ms onWaitForSingleObject) andqueue->ExecuteCommandLists. Another queue's submission, or arelease()of a placed resource callingretire, blocks behind it. Opt-in only, but consider dropping the lock around the wait, or documenting it indocs/experiments.md.before_submitrefreshes on whichever queue is executing (including compute or copy queues) and relies on implicit COMMON -> COPY_DEST promotion. This is valid for buffers, but no test submits on a non-direct queue. Add one, or state the limit in the docs.
Nit
x2w_d3d12_linear_buffer_inforeadsw->own().realafter thekindcheck only. That is fine, but anullptrguard onrealwould match the sibling exports.- Hardware-adapter variants are registered, but only WARP evidence is attached.
Title is neutral. The new code is original in-repo work; I found nothing that breaks clean-room.
AI-assisted; commands listed were executed locally.
tedin7
left a comment
There was a problem hiding this comment.
Note on my review above: it covers the earlier head 14769462719628f1ce3bfd871eb43738d2c073aa. The branch was updated to 60220de68a948cf66ff96e66c6ac2b1323595800 while I was reviewing, and it now reports MERGEABLE, so the P1 (merge conflict) no longer applies. The Win2025 WARP result (dev 17/17, release 17/17) and the P2 items were not re-run on the new head. Please re-verify them there before Ready.
AI-assisted; commands listed were executed locally.
Review of R0Y00#2218: - before_submit snapshots the copied buffers' work under mutex_, then takes, creates or waits for staging (a full pool waits up to 5 s for the oldest fence), fills it, resets and records a refresh list and runs ExecuteCommandLists without the lock, and publishes the result under it again. A release(), the fixture exports or another queue's submission no longer wait behind a fence wait or ExecuteCommandLists. Staging is still reused only after its fence, the refresh still runs at submit, and a buffer whose staging fails is still marked stale. - In render mode the refresh runs before queue_execute takes draw_lock and allocator_lock, so a staging wait does not stall list recording. - x2w_d3d12_linear_buffer_info returns false for a wrapper without a desktop object. The fixture adds a contention path (X2W_TEST_LINEAR_STAGING_LIMIT=1): while a refresh waits for the only staging buffer behind a gate, the info export, release() and a second queue's submission must finish, and a hold-lock mutant that keeps the lock across the wait must fail. The copy path also refreshes on COMPUTE and COPY queues, read by a dispatch and by CopyBufferRegion. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@tedin7, thanks for the review. All of it is addressed in
Results:
One environmental note. On this host, a debug-on run of #1942's AI-assisted. |
tedin7
left a comment
There was a problem hiding this comment.
Re-review of head 52d779d9dea7b2127393bdcc095e30995917321b (earlier review covered 14769462).
Previous findings
- P1 (merge conflict with main): resolved.
gh pr viewreports MERGEABLE;git diff --stat origin/main...HEADis 7 files, +2321/-22. - P2 (lock held across fence wait and
ExecuteCommandListsinbefore_submit): resolved.src/startup_stubs/linear_buffer_backing.hnow snapshots work undermutex_, stages/records/executes without it, and publishes under it again (L318-L430).retire()during a flight is safe: publish re-checkscopy.live. A newcontentioncase plus ahold-lockmutant cover it. - P2 (no test on a non-direct queue): resolved. The
copypath now has aq.comp/q.copycase (tests/linear_buffer_backing_check.cpp L925-L960) that submits through a COMPUTE queue (dispatch read) and a COPY queue (CopyBufferRegion read). The comment at L391 documents the implicit COMMON -> COPY_DEST promotion. - Nit (
realnull guard on the info export): resolved,d3d12_xs_device.cpp:1349checks!w->own().real.
Commands executed locally
python3 tests/docs_links_check.py: passed (18 files, 412 links).python3 tests/bidi_controls_check.py: passed (1498 files).git diff --check origin/main...HEAD: clean.gh pr checks: Linux Python checks, gfx1013 fixtures and Windows build+test all pass on this head.python3 x2w_pipe.py win2025 2218 --regex linear_buffer_backing(default 3-slot pool): dev phase 20/20 passed (warp + hardware variants, contention, and the 6 WILL_FAIL controls includinghold_lockand the new queue case, all killed as expected). The release phase failed twice at compile ofd3d12_xs_device.cppwithsccache: error reading compile response from server(connection reset, infrastructure, not a compiler diagnostic). So release ctest has NOT been confirmed on this head by me; the repo's Windows CI job is green.- Mutation: the PR's built-in mutants (
skip-refresh,reuse-early,copy-gpu-writes,ignore-feature,refusal-silent,hold-lock) all ran as WILL_FAIL controls and passed (each killed). I did not write a new mutant of my own, the Linux host cannot build the D3D12 test.
P1
- none.
P2
- Release-phase WARP result is missing on this head (sccache failure above). Please re-run the release phase before Ready.
Nit
- In
before_submit, two threads submitting at once can each snapshot the sameuploadeddiff and publish out of order, souploadedmay briefly lag the GPU copy. The effect is only an extra (redundant) refresh next submit, not stale data; a one-line comment would make that explicit. - The
hardwarevariants reported Passed on the Win2025 VM; I could not confirm whether a real GPU adapter was used there, so I do not count them as real-GPU evidence.
Title is neutral; the new code is original in-repo work; nothing breaks clean-room.
AI-assisted; commands listed were executed locally.
|
Thanks for the re-review.
AI-assisted. |
R0Y00
left a comment
There was a problem hiding this comment.
I reproduced a copy-path ordering failure on 52d779d9 after the existing Windows Release suite passed 37/37. In the fixture, I placed one copied buffer holding A and completed its first read. I recorded two read-only direct lists for that same buffer, wrote B once on CPU before submitting either list, and queued the first list behind an unsignaled fence. The second queue completed before the gate opened. After opening the gate, the first list read B in 1,024/1,024 words. The second had already read A in 1,024/1,024 words. Both WARP and RTX 4060 Laptop reproduced it for private memory and XMem, and neither reported a refresh failure. There are no concurrent guest writes. before_submit records the new bytes in uploaded when a copy is enqueued, so another queue skips its refresh before those bytes are available. Please track the pending refresh per backing and order foreign-queue consumers behind it, or explicitly refuse this use before the consumer runs. Keep the different-buffer contention case and add this same-buffer gate. Both reads should see B, or the second must hit an explicit refusal rather than finishing with stale A.
Two submissions that snapshot the same copied buffer can publish `uploaded` in either order, so it may briefly lag the GPU copy. The next diff is then redundant or larger than needed, never one that misses a change. Comment only (tedin7's review nit on R0Y00#2218). Refs R0Y00#1914 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tedin7
left a comment
There was a problem hiding this comment.
Re-review of head 793b52b5fa2ea08ecbe739b3ac540a4a194cf162 (previous review covered 52d779d9).
Previous findings
- P2 (release-phase WARP result missing on the earlier head): resolved. I re-ran it on this head, see below: release
/O220/20 passed. - Nit (concurrent publishes may leave
uploadedlagging): resolved. The only change since52d779d9is a comment insrc/startup_stubs/linear_buffer_backing.h(before_submit, around L403-L407, +5/-1). It states that the worst case is a redundant or larger refresh next submit, never a missed change. The wording matches what the code does (publish re-checks undermutex_). - Nit (
hardwarevariants are not proof of a real GPU): still open, informational only. I did not confirm an actual hardware adapter on the VM.
Commands executed locally
git diff --stat 52d779d9 793b52b5: 1 file, +5/-1, comment only. No logic change, so the earlier code review still holds.python3 tests/docs_links_check.py: passed (18 files, 412 links).python3 tests/bidi_controls_check.py: passed (1498 files).git diff --check origin/main...HEAD: clean.python3 x2w_pipe.py win2025 2218 --regex linear_buffer_backing --wait 3600(default 3-slot pool): dev phase passed (warp + hardware variants, contention, and the WILL_FAIL controls, all as expected; I only captured the tail of the dev output, so I do not quote a dev count). Release/O2: build 92.55s,ctest --preset release -R linear_buffer_backing: 20/20 passed, includingcontention_warp,contention_hardwareand thehold_lockcontrol.- Mutation: the PR's built-in mutants (
skip_refresh,reuse_early,copy_gpu_writes,ignore_feature,refusal_silent,hold_lock) ran as WILL_FAIL controls and all were killed. I wrote no mutant of my own: the Linux host cannot build the D3D12 test, and this head changes only a comment. gh pr checks: at review time the Windows build and gfx1013 jobs were stillpending; Linux Python checks passed. Please wait for those to turn green before Ready.- PR is MERGEABLE; the title is neutral; the new code is original in-repo work, so clean-room is intact.
P1
- none.
P2
- none. The previous P2 is resolved.
Nit
- The
hardwarectest variants pass on the VM, but I cannot show that a real GPU adapter was used, so I do not count them as real-GPU evidence.
AI-assisted; commands listed were executed locally.
|
@MasterDomino could you rebase this branch onto current GitHub reports head Files that conflict with current
Commands run locally: Once it is rebased and CI is green it will be re-checked right away. AI-assisted; commands listed were executed locally. |
793b52b to
9b8c36f
Compare
Review of R0Y00#2218: - before_submit snapshots the copied buffers' work under mutex_, then takes, creates or waits for staging (a full pool waits up to 5 s for the oldest fence), fills it, resets and records a refresh list and runs ExecuteCommandLists without the lock, and publishes the result under it again. A release(), the fixture exports or another queue's submission no longer wait behind a fence wait or ExecuteCommandLists. Staging is still reused only after its fence, the refresh still runs at submit, and a buffer whose staging fails is still marked stale. - In render mode the refresh runs before queue_execute takes draw_lock and allocator_lock, so a staging wait does not stall list recording. - x2w_d3d12_linear_buffer_info returns false for a wrapper without a desktop object. The fixture adds a contention path (X2W_TEST_LINEAR_STAGING_LIMIT=1): while a refresh waits for the only staging buffer behind a gate, the info export, release() and a second queue's submission must finish, and a hold-lock mutant that keeps the lock across the wait must fail. The copy path also refreshes on COMPUTE and COPY queues, read by a dispatch and by CopyBufferRegion. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two submissions that snapshot the same copied buffer can publish `uploaded` in either order, so it may briefly lag the GPU copy. The next diff is then redundant or larger than needed, never one that misses a change. Comment only (tedin7's review nit on R0Y00#2218). Refs R0Y00#1914 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of R0Y00#2218 (R0Y00): one copied buffer, one CPU write, then a list on queue 1 behind an unsignalled gate and a list on queue 2. Queue 2 read the old bytes: queue 1's refresh was enqueued behind its gate but recorded as uploaded, so queue 2 skipped its own. - Every refresh now runs on one internal COPY queue per device, which never waits on a title fence, and signals an internal fence value. Each copied buffer remembers the value of its last refresh. - Every submission through a queue wrapper first makes its queue wait for the highest such value among the live copied buffers that has not completed. A consumer on any queue runs after every refresh enqueued before it, and no title queue waits on another, so title-owned cross-queue fences cannot form a cycle with a refresh. - Staging is reused once its copy's internal fence value completes. The per-title-queue fences, after_submit and linear_submitted go. - If the internal queue or fence cannot be created, copied placements keep the default backing with that HRESULT recorded. - x2w_d3d12_linear_buffer_internal_queue lets fixtures hold refreshes. The fixture adds gate2q (both reads see the CPU write), gate2q.held (the second queue waits for a held refresh), xq (queue 1 waits on a fence queue 2 signals: no deadlock, both read the write) and a skip-consumer-wait mutant that must fail gate2q.held. Case c and contention hold the internal queue so staging stays in flight. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@R0Y00, your same-buffer cross-queue case is fixed, and the branch is rebased onto The stale read (
Rebase onto main's changes:
Results:
AI-assisted. |
|
Correction to the title-pair line in my comment above: neither arm of that pair got past the legal and acceptance page. Both ended at 420 s on that page with its boxes unticked. The same scripted presses ran in both arms, but on current AI-assisted. |
|
Title pair rerun on
AI-assisted. |
9b8c36f to
07455f0
Compare
Review of R0Y00#2218: - before_submit snapshots the copied buffers' work under mutex_, then takes, creates or waits for staging (a full pool waits up to 5 s for the oldest fence), fills it, resets and records a refresh list and runs ExecuteCommandLists without the lock, and publishes the result under it again. A release(), the fixture exports or another queue's submission no longer wait behind a fence wait or ExecuteCommandLists. Staging is still reused only after its fence, the refresh still runs at submit, and a buffer whose staging fails is still marked stale. - In render mode the refresh runs before queue_execute takes draw_lock and allocator_lock, so a staging wait does not stall list recording. - x2w_d3d12_linear_buffer_info returns false for a wrapper without a desktop object. The fixture adds a contention path (X2W_TEST_LINEAR_STAGING_LIMIT=1): while a refresh waits for the only staging buffer behind a gate, the info export, release() and a second queue's submission must finish, and a hold-lock mutant that keeps the lock across the wait must fail. The copy path also refreshes on COMPUTE and COPY queues, read by a dispatch and by CopyBufferRegion. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two submissions that snapshot the same copied buffer can publish `uploaded` in either order, so it may briefly lag the GPU copy. The next diff is then redundant or larger than needed, never one that misses a change. Comment only (tedin7's review nit on R0Y00#2218). Refs R0Y00#1914 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of R0Y00#2218 (R0Y00): one copied buffer, one CPU write, then a list on queue 1 behind an unsignalled gate and a list on queue 2. Queue 2 read the old bytes: queue 1's refresh was enqueued behind its gate but recorded as uploaded, so queue 2 skipped its own. - Every refresh now runs on one internal COPY queue per device, which never waits on a title fence, and signals an internal fence value. Each copied buffer remembers the value of its last refresh. - Every submission through a queue wrapper first makes its queue wait for the highest such value among the live copied buffers that has not completed. A consumer on any queue runs after every refresh enqueued before it, and no title queue waits on another, so title-owned cross-queue fences cannot form a cycle with a refresh. - Staging is reused once its copy's internal fence value completes. The per-title-queue fences, after_submit and linear_submitted go. - If the internal queue or fence cannot be created, copied placements keep the default backing with that HRESULT recorded. - x2w_d3d12_linear_buffer_internal_queue lets fixtures hold refreshes. The fixture adds gate2q (both reads see the CPU write), gate2q.held (the second queue waits for a held refresh), xq (queue 1 waits on a fence queue 2 signals: no deadlock, both read the write) and a skip-consumer-wait mutant that must fail gate2q.held. Case c and contention hold the internal queue so staging stays in flight. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Rebased onto How the conflicts were resolved
Re-verified at
Review and merge. Under the updated merge scope, our own PR goes to another maintainer.
AI-assisted; commands listed were executed locally. |
…pt-in) X2W_D3D12_LINEAR_BUFFERS=1 (or =copy) gives device slot 133 buffers in COMMON state (row-major or unknown layout) a backing that keeps the title's bytes visible to the GPU. Unset, slot 133 is unchanged. - Share only after D3D12_FEATURE_EXISTING_HEAPS reports support (queried once, before any open), for a buffer inside one committed private allocation at a 64 KiB-aligned offset. The heap is cached by base, which the open heap keeps from being released. - An XMem view is not shared: a heap opened from a view makes XMem's unmap of those pages fail with error 87 (measured), and desktop resources live for the process. Sharing reports 0x80070032 and the buffer is copied. - Copy into a committed default buffer at each submission through the queue wrapper, before the title's lists run, never at bind or record. Only changed bytes are copied, through staging buffers that are reused only after their submission's queue fence completes. - Refuse with a defined HRESULT where the copy cannot keep the guarantees: a GPU-written use returns the sharing HRESULT (or DXGI_ERROR_UNSUPPORTED when sharing was not attempted), no submit fence returns E_NOT_VALID_STATE, and a submission whose refresh cannot be staged is not executed. tests/linear_buffer_backing_check.cpp drives slot 133, wrapper lists and the queue wrapper in d3d12_xs.dll over XMem pages and a private range with the R0Y00#1942 cases and sentinels: default (old behaviour asserted), share, copy, host sharing refusal (EXISTING_HEAPS forced to 0) and a copy without a submit fence, plus four mutants that each remove one guarantee inside the DLL and must fail their case. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A title run with X2W_D3D12_LINEAR_BUFFERS=1 faulted at 1.76 s: the first eligible placement, a GPU-written buffer across XMem views, was refused with 0x80070057, and the title, for which CreatePlacedResourceX never fails on the console, used the null object. - Where neither sharing nor the copy keeps its guarantees (a GPU-written use that is not shared, no submit fence, no copy buffer), slot 133 now keeps the default backing and returns what it returns with the switch off. The refusal HRESULT is appended to the slot 133 log line, kept in x2w_d3d12_linear_buffer_info (path 3, refusal_hr) and counted in the totals (kept_default, last_refusal_hr). - A submission whose refresh cannot be staged now runs. The buffer keeps its last upload and is reported stale (info: stale, refresh_failures, last_refresh_hr; totals: refresh_failures, last_refresh_hr) until a later refresh succeeds; the first failures are logged. The fixture asserts the old behaviour and the reported refusal for every kept default (the log line read back through X2W_TRAP_LOG), adds a stale path (X2W_TEST_LINEAR_REFRESH_FAIL) and a refusal-silent mutant that drops the report and must fail. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of R0Y00#2218: - before_submit snapshots the copied buffers' work under mutex_, then takes, creates or waits for staging (a full pool waits up to 5 s for the oldest fence), fills it, resets and records a refresh list and runs ExecuteCommandLists without the lock, and publishes the result under it again. A release(), the fixture exports or another queue's submission no longer wait behind a fence wait or ExecuteCommandLists. Staging is still reused only after its fence, the refresh still runs at submit, and a buffer whose staging fails is still marked stale. - In render mode the refresh runs before queue_execute takes draw_lock and allocator_lock, so a staging wait does not stall list recording. - x2w_d3d12_linear_buffer_info returns false for a wrapper without a desktop object. The fixture adds a contention path (X2W_TEST_LINEAR_STAGING_LIMIT=1): while a refresh waits for the only staging buffer behind a gate, the info export, release() and a second queue's submission must finish, and a hold-lock mutant that keeps the lock across the wait must fail. The copy path also refreshes on COMPUTE and COPY queues, read by a dispatch and by CopyBufferRegion. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two submissions that snapshot the same copied buffer can publish `uploaded` in either order, so it may briefly lag the GPU copy. The next diff is then redundant or larger than needed, never one that misses a change. Comment only (tedin7's review nit on R0Y00#2218). Refs R0Y00#1914 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
legacy-code-archaeologist
left a comment
There was a problem hiding this comment.
I read the current head and found two correctness problems in src/startup_stubs/linear_buffer_backing.h. Both come from reading the code; I have not reproduced either one.
1. Two concurrent submissions can leave a copied buffer stale for good (refresh(), the Execute/Signal block and the publish below it)
Two submissions on different threads can snapshot the same changed span against the same uploaded. Each then copies the title bytes into its own staging buffer and runs ExecuteCommandLists and Signal outside mutex_. The internal queue runs the two copies in internal_mutex_ order, but uploaded is written later in mutex_ order, and the two orders are independent.
Sequence:
- Thread A copies the title bytes X into staging.
- The CPU writes Y.
- Thread B copies Y into staging.
- B takes
internal_mutex_first and gets value 1. A follows with value 2, so the backing ends up holding X. - A publishes
uploaded = X, then B publishesuploaded = Y. - The next submission compares the title (Y) with
uploaded(Y), finds no change and never refreshes. The GPU keeps reading X until the title changes those bytes again.
The comment above the publish says that the worst case is a redundant copy. That does not hold for this interleaving.
Possible fixes:
- Do the staging memcpy and the Execute/Signal in one critical section, per buffer or under
internal_mutex_. - Or publish
uploadedfor a buffer only from a refresh whose fence value is higher than the last one published for it.
2. Title memory is read after the lock is dropped, so a concurrent release can fault in the DLL (before_submit snapshot → refresh() memcpy)
before_submit collects every live copied buffer, not only the ones the submitted lists use, and calls probe_readable under mutex_. refresh() then copies w.source + w.offset without mutex_. If another thread releases one of those buffers (retire()) and unmaps or frees its pages in between, the memcpy raises an access violation inside d3d12_xs.dll. It only needs a release of an unrelated buffer on another thread while some queue submits.
Possible fixes:
- Recheck
liveand readability right before the memcpy, withretire()and the memcpy under the same lock. - Or guard the copy with SEH and mark that buffer stale.
AI-assisted (Claude Code).
|
Thanks, @legacy-code-archaeologist. Both points look right from the code. I'm folding them into the same rework as R0Y00's discarded-copy and ordering findings, since they touch the same refresh path:
Each will get a deterministic control where the fixture can force the interleaving, plus a mutant control. Thanks also, @tedin7, for the Win2025 build. New head and results to follow. AI-assisted. |
A list copy into a copied linear buffer changed the backing when the copy was recorded. A recording that was closed and then reset without being submitted therefore stopped the buffer's refreshes for good: the next read saw the old upload instead of the CPU's later bytes, on XMem and private memory alike (review repro on WARP and an RTX 4060). The write is now pending on the recording, next to the texture writes that list_copy.inl already tracks: commit_list_gpu_writes marks the buffer GPU-written after the recording's ExecuteCommandLists, and a Reset or a failed Close (discard_list_gpu_writes) drops it. The recording's own submission still refreshes the buffer first, and its queue waits for that refresh before the copy runs. The gpuw-at-record mutant restores the recording-time mark. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A refresh's copy into a copied linear buffer was ordered only before later consumers (their queues Wait for the internal fence). An earlier submission that still reads or writes the backing, on any queue, could run at the same time as the internal COPY queue overwrote it. Simultaneous access allows concurrent operations on one buffer only on disjoint ranges. Each queue wrapper now signals a user fence of its own after the title's lists (render and plain submissions). Before a refresh's copy executes, the internal queue Waits for every queue's latest user fence value that has not completed (totals: producer_waits). The wrappers cannot tell which buffers a submission reads, since titles bind them by GPU virtual address, so every earlier submission counts as a user of every copied backing. A queue whose latest submission sits behind a title Wait (queue slot 17) on a fence that has not been reached is not waited for (totals: producer_wait_skips, logged): a later submission that waits for this refresh may be the one that signals that fence, and waiting would deadlock both queues. That submission has not started and reads the CPU's newer bytes once it runs. A fence reached while the copy still executes can still overlap the read; the header says so. A submission now also waits for the refresh it enqueued itself, even if the title released the buffer meanwhile; before, such a refresh was left out of the consumer Wait. The contention case asserts the new order: S1, gated, reads B because C's copy waits for it; S2 reads C. The gate opens before the internal queue is drained. The skip-producer-wait mutant removes the wait. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two submissions on different threads could snapshot one copied buffer against the same upload record, stage the title's bytes at different times, execute their copies in one order and publish the upload record in the other. With X staged first, the CPU then writing Y and Y staged second, Y's copy could take the lower internal fence value and X's the higher, so the backing held X while the record said Y. No later submission refreshed the buffer until the title changed those bytes again. The comment that called this a redundant copy at worst was wrong. A copied buffer now remembers the internal fence value of its newest applied publish. A newer refresh applies its span; an older one that arrives after it drops the record (totals: reordered_publishes), and the next submission copies the whole buffer. An unknown record is set again only by a copy of the whole buffer. The publish-out-of-order mutant applies every publish in lock order, as before. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
before_submit snapshots every live copied buffer, not only those the submitted lists read, and probes its title memory under the lock. refresh() then copied that memory into staging without the lock. If the title released one of those buffers on another thread and freed or unmapped its pages in between, the copy faulted inside d3d12_xs.dll. The title memory is now probed again right before it is staged, and the copy runs under a fault guard (access violation or in-page error). A buffer whose memory is gone is skipped and counted (unreadable), as the snapshot already does; a read that faults anyway is counted (copy_faults) and fails that buffer's refresh. A buffer released after the snapshot whose pages are still mapped is staged for that submission, which may read it (the contention case does). The wrappers cannot tell which buffers a submission's lists read, so the snapshot still covers every live copied buffer. The copy-after-retire mutant skips the second probe; the guard then catches the faulting read. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ear_buffer_backing New cases on the copy path, on XMem and private memory: - gpuw.discard (the review repro): a list copy into a copied buffer is recorded, closed and reset without a submission; after the CPU writes B the next read must see B, with gpu_written 0. - war: a read of A on queue 1 behind a title gate; the CPU writes B and queue 2 submits a read. Queue 2 must not complete while the gate is closed, queue 1 must read A, queue 2 B, and producer_waits must grow. - xq.write: queue 1 waits through its wrapper (slot 17) on a title fence and submits a read; after the CPU writes B, queue 2's read must complete while queue 1 still waits (no deadlock), both read B, and the skip is counted. - order: two threads refresh one buffer, parked through a new fixture hook (x2w_d3d12_linear_buffer_test_pause) so that the older copy publishes last; the next submission must refresh and read D. - retire: a submission parks after its snapshot while the title releases X and frees its pages; X must be skipped as unreadable, with no copy fault and no failed refresh, and Y must read C. Four controls run on WARP with WILL_FAIL, each failing its own case: gpuw-at-record, skip-producer-wait, publish-out-of-order and copy-after-retire. The totals line prints the new counters. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd refresh races Describe the review fixes for slot 133's copied linear buffers. A list copy marks a buffer GPU-written only when its recording is submitted. A refresh's copy waits for every queue's earlier submission, except one that sits behind an unreached title Wait, which is skipped so that title fences cannot close a cycle. Uploads are published in the order their copies execute. Title memory is probed again and read under a fault guard right before it is staged. Add the gpuw.discard, war, xq.write, order and retire cases, the changed contention expectation (S1 reads B), the four new controls, and the results at 981b519 on WARP and an RX 9070 XT (driver 32.0.32029.2010) in the dev and release presets. Note the remaining overlap window and the cost of treating every submission as a user of every backing. Refs R0Y00#1914 Refs R0Y00#874 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@R0Y00, @legacy-code-archaeologist: all four points are addressed at
Decision needed: one exception to "wait on all prior users" (fix 2).
Is the exception acceptable, or would you prefer the conservative behaviour plus an explicit refusal for this pattern? I didn't add a mutant that removes the guard, because it would hang the GPU. Changes to existing behaviour:
Runs (Windows 11 build 26300; WARP 10.0.26100.9818; AMD Radeon RX 9070 XT, driver 32.0.32029.2010):
Not covered: the reverse publish order (correct by construction, with no separate case), and runs with the debug layer enabled. AI-assisted; commands listed were executed locally. |
|
Closing at the author's request (@MasterDomino asked us directly). The review findings from @R0Y00 and @legacy-code-archaeologist stay in this thread for the follow-up. AI-assisted; commands listed were executed locally. |
|
@tedin7, reopening: I didn't ask for this to be closed, so I think a request got crossed somewhere. If you saw a message that looked like it came from me, could you point me to it? Nothing has changed since the close. The head is still AI-assisted. |
|
For the Please detect the unsafe case before enqueueing any refresh or affected guest list, log/count a distinct refusal, and leave write/refresh bookkeeping consistent. Keep the wrapper’s ordinary fence Signal path usable so a refused list cannot strand the earlier queue. Test it with the earlier queue gated and a second CPU write, then release the gate and verify the earlier read of A, unchanged output for the refused read, queue progress after the explicit signal, and a later safe submission reading B. Keep the existing successful gated and ordinary write-after-read controls. A proven disjoint resource or an immutable per-submission backing could support more cases separately. |
|
@MasterDomino sorry about that, the close was our mistake: a request got crossed on our side and we acted on it without checking with you here first. Thanks for reopening. We will not touch the state of this PR again; the review is with @R0Y00 as you wrote. AI-assisted; commands listed were executed locally. |
|
Thanks, @R0Y00: understood, and thanks @tedin7, no harm done. For
New head and results to follow. AI-assisted. |
…letion order A refresh no longer skips a queue whose latest submission sits behind an unreached title Wait (slot 17). Skipping did not prove that the fence stays blocked until the copy finishes: another producer can reach it meanwhile and the copy then overlaps that read. Instead, right before the refresh would be enqueued (under internal_mutex_), a refresh that would have to wait for such a submission, or for one without a user fence value, refuses the whole submission: no refresh, consumer Wait, title lists or user fence Signal is enqueued. Staging buffers and the refresh list are freed, no upload record or refresh state changes, and recorded GPU writes stay pending on their recordings. The title's own Signal/Wait paths are untouched, so a later Signal still releases the earlier queue. Counted as unsafe_refresh_refusals (replacing producer_wait_skips) and logged. A title wait that cannot be stored now blocks the queue until the next submission behind it completes, instead of being forgotten at that submission. xq.write now gates queue 1 on a title fence with a read of A, writes B and expects queue 2's read to be refused (slot keeps P), queue 1 to read A after the title's Signal through queue 2's wrapper, and the refused recording to read B when resubmitted. New control accept-unsafe-refresh restores the skip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…letion order Replace the producer-wait skip in the runtime notes with the refusal: when it applies, what a refused submission leaves in place, its log line and the unsafe_refresh_refusals counter. In the experiment notes, rewrite the xq.write oracle, drop the skip results and the overlap caveat, and record the c6a0c8a runs and the accept-unsafe-refresh control. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@R0Y00 Thanks. Your
Runs (Windows 11 build 26300; WARP 10.0.26100.9818 and AMD Radeon RX 9070 XT, driver 32.0.32029.2010; debug layer off):
Not covered:
AI-assisted; commands listed were executed locally. |
Resolve d3d12_xs_device.cpp: main's retire_never mark for placed buffers moves into publish_placed_buffer, which this branch factored out of device_place_resource_x. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged current
@R0Y00, this is ready for your re-review of the AI-assisted; commands listed were executed locally. |
R0Y00
left a comment
There was a problem hiding this comment.
I rebuilt 7ecb6cfd in Windows Release. The unmodified ctest --preset release --no-tests=error -R '^linear_buffer_backing_' -V passed 29/29 with zero skips. The serial xq.write refusal and the discarded-copy/reset regression both work.
One reproducible blocker remains when slot 17 and ExecuteCommandLists overlap on the same guest queue. In the source-built xq.write fixture I added a local event pause immediately after the real queue enqueues Wait(F,1) and immediately before note_title_wait. While that caller is parked, another thread submits the unchanged read of A on queue 1. Let the Wait caller return, write B, submit the refresh on queue 2, and enqueue the guest Signal(F,1) on queue 2. note_title_wait records user.value + 1 after the unchanged submission already advanced user.value. The real Wait is ahead of that submission, but the bookkeeping puts it behind the submission. Queue 2 therefore accepts a refresh that waits on queue 1, and its own signal sits behind the refresh.
With only that scheduling hook and the fixture change, ctest --preset release --no-tests=error -R '^linear_buffer_backing_copy_(warp|hardware)$' -V failed on both WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656 (Windows 11 build 26200, debug layer off). Both XMem and private backing reported zero refusals and both lanes still pending after the queue signal. A CPU-side signal on the same fence let both complete, so the test is bounded.
Please make the native queue ordering and the producer/Wait records agree under concurrent calls. Add the bounded two-thread control alongside the serial case, with a cleanup signal on timeout. An accepted refresh must have a safe completion order; otherwise queue 2 must refuse before enqueuing affected work and still be able to signal F. Keep the test where a discarded GPU-write recording does not suppress subsequent CPU refresh.
|
Thanks, @R0Y00. That interleaving is real: the native The fix I'm making:
AI-assisted. |
A title Wait (queue slot 17) and ExecuteCommandLists on the same queue from two threads could be recorded in the opposite order to the desktop queue: a submission behind the desktop Wait took its user fence value before note_title_wait ran, so the Wait was recorded as preceding only later submissions. Another queue's refresh was then accepted and waited for the blocked submission, and that queue's own Signal of the fence sat behind the refresh. Each queue's linear-buffer record now has an order lock (SRWLOCK; users_ becomes a deque so records never move). Slot 17 holds it from the desktop Wait through note_title_wait; a submission holds it from the title's ExecuteCommandLists through after_submit, taken before draw_lock and allocator_lock in render mode and with no other lock held. It is not held across the refresh, nothing under it waits on the CPU for the GPU, and the title's Signal does not take it. The fixture adds xq.race: the Wait is parked through a new pause point (3) between the desktop Wait and its record while another thread submits the read of A on queue 1. Queue 2's read must still be refused and queue 2 must still signal the fence; waits are bounded with a CPU Signal of the fence as cleanup. Control unlocked-title-wait skips the lock in slot 17 and reproduces the review's pending lanes with zero refusals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@R0Y00 Thanks for the repro. You're right: the desktop queue could receive the The fix: a per-queue order lock in each queue's linear-buffer record.
Why the refusal decision can stay outside the lock: a refresh waits only for user values that have already been assigned. A New case
Every wait is bounded: if queue 2 or queue 1 doesn't complete within 3 s, the fixture signals F from the CPU, lets both queues drain and fails the row. Results (Windows 11 build 26300; WARP 10.0.26100.9818 and AMD Radeon RX 9070 XT, driver 32.0.32029.2010; debug layer off):
Not covered: RTX 4060, and runs with the debug layer. A run on your laptop would cover both. AI-assisted; commands listed were executed locally. |
R0Y00
left a comment
There was a problem hiding this comment.
The per-queue lock resolves my concurrent slot-17 review. I rebuilt ee56e734 and ran ctest --preset release --no-tests=error -R '^linear_buffer_backing_' -V: 30 passed, zero skips, on Windows 11 build 26200 with WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, debug layer off. In both XMem and private pools the queued read of A waited for the Wait record, the unsafe refresh was refused before either output changed, the guest signal let queue 1 finish, and the same recording later read B. The unlocked-Wait mutant reproduced the pending lanes, and the CPU cleanup signal drained them. The discarded-write and serial refusal controls also passed. This verifies the opt-in, source-built submission paths.
…one refusal (#2624) * feat: record the compute root signature and descriptor tables (slots 33 and 35) Header-only state in list_compute_root.h with a Linux-testable check. Dispatch (slot 14) is not handled here; the state is exposed through ready() and table() for it. Refs #870. * feat: record compute descriptor tables (slot 35) and clear them on a root or heap change * startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39) Compute root constants are kept per list next to the graphics ones, in a shared 16 x 8 word store that refuses parameter >= 16 and offset >= 8. A new compute root signature clears them. * feat: record command-list slot 14 Dispatch on the desktop list Part of #870. Forward Dispatch only with a desktop compute pipeline and root bound and group counts within 65535 per axis; refuse otherwise. * startup: refuse Dispatch under a compute root with unforwarded arguments, document slot 14 * startup: gate Dispatch on bound compute root SRVs and a pipeline built against the bound root Slot 43 clears a parameter's binding when a replacement is rejected, slot 33 clears all bindings, and the compute pipeline records its root so a mismatched pair is refused. * startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39) Compute root constants are kept per list next to the graphics ones, in a shared 16 x 8 word store that refuses parameter >= 16 and offset >= 8. A new compute root signature clears them. * feat: record command-list slot 14 Dispatch on the desktop list Part of #870. Forward Dispatch only with a desktop compute pipeline and root bound and group counts within 65535 per axis; refuse otherwise. * startup: refuse Dispatch under a compute root with unforwarded arguments, document slot 14 * startup: gate Dispatch on bound compute root SRVs and a pipeline built against the bound root Slot 43 clears a parameter's binding when a replacement is rejected, slot 33 clears all bindings, and the compute pipeline records its root so a mismatched pair is refused. * fix: pass pipeline root out-param in slot86 mesh cached pipeline build * fix: track which compute root constant words were set; drop slot 40 claim * Dispatch translated compute programs with raw table buffers A device slot 67 placeholder keeps the key of its published request. At list slot 14 the stand-in loads the stage cs manifest and compiled program for that key and records the dispatch: raw buffer inputs and outputs from hardware descriptors in the recorded compute tables, entry values from the recorded compute root constants. Other manifest lines leave the pipeline untranslated; a dispatch that cannot be bound completely is refused with one logged reason and records nothing. startup_compute_dispatch_{warp,hardware} drives a source-built program through the stand-in list and reads the output back, with controls before translation, without a Dispatch and for a refused output. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Log untranslated compute dispatches on their own line budget Dispatches that arrive before the offline translation no longer use up the lines kept for refusals at bind time. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Count compute dispatches per key with their first refusal The per-call refusal lines share one small budget, so a run cannot rank keys by dispatch count. Each key now keeps its Dispatch count, the calls recorded and the reason and table descriptor of its first refusal; the periodic totals are followed by the refused dispatches per reason and the 40 keys with the most dispatches. A manifest that exists but cannot be bound is counted apart from an absent one ("not modelled"). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Dispatch translated compute programs that store to 2D textures A `uav <i> tex2d float table <param> <byte> channels 4` manifest line is bound from the token of the unordered access view the title created in its descriptor memory. Everything else is refused with its own reason: an entry that is no such token, a view the desktop did not create, a view that is not 2D, a format a float4 store cannot target, and a texture bound to two slots of one dispatch. Programs without entry values, inputs or outputs load too: the translated root no longer emits an empty range or drops the table when only outputs exist. The fixture stores through the stand-in's own list into a 32x8 RGBA16_FLOAT texture and reads it back with CopyTextureRegion. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Dispatch translated compute programs that read 2D textures A `srv <i> tex2d table <param> <byte>` manifest line is bound from the token of the shader resource view the title created, through the texture the draw path samples for that resource, uploaded first when the title filled it in memory. `smp` lines become static samplers of the translated root. A dispatch is refused, never bound to a null view, when the entry is no such token, the resource has no desktop texture, the view is not 2D or names a packed format, or the upload fails. Sampler heaps, comparison samplers and other texture kinds keep the translation unavailable. The fixture samples a 1x1 texture into the stored words of the raw buffer case; without a view the dispatch is refused and the output is untouched. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Check a compute manifest without entry values at Dispatch Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Document texture views and the census of translated compute Dispatch Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Check the device on every 64th translated Dispatch and drop a liveness test The device check drains the debug layer; a draw runs it on every 64th call and the queue's execute drains the rest. A view token whose resource the caller released is the caller's misuse, as on the draw path. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Compute dispatch: allow two outputs of one texture, refuse packed outputs, print every census key A texture is refused only when the same call reads and writes it; two outputs of one texture share the unordered access state. A packed output view format gets its own refusal reason. The census prints every dispatched key instead of the first 40, and the wording on refused calls says what may already be recorded (an input texture upload). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * startup: compute input named by a resource heap record a root constant indexes gfx2hlsl.py lowers one form of a register-offset load through the directly indexed resource heap pointer of a compute root signature: s_lshl_b32 R, <root constant word>, 5 s_load_dwordx4 D, s[H:H+1], R ; s[H+1] a constant zero, no offset: with no write of R and no branch target in between. D is a buffer descriptor and the manifest names it `srv <i> buf heap rootconst <parameter> <word>`. Every other form keeps a refusal that names it, including an index read from a buffer. The stand-in records the title memory of the list's view heap on every slot 32 call (it kept only the sampler heap and, for oversized heaps, the wrapper) and a Dispatch reads the 16-byte descriptor at byte `word << 5` of that memory, then binds it through the path a table record takes. A record outside the heap refuses the dispatch and binds nothing. Checks: tests/startup_gfx2hlsl_heap_record_check.py (manifest and HLSL exact, 19 refused controls, one translator mutation, LLVM 15 reassembly) and tests/startup_compute_dispatch_heap_check.py on WARP and a physical adapter. Refs #2274 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * startup: drop a heap record control whose branch target was inside an instruction The second positive case of startup_gfx2hlsl_heap_record_check.py branched to the second dword of the two-dword heap load. The case with a branch target before the shift already covers the form outside the entry block. The experiments entry now says that WARP's descriptor increment is not 32 bytes. Refs #2274 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * startup: read the stage kind as the other handlers do in the heap load A check added on main calls op_s_load_dwordx8 on a stage built without a kind; the heap record branch read self.kind directly. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * startup: avoid calling the compute driver after process termination begins The slot 67 cache owns desktop COM objects until module teardown. During process termination, the driver can already be shut down when static destructors run. Keep normal reference release on explicit unload and skip driver calls only during process termination. AI-assisted with Codex (GPT-6.2 Astra, xhigh). * Repair a broken line in the dispatch check Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Pin four existing texture dispatch refusals: integer view format, manifest version, stage, output also an input Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * startup: bind a compute heap record whose index is a table buffer word at a dispatch-constant offset A compute program that reads its heap record index with s_buffer_load from an unmodified table buffer, at a literal byte offset or at a root constant word times a literal plus a literal (dword-aligned), then shifts it left by 5 for the heap s_load, is translated: the manifest names the word as `srv <i> buf heap word table <param> <byte> at <offset> [rootconst <param> <word> times <scale>]`. At Dispatch the runtime reads that word from the recording's upload memory, where no GPU command writes, and binds the record it indexes. A word outside the buffer or outside upload memory refuses the dispatch with one reason. Every other index source keeps the buffer refusal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: a compute heap record whose index is read from a table buffer Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: state the measured first refusals and the heap-record ceiling exactly Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Drop the repeated compute root reset left by merging two slot 14 snapshots list_compute_root cleared compute_srv_bound and recomputed compute_root_has_arguments twice; the second copy came from the second #1974 snapshot merge and changed nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * startup: keep the descriptor load tag when checking the index word's table buffer Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * startup: read the pipe's modified set tolerantly in the heap index word check Three existing checks build a stage on a bare pipe object without it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * startup: name the condition a compute buffer input failed instead of one refusal indirect_table_buffer takes an optional out-parameter and names, for every empty result, the condition that failed: zero records, a range over 16 MiB, one crossing a placed buffer or upload allocation, an address outside any placed buffer, a placed buffer that does not alias title memory, a view token that is not a buffer view, and the resource checks. The translated compute Dispatch uses it as its refusal reason in place of "an input is not a complete GPU-backed buffer range", and logs once per key which input failed and where its descriptor was read. The draw callers do not ask for the reason; nothing bound or refused changes. startup_compute_dispatch_input_check.py refuses five replaced input descriptors, each with its own reason and an untouched output, after the unchanged recording matches all 320 words. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: describe the zero-record descriptor by its shape and qualify the #2218 overlap Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: tedin7 <tedin7@users.noreply.github.com> Co-authored-by: tedin7 <tommasoderosa94@gmail.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com> Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com> Co-authored-by: c1 <c1@x.invalid> Co-authored-by: R0Y00 <R0Y00@users.noreply.github.com>
…esource (#2625) * feat: record the compute root signature and descriptor tables (slots 33 and 35) Header-only state in list_compute_root.h with a Linux-testable check. Dispatch (slot 14) is not handled here; the state is exposed through ready() and table() for it. Refs #870. * feat: record compute descriptor tables (slot 35) and clear them on a root or heap change * startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39) Compute root constants are kept per list next to the graphics ones, in a shared 16 x 8 word store that refuses parameter >= 16 and offset >= 8. A new compute root signature clears them. * feat: record command-list slot 14 Dispatch on the desktop list Part of #870. Forward Dispatch only with a desktop compute pipeline and root bound and group counts within 65535 per axis; refuse otherwise. * startup: refuse Dispatch under a compute root with unforwarded arguments, document slot 14 * startup: gate Dispatch on bound compute root SRVs and a pipeline built against the bound root Slot 43 clears a parameter's binding when a replacement is rejected, slot 33 clears all bindings, and the compute pipeline records its root so a mismatched pair is refused. * startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39) Compute root constants are kept per list next to the graphics ones, in a shared 16 x 8 word store that refuses parameter >= 16 and offset >= 8. A new compute root signature clears them. * feat: record command-list slot 14 Dispatch on the desktop list Part of #870. Forward Dispatch only with a desktop compute pipeline and root bound and group counts within 65535 per axis; refuse otherwise. * startup: refuse Dispatch under a compute root with unforwarded arguments, document slot 14 * startup: gate Dispatch on bound compute root SRVs and a pipeline built against the bound root Slot 43 clears a parameter's binding when a replacement is rejected, slot 33 clears all bindings, and the compute pipeline records its root so a mismatched pair is refused. * fix: pass pipeline root out-param in slot86 mesh cached pipeline build * fix: track which compute root constant words were set; drop slot 40 claim * Dispatch translated compute programs with raw table buffers A device slot 67 placeholder keeps the key of its published request. At list slot 14 the stand-in loads the stage cs manifest and compiled program for that key and records the dispatch: raw buffer inputs and outputs from hardware descriptors in the recorded compute tables, entry values from the recorded compute root constants. Other manifest lines leave the pipeline untranslated; a dispatch that cannot be bound completely is refused with one logged reason and records nothing. startup_compute_dispatch_{warp,hardware} drives a source-built program through the stand-in list and reads the output back, with controls before translation, without a Dispatch and for a refused output. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Log untranslated compute dispatches on their own line budget Dispatches that arrive before the offline translation no longer use up the lines kept for refusals at bind time. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Count compute dispatches per key with their first refusal The per-call refusal lines share one small budget, so a run cannot rank keys by dispatch count. Each key now keeps its Dispatch count, the calls recorded and the reason and table descriptor of its first refusal; the periodic totals are followed by the refused dispatches per reason and the 40 keys with the most dispatches. A manifest that exists but cannot be bound is counted apart from an absent one ("not modelled"). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Dispatch translated compute programs that store to 2D textures A `uav <i> tex2d float table <param> <byte> channels 4` manifest line is bound from the token of the unordered access view the title created in its descriptor memory. Everything else is refused with its own reason: an entry that is no such token, a view the desktop did not create, a view that is not 2D, a format a float4 store cannot target, and a texture bound to two slots of one dispatch. Programs without entry values, inputs or outputs load too: the translated root no longer emits an empty range or drops the table when only outputs exist. The fixture stores through the stand-in's own list into a 32x8 RGBA16_FLOAT texture and reads it back with CopyTextureRegion. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Dispatch translated compute programs that read 2D textures A `srv <i> tex2d table <param> <byte>` manifest line is bound from the token of the shader resource view the title created, through the texture the draw path samples for that resource, uploaded first when the title filled it in memory. `smp` lines become static samplers of the translated root. A dispatch is refused, never bound to a null view, when the entry is no such token, the resource has no desktop texture, the view is not 2D or names a packed format, or the upload fails. Sampler heaps, comparison samplers and other texture kinds keep the translation unavailable. The fixture samples a 1x1 texture into the stored words of the raw buffer case; without a view the dispatch is refused and the output is untouched. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Check a compute manifest without entry values at Dispatch Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Document texture views and the census of translated compute Dispatch Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Check the device on every 64th translated Dispatch and drop a liveness test The device check drains the debug layer; a draw runs it on every 64th call and the queue's execute drains the rest. A view token whose resource the caller released is the caller's misuse, as on the draw path. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Compute dispatch: allow two outputs of one texture, refuse packed outputs, print every census key A texture is refused only when the same call reads and writes it; two outputs of one texture share the unordered access state. A packed output view format gets its own refusal reason. The census prints every dispatched key instead of the first 40, and the wording on refused calls says what may already be recorded (an input texture upload). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * startup: compute input named by a resource heap record a root constant indexes gfx2hlsl.py lowers one form of a register-offset load through the directly indexed resource heap pointer of a compute root signature: s_lshl_b32 R, <root constant word>, 5 s_load_dwordx4 D, s[H:H+1], R ; s[H+1] a constant zero, no offset: with no write of R and no branch target in between. D is a buffer descriptor and the manifest names it `srv <i> buf heap rootconst <parameter> <word>`. Every other form keeps a refusal that names it, including an index read from a buffer. The stand-in records the title memory of the list's view heap on every slot 32 call (it kept only the sampler heap and, for oversized heaps, the wrapper) and a Dispatch reads the 16-byte descriptor at byte `word << 5` of that memory, then binds it through the path a table record takes. A record outside the heap refuses the dispatch and binds nothing. Checks: tests/startup_gfx2hlsl_heap_record_check.py (manifest and HLSL exact, 19 refused controls, one translator mutation, LLVM 15 reassembly) and tests/startup_compute_dispatch_heap_check.py on WARP and a physical adapter. Refs #2274 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * startup: drop a heap record control whose branch target was inside an instruction The second positive case of startup_gfx2hlsl_heap_record_check.py branched to the second dword of the two-dword heap load. The case with a branch target before the shift already covers the form outside the entry block. The experiments entry now says that WARP's descriptor increment is not 32 bytes. Refs #2274 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * startup: read the stage kind as the other handlers do in the heap load A check added on main calls op_s_load_dwordx8 on a stage built without a kind; the heap record branch read self.kind directly. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * startup: avoid calling the compute driver after process termination begins The slot 67 cache owns desktop COM objects until module teardown. During process termination, the driver can already be shut down when static destructors run. Keep normal reference release on explicit unload and skip driver calls only during process termination. AI-assisted with Codex (GPT-6.2 Astra, xhigh). * Repair a broken line in the dispatch check Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Pin four existing texture dispatch refusals: integer view format, manifest version, stage, output also an input Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * startup: bind a compute heap record whose index is a table buffer word at a dispatch-constant offset A compute program that reads its heap record index with s_buffer_load from an unmodified table buffer, at a literal byte offset or at a root constant word times a literal plus a literal (dword-aligned), then shifts it left by 5 for the heap s_load, is translated: the manifest names the word as `srv <i> buf heap word table <param> <byte> at <offset> [rootconst <param> <word> times <scale>]`. At Dispatch the runtime reads that word from the recording's upload memory, where no GPU command writes, and binds the record it indexes. A word outside the buffer or outside upload memory refuses the dispatch with one reason. Every other index source keeps the buffer refusal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: a compute heap record whose index is read from a table buffer Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: state the measured first refusals and the heap-record ceiling exactly Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Drop the repeated compute root reset left by merging two slot 14 snapshots list_compute_root cleared compute_srv_bound and recomputed compute_root_has_arguments twice; the second copy came from the second #1974 snapshot merge and changed nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * startup: keep the descriptor load tag when checking the index word's table buffer Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * startup: read the pipe's modified set tolerantly in the heap index word check Three existing checks build a stage on a bare pipe object without it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * startup: name the condition a compute buffer input failed instead of one refusal indirect_table_buffer takes an optional out-parameter and names, for every empty result, the condition that failed: zero records, a range over 16 MiB, one crossing a placed buffer or upload allocation, an address outside any placed buffer, a placed buffer that does not alias title memory, a view token that is not a buffer view, and the resource checks. The translated compute Dispatch uses it as its refusal reason in place of "an input is not a complete GPU-backed buffer range", and logs once per key which input failed and where its descriptor was read. The draw callers do not ask for the reason; nothing bound or refused changes. startup_compute_dispatch_input_check.py refuses five replaced input descriptors, each with its own reason and an untouched output, after the unchanged recording matches all 320 words. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: describe the zero-record descriptor by its shape and qualify the #2218 overlap Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * startup: bind a compute input behind a memory view token in its own resource A buffer view token whose resource is on a custom heap outside the placement index (the memory view path places it in the title's own heap) was refused because the placement lookup of its range finds no owner. Its desktop resource is that memory, so the view offset is bound there. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> --------- Co-authored-by: tedin7 <tedin7@users.noreply.github.com> Co-authored-by: tedin7 <tommasoderosa94@gmail.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com> Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com> Co-authored-by: c1 <c1@x.invalid>
What and why
This is the first production slice of the #1914 decision, as R0Y00 asked after #1942 merged. It wires #1942's comparison to one ordinary linear buffer that the CPU writes and the GPU reads, and it keeps the current backing as the default.
The buffer kind is device slot 133 (
CreatePlacedResourceX) with a buffer description, row-major or unknown layout, and initial stateCOMMON. This is the narrowest production kind that is linear, CPU-written and GPU-read:S_OKwith a zero-filled buffer that does not alias the title memory.Buffers in
UNORDERED_ACCESSor acceleration-structure state, textures and command-list slot 148 keep their current paths.X2W_D3D12_LINEAR_BUFFERS=1(or=copy) opts in. Unset or0, none of the new code runs.Rebase onto main (
ff06794b) and follow-upsThe branch is rebased onto
ff06794bas a series. Main had changed slot 133,release()andqueue_executesubstantially.Integration with main:
release(): main's budgetend_usecalls,drop_mesh_lease_ownerand the list-kinddiscard_mesh_lease_recordingare kept. The linearretireruns afterretire_placement, under the opt-in.queue_execute: main'ssubmitlambda (red_producers().execute,retire_address_uploads,retire_draw_sampler_heaps,note_submits,commit_list_gpu_writes) and the mesh XMem split path are unchanged. The internal-queue refresh and the consumerWaitrun once per guest call before the wrapper's locks, so they precede every list of the submission in both the render and non-render paths. That covers the producer fencesred_producersadds and each split mesh submission, and leavesred_producerssemantics as they are.publish_placed_buffercarries main's tail: theindex_resourcecallback inpublish_placement,x2w_budget::resource(..., placed)plus the heap'sbacking_budgetwithbegin_usewhen aliased, andx2w_budget::committed(..., DEFAULT)otherwise. Main's default path uses it unchanged.docs/experiments.md: main's "A lease for committed XMem section pages" and "GPU queue handoff to an XMem-backed root SRV" sections come first, then this one.New commits on top:
gpu: count linear-buffer backings in the D3D12 budget).budget(share, copy): one placement goes live in its category (placed with its heap live, or buffer), and the title's release moves it to retained, with nothing unmeasured.gpu: defer slot 133 linear buffers to the XMem lease path).X2W_MESH86_XMEM_SRVorX2W_MESH_INDIRECT_XMEM) takes the default copied placements of XMem pages whose console flags are 0.note_mesh_xmem_writerequiresPlacement::copied_bufferandconsole.Flags == NONE, then mirrors GPU writes into a leased view and publishes it to mesh readers.HRESULT_FROM_WIN32(ERROR_BUSY)(0x800700aa, "deferred to the lease path") in the log line, the info and the totals. Other placements, and everything while the lease path is off, are unchanged.lease: the XMem buffer keeps the default backing (reads zero, as before) with the deferral reported, and a private one is still copied.gpu: stop refreshing a copied linear buffer that a list copy writes).CopyBufferRegionandCopyResourceinto slot 133 placed buffers (list_copy.inl), so a copied linear buffer can be GPU-written. Those bytes never reach title memory, and a refresh whose changed span covered them would have copied older title bytes over them.gpu_writtenin the info and totals.gpuw(copy path): a listCopyBufferRegionwrites G, the title changes the words on both sides, and the read still sees G.refresh-gpu-writtenkeeps refreshing; it reads A instead, and fails 2 of 2.Follow-up, not in this PR: with #2280's section lease (pinned slots mapped as one view, opened as a D3D12 heap and released after GPU completion), XMem views could be shared through a lease instead of copied. This PR keeps copying them; view sharing stays refused (
0x80070032) because an open heap pins the title's own view.Review changes (R0Y00)
The repro. One copied buffer held A, and its first read was complete. Two read-only direct lists were recorded for it, and the CPU wrote B once before submitting either. List 1 went to queue 1 behind an unsignalled gate. List 2 went to queue 2, completed before the gate opened, and read A in 1,024 of 1,024 words; list 1 later read B. No refresh failure was reported.
The cause. Queue 1's submission enqueued the refresh on queue 1 behind the gate, but
uploadedwas updated at enqueue. Queue 2's diff therefore saw no change and skipped its refresh.Fix (
src/startup_stubs/linear_buffer_backing.h):ExecuteCommandListsandSignalon that queue are serialized by a small mutex of their own, so values stay in order. The backing's main lock is still never held across a wait orExecuteCommandLists.Wait(internal_fence, V). V is the highest value among the live copied buffers that has not completed; buffers the title released are not waited for. Recordinguploadedat enqueue is now correct, because every later consumer waits for the copy to land.after_submit, the per-title-queue fences andlinear_submittedare gone.docs/startup-runtime.md.X2W_TEST_SUBMIT_FENCE_FAIL=1still givesE_NOT_VALID_STATE. Nothing returns stale data silently.x2w_d3d12_linear_buffer_internal_queuereturns the internal queue, so a fixture can hold refreshes in flight behind a fence of its own. Cases c, contention andgate2q.helduse it. Without it, staging is free almost at once, and the in-flight cases would test nothing.Tests.
gate2q(R0Y00's case; copy path, private and XMem): queue 2 completes while queue 1's gate is still closed and reads B; queue 1 then reads B.gate2q.held: the internal queue is also held. Queue 2 must not complete in 200 ms before the refresh lands, then reads B. Queue 1 reads B.xq: queue 1 waits on a title fence that queue 2 signals after its list. Both complete, with no deadlock, and both read B.skip-consumer-wait: submissions no longer wait.gate2q.heldthen has queue 2 read A before the held refresh lands (2 of 2), and case c reads zeros.contentionnow holds the internal queue rather than a title fence. The probes still take 0 ms while the refresh waits about 310 ms. S1 and S2, both behind the title gate, now both read C, the CPU's last write before they ran. Under the old per-queue design S1 read B.reuse-earlystill fails it.q.compandq.copystill pass: the consumers on COMPUTE and COPY queues wait for the internal fence.Review changes (tedin7)
b0669e06. Inqueue_execute, runtime: allocate command-list upload memory on the recording allocator #2216'sretire_address_uploads(queue, ready)andlinear_submitted(queue, linear)are both kept, in that order. Main's "Command-list upload allocation (slot 148)" section precedes this one indocs/startup-runtime.md.before_submitno longer holdsmutex_across a fence wait orExecuteCommandLists.acquire_staging), creates staging (create_staging), waits up to 5 s for the oldest staging fence when the pool is full, copies into staging, takes and resets a refresh list (acquire_list), records it and runsExecuteCommandLists.shared_ptr, so a snapshot outlives a concurrentdiscard.after_submitstill signals the queue fence under the lock. That keeps fence values monotonic across threads;Signaldoes not wait.queue_executenow refreshes before it takesdraw_lockandallocator_lock, so a staging wait no longer stalls list recording either.linear_submittedruns after the ready check, so an executed refresh always gets its fence value.contentionpath (X2W_TEST_LINEAR_STAGING_LIMIT=1): S1 holds the only staging buffer behind a gate, and S2's refresh waits for it on another thread. While S2 waits, three probes must finish: the info export,release()of the buffer, and a submission on a second direct queue. Each took 0 ms, and S2 was still waiting after all three. After the gate opens, S2 takes the same staging buffer (none created) and reads its own bytes.hold-lockkeeps the lock across the wait, as before. The info probe then blocks for 4.7 s until the wait times out, S2 goes stale and reads the old bytes, and the case fails 2 of 2.q.compandq.copyon the copy path. The buffer is read by a dispatch on a COMPUTE queue and byCopyBufferRegionon a COPY queue, each through its queue wrapper. The refresh runs on that queue: the buffer is promoted fromCOMMONtoCOPY_DESTthere and decays after. The first submission reads B with 131,072 bytes copied, and a 16-word change then copies 64 bytes. This holds on both adapters with the debug layer on and off, with no debug-layer errors. Both queue types are supported, so neither is refused.x2w_d3d12_linear_buffer_inforeturns false for a wrapper whoseown().realis null. The totals export takes no wrapper.after_submit,linear_submittedand per-queue refresh lists are gone. The snapshot, unlocked work and publish structure is unchanged.Design (
src/startup_stubs/linear_buffer_backing.h)XMem keeps the title memory (identity, mapping, offsets, lifetime). The new file owns the desktop backing and the fences that say when the GPU is done with it.
Share only after
D3D12_FEATURE_EXISTING_HEAPSreports support. The query runs once per device, before any open. The buffer must lie inside one committed private allocation at a 64 KiB-aligned offset, and the heap must cover it. The heap is cached by allocation base: while it is open, the range cannot be released or decommitted (error 87, gpu: compare one linear buffer through sharing, copying and refused sharing #1942), so no other allocation can appear at that base. Each opened heap gets a generation.No sharing of XMem views. This was measured here: a heap opened from an XMem view makes XMem's unmap of those pages fail with error 87, and it succeeds after release. Desktop resources live for the process, so sharing a view would keep the title from ever unmapping or freeing its pages. Sharing reports
HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED)(0x80070032) and the buffer is copied. A buffer across several allocations, or at an unaligned offset, reportsE_INVALIDARG. Both are decided before any D3D12 call.Copy into a committed default buffer, refreshed from title memory at each submission through a queue wrapper's
ExecuteCommandLists(render and non-render paths), just before the title's lists run, never at bind or record.Keep the default backing and record the refusal where neither path keeps its guarantees. Slot 133 then returns what it returns with the switch off; the console never fails
CreatePlacedResourceX(see Title run). The refusals:ALLOW_UNORDERED_ACCESS) that cannot be shared has no copy-back point: the sharing HRESULT, orDXGI_ERROR_UNSUPPORTEDwhen sharing was not attempted;E_NOT_VALID_STATEunderX2W_TEST_SUBMIT_FENCE_FAIL=1, else the creation HRESULT;Each refusal is recorded three ways:
(kept default backing: linear refusal 0x..., use=... type=... existing-heaps=... share=...)appended;x2w_d3d12_linear_buffer_info, as path 3 withrefusal_hr;kept_defaultandlast_refusal_hr.Never hold a submission back, and never hold the lock across a wait. Work is snapshotted under the backing's lock, staged, recorded and executed without it, and published under it again (see Review changes). Consumers on direct, compute and copy queues all wait for the internal fence.
Refresh failures. If a copied buffer's refresh cannot be staged, the submission still runs. This happens when staging or a refresh list cannot be created, or when the pool stays full of buffers in flight past a 5 s wait (
DXGI_ERROR_WAS_STILL_DRAWING). The buffer keeps its last upload and is marked stale until a later refresh succeeds. The first failures are logged with their HRESULT, and every one is counted:stale,refresh_failuresandlast_refresh_hrin the info, andrefresh_failuresandlast_refresh_hrin the totals.d3d12_xs_device.cppchanges in four places:publish_placed_buffer. With the switch off, the default log line gets an empty suffix.releaseretires a copied buffer.queue_executerefreshes and inserts the consumer wait before the title's lists. In render mode this happens before the wrapper's locks.x2w_d3d12_linear_buffer_info,x2w_d3d12_linear_buffer_totals(layouts inlinear_buffer_report.h) andx2w_d3d12_linear_buffer_internal_queue.Fixture-only switches:
X2W_TEST_EXISTING_HEAPS_UNSUPPORTED=1X2W_TEST_LINEAR_REFRESH_FAIL=<n>(staging requests 2, 2 + n, ... fail withE_OUTOFMEMORY)X2W_TEST_LINEAR_STAGING_LIMIT=<n>(staging pool of n buffers instead of 256)X2W_TEST_LINEAR_BUFFER_MUTANT=<name>Title run
Measured on an RX 9070 XT (driver 32.0.31044.16, Windows 11 build 26300, Release) with a warm shader cache,
-Render -Translate -FakeUser -GpuMirror -StartupBelow40 -MemoryGiB 32and the same post-confirmation input in every run. Counts only; no title is named here.Earlier revision (
32ddb0bc), which returned the refusal from slot 133:X2W_D3D12_LINEAR_BUFFERS=1: the title faulted at 1.76 s, reading address0x18. Its first eligible slot 133 placement waswidth=0xae00000 flags=0x20004 type=0x40000 (MEM_MAPPED) use=gpu-written share=0x80070057, and slot 133 returned0x80070057. On the consoleCreatePlacedResourceXdoes not fail, so the title used the null object.That is why every refusal now keeps the default backing and is only recorded.
This revision (
14769462), matched pair on one build:X2W_D3D12_LINEAR_BUFFERS=10x80070057split or unaligned GPU-written, 440x80070032XMem view)The opt-in no longer changes how far the run gets, and the frame rate stays within 1% of the switch-off arm. The peak-commit difference is not attributed: a switch-off cold-cache run on the same input earlier today peaked at 16,289 MiB, so peak commit varies with how much a run loads. The opt-in arm had 2 missing pipelines and 3 undrawn draws where the switch-off arm had none; I have not investigated that difference.
Title run on this head (
9b8c36fe, rebased ontoff06794b)Correction: in this pair, neither arm got past the legal and acceptance page. Both ended at 420 s on that page with its boxes unticked. The scripted presses (the last at about 272 s) ran identically in both arms but no longer reach confirmation on current
main; the page most likely appears later than before. So this pair covers the startup phase up to that page, not the post-confirmation load. A rerun with input that reaches confirmation will follow.This is a matched pair on one build with the same input: RX 9070 XT (driver 32.0.32029.2010), Windows 11 build 26300, warm cache,
-Render -Translate -FakeUser -GpuMirror -StartupBelow40 -MemoryGiB 32, and a 420 s limit. The opt-in arm ran first. System shared commit was read withNtQuerySystemInformationbefore each arm and 10 s after it exited.X2W_D3D12_LINEAR_BUFFERS=10x80070057, 440x80070032)Test
tests/linear_buffer_backing_check.cppdrives the production entry points, not a model:ExecuteCommandLists(queue slot 10) on the queue wrapper, in render mode.It reuses #1942's sentinels and cases. The GPU reads through a root SRV and writes through a root UAV. Title memory is either
xmem.dllphysical pages (X2W_XMEM_SHARED_VIEWS=1, five pages per view, buffer at+0x30000, first buffer on freed slots that must read zero) or one committed private range.A kept default must meet three conditions:
S_OKwith an object;X2W_TRAP_LOG, written next to the executable aslinear_buffer_backing_<path>_<adapter>.log.The cases:
Waiton a gate.release()and another queue's submission finish while a refresh waits for the only staging buffer, whose copy is held on the internal queue.Results
Environment:
ff06794b(head9b8c36fe), Windows 11 build 26300.9974.1414:008c, driver 10.0.26100.9818) and AMD Radeon RX 9070 XT (1002:7550, driver 32.0.32029.2010; the driver changed since the earlier runs). Both reportD3D12_FEATURE_EXISTING_HEAPS.X2W_TEST_DEBUG_LAYER=1). No errors were stored.The results were identical in all four configurations, including every totals line. All eight paths pass, with no skips.
Bytes are those copied from title memory into the backing. HRESULTs are the slot 133 result, then the sharing result and the recorded refusal.
S_OK/ not attempted / noneS_OK/ not attempted / noneS_OK/S_OK/ noneS_OK/0x80070032, split0x80070057/ b, d20x80070032S_OK/ not attempted / b, d20x887A0004S_OK/0x887A0004from the feature gate / b, d20x887A0004S_OK/ not attempted / a0x8007139F(E_NOT_VALID_STATE), b and d20x887A0004S_OK/ not attempted / noneS_OK/ not attempted / none.held: queue 2 waits for the held refresh; xq: both complete and read BS_OK/ not attempted / noneS_OK/ not attempted / nonegpu_written1S_OK/S_OK/ noneS_OK/ not attempted /0x800700AAS_OK/ not attempted / noneS_OK/ not attempted / none0x8007000Ein info and log; next submission reads B, stale cleared; 2 refresh failures in totalsTotals per run:
Measured, not asserted (share path, XMem): on both adapters
OpenExistingHeapFromAddresson the five-page view and a placed buffer at+0x30000returnS_OK. While they live, XMem's unmap fails with error 87. After their release it succeeds and the pages are freed. This is why views are copied.Negative controls
Each control sets
X2W_TEST_LINEAR_BUFFER_MUTANT, which removes one guarantee insided3d12_xs.dll. Each must fail its case in both pools, and in all four configurations each does:skip-refresh(copy)reuse-early(copy)copy-gpu-writes(copy)ignore-feature(refusal)EXISTING_HEAPS = 0; gate 1 of 1 failedrefusal-silent(copy)hold-lock(contention)skip-consumer-wait(copy)gate2q.held: queue 2 completes before the held refresh lands and reads A; 2 of 2 failed (case c also reads zeros)refresh-gpu-written(copy)gpuw: the refresh of the title's two changed words spans the written region and copies A over G; 2 of 2 failedInside the run there are also these oracle controls:
Commands
ff06794b):ctest --preset release --no-tests=error -R '^(linear_buffer_backing|startup_upload_arena|startup_upload_lifetime|startup_list_resubmit|startup_address_console_|xmem_section_lease_|unified_buffer_paths_)' -j 4passed 53/53, covering WARP and hardware. That is 24linear_buffer_backing(8 paths on 2 adapters, plus 8 controls), 5unified_buffer_paths, 6xmem_section_lease, 8startup_list_resubmit, 6startup_address_console, 2startup_upload_arenaand 2startup_upload_lifetime.X2W_TEST_DEBUG_LAYER=1,-R '^linear_buffer_backing'passed 24/24.linear_buffer_backing_checkwas also run directly: all 8 paths and all 8 mutants, on both adapters, debug layer off and on. Every path passes, every mutant fails all its targeted rows, and the path totals are identical across the four configurations.out/diag/perfinfo.py), before the release build and after all of these runs:SharedCommittedPages: 926,231 → 922,226 pages, −4,005 pages (about −15.6 MiB). No shared-commit growth.CommittedPages: +79,010 pages (about 309 MiB) over the same window, which includes the release build and other activity on the machine.52d779d9), environmental failure: one earlier debug-layerctestattempt failedunified_buffer_paths_{warp,hardware}with setup errors. The cause was the system commit limit, with 51 MB free of 184 GB while a title run was active. The section pool's 256 MiB pagefile section could not be created, andgititself failed with0xC000012D. The same binaries then failed identically without the debug layer. Once commit was free again, the same command passed 25/25.14769462); not rerun for this one:ctest --preset dev --no-tests=error -R '^(vm_|era_|xmem|unified_buffer_paths|startup_|linear_buffer_backing)' -j 6selected 513 tests:linear_buffer_backing_*and 5unified_buffer_paths_*tests.startup_view_heap_{warp,hardware}andstartup_logical_view_{warp,hardware}.startup_run_ps1. It compares the translator's--watchpath against the 8.3 short form of%TEMP%and gets the long form, because the profile path on this host contains a space. It also fails on unmodified main on this host, so it is pre-existing.startup_gamesave_*C3066 build failure seen on an earlier base is fixed on main by tests: call the saved QueryApiImpl through load_real_query() #2204. It no longer occurs here.Skips
None on WARP or the RX 9070 XT.
linear_buffer_backing_share_hardwarereturns 77 on an adapter without existing-heap support, andrefusalcovers that case there. On a Gen9 adapter thesharerun would skip while the other paths run. That has not been measured here.Not covered
frame_copyat record, and graphics root SRVs still takeupload_from_titleat bind. Neither reads the slot 133 backing; moving them to the submit copy point is a separate change.OpenExistingHeapFromFileMapping) with section and offset from XMem.X2W_TEST_EXISTING_HEAPS_UNSUPPORTED=1.Refs #1914
Refs #874
🤖 Generated with Claude Code