public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* How to build gcc with AVX512?
@ 2019-11-14  5:31 Cameron Fletcher (CF)
  2019-11-14  8:27 ` Stefan Ring
  0 siblings, 1 reply; 6+ messages in thread
From: Cameron Fletcher (CF) @ 2019-11-14  5:31 UTC (permalink / raw)
  To: gcc-help

I am trying to build gcc 8.3 with using --with-fpmath=avx but it only builds gcc with AVX1.

Can someone help me on how to build gcc with avx512 support?

--
CF

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to build gcc with AVX512?
  2019-11-14  5:31 How to build gcc with AVX512? Cameron Fletcher (CF)
@ 2019-11-14  8:27 ` Stefan Ring
  2019-11-14  9:16   ` Cameron Fletcher (CF)
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Ring @ 2019-11-14  8:27 UTC (permalink / raw)
  To: Cameron Fletcher (CF); +Cc: gcc-help

On Thu, Nov 14, 2019 at 6:31 AM Cameron Fletcher (CF)
<circumflex@disroot.org> wrote:
>
> I am trying to build gcc 8.3 with using --with-fpmath=avx but it only builds gcc with AVX1.
>
> Can someone help me on how to build gcc with avx512 support?

Do you mean you want a compiler that understands the avx512
instruction set and can generate code for it?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to build gcc with AVX512?
  2019-11-14  8:27 ` Stefan Ring
@ 2019-11-14  9:16   ` Cameron Fletcher (CF)
  2019-11-14 15:42     ` Xi Ruoyao
  0 siblings, 1 reply; 6+ messages in thread
From: Cameron Fletcher (CF) @ 2019-11-14  9:16 UTC (permalink / raw)
  To: gcc-help

On 14/11/19 1:41 pm, Stefan Ring wrote:
> On Thu, Nov 14, 2019 at 6:31 AM Cameron Fletcher (CF)
> <circumflex@disroot.org> wrote:
>>
>> I am trying to build gcc 8.3 with using --with-fpmath=avx but it only builds gcc with AVX1.
>>
>> Can someone help me on how to build gcc with avx512 support?
> 
> Do you mean you want a compiler that understands the avx512
> instruction set and can generate code for it?
> 
Yes. I have a cascade lake xeon on which I am building gcc.


-- 
--
CF

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to build gcc with AVX512?
  2019-11-14  9:16   ` Cameron Fletcher (CF)
@ 2019-11-14 15:42     ` Xi Ruoyao
  2019-11-15  9:48       ` Cameron Fletcher (CF)
  0 siblings, 1 reply; 6+ messages in thread
From: Xi Ruoyao @ 2019-11-14 15:42 UTC (permalink / raw)
  To: Cameron Fletcher (CF); +Cc: gcc-help

On 2019-11-14 14:46 +0530, Cameron Fletcher (CF) wrote:
> On 14/11/19 1:41 pm, Stefan Ring wrote:
> > On Thu, Nov 14, 2019 at 6:31 AM Cameron Fletcher (CF)
> > <circumflex@disroot.org> wrote:
> > > I am trying to build gcc 8.3 with using --with-fpmath=avx but it
> > > only builds gcc with AVX1.
> > > 
> > > Can someone help me on how to build gcc with avx512 support?
> > 
> > Do you mean you want a compiler that understands the avx512
> > instruction set and can generate code for it?
> > 
> Yes. I have a cascade lake xeon on which I am building gcc.

You'll need `-march=cascadelake` to tell GCC your CPU is a Cascade
Lake, and `-ftree-vectorize` to tell GCC to vectorize some loops into
AVX/AVX2/AVX512 instructions.

If you want to fully utilize AVX512 `-mprefer-vector-width=512` may be
necessary.  Without this option GCC will use AVX512 instructions (with
`-march=cascadelake`) but only the 256-bit and 128-bit variants.

And we shoule notice that using AVX512 may slow down the system (due to
downclocking).  Daniel Lemire wrote a nice article discussing these
issues:

https://lemire.me/blog/2018/09/07/avx-512-when-and-how-to-use-these-new-instructions/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to build gcc with AVX512?
  2019-11-14 15:42     ` Xi Ruoyao
