compilemem: isolate transient compile spikes & guard deferred compiles from refused/retry #2578
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!2578
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2578"
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?
@steven-seagull27 on GitHub · 2026-11-29 14:34 UTC · original
steven-seagull27:fix/compilemem-estimator-and-deferred-refusal→main· +311 −37 · 3 files · 1 commits · merged 2026-11-30 14:12 UTCSummary
Fixes two tightly-coupled bugs in the shader-compile memory guard and pipeline failure reporting paths:
1. Prevent concurrent persistent allocations from poisoning
compilemem::Estimator(crates/victory-gpu/src/compilemem.rs)State::finishcomputedpeak.saturating_sub(r.private_at_start) / r.overlap.max(1)from whole-processPrivateUsage. When a shader compile overlapped a persistent allocation burst (such as buffers or textures committed while loading a scene), the compile was billed for gigabytes of unrelated persistent memory, inflatingEstimator::expected()for the rest of the session, throttling concurrent compilation, and trippingCOMMIT_FLOOR_MBprematurely.Create*PipelineStatereturns whereas persistent allocations stay committed atprivate_now,State::finishnow measures the transient compile spike abovebaseline = r.private_at_start.max(private_now):peak - max(start, now)).private_at_startare not overcounted as compile scratch.max(start, now)continue to be measured and shared across overlapping compiles.K32GetProcessMemoryInfo/figures_nowpolling insampler()andline()when no compiles are running.2. Do not falsely record memory-guard deferrals as permanent
0x8007000Efailures or bypasscompilememon retry (crates/victory-gpu/src/pipeline/host.rs,crates/victory-gpu/src/pipeline/refused.rs)compilemem::begindefers a compile,library::pipelinereturnsErr(memguard::refusal())(E_OUTOFMEMORY) with thread-localmemguard::deferred() == truesopipeline::makeretries it afterRETRY_AFTER_MS. However,HostPipeline::newcalledrefused::failed(...)andrefused::retry(...)unconditionally on error (compute, mesh, graphics, root signature):host pipeline failed (0x8007000e)inpipeline::refused.VICTORY_SHADER_CAPS=1was enabled,refused::retrycalledCreateComputePipelineState/CreateGraphicsPipelineStatedirectly on the driver, bypassingcompilememandmemguard.HostPipeline::newpipeline error handling throughon_pipeline_error, which returnsNoneimmediately whencrate::memguard::deferred()is true without recording a refusal or callingrefused::retry, while leaving the thread-local flag intact forpipeline::make'smemguard::take_deferred().crate::memguard::deferred()guards topipeline::refused::failedandpipeline::refused::retryas well.Testing
All tests are synthetic unit tests run in isolation (
--test-threads=1):cargo test --locked -j 2 -p victory-gpu --lib -- compilemem --nocapture --test-threads=1— 13 passed, 0 failed (including new tests for concurrent persistent growth, transient spike on top of persistent growth, fast unsampled compiles, unrelated frees below start, and overlapping compiles with persistent growth).cargo test --locked -j 2 -p victory-gpu --lib -- memguard --nocapture --test-threads=1— 6 passed, 0 failed.cargo test --locked -j 2 -p victory-gpu --lib -- pipeline:: --test-threads=1— 73 passed, 0 failed, 2 ignored (including new tests inpipeline::hostandpipeline::refusedverifying that deferred errors are not recorded inrefused, never invoke the retry closure, and preservememguard::deferred()fortake_deferred()).cargo clippy --locked -j 2 -p victory-gpu --lib --tests— passed with 0 warnings in touched files.git diff --check— clean.1. Measure compile memory usage as the transient spike above max(private_at_start, private_now) in compilemem::State::finish so concurrent persistent allocations (e.g. world-load buffers/textures) do not poison the estimator, and skip idle process_memory() polling in sampler()/line() when no compiles are running. 2. Guard pipeline::host error handling and pipeline::refused::{failed,retry} on memguard::deferred() so memory-guard deferrals return None cleanly without falsely recording permanent 0x8007000e failures or invoking the VICTORY_SHADER_CAPS direct-create retry (bypassing compilemem), while preserving the thread-local deferred flag for pipeline::make::take_deferred().