How to get best AVX2 performance from gfortran?
Thomas Koenig
tkoenig@netcologne.de
Thu Apr 19 08:09:00 GMT 2018
Hi Matt,
[timings]
> Intel AVX2:
>
> Â Â C_SWÂ Â Â Â Â Â 1.4931
> Â Â D_SWÂ Â Â Â Â Â 5.4254
> Â Â PG_DÂ Â Â Â Â Â 1.0878
> Â Â TRACER_2D 24.7418
> Â Â REMAPPING 27.2644
> Now I looked at GNU Fortran (7.3.0). Here my "stock" flags are quite
> boring (and all flags, not just the optimization ones):
[Various options elided, the best was]:
> GNU Haswell NoFMA Repack:
> Â Â C_SWÂ Â Â Â Â Â Â 2.4350
> Â Â D_SWÂ Â Â Â Â Â Â 9.7109
> Â Â PG_DÂ Â Â Â Â Â Â 0.7869
> Â Â TRACER_2D 163.6474
> Â Â REMAPPING 100.6820
>
> So, my questions to you gurus are: Is there something I could try adding
> to my gfortran options that might help with this discrepancy between
> Intel AVX2 and GCC? Or perhaps I need to *remove* something (some flag
> kills the vectorizer)?
The gcc 8 release is just around the corner, and a lot of improvements
have been made to code generation, also for AVX2. You might want to give
the current trunk (or the soon-to-be-released) release candidate, or the
then newly released gcc8 a spin.
Second, this performance gap with respect to Intel (a factor of 6.6 for
your TRACER_2D routine) is dramatic. If anything like this persists in
gcc8, the only way to get this fixed is to submit a bug report.
Profile the code, try to reduce the code to something that shows
the the problem (and that you can put in a bug report).
Regards
Thomas
More information about the Gcc
mailing list