GPU: cut pipeline creation allocations and CPU overhead #3396
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3396
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3396"
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?
@Desamodeth on GitHub · 2026-11-26 22:05 UTC · original
Desamodeth:opt/gpu-pipeline-create-stream→main· +682 −95 · 4 files · 1 commits · openSummary
During boot, a title can create ~60,000 pipeline states (create_stream) while drawing with only a small subset. Previously each graphics create_stream call allocated ~43 heap buffers (~10 KiB of transient churn and ~1.3 KiB retained):
(Orthogonal to #2211, #2974, #2986, #3005, and #3188.)
Verification (CPU-only, Windows 11 x64, Ryzen 7 9800X3D,
ustc 1.98.1 MSVC, base
63bcca43)Benchmarks (--release, synthetic create_stream / create_compute, counting GlobalAlloc)
Deterministic allocations & heap memory (exact before/after)
63bcca43)Interleaved Release timings (10 runs each: 5× main → pr + 5× pr → main, medians)
| Workload | main ( /
) | This PR ( /
Trade-offs
Claim: #1633
AI-assisted with Gemini 4 Neon
@Dukestar69 on GitHub · 2026-11-26 22:07 UTC · original · approved these changes
LGTM — verified on RTX 5090 (Windows / D3D12) against
origin/main(63bcca4).cargo test -p victory-gpu --lib pipeline:: -- --test-threads=1: 26 passed, 0 failed (includingsemantic_interning_reuses_common_and_caps_custom_names,write_describe_matches_debug_format, andkey_hex_roundtrip_and_rejection).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@passerbyyhx on GitHub · 2026-11-26 22:32 UTC · original
I tested early-cache compatibility in both directions between parent
63bcca43c6a00a758510398fa43096ce7e4f7df0and head92f218c54d56f34bec955621f2e46e2238977605on Windows D3D12 with an RTX 4090 Laptop GPU (621.14). Each direction used a fresh directory and three separate processes. The fixture exercises the real title key, early queue, library load, and save paths with synthetic compute and graphics shaders. Two graphics PSOs shared shaders and differed only in sample mask.The old and new builds produced identical keys. Both produced
B,Aon disk after two producer processes used A, then B. The opposite build started both before first use and recorded two real pipeline-library hits. The cold graphics PSO C was offered first and stayed unqueued until first use. It then made one new PSO, and the file saved asC,B,Ain both directions.Synthetic test fixture and runner
AI-assisted with Codex.
@Jackster on GitHub · 2026-11-26 22:52 UTC · original
Windows 11,
63bcca4+ this PR, Radeon RX 7900 XTX:cargo test -p victory-gpu --lib: 234 passed / 0 failed / 1 ignored (unpatched63bcca4here: 231 passed; +3).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.The three added tests are
pipeline::host::tests::semantic_interning_reuses_common_and_caps_custom_names,pipeline::host::tests::write_describe_matches_debug_formatandpipeline::library::tests::key_hex_roundtrip_and_rejection. The pipeline-creation path they cover is exercised on the device by the rest of the suite, which is green. Synthetic only. AI-assisted.@fuzeofficlal on GitHub · 2026-11-26 23:02 UTC · original · approved these changes
Reviewed
92f218c5merged ontomain(63bcca43) — clean allocation and CPU overhead reduction on pipeline creation.Verification
cargo xtask policy: 191 files ok;cargo check --locked --workspace --all-targets: ok;cargo clippy --locked -p victory-gpu --all-targets -- -D warnings(both default and--features diagnostics): 0 warnings.pipeline::unit tests passed on both a discrete NVIDIA RTX 5090 and WARP with--features diagnosticsandVICTORY_D3D12_DEBUG=1.GraphicsState::read(pipeline/host.rs:363-387),intern_semantic(pipeline/host.rs:183-202),write_describe/hash_describe(pipeline/host.rs:414-548),key_bytes(pipeline/make.rs:115-129), and lock-freeBEFORE: OnceLock<...>(pipeline/library.rs:501-536):f32values (+0.0,-0.0,NaN,±Inf, subnormals,MIN/MAX) and extremei32/u32bounds: byte-for-byte identical toDebugformatting andblake3(describe).GraphicsState::read(pastMAX_INTERNED_SEMANTICSinto the ownedself.namesfallback),key_bytes,note_created_key,wanted_early_key, andnote_used_key: 0 panics and deterministic keys across all threads.--releasemicrobenchmark on 10,000 iterations ofGraphicsState::read+key_bytesvsDebugformatting +blake3: 52.5 ms vs 70.1 ms (1.34×faster) with zero intermediateString/Vec<String>allocations.Minor non-blocking note
1..=255) inSemanticNameshowed 254/255 matchDebugbyte-for-byte (hash_describematchesblake3(describe)for all 255/255), with the single exception of ASCII single quote'(0x27), whichCStr'sDebugescapes as'. Adding&& b != b'''to the fast-path guard inpush_cstr_quoted(crates/victory-gpu/src/pipeline/host.rs:245) would make parity 100% exact even for non-HLSL semantic strings.LGTM.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.