perf: release-profile flags, AVX2 baseline, gate diagnostics allocato… #537

Closed
hqjake wants to merge 3 commits from upstream-pr/537 into main
hqjake commented 2026-11-28 00:31:20 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by hqjake on 2026-11-28T00:31:20Z.


…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().

  • Cache is now Arc 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 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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5534944395 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/537). Originally posted by [hqjake](https://github.com/hqjake) on 2026-11-28T00:31:20Z. --- …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(). - 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.
POMXARK commented 2026-11-28 02:11:04 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by POMXARK on 2026-11-28T02:11:04Z.


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 MiB default 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.7 with 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 (omitted panic = "abort", see note below)

Strictly 3D-only, draw-count-matched 12-minute A/B results

Bucket (3D only, fps < 20, draws >= 100) Baseline With x86-64-v3 + ThinLTO + cgu=1 Delta
ALL 3D (n=118 vs 113) 9.7 p50 / 10.30 mean (103.2 ms, Prep 81.6, copies 47.6) 11.2 p50 / 11.55 mean (89.1 ms, Prep 66.7, copies 35.3) +15.5% p50 (-14.1 ms)
Late 3D (last 30 samples) 7.9 p50 / 7.09 mean (126.7 ms, Prep 92.8, copies 60.7) 9.4 p50 / 9.20 mean (106.4 ms, Prep 73.0, copies 47.2) +19.0% p50 / +29.8% mean
High-draw 3D (7k–10k draws) (p50 ~8.35k) 8.45 p50 / 7.81 mean (118.6 ms, Prep 89.4) 9.30 p50 / 9.37 mean (107.4 ms, Prep 73.9) +10.1% p50 / +20.0% mean
Very-high-draw 3D (>=10k draws) (p50 ~11k) 7.20 p50 / 6.45 mean (139.9 ms) 7.80 p50 / 8.62 mean (127.6 ms) +8.3% p50 / +33.6% mean
Memory & stability SharedMax 9776 MB, 0 errors / 0 DevRem SharedMax 9261 MB, 0 errors / 0 DevRem clean, lower pressure

Two code-review notes

  1. panic = "abort" in [profile.release]: there are 6 active std::panic::catch_unwind sites in worker loops (crates/victory-gpu/src/descriptor.rs, host/aside.rs, list/thin.rs, land.rs, queue/behind.rs). Setting panic = "abort" turns any caught worker panic into an immediate process abort, so keeping default panic = "unwind" is safer.
  2. #[global_allocator] Counting in copystat.rs: in crates/victory-gpu/src/lib.rs, mod copystat; is already gated behind #[cfg(all(windows, feature = "diagnostics"))], so plain release builds were not compiling Counting (adding the inner #[cfg] inside copystat.rs is still harmless).
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7232188532 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/537#issuecomment-7232188532). Originally posted by [POMXARK](https://github.com/POMXARK) on 2026-11-28T02:11:04Z. --- 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 MiB` default 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.7` with 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` (omitted `panic = "abort"`, see note below) ### Strictly 3D-only, draw-count-matched 12-minute A/B results | Bucket (3D only, `fps < 20`, `draws >= 100`) | Baseline | With `x86-64-v3` + ThinLTO + `cgu=1` | Delta | |---|---:|---:|---:| | **ALL 3D** (`n=118` vs `113`) | `9.7` p50 / `10.30` mean (`103.2 ms`, `Prep 81.6`, `copies 47.6`) | **`11.2` p50 / `11.55` mean** (`89.1 ms`, `Prep 66.7`, `copies 35.3`) | **`+15.5%` p50** (`-14.1 ms`) | | **Late 3D (last 30 samples)** | `7.9` p50 / `7.09` mean (`126.7 ms`, `Prep 92.8`, `copies 60.7`) | **`9.4` p50 / `9.20` mean** (`106.4 ms`, `Prep 73.0`, `copies 47.2`) | **`+19.0%` p50 / `+29.8%` mean** | | **High-draw 3D (`7k–10k draws`)** (`p50 ~8.35k`) | `8.45` p50 / `7.81` mean (`118.6 ms`, `Prep 89.4`) | **`9.30` p50 / `9.37` mean** (`107.4 ms`, `Prep 73.9`) | **`+10.1%` p50 / `+20.0%` mean** | | **Very-high-draw 3D (`>=10k draws`)** (`p50 ~11k`) | `7.20` p50 / `6.45` mean (`139.9 ms`) | **`7.80` p50 / `8.62` mean** (`127.6 ms`) | **`+8.3%` p50 / `+33.6%` mean** | | **Memory & stability** | `SharedMax 9776 MB`, `0` errors / `0` DevRem | **`SharedMax 9261 MB`, `0` errors / `0` DevRem** | clean, lower pressure | ### Two code-review notes 1. **`panic = "abort"` in `[profile.release]`:** there are 6 active `std::panic::catch_unwind` sites in worker loops (`crates/victory-gpu/src/descriptor.rs`, `host/aside.rs`, `list/thin.rs`, `land.rs`, `queue/behind.rs`). Setting `panic = "abort"` turns any caught worker panic into an immediate process abort, so keeping default `panic = "unwind"` is safer. 2. **`#[global_allocator] Counting` in `copystat.rs`:** in `crates/victory-gpu/src/lib.rs`, `mod copystat;` is already gated behind `#[cfg(all(windows, feature = "diagnostics"))]`, so plain release builds were not compiling `Counting` (adding the inner `#[cfg]` inside `copystat.rs` is still harmless).

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
trustno1-coder/VIctory-NVIDIA!537
No description provided.