Skip to content

FEX-2405

Compare
Choose a tag to compare
@Sonicadvance1 Sonicadvance1 released this 03 May 02:34
· 1873 commits to main since this release
7c79e5d

Read the blog post at FEX-Emu's Site!

One month older and we have a new release for FEX. This month is a little bit slower for user facing features but behind the scenes we had a large amount of refactoring to facilitate future improvements.

Support OpenGL and Vulkan thunking with forwarding X11

A thorn in FEX's side has been forwarding X11 calls when thunking OpenGL and Vulkan. This has caused us pain since X11's API is a fairly leaky
abstraction that leaks data symbols which FEX's thunking can't accurately thunk. We have now instead redirect the X11 Display object directly in
OpenGL and Vulkan. This not only reduces the amount of code we need to thunk, but also is required for us to eventually thunk 32-bit libraries.

This may change behaviour in some games when thunks are enabled, so it will be useful to do some testing and regression testing.

Enable Enhanced REP MOVS when memcpy TSO is disabled

Alongside last month's optimization when optimizing memcpy instructions, we now enable this CPUID bit when memcpy TSO emulation is disabled. This
means that glibc will take advantage of the optimization when it is doing memcpy and memset operations. This is a minor performance improvement
depending on the application.

Implement support for SMSW instruction

This instruction isn't too notable since all it does on recent x86 CPUs is return the same data no matter what, but legacy CPUs it was useful for
checking if x87 was supported. As this is considered a system level instruction, FEX didn't implement it originally but we finally found a game that
uses it. The original Far Cry game from 2004 uses this instruction for some reason. Now that we have implemented the instruction the game at least
gets to the menus but seems to still stall out when going in-game. Kind of neat!

Fary Cry running under FEX

Fix disabling TSO emulation on some stack accesses

When emulating the x86 memory model, we can get away with not emulating it when a thread accesses its stack. This works since we know that stack
accesses are usually not shared between threads. While we usually disabled the TSO emulation in these cases, we had accidentally missed some cases.
This will mean that there is some performance improvements for "free."

Fix ADC and SBC instructions

Back in FEX-2403 we had landed some optimizations for these instructions. Turns out that we had inadvertently introduced some broken behaviour as an
edge case. Most games didn't hit these edge cases so they were fine but it completely broke rendering in the Steam release of Final Fantasy 7.
With that fixed, we now get correct rendering again!

Final Fantasy 7 under FEX

Option to disable half-barrier TSO emulation on unaligned atomics

On x86 most atomic instructions don't care about alignment, with a feature that Intel calls "Split-locks" to even support unaligned atomics that cross
a cacheline. On ARM we don't have this luxury, where all atomic instructions need to be naturally aligned to their size. Newer ARM CPUs added a
feature that allows unaligned atomics inside of a 16-byte region, but if the data crosses the edge then FEX needs to handle this instruction in a
different way. We backpatch the instruction stream with a "half-barrier" access which still emulates the x86 memory model but is exceedingly heavy.

Now we have an option to convert these "half-barrier" implementations in to non-atomic access. While this doesn't match true x86 behaviour, this can
accelerate some games that heavily abuse unaligned atomic memory accesses. So if a game is running slow, this is an option to try out!

FEXConfig option

Refactor code using clang-format

As alluded to at the start, the FEX codebase has now been completely refactored using clang-format to ensure a more consistent coding experience. We
provide a helper script and CI enforcement to ensure this stays in place. This took quite a bit of work to ensure the feature was up to everyone's
standards. Major thanks to everyone that worked on this!

Eliminate cross-block liveness for instructions

This is preparation work for future JIT improvements and speedups. Cross-block liveness makes our register allocator more complex and by removing this
from our JIT we can start working on improving the register allocator. Look forward to register allocator improvements in the coming months.

Support arm64ec function calls

This changes how some of FEX's JIT infrastructure works in order to support the ARM64ec windows ABI. This will get used in conjunction with Wine's
ARM64ec support. While still a work in progress, this is starting to become interesting as WINE continues to implement more features to handle this
case.

Video game showcase

YouTube Link
Hades running under FEX

Raw Changes

FEX Release FEX-2405

  • Allocator

  • Fixes compiling on Fedora 40 (7b88b0f)

  • AllocatorHooks

  • Mark JIT code memory as EC code on ARM64EC (bb24e14)

  • AppConfig

  • Disable libGL forwarding for steamwebhelper (02ebb6e)

  • Arm64

  • Adds another TSO hack to disable half-barrier TSO (1069cab)

  • CI

  • Drop use of obsolete ENABLE_X86_HOST_DEBUG setting (c126b20)

  • CPUID

  • Removes FEX version string from CPU model name (faa494c)

  • Fix inverted RDTSCP check (9781b95)

  • Enable enhanced rep movs in more situations (68e543c)

  • DebugData

  • Remove header (1616b4e)

  • FEXCore

  • Support x64 -> arm64ec calls (1a8b61b)

  • FHU

  • Switch over win32 file operations to std::filesystem (ae5e388)

  • IR

  • Remove VectorZero (a0f2cae)

  • JIT

  • fix neon vec4 faddv (fe70ec7)

  • fix ShiftFlags shuffles (376936c)

  • Adds support for spilling/Filling GPRPair (eedb120)

  • LookupCache

  • Track ARM64EC page state in the code cache (f0dad86)

  • OpcodeDispatcher

  • Implement support for SMSW (20bd864)

  • Fixes disabling TSO access on RSP SIB stores (1ba678f)

  • Add helper for making segment offset addresses (66cbb66)

  • RCLSE

  • disable store-after-store optimization (5cb11ae)

  • X87

  • Simplify constant loading for FLD family (271700e)

  • Misc

  • Library Forwarding: Support libGL/libvulkan without forwarding libX11 (b33e0e3)

  • clang-format: allow overriding clang-format (3fda47e)

  • Fix 8/16-bit ADC/SBC (9c6f749)

  • Library Forwarding: Fix issues with libGL's fake X11 dependency (81a4206)

  • Factor out SetWriteCursorBefore (a0bf6a4)

  • WOW64 backend code invalidation fixes (81c219c)

  • Clang Format file and script (53bed6d)

  • CI workflow to check clang-format usage on pull requests (f9097c0)

  • Add second reformat to git blame ignore file (55c054b)

  • Reformat until fixed-point (07e58f8)

  • Create .git-blame-ignore-revs with whole-tree reformat sha (7e97db8)

  • Remove trace of clang-tidy experiment from CMakeLists.txt (7614ac9)

  • Whole-tree reformat (1d806ac)

  • Move const to the left in preparation for reformatting (028c220)

  • Enable jemalloc for ARM64EC (a9b7ad8)

  • Validate that we have no crossblock liveness (e91e1d5)

  • Eliminate xblock liveness for shifts (cbfa426)
    7 hours ago 7c79e5d zip tar.gz