[patch, libfortran] AMD-specific versions of library matmul

Thomas Koenig tkoenig@netcologne.de
Thu May 25 10:46:00 GMT 2017


Hello world,

the attached patch speeds up the library version of matmul for AMD chips
by selecting AVX128 instructions and, depending on which instructions
are supported, either FMA3 (aka FMA) or FMA4.

Jerry tested this on his AMD systems, and found a speedup vs. the
current code of around 10%.

I have been unable to test this on a Ryzen system (the new compile farm
machines won't accept my login yet).  From the benchmarks I have read,
this method should also work fairly well on a Ryzen.

So, OK for trunk?

Regards

	Thomas

2017-05-25  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfortran/78379
	* Makefile.am: Add generated/matmulavx128_*.c files.
	Handle them for compiling and setting the right flags.
	* acinclude.m4: Add tests for FMA3, FMA4 and AVX128.
	* configure.ac: Call them.
	* Makefile.in: Regenerated.
	* config.h.in: Regenerated.
	* configure: Regenerated.
	* m4/matmul.m4:  Handle AMD chips by calling 128-bit AVX
	versions which use FMA3 or FMA4.
	* m4/matmulavx128.m4: New file.
         * generated/matmul_c10.c: Regenerated.
         * generated/matmul_c16.c: Regenerated.
         * generated/matmul_c4.c: Regenerated.
         * generated/matmul_c8.c: Regenerated.
         * generated/matmul_i1.c: Regenerated.
         * generated/matmul_i16.c: Regenerated.
         * generated/matmul_i2.c: Regenerated.
         * generated/matmul_i4.c: Regenerated.
         * generated/matmul_i8.c: Regenerated.
         * generated/matmul_r10.c: Regenerated.
         * generated/matmul_r16.c: Regenerated.
         * generated/matmul_r4.c: Regenerated.
         * generated/matmul_r8.c: Regenerated.
         * generated/matmulavx128_c10.c: New file.
         * generated/matmulavx128_c16.c: New file.
         * generated/matmulavx128_c4.c: New file.
         * generated/matmulavx128_c8.c: New file.
         * generated/matmulavx128_i1.c: New file.
         * generated/matmulavx128_i16.c: New file.
         * generated/matmulavx128_i2.c: New file.
         * generated/matmulavx128_i4.c: New file.
         * generated/matmulavx128_i8.c: New file.
         * generated/matmulavx128_r10.c: New file.
         * generated/matmulavx128_r16.c: New file.
         * generated/matmulavx128_r4.c: New file.
         * generated/matmulavx128_r8.c: New file.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p5.diff
Type: text/x-patch
Size: 526903 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20170525/55162382/attachment.bin>


More information about the Fortran mailing list