Bug 252597

Summary: net/openmpi compile error with AVX
Product: Ports & Packages Reporter: Jack <xxjack12xx>
Component: Individual Port(s)Assignee: Danilo Egea Gondolfo <danilo>
Status: Closed Overcome By Events    
Severity: Affects Some People CC: diizzy, linimon, xxjack12xx
Priority: --- Flags: bugzilla: maintainer-feedback? (danilo)
Version: Latest   
Hardware: amd64   
OS: Any   

Description Jack 2021-01-12 03:10:37 UTC
When AVX is on, the compilation fails.

make showconfig
===> The following configuration options are available for openmpi-4.1.0_1:
     AVX=on: Enable AVX instructions
     DEBUG=off: Build with debugging support
     IPV6=off: IPv6 protocol support
     SLURM=on: Enable SLURM support
     TORQUE=on: Enable Torque support


Making all in mca/op/avx
gmake[4]: Entering directory '/d2/obj/d2/ports/net/openmpi/work/openmpi-4.1.0/ompi/mca/op/avx'
  CCLD     liblocal_ops_avx.la
  CC       liblocal_ops_avx512_la-op_avx_functions.lo
op_avx_functions.c:454:5: error: always_inline function '_mm512_loadu_si512' requires target feature 'avx512f',
      but would be inlined into function 'ompi_op_avx_2buff_max_int8_t_avx512' that is compiled without support
      for 'avx512f'
    OP_AVX_FUNC(max, i, 8,    int8_t, max)
    ^
op_avx_functions.c:124:5: note: expanded from macro 'OP_AVX_FUNC'
    OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op);                  \
    ^
op_avx_functions.c:69:29: note: expanded from macro 'OP_AVX_AVX512_FUNC'
            __m512i vecA =  _mm512_loadu_si512((__m512*)in);                   \
                            ^
op_avx_functions.c:454:5: error: always_inline function '_mm512_loadu_si512' requires target feature 'avx512f',
      but would be inlined into function 'ompi_op_avx_2buff_max_int8_t_avx512' that is compiled without support
      for 'avx512f'
op_avx_functions.c:124:5: note: expanded from macro 'OP_AVX_FUNC'
    OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op);                  \
    ^
op_avx_functions.c:71:29: note: expanded from macro 'OP_AVX_AVX512_FUNC'
            __m512i vecB =  _mm512_loadu_si512((__m512*)out);                  \
                            ^
op_avx_functions.c:454:5: error: always_inline function '_mm512_max_epi8' requires target feature 'avx512bw',
      but would be inlined into function 'ompi_op_avx_2buff_max_int8_t_avx512' that is compiled without support
      for 'avx512bw'
op_avx_functions.c:124:5: note: expanded from macro 'OP_AVX_FUNC'
    OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op);                  \
    ^
op_avx_functions.c:72:27: note: expanded from macro 'OP_AVX_AVX512_FUNC'
            __m512i res = _mm512_##op##_ep##type_sign##type_size(vecA, vecB);  \
                          ^
<scratch space>:261:1: note: expanded from here
_mm512_max_epi8
^
op_avx_functions.c:454:5: error: always_inline function '_mm512_storeu_si512' requires target feature
      'avx512f', but would be inlined into function 'ompi_op_avx_2buff_max_int8_t_avx512' that is compiled
      without support for 'avx512f'
op_avx_functions.c:124:5: note: expanded from macro 'OP_AVX_FUNC'
    OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op);                  \
    ^
op_avx_functions.c:73:13: note: expanded from macro 'OP_AVX_AVX512_FUNC'
            _mm512_storeu_si512((__m512*)out, res);                            \
            ^
op_avx_functions.c:455:5: error: always_inline function '_mm512_loadu_si512' requires target feature 'avx512f',
      but would be inlined into function 'ompi_op_avx_2buff_max_uint8_t_avx512' that is compiled without
      support for 'avx512f'
    OP_AVX_FUNC(max, u, 8,   uint8_t, max)
    ^