@ 2019-11-15  9:48       ` Cameron Fletcher (CF)
  2019-11-15 10:22         ` Jonathan Wakely
  0 siblings, 1 reply; 6+ messages in thread
From: Cameron Fletcher (CF) @ 2019-11-15  9:48 UTC (permalink / raw)
  To: gcc-help

On 14/11/19 9:12 pm, Xi Ruoyao wrote:
> On 2019-11-14 14:46 +0530, Cameron Fletcher (CF) wrote:
>> On 14/11/19 1:41 pm, Stefan Ring wrote:
>>> On Thu, Nov 14, 2019 at 6:31 AM Cameron Fletcher (CF)
>>> <circumflex@disroot.org> wrote:
>>>> I am trying to build gcc 8.3 with using --with-fpmath=avx but it
>>>> only builds gcc with AVX1.
>>>>
>>>> Can someone help me on how to build gcc with avx512 support?
>>>
>>> Do you mean you want a compiler that understands the avx512
>>> instruction set and can generate code for it?
>>>
>> Yes. I have a cascade lake xeon on which I am building gcc.
> 
> You'll need `-march=cascadelake` to tell GCC your CPU is a Cascade
> Lake, and `-ftree-vectorize` to tell GCC to vectorize some loops into
> AVX/AVX2/AVX512 instructions.

I am trying to build GCC to support  AVX,
not building the application with AVX which I will be doing later.

> 
> If you want to fully utilize AVX512 `-mprefer-vector-width=512` may be
> necessary.  Without this option GCC will use AVX512 instructions (with
> `-march=cascadelake`) but only the 256-bit and 128-bit variants.
> 
> And we shoule notice that using AVX512 may slow down the system (due to
> downclocking).  Daniel Lemire wrote a nice article discussing these
> issues:
> 
> https://lemire.me/blog/2018/09/07/avx-512-when-and-how-to-use-these-new-instructions/
Thanks for this article.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to build gcc with AVX512?
  2019-11-15  9:48       ` Cameron Fletcher (CF)
@ 2019-11-15 10:22         ` Jonathan Wakely
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Wakely @ 2019-11-15 10:22 UTC (permalink / raw)
  To: Cameron Fletcher (CF); +Cc: gcc-help

On Fri, 15 Nov 2019 at 09:49, Cameron Fletcher (CF)
<circumflex@disroot.org> wrote:
>
> On 14/11/19 9:12 pm, Xi Ruoyao wrote:
> > On 2019-11-14 14:46 +0530, Cameron Fletcher (CF) wrote:
> >> On 14/11/19 1:41 pm, Stefan Ring wrote:
> >>> On Thu, Nov 14, 2019 at 6:31 AM Cameron Fletcher (CF)
> >>> <circumflex@disroot.org> wrote:
> >>>> I am trying to build gcc 8.3 with using --with-fpmath=avx but it
> >>>> only builds gcc with AVX1.
> >>>>
> >>>> Can someone help me on how to build gcc with avx512 support?
> >>>
> >>> Do you mean you want a compiler that understands the avx512
> >>> instruction set and can generate code for it?
> >>>
> >> Yes. I have a cascade lake xeon on which I am building gcc.
> >
> > You'll need `-march=cascadelake` to tell GCC your CPU is a Cascade
> > Lake, and `-ftree-vectorize` to tell GCC to vectorize some loops into
> > AVX/AVX2/AVX512 instructions.
>
> I am trying to build GCC to support  AVX,
> not building the application with AVX which I will be doing later.

You shouldn't need to do anything special to get a GCC that can
generate AVX instructions, that happens automatically if your
assembler supports them.

There's probably no benefit to compiling GCC itself with AVX
instructions, as it's not likely to benefit from them.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-11-15 10:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-14  5:31 How to build gcc with AVX512? Cameron Fletcher (CF)
2019-11-14  8:27 ` Stefan Ring
2019-11-14  9:16   ` Cameron Fletcher (CF)
2019-11-14 15:42     ` Xi Ruoyao
2019-11-15  9:48       ` Cameron Fletcher (CF)
2019-11-15 10:22         ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).