Repository navigation
Conversation
|
Test run of Tested
Review: A view of a buffer outside unified memory now gets a mirror in UMA, and every path that fills the mirror copies from Not tested: no retail title or regression run (I have no unpacked game), no Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code. |
|
Tested - Tool: OpenCode with DeepSeek V4.1 Flash 1017
Tested - re-tested at the new head, independent AMD RDNA2 validation
Not tested: retail title / AI use: OpenCode with DeepSeek V4.1 Flash 1017 ran the tests and drafted this report. |
|
Tested (PR head
For reference, a Not tested
AI use opencode with DeepSeek V4.1 Flash (opencode-go/deepseek-v4.1-flash) ran the build, the tests and the smoke |
|
Retail regression run of this PR: the retail title 1.0.2.1 (the same title as #675 and #616) crashes about 18–23 s in, inside Tested
Regression run main this PR merged onto it: Not tested
Runs and report by Claude Code (Claude Opus 5.5) on my machine. Generated by Claude Code |
There was a problem hiding this comment.
Review of 0f418b0 against its merge base 508a0c7, by reading the code; nothing was built or run here. The idea (give buffer views outside unified memory a mirror instead of an empty V#) fits the existing vertex/index mirrors, but mirror_of was written for a caller that had already checked the range, and the new callers do not.
-
CONFIRMED:
mirror_ofcopies from a source nobody checked (crates/xcl/src/hle/d3d12x/list_x.rs:1872-1877, copy at:1890). Whenreadable(src_start, len)fails, the fallback takes(va, bytes, src_va)and copies without a second check. Onmainthat was safe because the only caller,gpu_va, returns early unlessreadable(va, bytes)(list_x.rs:1810). The three new callers check nothing:buffer_view(real.rs:1195, whole resourceWidthat the placed address),dev_create_cbv_x(real.rs:1808) andbuffer_words_at(real.rs:2205). Scenario: a 64 KiB-aligned buffer whose memory is reserved but not committed, or larger than 256 MiB (readablereturns false above that,crates/xcl/src/gpu/shader.rs:208): the first check fails, the fallback is the same range, and the copy faults on its first byte. That matches the trace Dukiverse posted (0x3200000bytes, fault at the first source byte, insidemirror_of); I did not reproduce it. Fix: in the fallback, returnNoneunlessreadable(src_va, bytes), so the caller writes the empty V# as before. -
CONFIRMED: nothing refreshes these mirrors when the title writes; the description says it does.
sync_title_buffers(list_x.rs:1901-1916) only looks at the list's bound vertex and index buffers;MIRRORShas no other reader. A CBV/SRV/UAV mirror is filled when a view is created and again only when another view of the same range is created. Scenario: a title creates one CBV for a constant buffer outside unified memory and rewrites the constants every frame: the shader keeps reading the bytes from creation time.cbv_outside_uma_is_mirrored_and_refreshed(real.rs:5568-5593) passes because it callsmirror_oftwice itself; it never goes throughdev_create_cbv_xand does not show a refresh on a write. Fix: either sync the mirrored ranges the bound descriptors point at before a draw/dispatch, or say plainly in the description that views are a snapshot from creation time and rename the test. -
CONFIRMED: every
mirror_ofhit now recopies the whole view (list_x.rs:1850-1866). This also changes the existing vertex/index path: eachIASetVertexBuffers/IASetIndexBufferof a mirrored buffer (list_x.rs:2032,:2079) now copiesSizeInBytesat the bind, on top of the per-draw partial copy that the design note abovegpu_vasays replaced whole-buffer copies. Forbuffer_viewit is the whole resource per created view (50 MB perCreateShaderResourceViewin the trace above). Fix: keepmirror_offill-once as onmainand put the refresh where it is needed (see 2), not in the lookup. -
CONFIRMED (minor):
TITLE_BUFFER_BYTESis never cleaned up.res_releaseremoves the resource fromTITLE_ADDRESS(real.rs:1600-1602) but not from the new map (real.rs:1566-1574), so it grows by one entry per placed buffer and can hand a stale size to a later resource at the same pointer. Fix: remove it next toTITLE_ADDRESSinres_release.
Also missing against CONTRIBUTING: the description has no Regression run for a runtime change, and no test covers an unreadable source (finding 1).
Verdict: not ready to merge; finding 1 can crash a title that ran before, and the "refreshed on CPU writes" claim does not hold.
Review by Claude Code (Claude Fable 5.2); each point checked by a person before posting.
0f418b0 to
8d051f3
Compare
Thanks for finding and reporting this @Dukiverse! Root CauseThe 50 MB buffer view was placed in Fix
|
8d051f3 to
cfc848f
Compare
|
Re-read at
Reply by Claude Code (Claude Opus 5.5); checked by a person before posting. |
cfc848f to
cb4a9ae
Compare
|
RX 7900 XT downstream test of cb4a9ae on a build based on 930e8b4. The three focused tests for non-UMA buffers, constant-buffer refresh, and uncommitted views passed. The comparison build logged an empty buffer descriptor during startup. With this PR the title reached the new mirror path: one logged view was 118,060 bytes, and the last power-of-two sample showed 8,192 mirrors totaling 1,408 MB. Both runs had matching initial caches, scripted Player1 input at 33 seconds, two DXC workers and a 28 GiB whole-job limit. The comparison build later had a GPU page fault during world loading. The mirrored build exited at about 190 s with Rust allocation-error handling on a DirectStorage queue worker; peak sampled process commit was 27,560 MB and no device removal was logged. The title exercised the implementation. These two runs do not establish that mirroring fixed the GPU fault, or that mirrors alone caused the allocation failure. |
Buffer views (CBV, SRV, UAV) created for host allocations outside UMA previously got an empty V# descriptor (num_records 0), causing shaders translated to read buffer memory through mem to receive zeroes. Mirror these buffers into unified memory on view creation and refresh contents on update, committing lazy reservations and safely zeroing uncommitted pages to avoid faults on unwritten output buffers.
cb4a9ae to
3217101
Compare
Empirical test report (3217101)Hardware / environment
Commands and results
& $unitTestExe --exact hle::d3d12x::real::non_uma_buffer_view_tests::buffer_views_outside_uma_are_mirrored --test-threads=1
& $unitTestExe --exact hle::d3d12x::real::non_uma_buffer_view_tests::cbv_outside_uma_is_mirrored_and_refreshed --test-threads=1
& $unitTestExe --exact hle::d3d12x::real::non_uma_buffer_view_tests::uncommitted_buffer_view_does_not_crash --test-threads=1All three commands exited 0. Each reported 1 passed, 0 failed and 0 ignored. The focused log totals were 3 passed, 0 failed, 0 ignored and 0 skipped (case-sensitive Observed behavior
Not tested The full GPU workspace suite, shader execution against these descriptors and game smoke runs were omitted. AI use Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr637-focused.log and published. |
|
A test of this PR's idea on the retail title, done with an equivalent local change rather than this branch: copies of out-of-window buffer views are enough to get world geometry rasterised, with three conditions this PR may want to know about. Numbers: #697 (comment) Setup in short (the full block is in the linked comment):
Not tested: this branch itself; writes through UAV copies going back to the title (none of the by-address views in the GPU view was a UAV here). AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the ports and the runs) did this and drafted the comment. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Two contributors checked independently and found that #2384 solves the same problem in a different way: #1607, group D110. You may want to compare them with the other author and agree on one, or say in the PR why both are needed. This is a hint from the community triage in #1607, not a maintainer decision. AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table. |
When a title allocates resources outside XCL's mapped unified memory (UMA) windows and attempts to bind them into vertex or index buffers, native D3D12 device calls previously failed or produced invalid GPU virtual addresses.
This change transparently mirrors buffer views that fall outside the UMA memory windows into the coherent UMA pool (via
safe_copy_from_title), allowing games with custom out-of-pool heap layouts to bind buffers cleanly.What is in it
crates/xcl/src/hle/d3d12x/device_x.rs,crates/xcl/src/hle/d3d12x/list_x.rs,crates/xcl/src/hle/d3d12x/real.rs: mirror buffer views residing outside the 3 sparse UMA windows into the coherent memory region.Tested
rustc 1.97.1, release/debugcargo test -p xcl --lib list_x::tests: 27 passed, 0 failedRegression run
main(1d027e5):PR (
3217101):Not tested
AI use