Repository navigation
Conversation
|
On a GeForce RTX 5070 (driver 616.92), I reproduced stale mapped bytes on I extended the PR's sparse GPU test harness. A tracked native copy initialized 128 bytes to 0x3a and its readback updated the CPU shadow. The first 64-byte Map synchronization performed one readback and marked the page probed. A second clean synchronization correctly skipped. A native compute dispatch then wrote 0xa1b2c3d4 at offset 0 and 0xb0a3d2c5 at offset 60. I waited for its title-queue fence on the CPU before checking the same 64 bytes.
All 14 interior words retained 0x3a3a3a3a. The stock test with the shader write before the first Map passed on this adapter. This fixture calls the internal synchronization routine used by resource Map and checks the actual CPU shadow. It bypasses the guest COM wrapper. A clean probe establishes agreement at that point. Elision on subsequent Maps also needs evidence that no intervening submission could have written the page. |
|
A second native RTX 5070 control on 760a932 shows that submission invalidation alone would leave a stale-read case. The compute dispatch and fence both completed before the first Map. The dispatch wrote DWORDs at offsets 0 and 60 in a 4 KiB page initially filled with
|
760a932 to
b4fdc7a
Compare
|
I retested both sparse Map cases on revised head
All 14 untouched words matched in both runs. The stock UAV-write-before-first-Map control passed when its first Map covered the written words. On this revision the tracked copy used the async after-submit preparation and drain. After each native compute dispatch, the fixture invoked the production sparse after-submit hook with empty tracked-copy and immediate ranges, as appropriate for a shader-only write. The hook returns immediately on empty ranges. The CPU waited for the title fence before inspecting the shadow. The Map fixture used the production readback step through its test wrapper. The synthetic fixture bypasses guest COM dispatch and does not measure game performance. AI use: OpenAI Codex adapted the fixtures to this revision, ran the native comparisons, and drafted the report. |
|
merge-check The reverse-order test (added inside
|
b4fdc7a to
9635736
Compare
|
Retested the two previously failing 5070 cases on
In each case the default result matched the subsequent forced readback ( I used the saved native fixtures with the production AI disclosure: OpenAI Codex adapted and ran the fixtures and drafted this report. |
|
Ran the sparse readback and list tracking tests at System
Results
What this adds Not tested AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - ran the commands above on this machine and wrote this report; no game data was used. |
|
The red CI on 9635736 is not from this PR. Its four failures (shaders::pipeline_library::tests::builder_deduplicates_names_and_atomically_replaces_output, graphics_pipeline_round_trips_through_serialized_library, mesh_pipeline_round_trips_through_serialized_library, and shaders::warm_library::tests::cold_publish_makes_an_unchanged_corpus_reusable) are the test race that #3221 fixed on main (merged Nov 29, 16:18 UTC, after this run); its commit message names this PR's base, beeb81b. This PR touches none of those files. A rebase onto main should turn CI green; the PR check will then want a new xcl-smoke block on the new head. AI use: Claude (Claude Opus 5.5) matched the CI log against main's history; checked and posted by me. |
9635736 to
7300a37
Compare
|
Review (head 7300a37, diff read, not a merge-check; conflicts with main,
Fine: the epoch / fence tracker is ordered right (a submit is in flight from before AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
|
No open or merged PR skips clean sparse Map readbacks or adds AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
Skip redundant synchronous GPU readbacks on clean sparse Map ranges after certifying exact 64-byte chunks once (with XCL_MAP_SYNC=1 escape hatch), while checking pending async readback overlap and recording CopyBufferRegion, CopyResource, and ClearUnorderedAccessView writes into sparse console buffers. Certify only full 64-byte chunks actually transferred and verified clean (leaving partial chunks and unprobed neighbor chunks synchronous), and invalidate clean certification via a submission epoch and per-queue fence tracker across any potentially untracked GPU submission (draws, dispatches, bundles, indirects, non-buffer texture copies, replayed or unknown lists, split KickoffX segments, and in-flight independent queues). Assisted-by: Antigravity (exact model name not provided to the agent)
7300a37 to
e6fdb91
Compare
|
Thanks for the thorough review, @Foniass — all points are addressed in
|
Skip redundant synchronous GPU readbacks on clean sparse
Mapranges after certifying exact 64-byte chunks once (withXCL_MAP_SYNC=1escape hatch), while tracking buffer copies/clears (CopyBufferRegion,CopyResource,ClearUnorderedAccessView*,ResolveQueryData) and invalidating clean certification across all potentially untracked GPU submissions.Note on PR size: out of
+1747 / -91total lines,1015lines are dedicated unit and GPU regression tests covering sub-page and partial-chunk boundaries, multi-queue races, copy/clear/query write tracking, non-indexedDrawInstancedUAV writes, and atomic fast-paths (+730 / -91production lines + 2README.mdlines). Certification and full invalidation are kept in one PR so no partial skip lands without complete invalidation coverage.What is in it
sparse.rs):readback_now_stepcertifies only full 64-byte chunks actually transferred and verified clean againstsenthashes when no overlapping async readback is pending and all untracked submits have settled; partial-chunk reads and unprobed neighbor chunks remain synchronous. AddedXCL_MAP_SYNC=1escape hatch (README.md) andMAP_SYNC_READBACKS/MAP_SYNC_SKIPPEDcounters in the periodicsparse windows:log.list_x.rs,real.rs): RecordsCopyBufferRegion,CopyResource, andClearUnorderedAccessViewUint/Floatwrites into sparse console buffers, and integrates#3393'squery_result_bytesper-query sizing inresolve_query_data_x(marking the list untracked ifnote_copy_intocannot track the target).bind.rs,list_x.rs,real.rs,sparse.rs): Addednote_untracked_gpu_writetobind::draw_instanced(console vtable slot 12) so non-indexed draws writing to UAVs/stream-out invalidate certified chunks, alongsideDrawIndexedInstanced,Dispatch,DispatchMesh,ExecuteIndirect,ExecuteBundle, texture copies/resolves/clears, replayed/unknown lists, splitKickoffXsegments, and in-flight independent queues. Auditedreal.rsandbind.rsfor hookedCopyTiles,AtomicCopyBufferUINT/64,WriteBufferImmediate, and raytracing (DispatchRays,BuildRaytracingAccelerationStructure,CopyRaytracingAccelerationStructure) paths — none of those are hooked on command lists.sparse.rs,list_x.rs,real.rs):SPARSE_BUFFERS_ACTIVE(AtomicBool) fast-path:note_untracked_gpu_writeandbegin_submissionreturn in a single relaxed atomic load without touchingLISTSwhen no sparse/shadowed/view console buffers exist (lists created before sparse activation remain conservatively untracked if sparse activates later).DIRTY_LISTSdirect-mapped atomic cache inlist_x.rs: repeated draws on an already-dirty command list skip theLISTSmutex; cleared on create/reset/release.SignalinUntrackedSubmitTracker::finish: skips fence allocation andnative_queue_signalon submit until tracked sparse writes (prepare_after_execute) or a sparseMapprobe/certification arms it.sparse.rs,list_x.rs,bind.rs): Added unit and GPU tests for clean-probe skip,XCL_MAP_SYNC=1, pending async overlap, sub-page / partial-chunk boundaries, multi-queue in-flight blocking, late compute and non-indexedDrawInstancedUAV writes after a clean probe,SPARSE_BUFFERS_ACTIVE/DIRTY_LISTSfast-paths, and unarmed queueSignalskipping.Tested
XCL_ADAPTER=warp), Windows x64,rustc 1.100.0 (0ef1bc386 2026-11-09)cargo build -j 4 --workspace: passedcargo test -j 4 --workspace --no-run: passedcargo build -j 4 --release -p xcl: passed--test-threads=1):cargo test -j 4 -p xcl --lib hle::d3d12x::sparse::tests -- --test-threads=1: 149 passed, 0 failed, 1 ignored (0SKIPPED)cargo test -j 4 -p xcl --lib hle::d3d12x::list_x::tests -- --test-threads=1: 108 passed, 0 failed, 0 ignored (0SKIPPED)cargo test -j 4 -p xcl --lib hle::d3d12x::bind::tests -- --test-threads=1: 117 passed, 0 failed, 0 ignored (1SKIPPED:two_pass_binds_set_the_shared_view_heap, opt-inXCL_HEAP_WINDOWS=1)XCL_ADAPTER=warp(--test-threads=1):cargo test -j 4 -p xcl --lib hle::d3d12x::sparse::tests -- --test-threads=1: 149 passed, 0 failed, 1 ignored (5 pre-existing GPU/tiled-tier-2SKIPPED; all new sparseMapcertification andDrawInstancedUAV tests ran and passed)cargo test -j 4 -p xcl --lib hle::d3d12x::list_x::tests -- --test-threads=1: 108 passed, 0 failed, 0 ignored (0SKIPPED)cargo test -j 4 -p xcl --lib hle::d3d12x::bind::tests -- --test-threads=1: 117 passed, 0 failed, 0 ignored (1SKIPPED:two_pass_binds_set_the_shared_view_heap)3c290c16):sparse windows: 4096 submits, 1370 MB of CPU writes uploaded, 474 ms spent, 13388 tiles mapped, map sync 0 readbacks/0 skipped— this title reads sparse memory via persistent pointers rather thanMapread ranges, and the atomic fast-paths kept throughput parity (1676vs1666frames shown,61 60 60presents/2s).Regression run
Not tested
cargo test --workspacesuite on this rebased commit (only targetedsparse::tests,list_x::tests, andbind::testswere run on RTX 3060 and WARP).ID3D12Resource::Mapread-range calls on sparse buffers (covered by the GPU regression tests insparse::tests).AI use
Antigravity (Google Deepmind, Gemini) rebased the branch onto
upstream/main(#3393), audited GPU write hooks, implemented theDrawInstancedinvalidation fix, atomic fast-paths, and regression tests, and ran the builds, targeted tests, and paired smoke runs.