Warning about hardware accelerated CRC32C

Issue #343 resolved
Stefan Ritt created an issue

On my new MacBook Pro M1 (Apple Silicon), midas compiles very well (actually 6x faster!), but I get the annoying error

#warning Hardware accelerated CRC32C is not available.

Now I understand that the M1 does not support hardware accelerated CRC32C, but do I have to see this waring hundreds of times a day? May I propose not to remove the warning, but disable it for the M1? We can test for M1 with the “__arm__” flag, but that seems to me a bit too general, like

#ifdef HAVE_HWCRC32C
  ...
#else

   #ifdef __arm__
      // do nothing
   #else
      #warning Hardware accelerated CRC32C is not available.
   #endif
#endif  

Since the world is going towards Apple Silicon, we should find a good solution for that, since we will soon have many complaints about that (once people realise how good the M1 and M2 are).

Now dumping all preprocesor defines with

gcc -E -dM < /dev/null)

I see these define:

#define __ARM_FEATURE_CRC32 1

so I believe the M1 does have HW acceleration.

Any idea how I can use it?

Comments (7)

  1. dd1

    I will not have time to work on midas until late next week. Luckily midas-2022-a and midas-2022-b seem to be trouble-free so far.

  2. dd1

    if you want to try it implementing it yourself, note the difference between “CRC32” and “CRC32C” (the “C” version is newer and better). Also note the crc test program in progs/crc32c_sum.cxx. It computes CRC32C checksum of stdin. Ultimately, it should compute the same result on 32-bit x86, 64-bit x86, 32-bit ARM and 64-bit ARM. K.O.

  3. Log in to comment