startup: release retired slot-133 title-memory textures and track slot-18 SRV reuse (slice 2) #2460
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2468"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-25T17:36:05Z.
Extends the merged Slice 1 (
#2443, merge commitc887a65a) to device slot 133 (CreatePlacedResourceX) committed 2D textures withtitle_memory(Refs #2379, Slice 2).Rebased onto
origin/main851a1400as a clean linear chain of five commits (the earlier merge commit was linearized; its "keep both experiment records" resolution is preserved byte-for-byte — see the verification note). The slice-1 commits are not in this branch, and the diff againstmainis this slice plus the review follow-ups below (10 files, 1439 insertions, 61 deletions).What changed (Slice 2)
src/startup_stubs/d3d12_xs_device.cpp):device_place_resource_x(slot 133) setsretire_when_idle = retire_class(..., address, allow_title_memory=true)for non-buffer committed 2D textures (1 sample,DEFAULTheap, no RT/DS/UAV flags); slot 127 resources with__XMemAllocationHooks__title_memorystay excluded.resource_address_index/existing_memory_texture:drain_retired_resources()erases(title_memory, wrapper)undernote_lockafter claimingrefs(0 -> retired_refs) and beforereal->Release(), keepingresource_infos()intact.texture_uploads/list_copy_texture/draw_lock: the upload gate iskind == subresource && (!own().retire_when_idle || own().title_memory), so with the switch off nothing changes for ordinary textures while retiring slot 133 textures still upload onCopyTextureRegion;sync_title_source()and the copy path guardtexture_uploads()withdraw_lock, and the drain erasesrealunderdraw_lockbeforereal->Release().dropped_flightsis pre-reserved beforeretire_lockso flight collection cannot allocate under it.written_textures:retire_note_title_release()snapshotswritten_textures()[addr].generationat final guestRelease()(or clears immediately when no live sibling/tiled SRV or descriptor ref shares the address), and the drain clears stale entries only while the generation is unchanged and no live resource or tiled SRV uses the address.view_slot<18>SRVs +draw_translated):note_view/note_copy/retire_drop_heap_viewstrack materialized slot-18 SRV descriptor slots throughHeapInfo::shadow(retire_view_refs), falling back toretire_leave_classoutside tracked heaps or for slots 19-21;draw_translatedholds bound textures withretire_hold.911375fa):title_memoryalone, which changed the off path for ordinary textures).void, so a removed device is the only failure it reports;record_viewnow materializes a view only whenSUCCEEDED(GetDeviceRemovedReason()), releases the slot's previous view reference otherwise, and skipsnote_view_target.retire_holdreads the wrapper's desktop pointer and takes itsAddRefunderretire_lock(a leaf, taken afterdraw_lock/allocator_lock; the drain releases it before taking the other locks), and a use it cannot record setsretire_hold_missed, which the drain re-checks and answers by keeping that desktop object for the process.resource_address_index().erase,texture_uploads().erase,note_copyref counting,retire_drop_heap_views, the release-timewritten_texturescleanup, and the drain generation match (all caught).tests/startup_resource_retire_title.cpp(8 cases;startup_resource_retire_title_{warp,hardware}_debug{0,1}and_off_withX2W_RESOURCE_INDEX_CHECK=1), fixture-only read-only probesx2w_d3d12_resource_index_probe,x2w_d3d12_texture_upload_probe,x2w_d3d12_written_probe,tests/startup_resource_retire.cppclasses()so slot 133Tretires while a live-SRVVstays retained, plusdocs/startup-runtime.mdanddocs/experiments.md.Verification (
1ef07a64onorigin/main851a1400)ctest --preset dev --no-tests=error -R '^startup_resource_retire(_title)?_': 12 tests, 100% passed, 0 failed — 8 runnable pass on WARP (Microsoft Basic Render Driver) and onNVIDIA GeForce GTX 1660 SUPERwithdebug_errors_or_warnings=0, 4_debug1variants skip with 77 (Graphics Tools absent). Repeated 3×, green each time.ctest --preset dev -R '^(startup_resource_|startup_list_copy|startup_address_srv_)' -j 4: 34 tests, 100% passed, 0 failed.retire_holdremoval (retained=0/0 expected=65536/1) and skipped token resolve (pixel (0,0) got 00000000 want fff8f1ea) — all caught on WARP and hardware.git diff --checkclean;tests/docs_links_check.py(19 files, 472 links),bidi_controls_check.py,startup_translator_check.py,startup_tools_lint_check.py, and main's newstartup_gfx2hlsl_sop2_complement_check.py/startup_gfx2hlsl_getpc_refusal_check.py: PASS.4cd1cffc → 1ef07a64is patch-identical to main's own1405d945 → 851a1400delta;docs/experiments.mdat1ef07a64is exactly current main's text with the Slice 2 record appended, and that record is byte-identical to the merge resolution (the only lines not carried over are four that main itself rewrote in #2459).911375fa, RTX 3080, release build,X2W_D3D12_RELEASE_RETIRED=1 X2W_D3D12_BUDGET=1): process exited normally at 605 s, 17000 desktop references dropped, retained textures4.36 GB / 2315(Slice 1: access violation after 8xE_OUTOFMEMORY,13.7 GB / 6733), no OOM and no device removal. Different game path from the Slice 1 run, so directional only.Not established
_debug1variants have not run here (no debug layer); the new draw path is exercised withX2W_D3D12_DEBUG=0only.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-25T17:53:40Z.
A start-up measurement of
911375fa, plus review notes from reading the code.Host: RTX 3080 10 GB, driver 32.0.16.2124, Windows 11 26200, release build,
X2W_D3D12_RELEASE_RETIRED=1 X2W_D3D12_BUDGET=1, 40 GiB job cap, warm shader cache, manual input. Values are from the last heartbeat.E_OUTOFMEMORY(slot 133 placement)So slice 2 releases most of what slice 1 cannot. Local memory still ended about 4.6 GB over budget, with 2315 textures retained, presumably the ones still referenced from descriptor slots that were never overwritten (see S7 below). Not verified per resource. The run had no crash, no stop and no retire error. The two runs did not cover the same game path, so this is not a like-for-like comparison.
Notes from an independent read of the diff (not executed: no mutants and no extra tests were run here):
tests/startup_resource_retire_title.cpphas no draw path (descriptor table bind, draw, readback after the guest release). This leavesretire_holdind3d12_draw.inl:2017and the token resolution at:1966-1984untested: removing that hold would not fail the fixture.retire_view_refscheck in drain (d3d12_xs_device.cpp:4486),resource_address_index().erase(:4525),texture_uploads().erase(:4536), thenote_copyref counting (d3d12_capture.inl:347-361),retire_drop_heap_views(:4288) andwritten_texturesgeneration keeping (:4323-4338,:4527-4533).list_copy_texture.inl:150-160now gatesupload_textureontitle_memoryinstead of!retire_when_idle. Without the switch, subresource copies of non-title-memory textures would no longer call it. Please check that this is intended, because "unset, nothing changes" is the contract from #2443.d3d12_xs_device.cpp:3857callsrecord_view(true)even when the desktop view creation returned a failure HRESULT. That keeps the resource retained forever: a leak, not a safety issue.retire_holdreadsown().realwithout the lock (:4347), and its fallback only clearsretire_when_idle(:4367), which drain does not re-check. This is only reachable with use after release, but it is worth one lock or atomic.AI-assisted (Claude Code)
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-25T17:58:23Z.
Thanks — the end-to-end numbers are the part I could not produce here, and they match the intent of the slice:
#2468exits normally at 605 s,17000desktop references dropped, retained textures down to4.36 GB / 2315from13.7 GB / 6733, with noE_OUTOFMEMORYand no device removal. I read the comparison as directional only, for the reason you give (different game path), and the remaining 4.6 GB over budget with 2315 retained textures is consistent with S7: a texture stays retained while a descriptor slot still references it, and nothing here overwrites those slots.S3 is a real bug in this diff, not an intended change. You are right that the contract from
#2443is "switch off, nothing changes". The intended predicate is:With the switch off,
retire_when_idleis false for every resource (the retire class is never assigned), so every subresource copy uploads exactly as before; with it on, retire-class resources that have no title memory still skip the upload, and the slot-133 title-memory textures upload, which is what makes releasing them safe. Gating ontitle_memoryalone changed the switch-off path for ordinary textures and slipped past the fixture because case 1 only covers the switch-on slot-133 copy. I will add the switch-off ordinary-texture case, andtitle_memory-alone must fail it.On the other notes — all accepted, and each gets a fail-first check rather than only a fix:
retire_holdis removed and when the token resolution atd3d12_draw.inl:1966-1984is broken; that is the only way the hold is actually pinned.startup_resource_retire_titlefail —retire_view_refsgate in drain (d3d12_xs_device.cpp:4486),resource_address_index().erase(:4525),texture_uploads().erase(:4536), thenote_copyper-slot ref counting (d3d12_capture.inl:347-361),retire_drop_heap_views(:4288), and thewritten_texturesgeneration keeping (:4323-4338,:4527-4533).record_viewon a failed view creation): record the view only on a success HRESULT; on failure release the socket and do not retain, so a failed desktop view cannot pin the resource forever.retire_holdracing with release): take the retire lock while readingown().real, and make the fallback visible to drain — the class is cleared under the lock and drain re-checks it, so the fallback cannot leave a hold that nothing re-reads.#2443is still open, so this stays stacked. I will push the S3 fix and the draw-path case first (they are independent of the slice-1 review), post the sha and the mutation results here, then rebase ontomainand mark this Ready once#2443lands.If you disagree with the S3 predicate — in particular whether a non-title-memory resource should ever reach
list_copy_textureat all when the switch is on — say so before I push it.[PR #2468] startup: opt-in release of retired slot-133 title-memory textures (slice 2, stacked on #2443)to [PR #2468] startup: release retired slot-133 title-memory textures and track slot-18 SRV reuse (slice 2)Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T18:48:24Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
d72f1e2957ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-25T18:11:22Z.
A longer run of
911375faon the same host and settings: 1005 s with manual input, stopped by me, no crash, noE_OUTOFMEMORY, no device removal, 26.3 fps.texture retainedstill grows in steps at scene changes and does not come back down:For comparison, the v2 prototype (no list or descriptor proof) ended a 753 s run with 0 retained and 8.7 GB local. So in this workload a large set of slot 133 textures stays alive after the guest Release, which matches S7 above. A guess, not verified per resource: they are still counted by
retire_view_refsbecause their descriptor slots are never overwritten, or they left the class through a path thatretire_leave_classtakes. If it helps, I can rerun with an extra log line, for example a periodic count of the retired-but-held resources split by reason (view refs, list hold, flight, left class), if you add one behind an env switch.AI-assisted (Claude Code)
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-25T18:24:35Z.
Pushed
1a0ab9f8(d52f267asource,2ef78901fixture,1a0ab9f8docs) on top of911375fa. S3, S5, S1/S2, S6 and the B2 mutants are in; B1 (draw path) is not in this push — details at the bottom.S3 — fixed, and the mutant now fails. Both gates are
kind == subresource && (!own().retire_when_idle || own().title_memory), so with the switch off every subresource copy uploads as before, and with it on only retire-class resources without title memory skip. Case 5 (off mode) copies between two slot-127 committed textures with no title memory. Observable: the per-desktop-objecttexture_uploads()entry that the no-title-memory path records — the existingx2w_d3d12_retire_probeis switch-gated and the sibling fixture asserts it must stay unavailable off, so the fixture gets a read-onlyx2w_d3d12_texture_upload_probe(desktop_ptr)plus the existingx2w_d3d12_list_copy_texture_statsforwarded counter. Reverting the predicate totitle_memoryalone fails_off_warpand_off_hardwarewithFAIL: ordinary texture copy recorded no upload (source=0 destination=0).S5 — the premise does not hold, so the fix is different. The desktop view creation the shim binds for slots 19-21 returns
void, notHRESULT; I checked with a typed vtable call and the return register holds a non-HRESULTvalue (e.g.0x2dd3f490300), so "view creation returned a failure HRESULT" cannot happen. The only failure it reports is a removed device, sorecord_view()now records a materialized view only whenSUCCEEDED(GetDeviceRemovedReason()); on failure the slot is recorded unmaterialized, which releases its previous view reference and adds none, andnote_view_targetis skipped. That closes the "view keeps the resource retained forever" case without inventing an HRESULT that does not exist. My first attempt trusted the call result and made hardware title runs flaky, which is how the void return surfaced; that attempt is gone.S1/S2 — fixed.
retire_holdreadsown().realand does theAddRefunderretire_lock; the leaf-lock rule is kept (retire_lockis taken afterdraw_lock/allocator_lockand nothing is taken under it, per the comment atd3d12_xs_device.cpp:4239; the draw and copy call sites are alldraw_lock-then-retire_lock, anddrain_retired_resourcesreleasesretire_lockbefore taking the other three, so no new ordering edge). The fallback now clearsretire_when_idleand setsretire_hold_missed, which the drain re-checks underretire_lock: it countsretire_keptand drops only the retire bookkeeping, keeping the desktop object for the process, like a submission that cannot be fenced. Not fixture-covered: reaching it needs fault injection in the hold path (not in your B2 list).S6 — fixed by adding the case. Case 6 (on mode): a live slot-18 SRV keeps the older resource pending; the entry survives
Releasewith the generation snapshotted, a newer generation of the same address arrives, the view is dropped, and after the older resource retires the entry must still read generation 2. Case 3's comment no longer claims it.B2 — seven mutants, all caught (each a temporary edit, reverted; on-mode mutants fail only
_debug0, the off variants correctly unaffected,_debug1skips with 77):retire_view_refscheck disabledstartup_resource_retire_title_warp_debug0(+hardware)FAIL: T_addr2 freed while SRV slots liveresource_address_index().eraseskippedFAIL: resource_address_index entry for retired T_addr1 is still presenttexture_uploads().eraseskippedFAIL: texture_uploads entry for retired T1 is still presentnote_copysource add-ref loop removedFAIL: Tv1 freed while copied SRV in heap2 holds itretire_drop_heap_viewsmade a no-opFAIL: T_addr2 kept after heap releasedFAIL: a live view did not keep written_textures entryFAIL: retiring the older generation released the newer written generationTwo of those needed fixture probes as well: the index check only detects missing live entries, and
written_texturesis otherwise unobservable from the fixture, sox2w_d3d12_resource_index_probeandx2w_d3d12_written_probeexist next to the upload probe. All three are read-only, take the same locks the shim takes, change nothing, and answer in both switch modes.Verification on
1a0ab9f8:ctest --preset dev --no-tests=error -R '^startup_resource_retire(_title)?_'→ 12 tests, 8 passed, 4 skipped (_debug1, no debug layer), 0 failed; the suite was run repeatedly green, including 20 repeats on hardware.git diff --checkclean,tests/docs_links_check.pypasses (19 files, 467 links),docs/startup-runtime.mdanddocs/experiments.mddescribe the gate, the view recording and the hold fallback.B1 (draw path) is the next push. It is a new fixture case rather than a fix: place the slot-133 texture, bind it through a descriptor table, draw, read the target back, then release the guest resource and drain, asserting the readback stays correct and the budget only lets go after the drain — with
retire_holdremoval and a broken token resolution as the two required mutants. I will post the sha here.One unrelated observation, not caused by this change and not fixed here:
startup_resource_retire_hardware_debug0(the sibling non-title fixture) occasionally failsFAIL: the resolved destination is not the clear colour. It passed 10/10 on the pre-fix tree, did not reproduce in 8 later full-suite runs or 20 repeats on the final tree, and every required run was green.Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-25T18:41:06Z.
B1 is in:
d72f1e29addscase7_draw_samples_slot133_texturetotests/startup_resource_retire_title.cpp(+302) plus the CMake link (d3dcompiler, for the hostD3DCompileof the fixture shader) and the two docs paragraphs. Nosrc/change in this commit; the mutants below were temporary and reverted.What the case does
<key>.txt+.vs.cso+.ps.csointo a per-pidX2W_SHADER_CACHEdirectory under%TEMP%(ud 1 / udsrc 0 rect / srv 0 tex2d table 0 0). The pixel shader does aTexture2D.Loadof the slot-133 texture.VirtualAllocguest address filled with a generated pattern, creates the SRV through slot 18 (which writes theX2WVview token), binds it withSetDescriptorHeaps+SetGraphicsRootDescriptorTable, and draws a full-screen triangle through slot 12 into a 4x4 target (3x3 scissor, magenta clear).x2w_d3d12_retire_probemust reportlist_holds > 0for the closed list — that is the draw'sretire_hold.65536/1).settlemust show the texture leave the budget, and a third readback is still exact.Mutants, both required ones fail the case (temporary edits to
d3d12_draw.inl, reverted; verified on WARP and on the GTX 1660 SUPER, exit 5, not a build error):retire_hold(self, resource)atd3d12_draw.inl:2017FAIL: slot 133 texture left the budget before its draw recording was dropped — stage 'slot 133 texture held by the closed draw list' live=262144/4 expected=262144/4 retained=0/0 expected=65536/1d3d12_draw.inl:1971-1975(known = words[1] < view_records().size()→false)FAIL: slot 133 texture sampled by a translated draw: pixel (0,0) got 00000000 want fff8f1ea(withsrv 0 texture: … -> view UNKNOWN, resource 0)Verification on
d72f1e29:cmake --build --preset dev --target startup_resource_retire_titleclean;ctest --preset dev --no-tests=error -R '^startup_resource_retire(_title)?_'→ 12/12, 100% passed, 0 failed, of which 8 runnable pass and the 4_debug1variants skip with 77 (no debug layer on this host). Case 7 passed on WARP (Microsoft Basic Render Driver) and on theNVIDIA GeForce GTX 1660 SUPER, both withdebug_errors_or_warnings=0.git diff --checkclean;tests/docs_links_check.pypasses (19 files, 467 links).Still not pinned, stated plainly: the new draw path has only run with
X2W_D3D12_DEBUG=0, because the debug layer is absent here; M2 is the "skip the resolve" form (binds a null view) rather than picking a different live decoy token, which would need a second sampled texture; and the per-pid shader-cache directory under%TEMP%is left behind after a pass, same asstartup_indirect_draw_indexed.I am marking this Ready for review now. It is still stacked on
#2443(1ecd4cfc): when that merges I will rebase ontomain, re-run these 12 tests plusstartup_resource_retireandstartup_translator_check, and post the rebased sha here before asking for merge.Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-25T18:43:09Z.
Rebased onto main now that #2443 merged as
c887a65a: head isd03296d3on origin/maind2cc0a79. The slice-1 commits are gone from this branch; the diff against main is the slice-2 change plus the S3/S5/S1/S2/S6 and B1/B2 follow-ups (10 files, +1440/-61). Rebuilt and re-ran after the rebase: ctest --preset dev --no-tests=error -R '^startup_resource_retire(title)?' gives 12/12, 100% passed, 0 failed (8 runnable on WARP and GTX 1660 SUPER, 4 _debug1 skipped 77), and docs_links_check.py passes with 470 links.This is no longer stacked and is Ready for review. The review notes from your
911375faread are all answered in the two comments above (S3 fixed as the switch-off gate, S5 re-done because view creation returns oid, S1/S2 under the retire lock with a drain re-check, S6 and B1 added as cases 6 and 7, seven B2 mutants caught). The description now matches this head.Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T18:41:24Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
d72f1e2ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T18:56:21Z.
I resolved the docs-only conflict with main and kept both experiment entries. The final pushed head is
4cd1cffc. Independent Windows Release build ofstartup_resource_retire,startup_resource_retire_titleandstartup_resource_budget, thenctest --preset release --no-tests=error -j 1 -R '^startup_resource_(retire|budget)' -V: 20/20 on WARP and RTX 4060 Laptop, with both debug modes and switch-off controls, zero skips. This verifies the source-built retention and draw fixtures. The actual executable comparison from #2379 uses a separate prototype. Fresh CI is pending.Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-25T18:56:55Z.
AMD data for this PR's own runtime code, @R0Y00: an executable run of #2468 itself, not the v2 prototype. I built and ran head
d03296d3. The new head4cd1cffconly mergesmain, andgit diff d03296d3 4cd1cffc -- src/startup_stubs/is empty, so the runtime code is identical. I'm reporting fixture results and executable results separately.Fixture results (source-built)
--preset release. AMD Radeon RX 9070 XT (1002:7550, driver 32.0.32029.2010) and WARP 10.0.26100.9818. The D3D12 debug layer is available on this host, so the_debug1variants run here.debug1.Executable results (local title run, aggregates only)
X2W_D3D12_RELEASE_RETIRED=1 X2W_D3D12_BUDGET=1,run.ps1 -Render, 600 s.main673d8e4a.0x8007000e/ device removedmain)d03296d3, switch onRetention over time (budget heartbeats about 5 s apart):
So on this card and cap, slice 2 slows the growth and moves the out-of-memory crash about 80 s later. Retention still climbs in steps and doesn't come back down, which is the same shape @JB2WIN saw on the RTX 3080. The last verified point is the run reaching 573.8 s. The first remaining failure is an access violation after 8×
0x8007000ein placement, the same failure mode as the off arm, just later.This fits the S7 hypothesis: most retained textures stay counted through descriptor slots that are never overwritten. v2, which lacks that proof, keeps retention at zero. I haven't verified it per resource.
Merge status: the Codex P2 inline thread at
d3d12_xs_device.cpp:4325(an SRV-held sibling'swritten_texturesentry erased on a sibling's release) is unresolved. I'm not merging while it's open. The fixture results above are fine.Limits: one run, a local executable run rather than a source-built fixture, aggregate counters only.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-25T18:57:06Z.
Thanks for the merge commit
4cd1cffc� I have kept it and did not force-push over it. My local rebase of the same five commits was discarded in favour of your merge, so the remote branch and this PR head stay as you left them.Verified on
4cd1cffc:CI is running on
4cd1cffcnow. The review follow-ups and the draw-path case from my earlier comments are all in this head; the only open limits are the ones stated in the description (no _debug1 coverage on this host, no AMD hardware, and the retained-texture remainder in the end-to-end run that this slice does not release).Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T18:48:24Z.
Code review location:
src/startup_stubs/d3d12_xs_device.cpp; line 4325When two slot-133 textures reuse the same title address, an older wrapper can have
refs == 0but remain usable through a tracked slot-18 SRV (retire_view_refs > 0). If the newer wrapper is released without a view,retire_note_title_releasesees no shared user here and erases the address'swritten_texturesentry; a later draw through the older descriptor then loses the generation andbc7_widthmetadata used byupload_textureand can interpret the backing with the wrong layout. Count a sibling'sretire_view_refsas a live user before clearing this address.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-25T19:18:39Z.
Fixed and re-pushed: head is now
1ef07a64, a clean linear chain of the five slice-2 commits on currentorigin/main851a1400— the merge commit is gone, so the branch follows the same single-chain shape as the other PRs here.The "keep both experiment records" resolution from
4cd1cffcis preserved, and I checked that claim rather than assuming it:4cd1cffc → 1ef07a64is patch-identical (git patch-id) to main's own1405d945 → 851a1400delta — the rebase changed nothing in the code, tests, CMake or CI lists beyond what main itself changed.docs/experiments.mdat1ef07a64is exactly current main's text with the Slice 2 record appended at the end, and that record is byte-identical to the one in4cd1cffc. The only lines from4cd1cffcnot present are four lines of the sop2-complement paragraph that main itself rewrote in #2459 — following main there is correct, not a loss. No conflict markers anywhere.Verified on
1ef07a64:cmake --build --preset dev(620 targets) → exit 0.ctest --preset dev --no-tests=error -R '^startup_resource_retire(_title)?_'→ 12/12 passed, repeated 3× green (8 runnable on WARP + GTX 1660 SUPER, 4_debug1skip 77, no debug layer here).ctest --preset dev -R '^(startup_resource_|startup_list_copy|startup_address_srv_)' -j 4→ 34/34 passed.docs_links_check.py(472 links),bidi_controls_check.py,startup_translator_check.py,startup_tools_lint_check.py, and main's newsop2_complement/getpc_refusalchecks → all pass;git diff --checkclean.The description now matches this head. CI is running on
1ef07a64; the PR is MERGEABLE, and the only remaining gate is an approving review. The earlier mutant evidence (seven B2 mutants, the S3 gate revert, and B1's hold-removal / skipped-resolve mutants, all caught on WARP and hardware) applies unchanged because the code is byte-identical.Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-25T19:22:43Z.
Built and run here: 12/12 pass, two of three mutations caught, and the survivor is the UAV/RTV/DSV leave-class path that no test drives
Six cases per backend with the debug layer on and off, on WARP and on the physical GPU — that is a good matrix for a
lifetime change, because a use-after-free usually shows up only with the debug layer's residency tracking on.
Reproduction note for anyone else: the six older
startup_resource_retire_*cases come backNot Rununlessstartup_resource_retireis built as well asstartup_resource_retire_title. That is a missing executable, not afailure; I hit it before building both.
Three mutations of the new retire logic
src/startup_stubs/d3d12_xs_device.cppretire_drop_heap_views(self)skipped when the object is a descriptor heapretire_note_title_release(self)skipped whenretire_when_idleN >= 19 && N <= 21→N >= 20 && N <= 22The two caught ones are the load-bearing halves: a heap released while views still reference its descriptors, and a
title release not recorded, both change the retire decision and both are asserted.
The survivor is a slot range the fixture never enters
The title fixture exercises the slot 18 SRV path throughout —
T2 held by slot 70 → slot 18 SRV in heap[0],descriptor/view reuse with
CopyDescriptorsSimple, and dropping the descriptor that holds the SRV reference. Theif constexpr (N >= 19 && N <= 21)branch (UAV, RTV and DSV keep the resource's old lifetime) is a different class,and nothing in the file drives it:
A repo-wide search for a slot 19/20/21 case turns up unrelated tests (
api_trace_check.cpp,startup_clear_uav.cpp,the gamesave readers), none of which reaches this branch.
So shifting the range by one is invisible here: not a defect, and the branch may well be correct — but it is a class of
view whose retire behaviour this PR does not constrain. If a UAV or RTV view over a retired resource is something the
title does, one case that creates a slot-19 UAV and releases the resource underneath it would close it.
Environment
Windows 11 build 26300.9974;
startup_resource_retire_titleandstartup_resource_retirebuilt withcmake --build --preset dev --target …; debug layer on and off in the matrix above. Each mutation was built, run,reverted and rebuilt; final state 12/12 green.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T19:34:04Z.
Fixed the same-address SRV case in
e29b1a7b. Releasing a second texture at the same address now preserves write/format metadata while an older slot-18 SRV still holds the first texture. The shared check protects cleanup at both release and drain. In the new control, removing the sibling-view check fails on WARP as soon as the newer wrapper is released. The exact fixed commit passed all 12^startup_resource_retireRelease CTests on WARP and RTX 4060 Laptop, including debug-layer runs and switch-off controls. This verifies the source-built lifetime case. The matched executable retest remains tracked in #2379.Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-25T19:46:08Z.
Your merge
35b4361bis the head and I kept it � I had a linearized rebase ready locally, but your merge commit was already on the remote, so I did not force-push over it.Verified on
35b4361b:etire_address_has_live_user present at the release and drain call sites, and both of your controls are in the fixture (FAIL: releasing the newer wrapper erased metadata � at :838, FAIL: draining the newer wrapper erased metadata � at :844).
CI on
35b4361bis green (Windows build, fixtures, Linux Python; /O2 and coverage skip by design). The branch is 4 commits behind current main, which GitHub re-checks on merge; I left that alone rather than adding another merge or rebasing over your commit. If you would rather have a single linear chain for the final merge, say the word and I will linearize it � otherwise this head is ready for approval.Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-25T21:39:19Z.
Follow-up for descriptor slots that are never overwritten: #2579 (opt-in, on top of
X2W_D3D12_RELEASE_RETIRED=1). AI-assisted (Claude Code).Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-25T22:15:59Z.
@triggered02, a hardware result for the merged fixture:
startup_resource_retire_title_hardware_debug0and_debug1fail on a GTX 1060 6GB. The failure is on a clean dev build ofmain0104f763.Host: Windows 10 19045, NVIDIA driver 32.0.15.6094,
--preset dev.startup_resource_retire_title_warp_debug0/_debug1startup_resource_retire_title_off_warp/_off_hardwarestartup_resource_retire_title_hardware_debug0(layer off)startup_resource_retire_title_hardware_debug1(layer on)Both hardware arms stop at the same point, the last stage of
case4_descriptor_and_view_reuse:heap2[0].heap2.Reset()stays at 1 retained texture (64 KiB) aftersettle(). The WARP arms free it.It failed in all 4 runs here: one on clean
main, and three on a branch whose only change to this fixture is thedraw_revisionpin. I haven't looked into the cause. It may be in the heap-release path on hardware, orsettle_limitmay not cover a slower fence on this adapter. I can run a variant with a larger settle limit or extra drains here if that would help.AI-assisted (Claude Code).