loader: emulate AMD-only instructions on Intel CPUs #10
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!10
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/10/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?
@ismailchaka1 on GitHub · 2026-11-23 22:53 UTC · original
ismailchaka1:emulate-amd-only-instructions→main· +109 −1 · 1 files · 1 commits · merged 2026-11-23 23:08 UTCThe title is built for Zen 2 and uses AMD-only instructions that Intel CPUs lack. On an i7-14700KF it died at startup with an illegal instruction (
0xc000001d). It hit them one after another:clzero, thenmonitorx, then SSE4a'sinsertq.The vectored handler in
crates/victory-loader/src/crash.rsnow does their job and resumes:clzero(0f 01 fc) zeroes the 64-byte line atrax.monitorx(0f 01 fa) is skipped andmwaitx(0f 01 fb) yields. Both are only wait hints.extrq/insertq(register forms, with an optional REX prefix) run on the saved XMM registers.Anything else still reaches the crash report as before. Each emulated instruction costs an exception, so a hot loop would be slow; the title got through startup without noticeable delay.
Testing
cargo test -p victory-loader --lib crash: a new test runs each instruction and checks the result. It passes whether the CPU runs the instruction natively or the handler emulates it.VICTORY_D3D12_DEBUG=1on WARP, the debug layer reports compute shaders that want 64-lane waves, which the README already lists as a requirement.This change was written with AI assistance (Claude Code).
🤖 Generated with Claude Code
@jeremygold02 on GitHub · 2026-11-23 23:04 UTC · original · edited 2026-11-23 23:10 UTC
Verified on a second Intel system with a direct parent/head comparison. Windows 11, Core Ultra 7 265K, GeForce RTX 5070, NVIDIA 621.01. Both launchers were built locally with
--locked --profile diag --features diagnosticsand ran on the hardware adapter with no game memory cap.015d45b(parent)0xc000001d, before the first present. The instruction at the fault wasCLZEROin both the input image and the prepared copy. This CPU reports the CLZERO feature bit clear.934e67f(PR head)clzero_zeroes_its_line_on_any_cpuregression passed. With the same input, the title reached at least 128PresentXcalls; the host recorded 382 draws and 76 dispatches through that checkpoint. I ended the run at the capture checkpoint.The eight 1920×1080 present-source readbacks at frames 1, 2, 4, 8, 16, 32, 64 and 128 were uniformly black.
A follow-up run used the combined source tree now on
mainatd348b9a(identical Git tree365099f). Frame 256 showed the legible first-boot screen-narration/account menu on this RTX 5070. Both captured RGBA render targets matched the present-source image pixel for pixel. The menu ran at about 30 fps; the early black transitions at frames 357, 573, 789 and 1005 matched the cadence in #11. The 40-second observation ended at the time limit. Gameplay and longer-term GPU stability were outside this check.