Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Mark AVX2/AVX3 as non-broken on 32-bit x86 #1279

@johnplatts

Description

@johnplatts

Here is the how HWY_BROKEN_32BIT is currently defined in hwy/detect_targets.h:

#if HWY_ARCH_X86_32
#define HWY_BROKEN_32BIT (HWY_AVX2 | HWY_AVX3 | HWY_AVX3_DL | HWY_AVX3_ZEN4)
#else
#define HWY_BROKEN_32BIT 0
#endif

I was able to get HWY_AVX2/HWY_AVX3/HWY_AVX3_DL compiled successfully for 32-bit x86 on GCC 9, GCC 12, Clang 13, and Clang 15 on Ubuntu 22.04, and all of the Highway unit tests pass for HWY_AVX2/HWY_AVX3/HWY_AVX3_DL on 32-bit x86 with GCC 9, GCC 12, Clang 13, and Clang 15.

I also was able to get HWY_AVX2 compiled successfully for 32-bit x86 with MSVC 2019 (19.29), and all of the Highway unit tests pass for the HWY_AVX2 target on 32-bit x86 when compiled with MSVC 19.29.

HWY_BROKEN_32BIT should be changed to 0 for 32-bit x86 when compiled with GCC 9 and later or Clang 13 and later, and HWY_BROKEN_32BIT should be changed to (HWY_AVX3 | HWY_AVX3_DL | HWY_AVX3_ZEN4) for MSVC 19.29 or later.

Here is an updated version of the HWY_BROKEN_32BIT macro that will mark AVX2 as non-broken on 32-bit x86 with MSVC 19.29 or later, GCC 9.0 or later, or Clang 13.0 or later and that will mark AVX3 as non-broken on 32-bit x86 with GCC 9.0 or later or Clang 13.0 or later:

#if HWY_ARCH_X86_32
#if ((HWY_COMPILER_GCC_ACTUAL && HWY_COMPILER_GCC_ACTUAL < 900) || \
     (HWY_COMPILER_CLANG && HWY_COMPILER_CLANG < 1300))
 #define HWY_BROKEN_32BIT 0
#elif HWY_COMPILER_MSVC && HWY_COMPILER_MSVC < 1929
 #define HWY_BROKEN_32BIT (HWY_AVX3 | HWY_AVX3_DL | HWY_AVX3_ZEN4) 
#else
 #define HWY_BROKEN_32BIT (HWY_AVX2 | HWY_AVX3 | HWY_AVX3_DL | HWY_AVX3_ZEN4) 
#endif
#else  // x86_64 or non-x86
 #define HWY_BROKEN_32BIT 0 
#endif  // HWY_ARCH_X86_32

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions