Skip to content

Commit

Permalink
Make 128/256 bit generic simd separate options
Browse files Browse the repository at this point in the history
These will only be used on esoteric and/or new
architectures, which likely also miss cycle counters.
In this case the widest simd would be picked automatically
based on flops estimates, so to give the user more
control it is better to provide separate options
to enable/disable these two choices.
  • Loading branch information
Erik Lindahl committed Apr 8, 2015
1 parent cbe2a4a commit 4b3dbf7
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 63 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ rdft/simd/avx-128/*.c
rdft/simd/avx2/*.c
rdft/simd/avx2-128/*.c
rdft/simd/avx512/*.c
rdft/simd/generic-simd128/*.c
rdft/simd/generic-simd256/*.c
rdft/simd/common/*.c
rdft/simd/kcvi/*.c
rdft/simd/neon/*.c
Expand All @@ -34,6 +36,8 @@ dft/simd/avx-128/*.c
dft/simd/avx2/*.c
dft/simd/avx2-128/*.c
dft/simd/avx512/*.c
dft/simd/generic-simd128/*.c
dft/simd/generic-simd256/*.c
dft/simd/common/*.c
dft/simd/kcvi/*.c
dft/simd/neon/*.c
Expand Down
13 changes: 8 additions & 5 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,16 @@ NEON_LIBS = dft/simd/neon/libdft_neon_codelets.la \
rdft/simd/neon/librdft_neon_codelets.la
endif

if HAVE_GENERIC_SIMD
GENERIC_SIMD_LIBS = dft/simd/generic-simd256/libdft_generic_simd256_codelets.la \
dft/simd/generic-simd128/libdft_generic_simd128_codelets.la \
rdft/simd/generic-simd256/librdft_generic_simd256_codelets.la \
if HAVE_GENERIC_SIMD128
GENERIC_SIMD128_LIBS = dft/simd/generic-simd128/libdft_generic_simd128_codelets.la \
rdft/simd/generic-simd128/librdft_generic_simd128_codelets.la
endif

if HAVE_GENERIC_SIMD256
GENERIC_SIMD256_LIBS = dft/simd/generic-simd256/libdft_generic_simd256_codelets.la \
rdft/simd/generic-simd256/librdft_generic_simd256_codelets.la
endif

if THREADS
if COMBINED_THREADS
COMBINED_THREADLIBS=threads/libfftw3@PREC_SUFFIX@_threads.la
Expand All @@ -111,7 +114,7 @@ libfftw3@PREC_SUFFIX@_la_LIBADD = \
api/libapi.la \
$(SIMD_LIBS) $(SSE2_LIBS) $(AVX_LIBS) $(AVX2_LIBS) $(ALTIVEC_LIBS) \
$(VSX_LIBS) $(NEON_LIBS) $(KCVI_LIBS) $(AVX512_LIBS) \
$(GENERIC_SIMD_LIBS) \
$(GENERIC_SIMD128_LIBS) $(GENERIC_SIMD256_LIBS) \
$(COMBINED_THREADLIBS)

if QUAD
Expand Down
7 changes: 5 additions & 2 deletions api/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,12 @@ const char X(version)[] = PACKAGE "-" PACKAGE_VERSION
"-neon"
#endif
#if defined(HAVE_GENERIC_SIMD)
"-generic_simd"
#if defined(HAVE_GENERIC_SIMD128)
"-generic_simd128"
#endif
#if defined(HAVE_GENERIC_SIMD256)
"-generic_simd256"
#endif

;
15 changes: 11 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,18 @@ if test "$have_armv8cyclecounter"x = "yes"x; then
AC_DEFINE(HAVE_ARMV8CC,1,[Define if you have enabled the cycle counter on ARMv8])
fi

AC_ARG_ENABLE(generic-simd, [AC_HELP_STRING([--enable-generic-simd],[enable generic (gcc) SIMD optimizations])], have_generic_simd=$enableval, have_generic_simd=no)
if test "$have_generic_simd" = "yes"; then
AC_DEFINE(HAVE_GENERIC_SIMD,1,[Define to enable generic (gcc) SIMD float optimizations.])
AC_ARG_ENABLE(generic-simd128, [AC_HELP_STRING([--enable-generic-simd128],[enable generic (gcc) 128-bit SIMD optimizations])], have_generic_simd128=$enableval, have_generic_simd128=no)
if test "$have_generic_simd128" = "yes"; then
AC_DEFINE(HAVE_GENERIC_SIMD128,1,[Define to enable generic (gcc) 128-bit SIMD optimizations.])
fi
AM_CONDITIONAL(HAVE_GENERIC_SIMD, test "$have_generic_simd" = "yes")
AM_CONDITIONAL(HAVE_GENERIC_SIMD128, test "$have_generic_simd" = "yes")

AC_ARG_ENABLE(generic-simd256, [AC_HELP_STRING([--enable-generic-simd256],[enable generic (gcc) 256-bit SIMD optimizations])], have_generic_simd256=$enableval, have_generic_simd256=no)
if test "$have_generic_simd256" = "yes"; then
AC_DEFINE(HAVE_GENERIC_SIMD256,1,[Define to enable generic (gcc) 256-bit SIMD optimizations.])
fi
AM_CONDITIONAL(HAVE_GENERIC_SIMD256, test "$have_generic_simd256" = "yes")


dnl FIXME:
dnl AC_ARG_ENABLE(mips-ps, [AC_HELP_STRING([--enable-mips-ps],[enable MIPS pair-single optimizations])], have_mips_ps=$enableval, have_mips_ps=no)
Expand Down
11 changes: 5 additions & 6 deletions dft/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,10 @@ void X(dft_conf_standard)(planner *p)
if (X(have_simd_neon)())
X(solvtab_exec)(X(solvtab_dft_neon), p);
#endif
#if HAVE_GENERIC_SIMD
if (X(have_simd_generic)())
{
X(solvtab_exec)(X(solvtab_dft_generic_simd128), p);
X(solvtab_exec)(X(solvtab_dft_generic_simd256), p);
}
#if HAVE_GENERIC_SIMD128
X(solvtab_exec)(X(solvtab_dft_generic_simd128), p);
#endif
#if HAVE_GENERIC_SIMD256
X(solvtab_exec)(X(solvtab_dft_generic_simd256), p);
#endif
}
2 changes: 1 addition & 1 deletion dft/simd/generic-simd128/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SIMD_HEADER=simd-generic128.h
include $(top_srcdir)/dft/simd/codlist.mk
include $(top_srcdir)/dft/simd/simd.mk

if HAVE_GENERIC_SIMD
if HAVE_GENERIC_SIMD128

BUILT_SOURCES = $(EXTRA_DIST)
noinst_LTLIBRARIES = libdft_generic_simd128_codelets.la
Expand Down
2 changes: 1 addition & 1 deletion dft/simd/generic-simd256/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SIMD_HEADER=simd-generic256.h
include $(top_srcdir)/dft/simd/codlist.mk
include $(top_srcdir)/dft/simd/simd.mk

if HAVE_GENERIC_SIMD
if HAVE_GENERIC_SIMD256

BUILT_SOURCES = $(EXTRA_DIST)
noinst_LTLIBRARIES = libdft_generic_simd256_codelets.la
Expand Down
4 changes: 1 addition & 3 deletions kernel/ifftw.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ extern void X(extract_reim)(int sign, R *c, R **r, R **i);
defined(HAVE_KCVI) || \
defined(HAVE_ALTIVEC) || defined(HAVE_VSX) || \
defined(HAVE_MIPS_PS) || \
defined(HAVE_GENERIC128D) || defined(HAVE_GENERIC256D)
defined(HAVE_GENERIC_SIMD128) || defined(HAVE_GENERIC_SIMD256)
#define HAVE_SIMD 1
#else
#define HAVE_SIMD 0
Expand All @@ -115,8 +115,6 @@ extern int X(have_simd_avx512)(void);
extern int X(have_simd_altivec)(void);
extern int X(have_simd_vsx)(void);
extern int X(have_simd_neon)(void);
extern int X(have_simd_generic128d)(void);
extern int X(have_simd_generic256d)(void);

/* forward declarations */
typedef struct problem_s problem;
Expand Down
11 changes: 5 additions & 6 deletions rdft/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,10 @@ void X(rdft_conf_standard)(planner *p)
if (X(have_simd_neon)())
X(solvtab_exec)(X(solvtab_rdft_neon), p);
#endif
#if HAVE_GENERIC_SIMD
if (X(have_simd_generic)())
{
X(solvtab_exec)(X(solvtab_rdft_generic_simd128), p);
X(solvtab_exec)(X(solvtab_rdft_generic_simd256), p);
}
#if HAVE_GENERIC_SIMD128
X(solvtab_exec)(X(solvtab_rdft_generic_simd128), p);
#endif
#if HAVE_GENERIC_SIMD256
X(solvtab_exec)(X(solvtab_rdft_generic_simd256), p);
#endif
}
2 changes: 1 addition & 1 deletion rdft/simd/generic-simd128/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SIMD_HEADER=simd-generic128.h
include $(top_srcdir)/rdft/simd/codlist.mk
include $(top_srcdir)/rdft/simd/simd.mk

