fix(gpu): admit first uploads for on-demand tiles, map coarse mips first, and count tiled sweep bytes #2986
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!2986
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2986"
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?
@Luca121 on GitHub · 2026-11-29 19:13 UTC · original
Luca121:pr/on-demand-tile-admission-and-sweep→main· +85 −20 · 2 files · 1 commits · closed without mergingSummary
When
VICTORY_LEVELS_ON_DEMAND=1is active and VRAM crosses the normal texture room line (resource::room_line), three bugs intiles.rsandresource.rsprevented newly created reserved textures from receiving any tiles, caused fine-to-coarse allocation failure to leavefirst_shown() == None, and caused bounded idle sweeps to count0reclaimed bytes for tiled textures:First-upload admission skipped by
OnDemand::uploaded():draw.rsadmits a new texture's first upload past the normal room line viaresource::room_for_first_upload(video, reserve)(up tofirst_upload_cap, 95% of budget) so visible geometry does not draw untextured/neutral slabs.OnDemand::uploaded()only checkedroom(video)(the strictroom_line) and never consultedroom_for_first_upload. As a result, every on-demand texture admitted over the room line was created (CreateReservedResource) and queued for upload, only forOnDemand::uploaded()to passroom = false(0tiles mapped →first_shown() == None→ neutral placeholder shown indefinitely).Tiled::missing_bytes(held)to compute the exact unallocated tile byte footprint for the requestedheldlevels, and updatedOnDemand::uploaded()to allow tile mapping whenroom(video) || (reserve > 0 && room_for_first_upload(video, reserve)).Fine-to-coarse mip allocation order in
Tiled::give_locked():give_locked()previously pushed0..first_packed(mip 0 first) and the packed mip tail last. If the card could not satisfy the largest mip (level 0), allocation could fail before the small packed tail and coarser mips received tiles, leavingfirst_shown() == Noneinstead of falling back to a coarser valid mip.(0..first_packed).rev()(coarsest standard mip to finest mip 0) sofirst_shown()always has a valid coarser mip if a full card cannot allocate level 0.Bounded sweep & eviction byte accounting (
host.bytes == 0for tiled textures):HostTexture::new_tiledsetshost.bytes = 0because tiles are tracked intiles::STATS[2].let_go_idle()(both streamed-out and boundedbytes >= mostsweeps),slot_evict(),copy_state(),census(), andunmapped_holders()all addedhost.bytes(0) instead of the texture's actual mapped tile footprint (tiled.given_bytes()). During a bounded VRAM sweep (most != u64::MAX), evicting tiled textures never advancedbytestowardmost, causing bounded sweeps to over-evict and under-report reclaimed VRAM inKINDS[3],STREAMED_OUT[1],HOST_PRESSURE[1], andSLOT_EVICT[1].HostTexture::occupied_bytes()(self.tiled.as_ref().map_or(self.bytes, Tiled::given_bytes)) and used it acrosslet_go_idle,slot_evict,copy_state,census, andunmapped_holders.Hardware Telemetry (RTX 4070 Ti 12 GB, 32 GB RAM,
VICTORY_LEVELS_ON_DEMAND=1)aae5ac50)04804ef6/ this PR)uploads left a held level without memory(tiles::STATS[9])Testing
tiles::tests::missing_bytes_counts_only_unallocated_requested_levels.cargo test --locked -p victory-gpu --libpasses (missing_bytes_counts_only_unallocated_requested_levels,card_wrote_failure_does_not_poison_card_mask,show_from_preserves_resource_min_lod_for_2d_and_2d_array,first_upload_decision_lets_settled_targets_stop_vetoing_faces,copies_stop_at_the_texture_line,room_line_follows_the_budget).@Luca121 on GitHub · 2026-11-30 20:11 UTC · original
Closing to keep the PR queue clean — part of this already landed on main and the rest is stale/conflicting.
Pull request closed