[Bug preprocessor/92389] New: Compiling with -march=icelake-client does not enable __AVX512VPOPCNTDQ__

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug preprocessor/92389] New: Compiling with -march=icelake-client does not enable __AVX512VPOPCNTDQ__

msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92389

            Bug ID: 92389
           Summary: Compiling with -march=icelake-client does not enable
                    __AVX512VPOPCNTDQ__
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tom.dillon at gmail dot com
  Target Milestone: ---

## Tested on:
gcc version 8.3.0 (Ubuntu 8.3.0-16ubuntu3~16.04) 
gcc version 9.2.1 20191008 (Ubuntu 9.2.1-9ubuntu2~16.04.1) 

## Observed behavior:
When compiling on an icelake platform with -march=native or with
-march=icelake-client, GCC does not define __AVX512VPOPCNTDQ__.

$ gcc-8 -march=icelake-client -dM -E - < /dev/null | grep AVX512 | sort
#define __AVX512BITALG__ 1
#define __AVX512BW__ 1
#define __AVX512CD__ 1
#define __AVX512DQ__ 1
#define __AVX512F__ 1
#define __AVX512IFMA__ 1
#define __AVX512VBMI__ 1
#define __AVX512VBMI2__ 1
#define __AVX512VL__ 1
#define __AVX512VNNI__ 1

As a result, use of certain intrinsics that should be supported, like
_mm_popcnt_epi64, cause "target specific option mismatch" errors.

## Expected behavior:
 __AVX512VPOPCNTDQ__ should be defined since these instructions are supported
by the platform. For example, with clang:

$ clang-8 -march=icelake-client -dM -E - < /dev/null | grep AVX512 | sort
#define __AVX512BITALG__ 1
#define __AVX512BW__ 1
#define __AVX512CD__ 1
#define __AVX512DQ__ 1
#define __AVX512F__ 1
#define __AVX512IFMA__ 1
#define __AVX512VBMI__ 1
#define __AVX512VBMI2__ 1
#define __AVX512VL__ 1
#define __AVX512VNNI__ 1
#define __AVX512VPOPCNTDQ__ 1     <------------

## Workaround
As a workaround one can explicitly add -mavx512vpopcntdq

## Proposed Fix
It looks like the line here:
https://github.com/gcc-mirror/gcc/blob/a3f9c6f666e622f30eda441cd7ad8657a7a64bfe/gcc/config/i386/i386.h#L2439

Which reads:
const wide_int_bitmask PTA_ICELAKE_CLIENT = PTA_CANNONLAKE | PTA_AVX512VNNI
  | PTA_GFNI | PTA_VAES | PTA_AVX512VBMI2 | PTA_VPCLMULQDQ | PTA_AVX512BITALG
  | PTA_RDPID | PTA_CLWB;

Should read:
const wide_int_bitmask PTA_ICELAKE_CLIENT = PTA_CANNONLAKE | PTA_AVX512VNNI
  | PTA_GFNI | PTA_VAES | PTA_AVX512VBMI2 | PTA_VPCLMULQDQ | PTA_AVX512BITALG
  | PTA_RDPID | PTA_CLWB | PTA_AVX512VPOPCNTDQ;
Reply | Threaded
Open this post in threaded view
|

[Bug target/92389] Compiling with -march=icelake-client does not enable __AVX512VPOPCNTDQ__

msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92389

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2019-11-06
                 CC|                            |marxin at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
I can take a look.
Reply | Threaded
Open this post in threaded view
|

[Bug target/92389] Compiling with -march=icelake-client does not enable __AVX512VPOPCNTDQ__

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92389

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Thank you Tom for the bug report (and the suggested fix). It's obviously
correct.
One can verify the feature availability here:
https://en.wikipedia.org/wiki/AVX-512#CPUs_with_AVX-512
Reply | Threaded
Open this post in threaded view
|

[Bug target/92389] Compiling with -march=icelake-client does not enable __AVX512VPOPCNTDQ__

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92389

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.0
      Known to fail|                            |10.0, 8.3.0, 9.2.0
Reply | Threaded
Open this post in threaded view
|

[Bug target/92389] Compiling with -march=icelake-client does not enable __AVX512VPOPCNTDQ__

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92389

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Author: marxin
Date: Thu Nov 14 08:36:34 2019
New Revision: 278210

URL: https://gcc.gnu.org/viewcvs?rev=278210&root=gcc&view=rev
Log:
Enable VPOPCNTDQ for icelake-{client,server} and tigerlake.

2019-11-14  Martin Liska  <[hidden email]>

        PR target/92389
        * config/i386/i386.h: Add PTA_AVX512VPOPCNTDQ to
        PTA_ICELAKE_CLIENT which is later interited by
        PTA_ICELAKE_SERVER and PTA_TIGERLAKE.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.h
Reply | Threaded
Open this post in threaded view
|

[Bug target/92389] Compiling with -march=icelake-client does not enable __AVX512VPOPCNTDQ__

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92389

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |10.0
      Known to fail|10.0                        |

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed on trunk so far.
Reply | Threaded
Open this post in threaded view
|

[Bug target/92389] Compiling with -march=icelake-client does not enable __AVX512VPOPCNTDQ__

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92389

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
Author: marxin
Date: Thu Nov 14 09:21:58 2019
New Revision: 278213

URL: https://gcc.gnu.org/viewcvs?rev=278213&root=gcc&view=rev
Log:
Backport r278210

2019-11-14  Martin Liska  <[hidden email]>

        Backport from mainline
        2019-11-14  Martin Liska  <[hidden email]>

        PR target/92389
        * config/i386/i386.h: Add PTA_AVX512VPOPCNTDQ to
        PTA_ICELAKE_CLIENT which is later interited by
        PTA_ICELAKE_SERVER and PTA_TIGERLAKE.

Modified:
    branches/gcc-8-branch/gcc/ChangeLog
    branches/gcc-8-branch/gcc/config/i386/i386.c
Reply | Threaded
Open this post in threaded view
|

[Bug target/92389] Compiling with -march=icelake-client does not enable __AVX512VPOPCNTDQ__

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92389

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
Author: marxin
Date: Thu Nov 14 09:45:37 2019
New Revision: 278214

URL: https://gcc.gnu.org/viewcvs?rev=278214&root=gcc&view=rev
Log:
Backport r278210

2019-11-14  Martin Liska  <[hidden email]>

        Backport from mainline
        2019-11-14  Martin Liska  <[hidden email]>

        PR target/92389
        * config/i386/i386.h: Add PTA_AVX512VPOPCNTDQ to
        PTA_ICELAKE_CLIENT which is later interited by
        PTA_ICELAKE_SERVER and PTA_TIGERLAKE.

Modified:
    branches/gcc-9-branch/gcc/ChangeLog
    branches/gcc-9-branch/gcc/config/i386/i386.h
Reply | Threaded
Open this post in threaded view
|

[Bug target/92389] Compiling with -march=icelake-client does not enable __AVX512VPOPCNTDQ__

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92389

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to work|                            |9.2.1
         Resolution|---                         |FIXED
      Known to fail|9.2.0                       |

--- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed on all active branches.