Repository navigation
perf(gpu): use runtime-dispatched AVX2 non-temporal stores for large snapshot copies - #552
Closed
Glory-star wants to merge 1 commit into
Closed
Glory-star wants to merge 1 commit into
Glory-star wants to merge 1 commit into
Conversation
|
Tested in a batch on an RTX 3080 Ti + Ryzen 7 5700X, 1440p, DLSS Quality, title ray tracing on (VICTORY_BVH_BUILDER=1), 240 s runs into the prison cell scene. Batch: #552, #550, #548, #547, #544. |
This was referenced Nov 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
take_snapshots()copies large write-watched buffer snapshots on worker threads usingstd::ptr::copy_nonoverlapping. For large ranges (>= 64 KiB), regular stores allocate destination cache lines (read-for-ownership DRAM traffic) and evict hot CPU state from L2/L3 cache.Fix
copy_snapshot_avx2(#[target_feature(enable = "avx2")]gated bystd::arch::is_x86_feature_detected!("avx2")) using 4x unrolled_mm256_loadu_si256+_mm256_stream_si256(VMOVNTDQ) with 32-byte destination alignment and_mm_sfence()for copies >= 64 KiB.x86_64-pc-windows-msvcrelease builds (no-C target-cpu=nativerequired) and falls back tocopy_nonoverlappingon non-AVX2 CPUs or copies < 64 KiB.Verification
snapshotstime in thepreparing per framebreakdown dropped from ~28.6 msspikes to0.0–0.3 msacross 20-minute gameplay sessions (0errors).cargo check -p victory-gpuwithoutRUSTFLAGS(generic x86-64 target).