FAForever Forums
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Login

    Desync on all replays and games with Windows 11 Arm on M1 Max Apple

    Scheduled Pinned Locked Moved I need help
    22 Posts 10 Posters 3.6k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      malu5531
      last edited by

      From the first link these two function calls are important to ensure deterministic floating point calculations across different systems (such as Intel and AMD):

      _controlfp(_PC_24, _MCW_PC)
      _controlfp(_RC_NEAR, _MCW_RC)

      The first is Precision Control, the second is Rounding Control. According to the microsoft documentation linked for controlfp - setting the Precision Control to 24 bits is not supported on ARM. Making this call on ARM will simply not change anything. The Rounding Control to NEAR seems to be ok.

      (Precision Control is not supported for x64 either, but supreme commander FA is 32-bit application I think)

      1 Reply Last reply Reply Quote 1
      • M Offline
        malu5531
        last edited by malu5531

        On a second thought, might also be this assert that fails the first tick:

        gpAssert( (_controlfp(0, 0) & _MCW_PC) == _PC_24 );

        Since setting the _PC_24 flag does not do anything on ARM, when checking the flags, that will be unchanged. First thought - could we disable one of these asserts with a patch? Or somehow pretend the flags are always set as expected on Apple Silicon with _PC_24 set (or redefine _MCW_PC)?

        However, two more interesting bits of information I found, comparing Intel and Apple Silicon, which seems to hint at calculations using binary64 (double) match but binary32 (single float / 32 bit (24 bit precision)) don't match:

        https://stackoverflow.com/questions/71441137/np-float32-floating-point-differences-between-intel-macbook-and-m1

        https://eclecticlight.co/2021/04/22/can-you-trust-floating-point-arithmetic-on-apple-silicon/

        If so, that would mean the proper fix would be to replace all single floats in the game with double floats.

        1 Reply Last reply Reply Quote 1
        • First post
          Last post