if HAVE_GENERIC_SIMD
if HAVE_GENERIC_SIMD128

noinst_LTLIBRARIES = librdft_generic_simd128_codelets.la
BUILT_SOURCES = $(EXTRA_DIST)
Expand Down
2 changes: 1 addition & 1 deletion rdft/simd/generic-simd256/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SIMD_HEADER=simd-generic256.h
include $(top_srcdir)/rdft/simd/codlist.mk
include $(top_srcdir)/rdft/simd/simd.mk

if HAVE_GENERIC_SIMD
if HAVE_GENERIC_SIMD256

noinst_LTLIBRARIES = librdft_generic_simd256_codelets.la
BUILT_SOURCES = $(EXTRA_DIST)
Expand Down
2 changes: 1 addition & 1 deletion simd-support/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ avx512.c simd-avx512.h \
kcvi.c simd-kcvi.h \
altivec.c simd-altivec.h vsx.c simd-vsx.h \
neon.c simd-neon.h \
generic.c simd-generic128.h simd-generic256.h
simd-generic128.h simd-generic256.h

# sse2-nonportable.c needs SSE2_CFLAGS, but Automake does not support
# per-object CFLAGS. Thus we build a separate library.
Expand Down
29 changes: 0 additions & 29 deletions simd-support/generic.c

