perf: release-profile flags, AVX2 baseline, gate diagnostics allocato… #537
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!537
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-537"
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?
@hqjake on GitHub · 2026-11-28 00:31 UTC · original
perf/release-tuning→main· +389 −2 · 5 files · 3 commits · closed without merging…r, cache single-flight
Four zero-code-risk changes aimed at the submission-prep wall (findings.md: 48 ms of a 55 ms water-scene frame).
Cargo.toml [profile.release]
lto = "thin", codegen-units = 1, panic = "abort", incremental = false.
Cross-crate inlining on the hot CPU path; drops landing pads from every
function in the hot command-list code.
.cargo/config.toml
target-cpu = x86-64-v3 for x86_64. The fork already assumes AVX2
(findings.md's title-byte compares); this lets rustc emit AVX2, BMI1/2
and FMA throughout, which is exactly what auto-vectorizes the prep
thread's dword scans and hashing.
crates/victory-gpu/src/copystat.rs
Gate the Counting global allocator and its backing arrays behind
cfg(any(feature = "diagnostics", test)). The allocator's own docstring
said "diagnostics builds only" but it was active in release, so every
allocation paid two atomics plus a small-block branch for stats nobody
reads outside the diagnostics build. Release now uses the system
allocator directly. Tests still install Counting under cfg(test).
crates/victory-pipeline/src/cache.rs
Single-flight per key + race-tolerant publish + peek().
Verification:
cargo test -p victory-pipeline -> 11/11 pass
cargo test -p victory-gpu -> 434/436 (two failing tests are
pre-existing live-D3D12 tests
that also fail on a clean
v2026.11.27.8 extraction)
cargo check --release -p victory-gpu -> clean, no new warnings
Expected: 5-10% off the submission-prep wall; neutral on GPU-bound scenes.
Four zero-code-risk changes aimed at the submission-prep wall (findings.md: 48 ms of a 55 ms water-scene frame). Cargo.toml [profile.release] lto = "thin", codegen-units = 1, panic = "abort", incremental = false. Cross-crate inlining on the hot CPU path; drops landing pads from every function in the hot command-list code. .cargo/config.toml target-cpu = x86-64-v3 for x86_64. The fork already assumes AVX2 (findings.md's title-byte compares); this lets rustc emit AVX2, BMI1/2 and FMA throughout, which is exactly what auto-vectorizes the prep thread's dword scans and hashing. crates/victory-gpu/src/copystat.rs Gate the Counting global allocator and its backing arrays behind cfg(any(feature = "diagnostics", test)). The allocator's own docstring said "diagnostics builds only" but it was active in release, so every allocation paid two atomics plus a small-block branch for stats nobody reads outside the diagnostics build. Release now uses the system allocator directly. Tests still install Counting under cfg(test). crates/victory-pipeline/src/cache.rs Single-flight per key + race-tolerant publish + peek(). - Cache is now Arc<Inner> with inflight: Mutex<HashMap<CacheKey, Arc<Mutex<()>>>>. Threads converting the same key serialize on the per-key mutex; the first converts and publishes, the rest double-check and return the published path. In the shader-cache startup burst this turns duplicate translations of the same container across threads into disk reads. - publish() recovers when rename() fails but the destination is already a plain file: the key is content-addressed, so the bytes match by definition. Removes spurious errors when a sibling process wins. - Cache::peek(&CacheKey) -> Option<PathBuf> for read-only lookup. - Miss trace parity, error context on create_dir_all and rename, poisoned-mutex tolerance via a small lock() helper. Verification: cargo test -p victory-pipeline -> 11/11 pass cargo test -p victory-gpu -> 434/436 (two failing tests are pre-existing live-D3D12 tests that also fail on a clean v2026.11.27.8 extraction) cargo check --release -p victory-gpu -> clean, no new warnings Expected: 5-10% off the submission-prep wall; neutral on GPU-bound scenes.Cache now exposes `get_or_convert_chunks(converter, &[&[u8]])` and `CacheKey::from_chunks`. Both hash the chunks in order with no concatenation; the result matches `CacheKey::new` on the same bytes joined end-to-end. On a cache miss the chunks are concatenated exactly once before `Converter::convert` runs; on a cache hit nothing is allocated. The sole consumer, victory-gpu's shader cache, previously did `let input = [&build[..], container].concat();` on every call to `cached(..)`, which allocated and memcpy'd the concatenation per shader request even on warm-cache hits. On a typical scene the game asks for shaders continuously through its own PSO pipeline, so this ran per graphics/compute pipeline creation. The call site now hands the two slices directly to `get_or_convert_chunks` and the concatenation only happens when the cache actually misses. Tests: - `chunks_hash_matches_concatenation_and_skips_concat_on_hit`: verifies the key matches the concatenated form, that convert runs with the concatenated bytes on miss, and that convert is not called on hit. - Existing `translations_come_back_from_the_cache` still passes, confirming the shader-cache call-site change is correctness-neutral. victory-pipeline: 12/12 pass victory-gpu shader_cache tests: 2/2 pass@POMXARK on GitHub · 2026-11-28 02:11 UTC · original · edited 2026-11-28 03:57 UTC
Testing feedback on AMD Ryzen 7 5700X (8C/16T), NVIDIA RTX 5080 16 GB, 32 GB RAM, Windows 11, Series X 1440p + DLSS Quality + DLSS MFG 4× (
4 MiBdefault windows,VICTORY_GPU_BCPACK=0,VICTORY_WAIT_RESIDENT=0,VICTORY_TEXTURE_ROOM_PERCENT=70,VICTORY_LAND_SKIP=1), full 12-minute (720 s) 3D A/B workload.Full disclosure: tested on a fork branch based on
v2026.11.27.7with local GPU patches, applying only the compiler profile subset of this PR:.cargo/config.toml:rustflags = ["-C", "target-cpu=x86-64-v3"]Cargo.toml[profile.release]:lto = "thin",codegen-units = 1(omittedpanic = "abort", see note below)Strictly 3D-only, draw-count-matched 12-minute A/B results
fps < 20,draws >= 100)x86-64-v3+ ThinLTO +cgu=1n=118vs113)9.7p50 /10.30mean (103.2 ms,Prep 81.6,copies 47.6)11.2p50 /11.55mean (89.1 ms,Prep 66.7,copies 35.3)+15.5%p50 (-14.1 ms)7.9p50 /7.09mean (126.7 ms,Prep 92.8,copies 60.7)9.4p50 /9.20mean (106.4 ms,Prep 73.0,copies 47.2)+19.0%p50 /+29.8%mean7k–10k draws) (p50 ~8.35k)8.45p50 /7.81mean (118.6 ms,Prep 89.4)9.30p50 /9.37mean (107.4 ms,Prep 73.9)+10.1%p50 /+20.0%mean>=10k draws) (p50 ~11k)7.20p50 /6.45mean (139.9 ms)7.80p50 /8.62mean (127.6 ms)+8.3%p50 /+33.6%meanSharedMax 9776 MB,0errors /0DevRemSharedMax 9261 MB,0errors /0DevRemTwo code-review notes
panic = "abort"in[profile.release]: there are 6 activestd::panic::catch_unwindsites in worker loops (crates/victory-gpu/src/descriptor.rs,host/aside.rs,list/thin.rs,land.rs,queue/behind.rs). Settingpanic = "abort"turns any caught worker panic into an immediate process abort, so keeping defaultpanic = "unwind"is safer.#[global_allocator] Countingincopystat.rs: incrates/victory-gpu/src/lib.rs,mod copystat;is already gated behind#[cfg(all(windows, feature = "diagnostics"))], so plain release builds were not compilingCounting(adding the inner#[cfg]insidecopystat.rsis still harmless).Pull request closed