Repository navigation
startup: release retired slot-133 title-memory textures and track slot-18 SRV reuse (slice 2) - #2468
Conversation
|
A start-up measurement of Host: RTX 3080 10 GB, driver 32.0.16.2124, Windows 11 26200, release build,
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):
AI-assisted (Claude Code) |
|
Thanks — the end-to-end numbers are the part I could not produce here, and they match the intent of the slice: S3 is a real bug in this diff, not an intended change. You are right that the contract from if (side_src.kind == x2w_list_copy_texture::Kind::subresource
&& (!src_wrapper->own().retire_when_idle || src_wrapper->own().title_memory)) {With the switch off, On the other notes — all accepted, and each gets a fail-first check rather than only a fix:
If you disagree with the S3 predicate — in particular whether a non-title-memory resource should ever reach |
|
A longer run of
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 AI-assisted (Claude Code) |
|
Pushed S3 — fixed, and the mutant now fails. Both gates are S5 — the premise does not hold, so the fix is different. The desktop view creation the shim binds for slots 19-21 returns S1/S2 — fixed. S6 — fixed by adding the case. Case 6 (on mode): a live slot-18 SRV keeps the older resource pending; the entry survives B2 — seven mutants, all caught (each a temporary edit, reverted; on-mode mutants fail only
Two of those needed fixture probes as well: the index check only detects missing live entries, and Verification on 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 One unrelated observation, not caused by this change and not fixed here: |
|
B1 is in: What the case does
Mutants, both required ones fail the case (temporary edits to
Verification on Still not pinned, stated plainly: the new draw path has only run with I am marking this Ready for review now. It is still stacked on |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour 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. |
d72f1e2 to
d03296d
Compare
|
Rebased onto main now that #2443 merged as c887a65: head is d03296d on origin/main d2cc0a7. 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 911375f read 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. |
There was a problem hiding this comment.
💡 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
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
|
I resolved the docs-only conflict with main and kept both experiment entries. The final pushed head is |
|
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 Fixture results (source-built)
Executable results (local title run, aggregates only)
Retention 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× 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 Limits: one run, a local executable run rather than a source-built fixture, aggregate counters only. AI-assisted; commands listed were executed locally. |
|
Thanks for the merge commit 4cd1cff � 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 4cd1cff:
CI is running on 4cd1cff now. 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). |
…t-18 SRV reuse (slice 2)
…ding (review follow-up)
…and retire bookkeeping
… (review follow-up)
… retire fixture (B1) startup_resource_retire_title had no draw path, so draw_translated's retire_hold and the slot-133 view-token resolution were untested. Case 7 samples a slot 133 title-memory texture through a descriptor table with a host-built translated pipeline and asserts the exact readback (including a clear sentinel row and column). The closed recording must keep the released texture retained until it is dropped, which is the hold; a skipped token resolve binds no view and fails the readback.
4cd1cff to
1ef07a6
Compare
|
Fixed and re-pushed: head is now The "keep both experiment records" resolution from
Verified on
The description now matches this head. CI is running on |
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 drivesSix cases per backend with the debug layer on and off, on WARP and on the physical GPU — that is a good matrix for a Reproduction note for anyone else: the six older Three mutations of the new retire logic
The two caught ones are the load-bearing halves: a heap released while views still reference its descriptors, and a The survivor is a slot range the fixture never entersThe title fixture exercises the slot 18 SRV path throughout — A repo-wide search for a slot 19/20/21 case turns up unrelated tests ( 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 EnvironmentWindows 11 build 26300.9974; AI-assisted. |
|
Fixed the same-address SRV case in |
|
Your merge 35b4361 is 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 35b4361:
CI on 35b4361 is 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. |
|
Follow-up for descriptor slots that are never overwritten: #2579 (opt-in, on top of |
|
@triggered02, a hardware result for the merged fixture: Host: Windows 10 19045, NVIDIA driver 32.0.15.6094,
Both hardware arms stop at the same point, the last stage of
It failed in all 4 runs here: one on clean AI-assisted (Claude Code). |
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 gfx2hlsl: lower s_nand_b32, s_nor_b32 and s_xnor_b32 on lane masks #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.