From: Richard Biener <richard.guenther@gmail.com>
To: Janne Blomqvist <blomqvist.janne@gmail.com>
Cc: Thomas Koenig <tkoenig@netcologne.de>,
"fortran@gcc.gnu.org" <fortran@gcc.gnu.org>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch, fortran] Enable FMA for AVX2 and AVX512F for matmul
Date: Thu, 02 Mar 2017 08:14:00 -0000 [thread overview]
Message-ID: <CAFiYyc08M+yKc9FxBjP1wcdTp-GFYGCcvDZyn5CpP3066M+vhA@mail.gmail.com> (raw)
In-Reply-To: <CAO9iq9EUtKAkMGSJxZrtmNzfk2eEGOn=OtzGCrY=zcvx=S3+uQ@mail.gmail.com>
On Thu, Mar 2, 2017 at 9:09 AM, Janne Blomqvist
<blomqvist.janne@gmail.com> wrote:
> On Thu, Mar 2, 2017 at 9:50 AM, Thomas Koenig <tkoenig@netcologne.de> wrote:
>> Am 02.03.2017 um 08:32 schrieb Janne Blomqvist:
>>>
>>> On Wed, Mar 1, 2017 at 11:00 PM, Thomas Koenig <tkoenig@netcologne.de>
>>> wrote:
>>>>
>>>> Hello world,
>>>>
>>>> the attached patch enables FMA for the AVX2 and AVX512F variants of
>>>> matmul. This should bring a very nice speedup (although I have
>>>> been unable to run benchmarks due to lack of a suitable machine).
>>>
>>>
>>> In lieu of benchmarks, have you looked at the generated asm to verify
>>> that fma is actually used?
>>
>>
>> Yes, I did.
>>
>> Here's something from the new matmul_r8_avx2:
>>
>> 156c: c4 62 e5 b8 fd vfmadd231pd %ymm5,%ymm3,%ymm15
>> 1571: c4 c1 79 10 04 06 vmovupd (%r14,%rax,1),%xmm0
>> 1577: c4 62 dd b8 db vfmadd231pd %ymm3,%ymm4,%ymm11
>> 157c: c4 c3 7d 18 44 06 10 vinsertf128
>> $0x1,0x10(%r14,%rax,1),%ymm0,%ymm0
>> 1583: 01
>> 1584: c4 62 ed b8 ed vfmadd231pd %ymm5,%ymm2,%ymm13
>> 1589: c4 e2 ed b8 fc vfmadd231pd %ymm4,%ymm2,%ymm7
>> 158e: c4 e2 fd a8 ad 30 ff vfmadd213pd
>> -0x800d0(%rbp),%ymm0,%ymm5
>
> Great, looks good!
>
>> ... and here from matmul_r8_avx512f:
>>
>> 1da8: c4 a1 7b 10 14 d6 vmovsd (%rsi,%r10,8),%xmm2
>> 1dae: c4 c2 b1 b9 f0 vfmadd231sd %xmm8,%xmm9,%xmm6
>> 1db3: 62 62 ed 08 b9 e5 vfmadd231sd %xmm5,%xmm2,%xmm28
>> 1db9: 62 62 ed 08 b9 ec vfmadd231sd %xmm4,%xmm2,%xmm29
>> 1dbf: 62 62 ed 08 b9 f3 vfmadd231sd %xmm3,%xmm2,%xmm30
>> 1dc5: c4 e2 91 99 e8 vfmadd132sd %xmm0,%xmm13,%xmm5
>> 1dca: c4 e2 99 99 e0 vfmadd132sd %xmm0,%xmm12,%xmm4
>> 1dcf: c4 e2 a1 99 d8 vfmadd132sd %xmm0,%xmm11,%xmm3
>> 1dd4: c4 c2 a9 99 d1 vfmadd132sd %xmm9,%xmm10,%xmm2
>> 1dd9: c4 c2 89 99 c1 vfmadd132sd %xmm9,%xmm14,%xmm0
>> 1dde: 0f 8e d3 fe ff ff jle 1cb7
>> <matmul_r8_avx512f+0x1cb7>
>
> Good, it's using fma, but why is this using xmm registers? That would
> mean it's operating only on 128 bit blocks at a time so no better than
> plain AVX. AFAIU avx512 should use zmm registers to operate on 512 bit
> chunks.
>
> I guess this is not due to your patch, but some other issue.
The question is, was it using %zmm before the patch?
>
> --
> Janne Blomqvist
next prev parent reply other threads:[~2017-03-02 8:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-01 21:00 Thomas Koenig
2017-03-02 3:22 ` Jerry DeLisle
2017-03-02 6:15 ` Thomas Koenig
2017-03-02 7:32 ` Janne Blomqvist
2017-03-02 7:50 ` Thomas Koenig
2017-03-02 8:09 ` Janne Blomqvist
2017-03-02 8:14 ` Richard Biener [this message]
2017-03-02 8:16 ` Jakub Jelinek
2017-03-02 8:43 ` Jakub Jelinek
2017-03-02 9:03 ` Thomas Koenig
2017-03-02 9:08 ` Jakub Jelinek
2017-03-02 10:46 ` Thomas Koenig
2017-03-02 10:48 ` Jakub Jelinek
2017-03-02 11:02 ` Jakub Jelinek
2017-03-02 11:57 ` Thomas Koenig
2017-03-02 12:02 ` Jakub Jelinek
2017-03-02 13:01 ` Thomas Koenig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFiYyc08M+yKc9FxBjP1wcdTp-GFYGCcvDZyn5CpP3066M+vhA@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=blomqvist.janne@gmail.com \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=tkoenig@netcologne.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).