op_avx_functions.c:124:5: note: expanded from macro 'OP_AVX_FUNC'
    OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op);                  \
    ^
op_avx_functions.c:69:29: note: expanded from macro 'OP_AVX_AVX512_FUNC'
            __m512i vecA =  _mm512_loadu_si512((__m512*)in);                   \
                            ^
op_avx_functions.c:455:5: error: always_inline function '_mm512_loadu_si512' requires target feature 'avx512f',
      but would be inlined into function 'ompi_op_avx_2buff_max_uint8_t_avx512' that is compiled without
      support for 'avx512f'
op_avx_functions.c:124:5: note: expanded from macro 'OP_AVX_FUNC'
    OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op);                  \
    ^
op_avx_functions.c:71:29: note: expanded from macro 'OP_AVX_AVX512_FUNC'
            __m512i vecB =  _mm512_loadu_si512((__m512*)out);                  \
                            ^
op_avx_functions.c:455:5: error: always_inline function '_mm512_max_epu8' requires target feature 'avx512bw',
      but would be inlined into function 'ompi_op_avx_2buff_max_uint8_t_avx512' that is compiled without
      support for 'avx512bw'
op_avx_functions.c:124:5: note: expanded from macro 'OP_AVX_FUNC'
    OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op);                  \
    ^
op_avx_functions.c:72:27: note: expanded from macro 'OP_AVX_AVX512_FUNC'
            __m512i res = _mm512_##op##_ep##type_sign##type_size(vecA, vecB);  \
                          ^
<scratch space>:10:1: note: expanded from here
_mm512_max_epu8
^
op_avx_functions.c:455:5: error: always_inline function '_mm512_storeu_si512' requires target feature
      'avx512f', but would be inlined into function 'ompi_op_avx_2buff_max_uint8_t_avx512' that is compiled
      without support for 'avx512f'
op_avx_functions.c:124:5: note: expanded from macro 'OP_AVX_FUNC'
    OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op);                  \
    ^
op_avx_functions.c:73:13: note: expanded from macro 'OP_AVX_AVX512_FUNC'
            _mm512_storeu_si512((__m512*)out, res);                            \
            ^
op_avx_functions.c:456:5: error: always_inline function '_mm512_loadu_si512' requires target feature 'avx512f',
      but would be inlined into function 'ompi_op_avx_2buff_max_int16_t_avx512' that is compiled without
      support for 'avx512f'
    OP_AVX_FUNC(max, i, 16,  int16_t, max)
    ^
op_avx_functions.c:124:5: note: expanded from macro 'OP_AVX_FUNC'
    OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op);                  \
    ^
op_avx_functions.c:69:29: note: expanded from macro 'OP_AVX_AVX512_FUNC'
            __m512i vecA =  _mm512_loadu_si512((__m512*)in);                   \
                            ^
op_avx_functions.c:456:5: error: always_inline function '_mm512_loadu_si512' requires target feature 'avx512f',
      but would be inlined into function 'ompi_op_avx_2buff_max_int16_t_avx512' that is compiled without
      support for 'avx512f'
op_avx_functions.c:124:5: note: expanded from macro 'OP_AVX_FUNC'
    OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op);                  \
    ^
op_avx_functions.c:71:29: note: expanded from macro 'OP_AVX_AVX512_FUNC'
            __m512i vecB =  _mm512_loadu_si512((__m512*)out);                  \
                            ^
op_avx_functions.c:456:5: error: always_inline function '_mm512_max_epi16' requires target feature 'avx512bw',
      but would be inlined into function 'ompi_op_avx_2buff_max_int16_t_avx512' that is compiled without
      support for 'avx512bw'
op_avx_functions.c:124:5: note: expanded from macro 'OP_AVX_FUNC'
    OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op);                  \
    ^
op_avx_functions.c:72:27: note: expanded from macro 'OP_AVX_AVX512_FUNC'
            __m512i res = _mm512_##op##_ep##type_sign##type_size(vecA, vecB);  \
                          ^
<scratch space>:22:1: note: expanded from here
_mm512_max_epi16
^
op_avx_functions.c:456:5: error: always_inline function '_mm512_storeu_si512' requires target feature
      'avx512f', but would be inlined into function 'ompi_op_avx_2buff_max_int16_t_avx512' that is compiled
      without support for 'avx512f'
op_avx_functions.c:124:5: note: expanded from macro 'OP_AVX_FUNC'
    OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op);                  \
    ^
op_avx_functions.c:73:13: note: expanded from macro 'OP_AVX_AVX512_FUNC'
            _mm512_storeu_si512((__m512*)out, res);                            \
            ^
op_avx_functions.c:457:5: error: always_inline function '_mm512_loadu_si512' requires target feature 'avx512f',
      but would be inlined into function 'ompi_op_avx_2buff_max_uint16_t_avx512' that is compiled without
      support for 'avx512f'
    OP_AVX_FUNC(max, u, 16, uint16_t, max)
    ^
op_avx_functions.c:124:5: note: expanded from macro 'OP_AVX_FUNC'
    OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op);                  \
    ^
op_avx_functions.c:69:29: note: expanded from macro 'OP_AVX_AVX512_FUNC'
            __m512i vecA =  _mm512_loadu_si512((__m512*)in);                   \
                            ^
op_avx_functions.c:457:5: error: always_inline function '_mm512_loadu_si512' requires target feature 'avx512f',
      but would be inlined into function 'ompi_op_avx_2buff_max_uint16_t_avx512' that is compiled without
      support for 'avx512f'
op_avx_functions.c:124:5: note: expanded from macro 'OP_AVX_FUNC'
    OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op);                  \
    ^
op_avx_functions.c:71:29: note: expanded from macro 'OP_AVX_AVX512_FUNC'
            __m512i vecB =  _mm512_loadu_si512((__m512*)out);                  \
                            ^
op_avx_functions.c:457:5: error: always_inline function '_mm512_max_epu16' requires target feature 'avx512bw',
      but would be inlined into function 'ompi_op_avx_2buff_max_uint16_t_avx512' that is compiled without
      support for 'avx512bw'
op_avx_functions.c:124:5: note: expanded from macro 'OP_AVX_FUNC'
    OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op);                  \
    ^
op_avx_functions.c:72:27: note: expanded from macro 'OP_AVX_AVX512_FUNC'
            __m512i res = _mm512_##op##_ep##type_sign##type_size(vecA, vecB);  \
                          ^
<scratch space>:34:1: note: expanded from here
_mm512_max_epu16
^
op_avx_functions.c:457:5: error: always_inline function '_mm512_storeu_si512' requires target feature
      'avx512f', but would be inlined into function 'ompi_op_avx_2buff_max_uint16_t_avx512' that is compiled
      without support for 'avx512f'
op_avx_functions.c:124:5: note: expanded from macro 'OP_AVX_FUNC'
    OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op);                  \
    ^
op_avx_functions.c:73:13: note: expanded from macro 'OP_AVX_AVX512_FUNC'
            _mm512_storeu_si512((__m512*)out, res);                            \
            ^
op_avx_functions.c:458:5: error: always_inline function '_mm512_loadu_si512' requires target feature 'avx512f',
      but would be inlined into function 'ompi_op_avx_2buff_max_int32_t_avx512' that is compiled without
      support for 'avx512f'
    OP_AVX_FUNC(max, i, 32,  int32_t, max)
    ^
op_avx_functions.c:124:5: note: expanded from macro 'OP_AVX_FUNC'
    OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op);                  \
    ^
op_avx_functions.c:69:29: note: expanded from macro 'OP_AVX_AVX512_FUNC'
            __m512i vecA =  _mm512_loadu_si512((__m512*)in);                   \
                            ^
