Skip to content

[CI only] Validate AVX2 shadow merge - #5

Draft
VlREX wants to merge 4 commits into
mainfrom
perf/avx2-shadow-merge
Draft

VlREX wants to merge 4 commits into
mainfrom
perf/avx2-shadow-merge

Conversation

@VlREX

@VlREX VlREX commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Motivation

The shadow copy-back merge runs byte by byte after reading a changed GPU piece. Replace only this arithmetic loop with a 32-byte AVX2 path and scalar fallback. This is complementary to Marvisak#1656 (allocation and write-span reduction), not a replacement for its work.

Semantics

For every byte, keep the current CPU byte when host equals the old snapshot; otherwise take the host GPU byte. Synchronize both output slices and return true iff title bytes changed. Runtime feature detection, unaligned bounded vector loads/stores, scalar tail. No changes to synchronization, copy ranges, GPU commands or page tracking.

Validation

A native C AVX2 equivalent was compiled with GCC -O3 and executed on an AVX2-capable CPU: all 16,777,216 possible byte triples, and 4,416 length/alignment cases (4,880,384 processed bytes with guard checks) agreed with the scalar or mathematical oracle. Three Rust tests added, including the same length/alignment corpus. Native Rust compilation/Clippy and D3D12 integration tests remain pending. No game data, no new dependency, no measured FPS claim; the compiler may already vectorize scalar code. AI-assisted (ChatGPT).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant