CLI: check every extension the title uses unchecked, not only AVX2 (depends on #238) #558
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!558
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/558/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?
@mercuryVM on GitHub · 2026-11-24 04:53 UTC · original
mercuryVM:cli/cpu-check-measured-features→main· +150 −3 · 2 files · 3 commits · closed without mergingDepends on #238 (this branch is #238's commit plus one on top; once #238 lands, only the second commit remains).
#238 stops
victory run --executeon a CPU without AVX2. The title needs more than that, and it does not ask first, so a CPU missing any of the rest still dies onSTATUS_ILLEGAL_INSTRUCTION(#102, #103, #106, #108, #210 are crashes of this kind).What the title uses (Grand Theft Auto VI 1.0.2.1, measured)
dumpbin /disasmover the executable's code: 26.7 M instructions,cpuidfrom 9 places only. Counts only, nothing of the title quoted:avx2)bextr,andn,tzcnt,blsr, ...)shlx,mulx,shrx,rorx,bzhi,pext, ...)aes)cpuid; requiring it would turn away Haswell CPUs that may run fineinsertq19,clzero10,clwb8,monitorx/mwaitx2+2victory_loader::crashemulates them on mainChange
REQUIRED_FEATURESlists the ten;missing_cpu_features()detects each withis_x86_feature_detected!; the error names every missing one (not just the first), andVICTORY_SKIP_CPU_CHECK=1still bypasses it.check_cpu_features_withcases (nothing missing, AVX2 missing, several missing named, skip), the host check, and that the list has no duplicates.Tested
c27c9dfon Windows 11, Rust 1.98.1, AMD Ryzen + RTX 5070:cargo test --workspace271 passed, 0 failed;rustfmt --checkon the changed file;cargo xtask policyok. Not run against the title (no package on this machine), and I have no CPU without these extensions to see the message on real hardware.Note:
cargo fmt --all -- --checkfails on main itself (31 files); this PR does not touch them.🤖 Generated with Claude Code
@mercuryVM on GitHub · 2026-11-24 12:54 UTC · original
@catminou4 thanks for the review. CI hasn't run on this PR yet; I think fork PRs wait for a maintainer to approve workflow runs. Here is the same check locally on Windows 11 x64 (AMD CPU, RTX 5070, rustc 1.98.1 MSVC), head
fa83a31(main8e79c80merged in), with the CI's own commands:cargo clippy --workspace --all-targets --locked -- -D warningsand the--all-featuresvariant are clean, andcargo test -p victory --lockedhas 8 passed, the CPU-check tests among them.AI-assisted (Claude Code).
@hadrianhola on GitHub · 2026-11-24 20:30 UTC · original
On the open question in the table ("may be picked by
cpuid"): it is. Static analysis ofgame_scarlett_master.exe1.0.2.1 (dumpbin /disasm, the same 26.7 M instructions and the same counts as above), counts only:cpuidsites, 3 are the MSVC CRT's__isa_availablesetup. 4 belong to a feature-detection routine of the library that holds the ADX code: it tests leaf/register/bit one at a time and records AVX, AVX2, RDRAND, RDSEED, BMI1, BMI2, AES, ADX (leaf 7 EBX bit 19), MOVBE and SHA as bits of one flags word. The other 2 read leaf 7 subleaves 0/1 for AVX2, BMI2, AVX-512 and VNNI, and record nothing for ADX.adcx/adoxsit in one 0.26 MB block. Building the control flow of that block gives the addresses from which an ADX instruction can be reached. All 289 direct code references from outside the block into those addresses go through a function that reads the flags word and tests a mask that includes ADX, within at most 8 call levels. ADX is always tested together with BMI2 (0x50), or with AVX2 and BMI2 (0x52), and the other branch takes a generic path. I checked one dispatcher by hand:not flags; test flags, 0x52; jnz generic..rdata/.datapoints into ADX-reachable code. Three 32-bit values do, but they land in the middle of unrolledmulx/adcxruns with no indirect jump around them, so they look coincidental.So a CPU without ADX (Haswell, as in #68) should take the generic path. Leaving ADX out of
REQUIRED_FEATURESlooks right. The CPU here is a Haswell-E i7-5820K (no ADX, CPUID-checked); the title has not been run on it yet.AI-assisted (Claude Code); analysis on my machine, nothing of the title quoted.
@Marvisak on GitHub · 2026-11-25 00:24 UTC · original
Automated triage for the maintainers. Closing because another open pull request covers the same change.
See #238. #238's commit plus checks for FMA, BMI1/2, F16C, LZCNT, POPCNT, MOVBE, AES and PCLMULQDQ, which by its own comment every AVX2 CPU has, so the added checks cannot fire where #238's does not; also edits the README to say
victory runchecks them. Take #238.If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed