gpu: keep placed views out of HOST_WRITTEN_AT and clear host-written ranges on remap #4464
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!4464
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4463"
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?
@nidea1 on GitHub · 2026-11-30 20:38 UTC · original
nidea1:fix/host-written-placed-lifecycle→main· +557 −44 · 4 files · 2 commits · closed without mergingWhat it changes
Fixes two lifecycle bugs in
HOST_WRITTEN_AT/HOST_WRITTENthat strand stale host-written records at recycled streaming addresses, cause falseHERO LEADwarnings (8–50 per 40 s run), can alias/seed newly streamed textures from dead GPU copies, and pin recycled placed views in VRAM:Placed views (
PLACED_TEXTURES) overwroteHOST_WRITTEN_AT(texture.rs,list.rs,resource.rs)texture::seed_later(view, source)and theplaced_twinscopy loops inCopyResource/CopyTextureRegion(list.rs) calledtexture::host_written(view/twin).HOST_WRITTEN_AT[address]with the cachedPLACED_TEXTURESpointer, which the title never releases (texture::forgetis never called on it).source/dstresource,forget(source)checkedd.5 != sourceand leftHOST_WRITTEN_AT[address]stranded for the rest of the run.WARN HERO LEAD, falsely matchedhost_written_like/host_written_block_like(aliasing or seeding from the dead view), or hit a cachedPLACED_TEXTURESview still stuck inHOST_WRITTEN.resource::texture_atalso calledplaced_in_host_written(address, desc)unconditionally right afterseed_later, emitting a self-warning on views thatseed_laterhad already wired up to copy fromsource.texture::host_written_view(resource)forPLACED_TEXTURESviews (marksHOST_WRITTENand tracks(address, resource) -> bytesinHOST_WRITTEN_PLACEDwithout touchingHOST_WRITTEN_AT), use it inseed_laterandlist.rs'splaced_twinspaths, and only callplaced_in_host_writtenwhenseed_laterdid not handle the view.Title memory unmap / remap / free never notified
texture.rs(watch.rs,texture.rs)watch::title_memory_changed(title_memory_remapped/title_memory_unmapping) andwatch::title_memory_freednotifiedtexback,descriptor::host,inplace, andhwrt, but never invalidatedHOST_WRITTEN_ATorHOST_WRITTEN_PLACED.(address, desc), a cachedPLACED_TEXTURESview stayed inHOST_WRITTEN/WRITE_SUBMITTED, skippingupload_fromof the new title-memory texture and refusing idle/slot VRAM eviction indefinitely.texture::remapped(at, len)(with a lock-freeAtomicUsizefast path and read-firstRwLockchecks +max_bytes-bounded range scan for exact nested-interval overlap) called fromwatch::title_memory_changedandwatch::title_memory_freed(resolvinglen == 0viaallocation_endonly when host-written ranges exist).HOST_WRITTENandHOST_WRITTEN_AT/HOST_WRITTEN_PLACEDatomically consistent under strict lock order (HOST_WRITTEN->HOST_WRITTEN_AT->HOST_WRITTEN_PLACED), clearing both overlappingstale_sourcesandstale_viewsfromHOST_WRITTEN,WRITE_SUBMITTED,STAGING, andSEEDS(so still-live resources over remapped memory can also re-register on a later host copy).host_write_listed's deferredWRITE_SUBMITTEDinsert underHOST_WRITTEN.read()so a command list submitted afterremapped/forgetcannot re-insert an invalidated resource intoWRITE_SUBMITTED.texture::forgetso non-host-written resource releases avoid write-locking the host-written tables andSEEDS.How it was tested
origin/main): 25, 42, 50, and 8HERO LEADwarnings per 40 s run (100% caused by1024x10249-mip placed views left behind inHOST_WRITTEN_AT), plus falseseed_latermatches against stale entries.6ba5def7+ 2 combined runs with #4433 on latest commit7f7cb8ec, bothVICTORY_SAMPLED_EVICT=0and=1): 0, 0, 0, and 0HERO LEADwarnings, 0UPLOAD OVER HOST WRITE, character faces/skin/textures inspected clean on captured frames.cargo testpassed for the crates it touches: yes (cargo test -j 4 -p victory-gpu --locked --lib -- texture:: resource::tests:: watch::: 160 passed, 0 failed, 5 pre-existing ignored, including 3host_written_lifecycle_testscoveringseed_later/placed_twinsownership preservation, multi-view coexistence, nested/boundary/overflow remap ranges, source re-registration after remap, stale deferredWRITE_SUBMITTEDsuppression,forgetfast path, andtitle_memory_freed(base, 0);cargo clippy -j 4 -p victory-gpu --all-targets --locked --no-deps: 0 warnings in touched files;cargo run -p xtask -- policy --staged: ok).Checked for overlap
VICTORY_HOST_WRITTEN_REUSE=1heuristic that dropsHOST_WRITTEN_ATon a different-layout view; does not preventseed_later/placed_twinsfrom overwritingHOST_WRITTEN_ATwith immortalPLACED_TEXTURESviews or invalidateHOST_WRITTEN/HOST_WRITTEN_ATon memory remap/unmap/free).@tikD1337 on GitHub · 2026-11-30 20:51 UTC · original
Tested headlessly on
origin/main(e1251c31, Windows 11, no game run):origin/main.cargo test -p victory-gpu --lib -- watch::tests: 43 passed, 0 failed (1159 filtered).cargo test -p victory-gpu --lib -- texture::: 26 passed, 0 failed, 4 ignored (1172 filtered), including all 3 newtexture::host_written_lifecycle_tests. No new warnings.(AI-assisted build/unit-test check; game runtime not launched.)
7f7cb8ec3ato02c8ca5ac5@trustno1-coder on GitHub · 2026-12-01 18:41 UTC · original
Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
Pull request closed