From: Yongseok Koh <yskoh@mellanox.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: Thomas Monjalon <thomas@monjalon.net>,
"bruce.richardson@intel.com" <bruce.richardson@intel.com>,
"dev@dpdk.org" <dev@dpdk.org>,
Shahaf Shuler <shahafs@mellanox.com>,
"stable@dpdk.org" <stable@dpdk.org>,
Konstantin Ananyev <konstantin.ananyev@intel.com>,
Anatoly Burakov <anatoly.burakov@intel.com>
Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH] build: disable compiler AVX512F support
Date: Fri, 2 Nov 2018 23:31:37 +0000 [thread overview]
Message-ID: <20181102233115.GD15737@mtidpdk.mti.labs.mlnx> (raw)
In-Reply-To: <f3a8112e-d3e8-2cce-9894-bb2fdce96ede@intel.com>
On Fri, Nov 02, 2018 at 09:46:09PM +0000, Ferruh Yigit wrote:
> On 11/2/2018 8:59 PM, Yongseok Koh wrote:
> > On Fri, Nov 02, 2018 at 01:48:11PM +0000, Ferruh Yigit wrote:
> >> On 11/2/2018 12:42 PM, Ferruh Yigit wrote:
> >>> On 10/23/2018 10:23 PM, Yongseok Koh wrote:
> >>>> This is a workaround to prevent a crash, which might be caused by
> >>>> optimization of newer gcc (7.3.0) on Intel Skylake.
> >>>>
> >>>> Bugzilla ID: 97
> >>>
> >>> After checking the defect description again, this is the issue observed in
> >>> rte_memcpy() implementation for AVX2, compiler uses AVX512F instructions while
> >>> compiling it which causes the failure, so this may be a compiler defect but we
> >>> don't know the root cause yet.
> >>
> >> Is the issue only with gcc, and only with specific version of gcc?
> >> If so can we reduce the disabling avx512 only to that gcc version?
> >>
> >>>
> >>> I think best solution is to find the root cause and fix either avx2
> >>> implementation or compiler, but this seems won't be soon, at least for rc2.
> >>>
> >>> What this patch does is to prevent compiler to use avx512f instruction when
> >>> "CONFIG_RTE_ENABLE_AVX512=n".
> >>>
> >>> Concern is this will affect all DPDK generated code for x86, but since
> >>> rte_memcpy() in header file there is no way to disable using avx512f
> >>> instructions locally for rte_memcpy().
> >>> I can't think of any other solution for now, so OK to go with this patch for
> >>> now. Please find below comment.
> >>>
> >>>>
> >>>> Cc: stable@dpdk.org
> >>>>
> >>>> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
> >>>> ---
> >>>> config/x86/meson.build | 5 +++++
> >>>> mk/rte.cpuflags.mk | 5 +++++
> >>>> 2 files changed, 10 insertions(+)
> >>>>
> >>>> diff --git a/config/x86/meson.build b/config/x86/meson.build
> >>>> index 33efb5e547..e10ba872ac 100644
> >>>> --- a/config/x86/meson.build
> >>>> +++ b/config/x86/meson.build
> >>>> @@ -47,6 +47,11 @@ endif
> >>>> if cc.get_define('__AVX512F__', args: march_opt) != ''
> >>>> dpdk_conf.set('RTE_MACHINE_CPUFLAG_AVX512F', 1)
> >>>> compile_time_cpuflags += ['RTE_CPUFLAG_AVX512F']
> >>>> +else
> >>>> +# disable compiler's AVX512F support as a workaround for Bug 97
> >>>> + if cc.has_argument('-mavx512f')
> >>>> + machine_args += '-mno-avx512f'
> >>>> + endif
> >>>> endif
> >>>>
> >>>> dpdk_conf.set('RTE_CACHE_LINE_SIZE', 64)
> >>>> diff --git a/mk/rte.cpuflags.mk b/mk/rte.cpuflags.mk
> >>>> index 43ed84155b..8fdb0cc2c3 100644
> >>>> --- a/mk/rte.cpuflags.mk
> >>>> +++ b/mk/rte.cpuflags.mk
> >>>> @@ -68,6 +68,11 @@ endif
> >>>> ifneq ($(filter $(AUTO_CPUFLAGS),__AVX512F__),)
> >>>> ifeq ($(CONFIG_RTE_ENABLE_AVX512),y)
> >>>> CPUFLAGS += AVX512F
> >>>> +else
> >>>> +# disable compiler's AVX512F support as a workaround for Bug 97
> >>>> +ifeq ($(shell $(CC) --target-help | grep -q mavx512f && echo 1), 1)
> >>>
> >>> This will not work for ICC, and do we need this? AUTO_CPUFLAGS already should
> >>> have what you are looking for, so I think this check can be removed.
> >
> > This is different from AUTO_CPUFLAGS as it tries to check compiler flag support.
>
> What AUTO_CPUFLAGS does?
>
> It is output of `cc -march=xxx -dM -E - < /dev/null`, which list defined macros
> for that specific march provided.
>
> Like if you use `-march=corei7` you won't see __AVX2__ set.
>
> And for `native`, if compiler doesn't support AVX2, I assume it won't able to
> output __AVX2__
>
> Is there a case AUTO_CPUFLAGS has __AVX512F__ but "$(CC) --target-help" doesn't
> have `mavx512f`?
Right. For some reason, I have wrong impression that the flag grabs cpuflags of
the compile host. Will submit a new version.
> > And per your question, I have only tested it with gcc, so I agree on applying it
> > only for gcc. Will submit v2. But, I don't think we need to check gcc version as
> > there's no fix reported yet in a newer gcc version and this patch would have
> > very limited impact. avx512f support is quite new and kinda experimental so
> > far. Dropping a bit of performance would be better than crash. :-)
> >
> > Thanks for your review,
> > Yongseok
> >
> >>>> +MACHINE_CFLAGS += -mno-avx512f
> >>>> +endif
> >>>> endif
> >>>> endif
> >>>>
> >>>>
> >>>
> >>
>
next prev parent reply other threads:[~2018-11-02 23:31 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-23 21:23 [dpdk-dev] " Yongseok Koh
2018-11-01 23:11 ` Thomas Monjalon
2018-11-02 12:42 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2018-11-02 13:48 ` Ferruh Yigit
2018-11-02 20:59 ` Yongseok Koh
2018-11-02 21:46 ` Ferruh Yigit
2018-11-02 23:31 ` Yongseok Koh [this message]
2018-11-02 21:04 ` [dpdk-dev] [PATCH v2] " Yongseok Koh
2018-11-05 14:06 ` Wiles, Keith
2018-11-06 21:30 ` Yongseok Koh
2018-11-07 9:04 ` Wiles, Keith
2018-11-08 15:59 ` [dpdk-dev] AVX512 bug on SkyLake Thomas Monjalon
2018-11-08 17:21 ` Ferruh Yigit
2018-11-08 23:01 ` Yongseok Koh
2018-11-09 6:27 ` Christian Ehrhardt
2018-11-09 9:49 ` Ferruh Yigit
2018-11-09 11:35 ` Thomas Monjalon
2018-11-09 10:03 ` Ferruh Yigit
2018-11-09 13:17 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2018-11-09 14:27 ` Thomas Monjalon
2018-11-09 20:06 ` Ferruh Yigit
2018-11-09 18:46 ` [dpdk-dev] " Stephen Hemminger
2018-11-10 2:13 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2018-11-11 14:15 ` Ananyev, Konstantin
2018-11-11 18:15 ` Thomas Monjalon
2018-11-12 9:09 ` Christian Ehrhardt
2018-11-12 9:21 ` Thomas Monjalon
2018-11-12 9:26 ` Ananyev, Konstantin
2018-11-03 1:06 ` [dpdk-dev] [PATCH v3] build: disable gcc AVX512F support Yongseok Koh
2018-11-04 20:56 ` Thomas Monjalon
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=20181102233115.GD15737@mtidpdk.mti.labs.mlnx \
--to=yskoh@mellanox.com \
--cc=anatoly.burakov@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=konstantin.ananyev@intel.com \
--cc=shahafs@mellanox.com \
--cc=stable@dpdk.org \
--cc=thomas@monjalon.net \
/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 NNTP newsgroup(s).