[Mesa-dev] [Mesa-stable] [PATCH] swr: fix -march flag for AVX

Rowley, Timothy O timothy.o.rowley at intel.com
Fri Jun 10 20:56:56 UTC 2016


> On Jun 10, 2016, at 3:49 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> 
> On Fri, Jun 10, 2016 at 4:48 PM, Rowley, Timothy O
> <timothy.o.rowley at intel.com> wrote:
>> 
>>> On Jun 10, 2016, at 3:37 PM, Rowley, Timothy O <timothy.o.rowley at intel.com> wrote:
>>> 
>>>> 
>>>> On Jun 10, 2016, at 3:01 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>>>> 
>>>> On 10 June 2016 at 20:43, Tim Rowley <timothy.o.rowley at intel.com> wrote:
>>>>> Previously used core-avx-i was for ivybridge;
>>>>> corei7-avx allows sandybridge.
>>>> Which GCC version was required by the previous and which by the
>>>> current version ?
>>> 
>>> Both options work back to gcc 4.8.x.  I picked the wrong architecture flag when setting up the build system initially.
>>> 
>>>>> ---
>>>>> src/gallium/drivers/swr/Makefile.am | 2 +-
>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>> 
>>>>> diff --git a/src/gallium/drivers/swr/Makefile.am b/src/gallium/drivers/swr/Makefile.am
>>>>> index d211f2e..8156cf2 100644
>>>>> --- a/src/gallium/drivers/swr/Makefile.am
>>>>> +++ b/src/gallium/drivers/swr/Makefile.am
>>>>> @@ -124,7 +124,7 @@ COMMON_LDFLAGS = \
>>>>> lib_LTLIBRARIES = libswrAVX.la libswrAVX2.la
>>>>> 
>>>>> libswrAVX_la_CXXFLAGS = \
>>>>> -       -march=core-avx-i \
>>>>> +       -march=corei7-avx \
>>>> I'm likely missing something but neither one seems listed in the 5.4
>>>> [1] and 6.1 [2] manual. Should we be using one that's officially
>>>> supported ?
>>> 
>>> According to Chuck Atkins, while the older options aren’t documented anymore, they still work on gcc 5.x and 6.x.
>>> 
>>> Another possibility which Ilia also mentioned was to use feature flags instead which have stayed consistent between gcc versions, i.e. “-mavx” and “-mavx2 -mfma -mf16c” respectively for the avx and avx2 configurations.  Not too opposed to this except that we’ve had extensive testing with the -march flags and changing the build configuration during the release candidate stage seems a bit late.
>> 
>> Another thought along these lines - since the swr code makes heavy use of intrinsics, we would like to have the code optimized as best as possible to the target architecture (or at least, the baseline architecture which introduces AVX and AVX2 respectively), which is best done with the -march flags.
> 
> Actually it's best done with -mtune flags. -march, of course, also
> sets mtune. (But you can override it later.)

Ah, true.  Though the documented architecture flags for -mtune have changed along with -march between gcc 4.8 and gcc >=5, so we don’t really gain from using feature flags and -mtune versus -march.



More information about the mesa-dev mailing list