GPU: merge shadow write-back bytes in AVX2 vectors with scalar fallback #1867
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!1867
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1867"
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?
@VlREX on GitHub · 2026-11-24 23:49 UTC · original
VlREX:perf/avx2-shadow-merge→main· +118 −8 · 2 files · 4 commits · openVectorize CPU-side GPU shadow write-back merging with AVX2, processing 32 bytes per iteration with runtime CPU detection and scalar fallback. Native C AVX2 equivalent verified against all 16,777,216 possible byte triples and 4,416 alignment/length cases, zero mismatches. Three Rust regression tests included. Native Rust integration and GPU performance benchmarks pending. No new dependencies or game assets. AI-assisted (ChatGPT).
@upipibi on GitHub · 2026-11-25 00:10 UTC · original
Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at
eabd870:cargo test -p victory-gpu --lockedgives 79 passed, 2 failed, 1 ignored. The two failures are the NVIDIA heap-cap onesmainalso has (descriptor::host::tests::dynamic_slots_are_held_until_releasedandmemory::tests::lists_share_a_table_and_copies_keep_their_views, #1744), so there is nothing new on this hardware. Not run: a title.AI-assisted (Claude Code).
@Marvisak on GitHub · 2026-11-25 07:18 UTC · original · edited 2026-11-25 22:18 UTC
Automated triage for the maintainers.
Needs rebase. This PR no longer merges cleanly into
main(conflict incrates/victory-gpu/src/shadow.rs). It will be reviewed again once it is rebased.From the earlier needs-work note, still open: post before/after copy-back timings from a release build, and update the title, description and test name, which still describe AVX2 vectors.
Generated by Claude Code
@catminou4 on GitHub · 2026-11-25 00:32 UTC · original · reviewed
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Shadow write-back bytes merged in AVX2 (docs+gpu): SIMD merge of shadow ranges — pairs with #1382's batched barriers.
@upipibi on GitHub · 2026-11-26 17:46 UTC · original
Release-build copy-back timings: std-only bench, bodies copied verbatim, workspace
[profile.release]. Ns per call net of a memcpy baseline, median of 41 interleaved samples. Scalar = the loop this PR replaces (70564ae0), PR =mergeatea57fd91.Asm (baseline SSE2): the old loop is only partly vectorized. LLVM does the compares 16 bytes at a time, but it scalarizes the conditional
*t = *hinto 16 test/branch/byte-store sequences per block.mergecompiles to a branch-free pcmpeqb/pand/pandn/por loop.However,
mainalready has a branch-freemerge_writeback(#2054). It runs 2-8 % faster than this PR'smergein 35 of 36 session-case pairs, so after a rebase this PR adds no speed.A second session kept the ratios, but its absolute times ran up to 64 % higher (loaded machine).
Ryzen 9 5950X with AVX2, rustc 1.98.1, high priority, pinned to one core. Inputs are synthetic.
AI-assisted (Claude Code, Claude Opus 5.5).
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.