op_avx_functions.c:458:5: error: always_inline function '_mm512_loadu_si512' requires target feature 'avx512f',
      but would be inlined into function 'ompi_op_avx_2buff_max_int32_t_avx512' that is compiled without
      support for 'avx512f'
op_avx_functions.c:124:5: note: expanded from macro 'OP_AVX_FUNC'
    OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op);                  \
    ^
op_avx_functions.c:71:29: note: expanded from macro 'OP_AVX_AVX512_FUNC'
            __m512i vecB =  _mm512_loadu_si512((__m512*)out);                  \
                            ^
op_avx_functions.c:458:5: error: always_inline function '_mm512_max_epi32' requires target feature 'avx512f',
      but would be inlined into function 'ompi_op_avx_2buff_max_int32_t_avx512' that is compiled without
      support for 'avx512f'
op_avx_functions.c:124:5: note: expanded from macro 'OP_AVX_FUNC'
    OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op);                  \
    ^
op_avx_functions.c:72:27: note: expanded from macro 'OP_AVX_AVX512_FUNC'
            __m512i res = _mm512_##op##_ep##type_sign##type_size(vecA, vecB);  \
                          ^
<scratch space>:46:1: note: expanded from here
_mm512_max_epi32
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
gmake[4]: *** [Makefile:1991: liblocal_ops_avx512_la-op_avx_functions.lo] Error 1
gmake[4]: Leaving directory '/d2/obj/d2/ports/net/openmpi/work/openmpi-4.1.0/ompi/mca/op/avx'
gmake[3]: *** [Makefile:3555: all-recursive] Error 1
gmake[3]: Leaving directory '/d2/obj/d2/ports/net/openmpi/work/openmpi-4.1.0/ompi'
gmake[2]: *** [Makefile:1901: all-recursive] Error 1
gmake[2]: Leaving directory '/d2/obj/d2/ports/net/openmpi/work/openmpi-4.1.0'
===> Compilation failed unexpectedly.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2021-01-12 05:01:35 UTC
To submitter: is this with Makefile r561280 ?
Comment 2 Jack 2021-01-12 05:04:17 UTC
How do I check that with git? It's the Jan 11 revision (latest one in git)
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2021-01-12 05:41:52 UTC
(In reply to Jack from comment #2)

Because it will have the following changes:

https://svnweb.freebsd.org/ports/head/net/openmpi/Makefile?r1=561056&r2=561280

However, please note that I did not test with AVX *on*.  I tested on powerpc64 and aarch64 to make sure that AVX was *not shown* as an option on those archs (and, then, afterwards, on amd64 with those changes to make sure that I was not committing a reversion).

danilo@, can you comment on having AVX enabled on amd64?  In *theory* I should not have changed anything in that situation.
Comment 4 Jack 2021-01-12 07:48:29 UTC
PORTVERSION=    4.1.0
PORTREVISION=   1

is what is in the Makefile
Comment 5 Danilo Egea Gondolfo freebsd_committer freebsd_triage 2021-01-12 08:21:59 UTC
It will fail if your hardware doesn't support AVX2. OpenMPI doesn't auto-detect it. That is why it's disabled by default for now.

Does your CPU support AVX2? The compilation works fine for me.
Comment 6 Jack 2021-01-12 08:59:22 UTC
The CPU is AMD FX-8320 which supports AVX but not AVX2, maybe the option should be called AVX2 to prevent confusion?
Comment 7 Daniel Engberg freebsd_committer freebsd_triage 2022-08-09 13:04:10 UTC
This seems to have been fixed in current version in tree (4.1.4) as I can enable AVX and compile the port without my CPU supporting AVX2.
Comment 8 Daniel Engberg freebsd_committer freebsd_triage 2023-10-08 09:37:41 UTC
Closing this as Overcome By Events, please reopen if its still an issue