GPU: reuse immutable descriptor tables across command lists #562
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!562
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-562"
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?
@aycow on GitHub · 2026-11-24 04:56 UTC · original
aycow:gpu/reuse-immutable-descriptor-tables→main· +1051 −66 · 7 files · 11 commits · draftChange
Share immutable texture SRV tables that current main already rebuilds because they extend beyond the mirrored portion of a capped native descriptor heap. The cache matches the full table width, populated offsets, title view generations and native resource identities. Each recorded list retains its allocation and the native resources through execution and replay. Cache hits still schedule the list's usual texture preparation and state transitions. Resolution snapshots each title descriptor generation and pins the resource until preparation completes. The global view registry lock is released before native descriptor creation, uploads, or state transitions.
Ordinary dynamic ranges also retain their original allocator. Resetting an old recording releases only the slots it owns, even if a replacement title heap uses the same guest address. Current main's raw table CBVs, mixed tables, placed views, UAVs and direct bindless paths keep their existing materialization.
Current-main eligibility is limited to already materialized textures with fixed backing. Evictable textures and textures placed in the new native arena use normal table materialization. This keeps recorded tables out of the path that can recycle their backing allocations.
Synthetic reproduction and validation
On Windows, select the adapter and run the fixture on the system D3D12 runtime.
The fixture at
134dde0uses the Windows system shader compiler and system D3D12 device creation. It passed native output, closed-list replay, heap replacement, and retirement on AMD Radeon Graphics, GeForce RTX 5070 Laptop GPU, and WARP. The native workload also passed full GPU-based validation on all three using a local validation harness. The fixture acceptsVICTORY_TABLE_TEST_GBV=1for installations where the system debug runtime supports it and requires no SDK path. The lifetime regression covers rejection after collecting a pin and resource release after descriptor replacement. Both strict workspace Clippy configurations passed.The update at
db0c7e5incorporates mainf3578e3. Shared tables now populate view-address entries and clear stale buffer write marks. If the address buffer appears after a table was recorded, a new table supplies its metadata while the old recording keeps its own descriptors. The metadata regression and capped-pool fixture passed on AMD, NVIDIA, and WARP. Thanks to fuzeofficlal for independently verifying the previous head on RTX 5090 and WARP. Independent reportScope
The current results measure occupancy and correctness on an original synthetic workload. Title-level hit rates, performance and mixed-table coverage remain open. The cache uses main's synchronous completion contract and retains slots while a valid recording can replay them. Distinct ranges can still exhaust or fragment the pool. Fragmentation report
rpmaster2 recorded 12,212 mixed and 3,710 CBV-only requests before the first failed rebuilt table on RX 9070 XT. The texture cache saw zero hits there. LooperSalty eliminated the reported indirect allocation failures by enlarging the dynamic range from 65,536 to 262,144 on a different NVIDIA stack. AMD demand report · NVIDIA capacity control
The earlier CBV ownership and transactional reservation experiments remain available as supporting results. Cross-list mixed-resource and CBV sharing still requires immutable upload versions or submission-time binding. CBV replay fixture · Transactional reservation fixture
Draft pending a matched title capture that demonstrates cross-recording reuse of eligible SRV tables and lower peak slot occupancy or fewer allocation failures. Capture follow-up and A/B instructions · Capture build updated to main AI-assisted with OpenAI Codex.
ccfb02996e' into maintenance/pr562-ccfb029 4d53cda620f3578e386e' into maintenance/pr562-f3578e3 7ddecdc415@aycow on GitHub · 2026-11-24 06:43 UTC · original
I published an opt-in companion branch at
82e4aa6to measure which rebuilt tables account for the dynamic-pool demand. It reports reservations and failures by width, descriptor type, CBV presence, exact cross-list record duplication, generation changes and texture-sharing eligibility. AMD, NVIDIA and WARP passed the capped-pool readback fixture with full GPU-based validation.If you're authorized to retest the exhaustion case, build the diagnostics branch, set
VICTORY_DESCRIPTOR_DEMAND=1, and repeat the same warm-cache route. Please share only therebuilt descriptor demandaggregate lines, revision, GPU/driver and whether the run exhausted the pool. Use a separate pass with the flag off for timing comparisons. Reproduction and counter definitions@LooperSalty on GitHub · 2026-11-24 09:18 UTC · original
A measurement for the capped-heap case this PR is about, on an RTX 4070 SUPER (view heap capped at 1,000,000; the title asks for 1,245,184), diag build of main
58fed37+ #89 #493 #189 #206 #469 #459 #454 #688 #464 #490 #497 #346 #483 #638 #579 #302 #489 #585 #617 #307 #550, 2 minutes in the world each time:MIN_DYNAMIC):no dynamic slots for its tables15 times, up todropped=16384; and ~720 draws/frame dropped asindirect kind 10: prepare failed (compute false, mesh true)plus ~256/frameindirect kind 0: prepare failed for indirect rectangles(both go throughtake_dynamicinprepare_for/root_srv_table).PORTABLE_VIEWS - dynamic - guardtitle slots instead): 0no dynamic slots, and neither indirect message appears any more. No new warning, no device removal.So on NVIDIA the exhaustion is what drops the indirect mesh dispatches. The cost is fewer mirrored title slots (737,855 instead of 934,463); I saw no draw needing a slot in that range, but I have not checked it directly. Reusing tables as this PR does would get the same result without giving up title slots; it conflicts with #688's lease/reclaim allocator on my stack, so I could not test the two together.
🤖 Generated with Claude Code
@rpmaster2 on GitHub · 2026-11-24 08:31 UTC · original · edited 2026-11-24 12:31 UTC
Tested on RX 9070 XT 16 GB (RDNA4), Adrenalin 26.11.2 (32.0.32029.2010), Windows 11 26300, Ryzen 5 5600, 32 GB, pagefile 32/48 GB; diag build of this PR.
Menus 30 fps; world entry around frame 1024;
no free dynamic descriptor slots: a table is not made n=135; 2 fps; host device removed (0x887A0004/0x887A0006) before the first cutscene. The reuse here does not remove the exhaustion on this host.Requested diagnostics (
aycow:gpu/descriptor-allocation-demand@82e4aa6,VICTORY_DESCRIPTOR_DEMAND=1), at the first failed rebuilt table (frame 1096):LocalNew13,879 tables / 71,536 slots;LocalReuse2,906 / 39,215;NoRange1 / 178;SharedNewandSharedReuse0.Mixed12,212 / 72,250 withduplicate_untracked11,947 / 71,159;CbvOnly3,710 / 3,725 withduplicate_untracked3,707 / 3,722;Unresolved864 / 34,954 withduplicate_untracked864 / 34,954.no free dynamic descriptor slots n=178and device removal.#550 was tested too: its past-host-heap path never fires on this host and the TDR remains. Full report: #597. No game data.
AI-assisted: written by DeepSeek (OpenCode harness) from my run logs and observations; the hardware, the dump and the runs are mine.
@aycow on GitHub · 2026-11-24 16:29 UTC · original
@rpmaster2 @LooperSalty Thanks for the two controls.
05c3757is rebased onffe310eand keeps the #336 cap and refusal behavior. The 65,536-slot texture fixture again passed AMD, NVIDIA and WARP with GBV. The AMD workload had zero texture sharing hits and points to mixed/CBV demand. The NVIDIA capacity experiment identifies allocation pressure for indirect mesh admission, with a title-slot tradeoff on that test stack. I’ve recorded both results in the description. The synthetic ordered-copy test still needs separate upload versions even for identical CBV records; the rebased path keeps those uploads list-local.@rpmaster2 on GitHub · 2026-11-24 17:25 UTC · original
@aycow thanks - noted, and good to see
05c3757rebased onffe310ewith the #336 cap and refusal behaviour kept.One honest limitation from my side, so the record is clear: on the RX 9070 XT the "no free dynamic descriptor slots" refusal no longer appears at all on
main@58fed37or later (0 occurrences across a dozen 300-480 s world runs), so I cannot show a benefit from table reuse there any more - the pool simply is not the limiter on this host now. The AMD control you recorded (zero texture-sharing hits, mixed/CBV demand) is the last measurement where the demand was visible.What I can still test on the rebased head, if it helps you: the same 480 s A/B against
ffe310ewithVICTORY_DESCRIPTOR_DEMAND=1, reporting the demand breakdown and whetherno free dynamic slotsstays at zero. Say the word and it goes in the queue - GPU runs on this machine are paused tonight after a driver reset froze it, so it would be tomorrow.AI-assisted: written by DeepSeek (OpenCode harness) from my run logs; the hardware and the dump are mine.
@aycow on GitHub · 2026-11-24 18:16 UTC · original
Thanks for the RX 9070 XT repetition. The zero current-main refusals are a useful control. If a matched warm scene is available, could you share aggregate dynamic table counts by width and composition (CBV-only, mixed CBV/SRV/UAV, and sampler), unique/repeated counts, peak live slots and refusal counts? The exact commit and settings help compare shape without attributing a speedup to reuse. Counts only are sufficient. Cross-list CBVs still need immutable upload contents retained until fence completion.
@rpmaster2 on GitHub · 2026-11-24 18:22 UTC · original
@aycow counts from the run I did on your diagnostics branch, as requested. All numbers are aggregates at the first failed rebuilt table, nothing scene-specific.
aycow:gpu/descriptor-allocation-demand@82e4aa6, diag build,VICTORY_DESCRIPTOR_DEMAND=1,VICTORY_D3D12_DRED=1, DRED off for this run otherwise default; RX 9070 XT 16 GB, Adrenalin 26.11.2, Windows 11 26300, Ryzen 5 5600, 32 GB.first failed rebuilt table.Outcome across the frame:
LocalNew13,879 tables / 71,536 slotsLocalReuse2,906 / 39,215NoRange1 / 178SharedNewandSharedReuse0 / 0By width (requested):
By composition:
Mixed: 12,212 tables / 72,250 slots, reserved 10,775 / 60,770,duplicate_untracked11,947 / 71,159CbvOnly: 3,710 / 3,725, reserved 2,442 / 2,457,duplicate_untracked3,707 / 3,722Unresolved: 864 / 34,954, reserved 662 / 8,309,duplicate_untracked864 / 34,954Then
no free dynamic descriptor slots: a table is not made n=178and the device was removed.Two caveats for shape comparison, both from later runs on my host:
main; onmain@58fed37and later the refusal count is zero in every 300-480 s world run (a dozen of them), so this is the last measurement where the demand was visible on this card.I can re-run the demand branch on current
mainafter this session (a long run is in flight right now) if a current-tree number is more useful than the historical one; it would be the same protocol, counts only.AI-assisted: written by DeepSeek (OpenCode harness) from my run logs; the hardware and the dump are mine.
@aycow on GitHub · 2026-11-24 21:17 UTC · original
@rpmaster2 Thanks for the breakdown. The historical failure provides a useful width-178 stress case. Mixed tables accounted for 60,770 reserved slots and CBV-only tables for 2,457. The mixed duplicate counter did not establish identical immutable descriptor and upload generations, so it does not predict reusable capacity.
Your zero-refusal current-main results and the new RTX 5060 #1349 comparison make the next comparison more specific. Would you be able to share a current-main warm-window census with the same aggregate fields and peak live slots, including when refusals are zero? A #1349 comparison on the affected hardware would help establish how much pressure remains. We are keeping #562 in draft and holding mixed-CBV expansion until there is current demand and evidence that sealed upload versions can reduce it.
AI-assisted using Codex.
@Marvisak on GitHub · 2026-11-25 00:25 UTC · original · edited 2026-11-25 19:25 UTC
Automated triage for the maintainers.
Needs work: needs the maintainer's decision. It now merges cleanly into
main. CI:checkpassing.The PR shares fully resolved texture-SRV tables across command lists (
HostHeap::shared_textures,Heap::with_texture_table, the new branch inState::tablesindraw.rs). It also replaces the(heap, first, n)release bookkeeping with drop-releasedDynamicRanges tied to a per-heapDynamicSlotsidentity. The identity change is a good fix: a release can no longer reach a reused heap address. Three things block it:with_texture_tableholds the globalVIEWSmutex while its closure runs, and the closure callsreadable(texture uploads, alias copies, state transitions) andCreateShaderResourceView. That stalls descriptor creation on every title thread and risks lock-order inversions. Please collect the entries, release the lock, then do the work.reuse_tests.rsfixture loads an Agility SDK fromVICTORY_TABLE_TEST_AGILITYthroughID3D12DeviceFactory, which loads external code and needs the maintainer's decision.main. The capture build you posted is the right way to get that number.Splitting out the
DynamicSlotsidentity fix would let it land on its own.Generated by Claude Code
@aycow on GitHub · 2026-11-25 01:10 UTC · original
Updated to upstream
42363abat4cd352f. The draft shares immutable texture SRVs only when main already rebuilds the table on a capped heap. Main’s raw CBV and mixed-table paths are preserved. Recorded allocations now release into their original native heap even after title heap address reuse.AMD, NVIDIA, and WARP passed native readback and closed-list replay with full GPU-based validation. In the synthetic 65,536-slot test, repeated tables reduced peak slots from 65,536 to 4,096 and allocation failures from nine to zero. The unique-table control kept the same occupancy. I updated the description with reproduction steps and the limitations of the current workload.
@rpmaster2 on GitHub · 2026-11-25 06:11 UTC · original
@aycow happy to run it, with one blocker on this host right now.
Current
main(@940d32f) dies in the driver's shader compiler before a warm window exists here:0xc0000005 at amdxc64.dll+0x861b9f, the same offset onmain, onmain+ #1762, and on fxceless's fork. It happens during pipeline creation in the credits/prologue, so a 300-480 s run reaches 1,700-9,100 draws/frame and then the process is gone - there is no steady window to census. I filed it as #2124 with the Windows Event Log entry namingamdxc64.dll32.0.32029.2010.Two ways I can give you the census you want, pick one:
ffe310e(yesterday's main). That is where my historical numbers came from and where the zero-refusal runs happened; I can run the diagnostics there withVICTORY_DESCRIPTOR_DEMAND=1and report the same aggregate fields plus peak live slots, flagged as historical rather than current.On #1349: that card is not in this machine, so I cannot give you a same-hardware comparison. What I can add is the RX 9070 XT side of the picture at the moment refusals were zero - which, per my earlier runs, is the whole steady state on this card since #336 landed, so the "how much pressure remains" answer from here is likely "none that the dynamic pool can see, whatever the tables do".
I would rather not report a census from runs that die at 86% of pipeline compilation; a truncated window is worse than a historical one, and you already have my full historical breakdown.
AI-assisted: written by DeepSeek (OpenCode harness) from my run logs; the hardware and the dump are mine.
@aycow on GitHub · 2026-11-25 16:58 UTC · original
Updated against current main at
e9d3e95. Sharing now checks for fixed backing before caching an immutable table because upstream can evict title-fed textures and reuse native placement ranges. The capped 65,536-slot synthetic fixture again went from nine failures to zero and from 65,536 to 4,096 peak slots on AMD, NVIDIA, and WARP with full GPU-based validation. The unique-table control retained its original occupancy.Thanks @rpmaster2 for documenting the compiler crash that prevented a warm capture. The draft remains open pending evidence that eligible tables account for meaningful demand in an affected run. The documentation page has been removed and the reproduction is in the PR description.
@aycow on GitHub · 2026-11-25 17:33 UTC · original
@LooperSalty @Ender1Dragon If either of you has an authorized test slot for the capped-heap workload, this capture build at
8d1685ccan now measure the exact tables #562 can share. The older reports established pool pressure. This capture separates fixed-backing eligibility and cross-recording hits from mixed or evictable tables.Build that commit with
cargo build --locked --profile diag -p victory --features diagnostics. For both runs, setVICTORY_LOG=infoandVICTORY_DESCRIPTOR_DEMAND=1. UseVICTORY_DESCRIPTOR_DEMAND_NO_SHARE=1for the baseline and0for the reuse run. Start a fresh process for each arm and match the adapter, driver, save, cache state and present window. The same binary runs both modes.Please share only the
rebuilt descriptor demandlines and the adapter, driver and scene phase. A zero-eligible or zero-refusal window is useful, and a first-refusal snapshot is enough if the run ends early. The collector reports exact eligibility, cross-recording hits, live and peak slot counts, and refused ranges. The capture is separate from the draft PR.@aycow on GitHub · 2026-11-25 19:32 UTC · original
Quick follow-up for @LooperSalty and @Ender1Dragon. If either of you has an authorized test slot, one matched pair on the capped-heap workload would help resolve the review question for #562.
Use the same capture build at
8d1685c, with a fresh process for each run. Keep the adapter, driver, save, cache state, heap cap, and present window matched. SetVICTORY_LOG=infoandVICTORY_DESCRIPTOR_DEMAND=1for both runs. SetVICTORY_DESCRIPTOR_DEMAND_NO_SHARE=1for the baseline and0for reuse.Please post just the aggregate
rebuilt descriptor demandlines for both runs, including anyfirst_refusalline in the matched window. The comparison is cross-list hits (SharedOtherList), peak slots for the same capacity, and allocation failures (NoRange). A zero-hit or unchanged result is useful too. If the scene is blocked before a matched window, a short status is enough.@fuzeofficlal on GitHub · 2026-11-25 19:59 UTC · original
Reviewed and verified
134dde05on Windows 11 (RTX 5090 + WARP) againstmain(13f91ca).Code review
Heap::texture_table_recordssnapshots[tag, id, generation]underVIEWSand acquires temporary refs viaobject::try_add_refso resources mid-teardown are not resurrected;SharedTextureTableholdsDynamicRange, the heap, and backingID3D12Resources whileDynamicSlots::sharedkeeps onlyWeak, anddraw::State::shared_tableskeeps theArcalive through execution/replay.TextureTableKeyincorporates(slot, generation << 32 | id, raw_resource)so rewritten slots miss cleanly; cache hits still callreadable(..., true)for every used slot so uploads/transitions stay intact;HostHeap::identity()+DynamicRangeproperly isolates heap replacement at the same address.main(13f91ca):fixed_table_textureintentionally requirescopy.key.is_none() && copy.placement.is_none()to avoid eviction and placement hazards. Note that inresource.rs:1256(shared_texture), almost every standard DXGI format withelement(desc.format).is_some()(1..=99,115..=120,189..=191) is assignedt.key = Some(memory_key(...)). On currentmain, common-format non-placed textures will therefore havekey.is_some()and bypass shared-table reuse untilHostHeap::evict(and#2707) can invalidate or account for slots pinned inSharedTextureTable.Verification (Windows 11, RTX 5090 + WARP)
VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics -- --test-threads=1: 200 passed, 0 failed, 2 ignored.capped_pool_texture_table_reuse(--features diagnostics,-- --ignored --nocapture):over-capshared=false failed=9 peak=65536vsshared=true failed=0 peak=4096.over-cap:shared=false failed=9 peak=65536 prepare_ms=9.021vsshared=true failed=0 peak=4096 prepare_ms=0.946equal-work:shared=false peak=49152 prepare_ms=2.597vsshared=true peak=4096 prepare_ms=0.886unique(no reuse): bothfailed=0 peak=49152,prepare_ms=2.613(shared=false) vs9.763(shared=true)--test-threads=1):descriptor::tests7/7,draw::tests11/11.cargo clippy -p victory-gpu --all-targets --locked -- -D warnings(default and--features diagnostics): 0 warnings;cargo xtask policy: 185 files ok.git merge-treeagainst13f91caand#2707(fb10ff37); conflicts incrates/victory-gpu/src/draw.rswith#2650(3e606d27).View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.