Repository navigation
Conversation
|
merge-check |
Review follow-ups to xcl-dev#3553: - The pool widening, spares and the new-placement wait work around amdgpu's in-order page-table updates, which Windows drivers do not have, and cost CreateReservedResource calls and waits on the title's thread. They are now on by default only under Wine on an AMD adapter (vendor 0x1002), decided per device; XCL_LIVE_RESERVED=1/0 forces them on or off anywhere. - A clear value keys the pool by its meaningful bytes only: the format and the colour, or the depth and stencil of a depth-stencil texture, never the uninitialised rest of the union. - The new-placement wait sleeps on an event (SetEventOnCompletion and WaitForSingleObject) instead of spinning. - Spares are not kept as reserved resources of the title while they sit in the pool, and pool entries evicted without a title Release leave that registry too. Tests: the gate, the depth clear key with garbage in the tail, wait_fence returning at the Signal and timing out, and place_on_pages with the gate on (a new texture waits behind a held mapping queue and gets two spares; the next one comes from the pool without waiting) and off (no spares, no wait).
|
Thanks for the review. Addressed in 797541b:
|
|
Source review of current head
Candidate clear-key correctiondiff --git a/crates/xcl/src/hle/d3d12x/vram.rs b/crates/xcl/src/hle/d3d12x/vram.rs
@@
- let raw = std::ptr::read_unaligned(clear as *const [u8; CLEAR_VALUE_BYTES]);
let used = if desc.Flags.contains(D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL) { 4 + 4 + 1 } else { CLEAR_VALUE_BYTES };
- key.clear[..used].copy_from_slice(&raw[..used]);
+ std::ptr::copy_nonoverlapping(clear.cast::<u8>(), key.clear.as_mut_ptr(), used);
This is source review, not a new GPU or title test of this head. AI use: OpenAI Codex (GPT-6.2 Sol) traced the current source and vkd3d-proton path; OpenAI Codex (GPT-6.2 Astra) independently checked the lifecycle and concurrency paths. |
Second review of xcl-dev#3553: - wait_fence polls the fence with short sleeps instead of registering an event: vkd3d-proton keeps a registered handle until the value is reached, so an event closed after a timeout could be signalled later under a reused handle. - signal_now moves the mapping queue's value only once its Signal was queued, and says when it failed. Queues wait for that value before their work, so a value no Signal reaches would hold them forever. The bind and unmap paths go through it; a mapping whose Signal failed is covered by the next one that succeeds. A new placement whose Signal failed does not wait, and spares without their Signal are released. - A depth-stencil clear value is read only as far as its depth and stencil, never the rest of the union. - place_on_pages reserves the spares a description lacks under the pages lock (in-flight ones count), and the reservation is given back when they are made, fail, or the placement ends early, so placements of one description at once make no more than XCL_RESERVED_SPARES. Tests: a timed-out wait leaves no event to signal; a clear value right before an unreadable page; an injected Signal failure publishes no value and no spares and gives the reservation back; four placements of one description at once behind a held mapping queue make at most the spares of one.
|
Thanks, all four addressed in 85c1c59:
Description updated: suite and |
|
Follow-up on head
Please track mapping work whose Signal failed and obtain a successful later mark before allowing dependent execution or recycling. If no mark can be queued, keep the mapping/resource unavailable rather than treating the previous completed value as its mark. A regression can complete mark N, inject a failed Signal after a bind or NULL unmap, hold the mapping queue behind a test fence, and verify that execution/recycling waits for a successfully queued N+1 and its completion. This is a source trace; I did not inject a failure or run a GPU test on this revision. AI use: Codex (GPT-6.2 Sol) checked the revised call paths; Codex (GPT-6.2 Astra) independently reviewed the mapping and retirement sequence. |
|
Thanks, the follow-up is right: a failed Signal after On the other points raised elsewhere:
|
|
merge-check |
|
One ordering detail for the failed-Signal fix you described on head If recovery happens in |
|
One separate lifetime point on head
Create an internal spare through the existing PC creator and register diagnostics only when a resource is handed to the title. The GPU-owned and sampled placement paths already do the latter after successful placement. Clearing Candidate diff against this headdiff --git a/crates/xcl/src/hle/d3d12x/vram.rs b/crates/xcl/src/hle/d3d12x/vram.rs
@@
- let hr = super::real::dev_create_reserved_resource(this, tiled as *const _ as usize, state as usize, clear as usize, riid, &mut p);
+ let hr = super::real::pc_create_reserved_resource(this, tiled as *const _ as usize, state as usize, clear as usize, riid, &mut p);
@@
- // (idle in the pool, as a title's released one: `note_reserved` again when handed out)
- super::real::forget_reserved(p as usize);Please add a deterministic regression with dump tracking enabled: make a 3D spare, check that the idle spare is absent from diagnostic enumeration, force pool eviction, then check that enumeration cannot touch the released resource. A checked-out 3D texture should still be registered. I traced this in source; I did not run that regression or a GPU test on this head. AI use: Codex (GPT-6.2 Sol) checked the release and diagnostic paths; Codex (GPT-6.2 Astra) independently traced the spare lifecycle. |
|
One additional cold-placement case for the failed-Signal fix on head Please distinguish a disabled placement wait from a failed Signal. On failure, queue a successful readiness mark and wait for it before returning the resource, or roll back the placement and propagate failure. A focused regression can disable spares, hold the mapping queue behind a test fence, inject the first Signal failure during a cold lazy placement, and verify the caller does not receive a usable resource before a successful retry completes. This is a source trace; I did not run that failure injection or a GPU test on this head. AI use: Codex (GPT-6.2 Sol) checked the call path; Codex (GPT-6.2 Astra) independently checked the page-table invariant. |
|
Ran the Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build, The 78/0/1 of Not tested: Wine with AMD/RADV (where the change is on by default), the AI-assisted (OpenCode), model: MiMo-V2.6-Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used. |
85c1c59 to
5d7820c
Compare
|
Squashed into one commit, 5d7820c, which also covers the open points: @Foniass's merge-check:
Description updated: suite (one module per process, 2 threads, failing modules rerun with 1) and the |
|
This is a new response on the same thread as my report at Ran the Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build, All 82 tests pass at the squashed head, four more than the 78 of my earlier report at Not tested: Wine with AMD/RADV (where the change is on by default), the AI-assisted (OpenCode), model: MiMo-V2.6-Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used. |
|
merge-check AI-written and posted by Foniass without a human check of each point. |
5d7820c to
db57f30
Compare
|
Thanks. All four points of 7306339703 are addressed; the new head is db57f30:
Suite and |
|
Re-review (head db57f30; range-diff from 5d7820c, which I merge-checked, read). Not a new merge-check: this head is stacked on #3566, which is still a draft.
Once #3566 is out of draft and merged, a suite run and smoke pair of this commit on main would make it ready. On Windows the live path stays off, so the default path there is unchanged. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
|
This is a new response on the same thread as my report at Ran the Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build, All 83 tests pass at the stacked head, one more than the 82 of my previous report. The new behaviour remains gated off by default on Windows NVIDIA, so this is a no-registration check of the module, not a test of the Wine/AMD path. Not tested: Wine with AMD/RADV (where the change is on by default), the AI-assisted (OpenCode), model: MiMo-V2.6-Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used. |
|
Stacked on #3566: its first commit (6970034) is #3566, and that is where the 153 shared added lines come from. Not a duplicate. This PR's own commit, db57f30, adds the live reserved-texture pool, spares made ahead, and the wait for new placements in AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
db57f30 to
ee13d5a
Compare
|
The Windows CI job on db57f30 ran into its 45-minute timeout: with 4 test threads, several |
|
This is a new response on the same thread as my report at Ran the Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build, All 83 tests pass at this head, the same count as at Not tested: Wine with AMD/RADV (where the change is on by default), the AI-assisted (OpenCode), model: MiMo-V2.6-Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used. |
|
merge-check AI-written and posted by Foniass without a human check of each point. |
|
Review of head ee13d5a (not a full merge-check: no test suite or title run on this machine)
Blocking: the first commit, 6970034 (#3566 as it stands), lands with a test that can hang the suite. What would unblock it: move Not blocking:
Hardware: Linux x86_64 cloud machine, no GPU. The crate was type-checked only, not built for or run on Windows. |
vram's mapping queue raised its value and then signalled it, ignoring the result. When that Signal failed, the value was one no Signal would reach: every queue's next submit waited for it (before_execute) and a retired texture's NULL unmap counted as done although nothing marked it. The value now moves only when the Signal was queued. A mapping or unmapping whose Signal failed is marked, and gets a later Signal before anything counts on it: before_execute queues one and has the title's queue wait for it, and a retired texture stays out of the pool until one completes. When none can be queued either, before_execute says so, and the submission stops with that cause (MappingUnmarked) instead of going out with mappings nothing covers. Tests: a failed Signal leaves the value a Signal reached; with the mapping queue held behind a test fence, a bind, a held unmap released inside before_execute and a retired texture's unmap whose Signals fail each get a later mark, and the work waits for it or does not go. The held-queue test cannot hang the test process: each gate is a guard that Drop opens on unwind, and a detached watchdog opens it after 10 s and fails the test with the phase it was held in. With FAIL_SIGNALS nothing else signals the gates, so an assert between mq.Wait and a gate's Signal, or a test placing on the shared device meanwhile, would otherwise leave the mapping queue waiting for good. reserved_resource_with_private_data_is_excluded_from_recycle takes VRAM_TEST_LOCK, and a test-only lock keeps drain_recycled from marking the test's retired texture while it checks that nothing marked it.
ee13d5a to
18547df
Compare
|
Test report (not a merge-check: AI-written and posted by Foniass without a human check of each point. |
Publish a consumer wait only once it was queued. Propagate mapping readiness failures out of texture upload preparation, including mappings made after the title queue’s initial wait. Assisted-by: Codex (GPT-6.2 Sol)
amdgpu, the Linux kernel driver, runs a process's page-table updates in order on one queue, and every unmap and every sparse rebind (REPLACE frees the old range) waits for all command submissions of the VM first. While a frame is in flight, a reserved texture made after its submit has no page-table entries, not even the PRT ones, until that frame is done. A console title may write a descriptor of a texture it has just placed that work it already submitted reads; on the console the memory is there, here the read is a GPU page fault (TCP, PERMISSION_FAULTS 0x3) and the device is lost. RADV_DEBUG=bo_history and the kernel log put the faulting virtual BO 32-38 ms after its creation, by a new placement, with the hung IB older than the texture. A texture from the pool has had its entries since before: its rebind still lands late, but the work in flight reads a NULL tile meanwhile. So: - the pool also takes render targets, depth and UAV textures and those with a clear value, keyed by its meaningful bytes; - every placement tops its description up to XCL_RESERVED_SPARES (default 2) spares made ahead, reserved under the pages lock and pooled only once a Signal of the mapping queue after them completes; - a placement that still has to make a new texture waits up to XCL_PLACE_MAP_WAIT_MS (default 1000) for such a Signal, polling the fence; when no Signal can be queued for it, the placement fails as a failed creation does. It is one change because the parts only work together: without the wait a burst of new textures outruns the spares and faults; without the spares every new placement waits a frame. It builds on the marks for mappings whose Signal failed (the commit before): spares and new placements count on a Signal reaching their mappings. On by default only under Wine with an AMD GPU, judged by the Vulkan physical device vkd3d-proton drives (DXVK's DXGI may report an NVIDIA GPU as AMD), else by the DXGI adapter: Windows drivers do not order page-table updates like this, and the extra creations and waits cost time on the title's thread (the log says how much: the placements, the spares made and the time spent making them, and the waits). XCL_LIVE_RESERVED=1/0 forces it either way. Tests: the gate and the vendor source, clear keys, the fence wait, placements with the gate on and off, concurrent placements and their spares, spares and a cold lazy placement whose Signal fails, and spares kept out of dump tracking.
18547df to
5800b72
Compare
|
merge-check AI-written and posted by Foniass without a human check of each point. |
On amdgpu (Linux, RADV) a title can fault the GPU on a reserved texture XCL has just created for one of its placements: the GPU reads it through work submitted before the texture existed, and the kernel has not mapped it yet. This hands the title reserved textures whose page tables already exist, and makes the rare new one wait for its mapping. It is on by default only under Wine on an AMD GPU, where the problem exists;
XCL_LIVE_RESERVED=1/0forces it either way.What is in it
vm->delayed). Every unmap, and every sparse rebind (REPLACEputs the old range onvm->freed), first waits for all of the VM's submitted work (amdgpu_vm_clear_freed,AMDGPU_SYNC_EQ_OWNER). A new submit waits forvm->last_update, but work already submitted does not. So while a long frame runs, a reserved texture created after that frame was submitted has no PTEs at all, not even the PRT ones fromvkCreateImage. When the title writes its descriptor into memory that the already-submitted work reads (fine on the console), the read faults:[gfxhub] page fault … client TCP,PERMISSION_FAULTS 0x3, thenDXGI_ERROR_DEVICE_REMOVED. Shown withRADV_DEBUG=bo_history, the kernel log on the same clock and a devcoredump: the faulting virtual BO was created 32–38 ms before the fault, and the hung IB is in a CS BO created 437 ms before the texture.94b0d761. The bottom commits cover failed mapping Signals and Waits on every platform. Only the top commit belongs to D3D12.X: hand the title reserved textures with live page tables #3553.vram.rs, one commit: the parts only work together. Without the wait a burst of new textures outruns the spares and faults; without the spares every new placement waits a frame):ReservedPoolalso takes render-target, depth and UAV textures and textures with an optimised clear value. The key copies and compares only the clear value's meaningful bytes: format + four colour floats, or depth float + stencil byte (the union's tail is never read).XCL_RESERVED_SPARES(default 2) spares made ahead. A spare enters the pool only after a Signal on the mapping queue that was sent after it completes, so its PTEs exist. Missing spares are reserved under the pages lock (pooled, pending and in-flight ones count), so concurrent placements of one description do not over-create them; a drop guard returns the reservation on every early exit. Spares are kept out of theRESERVEDregistry (and so out of dumps) until handed out, and every pool eviction removes the entry before the release.XCL_PLACE_MAP_WAIT_MS(default 1000; 0 = off), by polling the fence with short sleeps: no event is registered, so none can be left with vkd3d-proton after a timeout. If that Signal cannot be queued, the placement fails as a failed creation does (nothing is mapped or noted yet), instead of handing out a texture nothing covers.ID3D12DXVKInteropDevice; DXVK's DXGI may report an NVIDIA GPU as AMD), else by the DXGI adapter. Windows drivers do not run page-table updates behind in-flight work, and the spares and the wait cost time on the title's thread. Elsewhere the previous behaviour is unchanged.XCL_LIVE_RESERVED=1/0forces it;XCL_RESERVED_POOL=0still turns the pool off.CreateReservedResourceper placement still runs on the placing thread. Measured in the retail run below: 66126 spares made in 2071 ms over 130 s (31 µs each on average, longest call 10 ms), about 1.6 % of one thread; the waits of new placements are on top (5.3 s over 125 s, longest 102 ms).place_on_pagesbut solves a different problem.before_executeand recycling (the value stays reachable, no spares pooled, the work is held until a later Signal), a lazy placement without a readiness Signal, a depth clear value placed right before a no-access page, concurrent same-description placements (at most 2 spares), spares kept out of dumps, and a GPU test throughplace_on_pages(with the mapping queue held a new texture waits and gets two spares, the next comes from the pool without a wait; gate off: no spares, no wait).Tested
hle::d3d12x::vram::tests::run on this head under Wine: ok. 83 passed; 0 failed; 1 ignored; 0 measured; 2702 filtered out; finished in 3.11s18547df7: 2,918 passed, 0 failed, 51 ignored in the four-thread workspace suite. Test reportRegression run
main:
PR:
The PR's kernel log recorded 0 page faults, 0 ring timeouts, 0 ring resets, 0 coredumps, 0 bus losses.
Not tested
XCL_LIVE_RESERVED=1, NVIDIA under Wine, and other AMD generations.AI use
🤖 Generated with Claude Code