gpu(pipeline,sampler): deduplicate host root signatures and cache OPTIONS19 #158
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: launcher
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
run report
security: hold
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs gpu test
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/Androtim--MiniVI!158
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/158/head"
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?
@Androtim on GitHub · 2026-11-29 19:28 UTC · original
Androtim:feat/iter156-gpu-root-signature-cache-options19→main· +1460 −26 · 4 files · 1 commits · closed without mergingPort
815f58ceto deduplicate hostID3D12RootSignatureCOM objects / blobs and cacheD3D12_FEATURE_DATA_D3D12_OPTIONS19(AnisoFilterWithPointMipSupported) perID3D12Device:Changes
crates/victory-gpu/src/sampler.rs(aniso_point_mip): CacheOPTIONS19query results perID3D12Device(retaining a COM reference so raw pointers cannot suffer ABA reuse across test/live devices).crates/victory-gpu/src/pipeline/host.rs(root_signature): DeduplicateID3D12RootSignatureCOM objects and serialized blobs (Arc<[u8]>) across pipelines keyed on(device_raw, flags, params, static_samplers)(VICTORY_ROOT_CACHE=0to disable), skipping redundant serialization andCreateRootSignaturecalls while preservingID3D12PipelineLibrarynames.crates/victory-gpu/src/host.rs(HostList::bind_pipeline): Deduplicate shared root-signature COM retention inHostList::deferred.kept.crates/victory-gpu/src/draw.rs: Track#[cfg(test)] root_binds/host_roots()for root-signature rebind tests.Verification
cargo +1.98.1-x86_64-pc-windows-gnu run --locked -p xtask -- policycargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --locked -- pipeline::host::cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --locked -- sampler::cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --locked -- draw::cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --locked -- host::cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --locked --all-targets -- -D warnings(default features and--all-features)@Androtim on GitHub · 2026-11-29 20:05 UTC · original · edited 2026-11-30 02:04 UTC
Automated triage for the maintainers (not an approval).
Verdict:
needs-gpu-test· CI (check):passingSummary
Solid, well-tested implementation that deduplicates host
ID3D12RootSignatureCOM objects and serialized blobs across pipelines with identical layouts, avoids redundant root-signature retention inHostList::deferred.kept, and fixesaniso_point_mipto cacheD3D12_OPTIONS19perID3D12Device.Code Review
crates/victory-gpu/src/pipeline/host.rs(root_sig_key,RootSigKeyBuf,root_signature_in):root_sig_keybuilds a self-delimiting, bit-exact key over(device_raw, flags, params, static_samplers), using.to_bits()for float sampler fields (MipLODBias,MinLOD,MaxLOD), validating non-nullpDescriptorRangeswhenNumDescriptorRanges > 0, and guardingD3D12_STATIC_SAMPLER_DESCsize with a compile-timeassert!.RootSigKeyBufavoids heap allocation on cache hits via a 256-u32inline buffer andHashMap<Box<[u32]>, CachedRootSig>::get(key.as_slice()).CachedRootSigretains_device: ID3D12Deviceto prevent raw-pointer ABA reuse across devices, andentry(...).or_insert_with(...)ensures concurrent cold misses converge on a single canonicalID3D12RootSignatureandArc<[u8]>blob while preservingsuper::library::namekeys.VICTORY_ROOT_CACHE=0cleanly bypasses the cache.std::process::Command::new(dxc)is in#[cfg(test)] fn compile_named, matching the existing#[cfg(test)] fn compilehelper onmain.crates/victory-gpu/src/sampler.rs(aniso_point_mip):OnceLock<bool>with a lock-freeFIRSTfast path plus anOTHERSRwLock<Vec<...>>fallback, retainingHeldDevice(ID3D12Device)per entry to prevent ABA pointer reuse.crates/victory-gpu/src/host.rs(HostList::bind_pipeline):Deferred::boundto deduplicate sharedID3D12RootSignaturepushes intodeferred.kept. Because bothpsoandrootremain live indeferred.keptuntil reset, their COM pointers cannot alias or be reused mid-recording.crates/victory-gpu/src/draw.rs(State):root_binds,host_roots()) with zero non-test runtime impact.Verdict
Logic, thread safety, and CI look good. Because this changes D3D12 host root-signature sharing,
ID3D12PipelineLibraryreload inputs, andSet*RootSignatureelision across PSO switches, a local real-GPU smoke test is recommended before merging.Generated with Antigravity CLI (
agy).@Androtim on GitHub · 2026-11-29 21:28 UTC · original
Now conflicts with updated
mainafter the Wave 5 GPU merges. Please rebase onto latestmain.@Androtim on GitHub · 2026-11-30 09:17 UTC · original
Now that
#173merged ontomain,crates/victory-gpu/src/pipeline/host.rs:1813needscode_tableinitialized onHostShader. Please rebase onto latestmain.@Androtim on GitHub · 2026-12-01 01:38 UTC · original
Closing stale/conflicted backlog PR per #276. Superseded by the active root-architecture replacement pillars with isolated plain --release A/B verification.
Pull request closed