This file was deleted.

2 changes: 1 addition & 1 deletion simd-support/simd-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
# define ALIGNMENT 16 /* Alignment for the LD/ST macros */
# endif
# define ALIGNMENTA 64 /* Alignment for the LDA/STA macros */
#elif defined(HAVE_GENERIC_SIMD)
#elif defined(HAVE_GENERIC_SIMD128) || defined(HAVE_GENERIC_SIMD256)
# define ALIGNMENT 16
# define ALIGNMENTA sizeof(V)
#endif
Expand Down
2 changes: 1 addition & 1 deletion simd-support/simd-generic128.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


#if defined(FFTW_LDOUBLE) || defined(FFTW_QUAD)
# error "Generic simd only works in single or double precision"
# error "Generic simd128 only works in single or double precision"
#endif

#define SIMD_SUFFIX _generic_simd128 /* for renaming */
Expand Down
2 changes: 1 addition & 1 deletion simd-support/simd-generic256.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/

#if defined(FFTW_LDOUBLE) || defined(FFTW_QUAD)
# error "Generic simd only works in single or double precision"
# error "Generic simd256 only works in single or double precision"
#endif

#define SIMD_SUFFIX _generic_simd256 /* for renaming */
Expand Down

0 comments on commit 4b3dbf7

Please sign in to comment.