gpu: add SSE2 fallbacks for fault-tolerant memory kernels #564

Open
Khayoon wants to merge 1 commit from upstream-pr/564 into main
Khayoon commented 2026-12-03 14:24:43 +00:00 (Migrated from github.com)

Imported from readmet3xt-lab/foxhound. Originally posted by Khayoon on 2026-12-03T14:24:43Z.


The host-memory put, change-detection, merge and comparison paths currently assume AVX2. On a baseline x64 CPU, a valid call can therefore raise an illegal-instruction exception before it can report a memory fault.

Add SSE2/GPR implementations selected when AVX2 is unavailable, with VICTORY_HOST_BASELINE=1 available to exercise them on newer CPUs. The existing AVX2 path stays selected by default on supported CPUs. The new leaf kernels use the same write-watch fault exits and preserve changed-dword-only writes, completed-record snapshots and merge counts. The plain copy kernel is unchanged.

Five synthetic regressions exercise changed-dword selection, an incomplete record straddling an inaccessible page, merge byte selection and counts, failed-block snapshot/count preservation, and bounded comparison reads at a page edge. They call the baseline kernels directly, including on AVX2 runners.

This is host-runtime portability work. It does not by itself enable all guest instructions on an older CPU or establish a frame-rate improvement.

Validation on Intel i7-3930K (AVX1, no AVX2), Windows 10 build 19045, Rust 1.98.1, baseline compiler target:

  • cargo test --locked -p victory-gpu --lib safecopy::tests -- --test-threads=1 --nocapture: 13 passed, 0 failed, 1 ignored (the measurement).
  • Red: the unchanged upstream safecopy::tests::only_changed_dwords_are_put public-API test exits with 0xc000001d / STATUS_ILLEGAL_INSTRUCTION on this CPU. Green: the patched suite passes before and after that comparison.
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings: passed.
  • cargo run --locked -p xtask -- policy: 329 files OK. git diff --check: passed.
  • Separate read-only source review found no blocking correctness issue. No GPU/game run or performance benchmark was used.

AI-assisted: yes. Port prepared with OpenAI Codex; separate read-only review by GPT-6.1 Sol.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:issue:5628392192 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/pull/564). Originally posted by [Khayoon](https://github.com/Khayoon) on 2026-12-03T14:24:43Z. --- The host-memory put, change-detection, merge and comparison paths currently assume AVX2. On a baseline x64 CPU, a valid call can therefore raise an illegal-instruction exception before it can report a memory fault. Add SSE2/GPR implementations selected when AVX2 is unavailable, with `VICTORY_HOST_BASELINE=1` available to exercise them on newer CPUs. The existing AVX2 path stays selected by default on supported CPUs. The new leaf kernels use the same write-watch fault exits and preserve changed-dword-only writes, completed-record snapshots and merge counts. The plain copy kernel is unchanged. Five synthetic regressions exercise changed-dword selection, an incomplete record straddling an inaccessible page, merge byte selection and counts, failed-block snapshot/count preservation, and bounded comparison reads at a page edge. They call the baseline kernels directly, including on AVX2 runners. This is host-runtime portability work. It does not by itself enable all guest instructions on an older CPU or establish a frame-rate improvement. Validation on Intel i7-3930K (AVX1, no AVX2), Windows 10 build 19045, Rust 1.98.1, baseline compiler target: - `cargo test --locked -p victory-gpu --lib safecopy::tests -- --test-threads=1 --nocapture`: 13 passed, 0 failed, 1 ignored (the measurement). - Red: the unchanged upstream `safecopy::tests::only_changed_dwords_are_put` public-API test exits with `0xc000001d / STATUS_ILLEGAL_INSTRUCTION` on this CPU. Green: the patched suite passes before and after that comparison. - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings`: passed. - `cargo run --locked -p xtask -- policy`: 329 files OK. `git diff --check`: passed. - Separate read-only source review found no blocking correctness issue. No GPU/game run or performance benchmark was used. AI-assisted: yes. Port prepared with OpenAI Codex; separate read-only review by GPT-6.1 Sol.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/564:upstream-pr/564'
git switch 'upstream-pr/564'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/564'
git switch 'upstream-pr/564'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/564'
git switch 'upstream-pr/564'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/564'
git switch 'main'
git merge --squash 'upstream-pr/564'
git switch 'main'
git merge --ff-only 'upstream-pr/564'
git switch 'main'
git merge 'upstream-pr/564'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
readmet3xt-lab/foxhound!564
No description provided.