Select the Windows game library automatically for v2 and v3 CPUs #11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "MilqueAndToast/fe3h-recomp:codex/windows-without-avx2"
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?
Codex here. Refs #2.
What this changes and why
The standard Windows ZIP now works with both CPU targets. The launcher selects v3 on supported CPUs and x86-64-v2 on older CPUs that meet the v2 requirements. Existing v3 installations keep their game DLL and cache ID. The v2 library has its own filename and cache ID. Set
LARECOMP_FORCE_X86_64_V2=1to exercise that path on a modern CPU.The v2 build uses software fused multiply-add from musl, including its FreeBSD-derived single-precision routine, to preserve the game’s rounding behavior. The package includes the notices.
Tested on
5653d8balso loaded that same DLL unchanged. We verified startup through the game DLL load. Title-screen rendering in the VM and gameplay on a physical i5-2400 remain unverified.make test-mods, andmake distpassed.To reproduce the 72,000-case v3 check from the repository root with Clang on
PATHand the project’s Python dependencies installed:All 72,000 cases matched Unicorn. Commit
05b6e67updates the test harness’sfnprof_hitstub to matchruntime/cpu.h, so the command works from a clean checkout. We kept that fix in its own commit and are happy to split it out if you prefer.generated/), extracted files, assets or logs containing game code are included.@MilqueAndToast Thanks, this is great work. The software FMA matching all 72,000 cases is exactly the hard part, and the licence notice is handled right.
On your question: I'd rather not ship a separate download. The updater always fetches the standard zip, so anyone on a v2 package would be "updated" onto the AVX2 build and it would stop starting. Players could also pick the wrong zip.
Since the game code is built on the player's PC anyway, could the target be chosen there instead?
zig/rtandzig/rt-v2), each built by zig_slim.sh for its own CPU..gamelib-idmeans every generator edit rebuilds the whole runtime; only the target should trigger that.Once that works under SDE, we'd put out a pre-release for Barthomero (#2) to try on his i5-2400. No promises on performance there, but at least it would start.
Codex here. Thanks for explaining the updater behavior. We’re working on a single Windows package that selects the CPU target automatically. We traced the v3 cache ID difference to two trailing spaces in the 0.2.7 Makefile. Setting the same v3 target explicitly dropped those spaces from the hash input. Our local build now produces the same v3 cache ID as the released version. We’re checking that upgrading a stock 0.2.7 install reuses its existing game DLL without recompiling.
Codex here. The single Windows package is ready for review at
874a66a. Under Intel SDE’s Sandy Bridge profile, the launcher automatically selected v2 from an empty cache, built the game DLL, and reached the title screen and Prologue. SDE reported no unsupported instructions during setup or either launch.We also upgraded a stock 0.2.7 v3 install, forced v2 once, then switched back to v3 in the same folder. Both v3 launches reused the original DLL. Its hash and timestamp stayed the same, and neither launch started the generator or compiler. Gameplay and performance on a physical i5-2400 are still unverified.
@MilqueAndToast Thanks, this is exactly the shape I hoped for, and the v3 id check is a great catch. We reviewed the whole diff (plus an independent review); nothing wrong on the normal path. A few things before we test it here:
reserve_guest_space(constructor 101, main.c) and the C++ static initializers (ImGui / UI, built with -march=x86-64-v2). On a pre-v2 CPU that could crash before the message. Could the check move into aconstructor(100)in windows.c?-nhmor-wsm), since Sandy Bridge has AVX and the README now promises any v2 CPU.Once those are in, we'll test it on our AMD and NVIDIA PCs and put out a pre-release for users.
WIP: Add an optional Windows build target for CPUs without AVX2to WIP: Select the Windows game library automatically for v2 and v3 CPUsCodex here. Thanks for the review and for offering to test on AMD and NVIDIA.
333d7adis ready for that testing.constructor(100)inwindows.c, which is compiled for baseline x86-64. We checked the linked Windows executable and confirmed the guard runs beforereserve_guest_spaceand all six C++ UI initializers.compiler_rtsuppliesfmaandfmaf; MinGW suppliesfmal. Without the v2 helpers we reproduced a NaN for finite double inputs and incorrect rounding for single-precision midpoint cases. The helpers matched the reference in all four rounding modes.-nhm. The launcher selected v2, but Windows still advertised host AVX to the generator’s C runtime, andlasgen --helptrapped in its AVXmemcpy. The launcher also stopped under SDE with an OSXSAVE error. We then booted Windows 10 in a Nehalem VM where both CPUID and Windows reported AVX unavailable. The same generator selected its non-AVXmemcpy, passed--help, and processed the completesubsdk0module. All 248 outputs matched the native run byte for byte. A full first-launch build and gameplay on a no-AVX CPU remain unverified.runtime/gamebuild.h. The header now names both Windows outputs:fe3hgame-v2.dllfor v2 andfe3hgame.dllfor v3.@MilqueAndToast Thanks, that covers everything, and the Nehalem VM run is a better test than SDE could give. #19 is merged now, so #11 conflicts in
tools/zig_slim.sh: could you rebase onto the currentfe3hbranch and drop the duplicate part?05b6e676d4to5653d8bd81Codex here. Rebased #11 onto
8e78dbd(0.2.8) and dropped our duplicate Zig packaging commit. The script now uses the path fix merged in #19 for both CPU targets. At5653d8b, the Windows ZIP built successfully, the mod tests passed, and both the v2 and v3 slim compilers linked a DLL from an empty cache after relocation.WIP: Select the Windows game library automatically for v2 and v3 CPUsto Select the Windows game library automatically for v2 and v3 CPUsView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.