An error occurred fetching the project authors.
  1. 13 Apr, 2021 1 commit
    • Marko Mäkelä's avatar
      MDEV-24745 Generic CRC-32C computation wrongly uses SSE4.2 instructions · 58f184a4
      Marko Mäkelä authored
      In commit d25f806d (MDEV-22749)
      the CRC-32C implementation of MariaDB was broken on some
      IA-32 and AMD64 builds, depending on the compiler version and
      build options. This was verified for IA-32 on GCC 10.2.1.
      
      Even though we try to identify the SSE4.2 extensions and the
      availaibility of the PCLMULQDQ instruction by executing CPUID,
      the fall-back code could be generated with extended instructions,
      because the entire file mysys/crc32/crc32c.c was being compiled
      with -msse4.2 -mpclmul. This would cause SIGILL on a PINSRD
      instruction on affected IA-32 targets (such as some Intel Atom
      processors). This might also affect old AMD64 processors
      (predating the 2007 Intel Nehalem microarchitecture), if some
      compiler chose to emit the offending instructions.
      
      While it is fine to pass a target-specific option to a target-specific
      compilation unit (like -mpclmul to a PCLMUL-specific compilation unit),
      that is not safe for mixed-architecture compilation units.
      
      For mixed-architecture compilation units, the correct way is to set
      target attributes on the target-specific functions.
      
      There does not seem to be a way to pass target attributes to
      function template instantiation. Hence, we must replace the
      ExtendImpl template with plain functions crc32_sse42() and
      crc32_slow().
      
      We will also remove some inconsistency between
      my_crc32_implementation() and mysys_namespace::crc32::Choose_Extend().
      
      The function crc32_pclmul_enabled() will be moved to mysys/crc32/crc32c.cc
      so that the detection code will be compiled without -msse4.2 -mpclmul.
      
      The AMD64 PCLMUL accelerated crc32c_3way() will be moved to a new
      file crc32c_amd64.cc. In this way, only a few functions that depend
      on -msse4.2 in mysys/crc32/crc32c.cc can be declared with
      __attribute__((target("sse4.2"))), and most of the file can be compiled
      for the generic target.
      
      Last, the file mysys/crc32ieee.cc will be omitted on 64-bit POWER,
      because it was dead code (no symbols were exported).
      
      Reviewed by: Vladislav Vaintroub
      58f184a4
  2. 07 Sep, 2020 1 commit
  3. 04 Sep, 2020 1 commit
  4. 27 Aug, 2020 1 commit
    • Marko Mäkelä's avatar
      MDEV-23585: Fix HAVE_CLMUL_INSTRUCTION · b47d61d0
      Marko Mäkelä authored
      MDEV-22641 in commit dec3f8ca
      refactored a SIMD implementation of CRC-32 for the ISO 3309 polynomial
      that uses the IA-32/AMD64 carry-less multiplication (pclmul)
      instructions. The code was previously only available in Mariabackup;
      it was changed to be a general replacement of the zlib crc32().
      
      There exist AMD64 systems where CMAKE_SYSTEM_PROCESSOR matches
      the pattern i[36]86 but not x86_64 or amd64. This would cause a
      link failure, because mysys/checksum.c would basically assume that
      the compiler support for instruction is always available on GCC-compatible
      compilers on AMD64.
      
      Furthermore, we were unnecessarily disabling the SIMD acceleration
      for 32-bit executables.
      
      Note: Until MDEV-22749 has been implemented, the PCLMUL instruction
      will not be used on Microsoft Windows.
      
      Closes: #1660
      b47d61d0
  5. 01 Jun, 2020 1 commit
    • mysqlonarm's avatar
      MDEV-22641: Provide SIMD optimized wrapper for zlib crc32() (#1558) · dec3f8ca
      mysqlonarm authored
      Existing implementation used my_checksum (from mysys)
      for calculating table checksum and binlog checksum.
      
      This implementation was optimized for powerpc only and lacked
      SIMD implementation for x86 (using clmul) and ARM
      (using ACLE) instead used zlib-crc32.
      
      mariabackup had its own copy of the crc32 implementation
      using hardware optimized implementation only for x86 and lagged
      hardware based implementation for powerpc and ARM.
      
      Patch helps unifies all such calls and help aggregate all of them
      using an unified interface my_checksum().
      
      Said unification also enables hardware optimized calls for all
      architecture viz. x86, ARM, POWERPC.
      Default always fallback to zlib crc32.
      
      Thanks to Daniel Black for reviewing, fixing and testing
      PowerPC changes. Thanks to Marko and Daniel for early code feedback.
      dec3f8ca
  6. 12 Mar, 2020 1 commit
    • Marko Mäkelä's avatar
      MDEV-21907: InnoDB: Enable -Wconversion on clang and GCC · f2245252
      Marko Mäkelä authored
      The -Wconversion in GCC seems to be stricter than in clang.
      GCC at least since version 4.4.7 issues truncation warnings for
      assignments to bitfields, while clang 10 appears to only issue
      warnings when the sizes in bytes rounded to the nearest integer
      powers of 2 are different.
      
      Before GCC 10.0.0, -Wconversion required more casts and would not
      allow some operations, such as x<<=1 or x+=1 on a data type that
      is narrower than int.
      
      GCC 5 (but not GCC 4, GCC 6, or any later version) is complaining
      about x|=y even when x and y are compatible types that are narrower
      than int.  Hence, we must rewrite some x|=y as
      x=static_cast<byte>(x|y) or similar, or we must disable -Wconversion.
      
      In GCC 6 and later, the warning for assigning wider to bitfields
      that are narrower than 8, 16, or 32 bits can be suppressed by
      applying a bitwise & with the exact bitmask of the bitfield.
      For older GCC, we must disable -Wconversion for GCC 4 or 5 in such
      cases.
      
      The bitwise negation operator appears to promote short integers
      to a wider type, and hence we must add explicit truncation casts
      around them. Microsoft Visual C does not allow a static_cast to
      truncate a constant, such as static_cast<byte>(1) truncating int.
      Hence, we will use the constructor-style cast byte(~1) for such cases.
      
      This has been tested at least with GCC 4.8.5, 5.4.0, 7.4.0, 9.2.1, 10.0.0,
      clang 9.0.1, 10.0.0, and MSVC 14.22.27905 (Microsoft Visual Studio 2019)
      on 64-bit and 32-bit targets (IA-32, AMD64, POWER 8, POWER 9, ARMv8).
      f2245252
  7. 11 May, 2019 1 commit
  8. 30 Oct, 2018 1 commit
  9. 26 Apr, 2018 1 commit
  10. 27 Apr, 2017 1 commit