Commit Graph

37 Commits (master)

Author SHA1 Message Date
Bassam Tabbara 0690ba86a8 Added --enable flags for debugging runtime SIMD 2016-09-13 12:25:00 -07:00
Bassam Tabbara ad11042132 Simplify SIMD make scripts
ax_ext.m4 no longer performs any CPU checks. Instead it just checks
if the the compile supports SIMD flags.

Runtime detection will choose the right methods base on CPU
instructions available.

Intel AVX support is still done through the build since it would
require a major refactoring of the code base to support it at runtime.
For now I added a configuration flag --enable-avx that can be used
to compile with AVX support.

Also use cpu intrinsics instead of __asm__
2016-09-13 12:25:00 -07:00
Bassam Tabbara 4339569f14 Support for runtime SIMD detection
This commits adds support for runtime detection of SIMD instructions. The idea is that you would build once with all supported SIMD functions and the same binaries could run on different machines with varying support for SIMD. At runtime gf-complete will select the right functions based on the processor.

gf_cpu.c has the logic to detect SIMD instructions. On Intel processors this is done through cpuid. For ARM on linux we use getauxv.

The logic in gf_w*.c has been changed to check for runtime SIMD support and fallback to generic code.

Also a new test has been added. It compares the functions selected by gf_init when we enable/disable SIMD support through build flags, with runtime enabling/disabling. The test checks if the results are identical.
2016-09-13 12:24:25 -07:00
Bassam Tabbara 7761438c63 Add SIMD test helpers
This commit adds a couple of scripts that help test SIMD functionality
on different machines through QEMU.

tools/test_simd_qemu.sh will automatically start qemu, run tests
and stop it. it uses the Ubuntu cloud images which are built for
x86_64, arm and arm64.

tools/test_simd.sh run a number of tests including compiling
with different flags, unit tests, and gathering the functions
selected in gf_init (and when compiling with DEBUG_FUNCTIONS)
2016-09-13 12:24:25 -07:00
Bassam Tabbara 87f0d4395d Add support for printing functions selected in gf_init
There is currently no way to figure out which functions were selected
during gf_init and as a result of SIMD options. This is not even possible
in gdb since most functions are static.

This commit adds a new macro SET_FUNCTION that records the name of the
function selected during init inside the gf_internal structure. This macro
only works when DEBUG_FUNCTIONS is defined during compile. Otherwise the
code works exactly as it did before this change.

The names of selected functions will be used during testing of SIMD
runtime detection.

All calls such as:

gf->multiply.w32 = gf_w16_shift_multiply;

need to be replaced with the following:

SET_FUNCTION(gf,multiply,w32,gf_w16_shift_multiply)

Also added a new flag to tools/gf_methods that will print the names of
functions selected during gf_init.
2016-09-13 12:24:25 -07:00
Loic Dachary f940bf3b5b log-zero-ext: workaround for uninitialized memory
Workaround until issue #13 is dealt with.

Signed-off-by: Loic Dachary <loic@dachary.org>
2016-09-13 11:46:05 +02:00
Loic Dachary 22cd7b15e8 add --enable-valgrind for make check
If --enable-valgrind is given to ./configure, all tests are run with
valgrind set to fail if an error is reported ( --error-exitcode=1 )

Signed-off-by: Loic Dachary <loic@dachary.org>
2016-09-13 10:09:00 +02:00
Janne Grunau 36e75c3efe use posix_memalign to align memory for SIMD region tests
Properly emulate aligned allocation if posix_memalign is not available.
2014-10-09 23:22:34 +02:00
Janne Grunau 568df90edc simd: rename the region flags from SSE to SIMD
SSE is not the only supported SIMD instruction set. Keep the old names
for backward compatibility.
2014-10-09 23:22:32 +02:00
Janne Grunau 2a2f1e306f check: split unit tests and support paralell execution 2014-10-09 23:22:29 +02:00
Janne Grunau f6828cfbc1 build: fix out of source tree build 2014-10-09 23:22:28 +02:00
Adam Disney c25310f215 Removed comments marking CARRY_FREE_GK additions. 2014-06-16 13:04:15 -04:00
Adam Disney f48f2d38af Merge remote-tracking branch 'dalgaaf/wip-da-sca-20140513' 2014-06-16 12:44:45 -04:00
Adam Disney 5be1fecbcb Fixed a few minor warnings when running autogen.sh. 2014-06-16 12:27:19 -04:00
Adam Disney d08de3bdcb Merge remote-tracking branch 'jayrde/wip-autoconf-cleanup'
Conflicts:
	.gitignore
	INSTALL
	Makefile.in
	aclocal.m4
	config.guess
	config.sub
	configure
	examples/Makefile.in
	include/config.h.in
	include/config.h.in~
	install-sh
	ltmain.sh
	m4/libtool.m4
	m4/ltversion.m4
	missing
	src/Makefile.in
	test/Makefile.in
	tools/Makefile.in
2014-06-16 12:24:06 -04:00
Adam Disney 6bb1ebb9f4 Implemented CARRY_FREE_GK. Sections added are tagged with a comment //ADAM
for easy navigation.
2014-06-06 13:09:04 -04:00
Danny Al-Gaaf 40b9f8f968 gf_time.c: remove dead assignment to 'elapsed'
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2014-05-14 16:12:59 +02:00
Danny Al-Gaaf 3e242830b0 tools/gf_poly.c: fix undefined allocation of 0 bytes
Due to man page of malloc the behaviour in case of allocation size of
0 bytes is undefined: "If size was equal to 0, either NULL or a
pointer suitable to be passed  to free() is returned"

Fix for clang scan-build report:

Unix API     Undefined allocation of 0 bytes (CERT MEM04-C; CWE-131)

210 poly = (gf_general_t *) malloc(sizeof(gf_general_t)*(n+1));

    9 Call to 'malloc' has an allocation size of 0 bytes

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2014-05-14 09:55:57 +02:00
Danny Al-Gaaf 33492be5db gf_inline_time.c: fix memory leak
Free all with malloc allocated memory before exit. Change
if checks against 'w' to be a if-else check to prevent checking
after already matched.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2014-05-13 19:06:13 +02:00
Kevin Greenan 8a96cbb371 Ran autogen to pick-up the changes needed to run 'make check' 2014-04-02 10:35:21 -07:00
Loic Dachary c18b97cd02 add make check target and basic tests
To conveniently run tests as

 $ make check
 ============================================================================
 Testsuite summary for gf-complete 1.0
 ============================================================================
 # TOTAL: 1
 # PASS:  1
 # SKIP:  0
 # XFAIL: 0
 # FAIL:  0
 # XPASS: 0
 # ERROR: 0
 ============================================================================

The run-tests.sh script loops over gf_methods and is introduced because
autotools does not allow tests to have parameters in the Makefile.am

Signed-off-by: Loic Dachary <loic@dachary.org>
2014-04-02 17:57:15 +02:00
Jens Rosenboom 2758e242fe remove autogenerated files from repository 2014-03-18 21:53:24 +01:00
Loic Dachary 5c5b312a76 main() returns int
Signed-off-by: Loic Dachary <loic@dachary.org>
2014-03-06 17:48:38 +01:00
Loic Dachary 191b86b5d2 remove unused variables from #if SSE blocs
Signed-off-by: Loic Dachary <loic@dachary.org>
2014-03-06 17:48:38 +01:00
Loic Dachary 59cb51046b remove spurious i < in for loop
Signed-off-by: Loic Dachary <loic@dachary.org>
2014-03-06 17:48:38 +01:00
Loic Dachary 3c4a451b50 silence some warnings for unset variables
By setting them when they are defined and when the compiler fails to see
the logic is ok.

Signed-off-by: Loic Dachary <loic@dachary.org>
2014-03-06 17:47:59 +01:00
Loic Dachary d36bd6e540 cast void* to char* for pointer arithmetic
Signed-off-by: Loic Dachary <loic@dachary.org>
2014-03-06 17:29:36 +01:00
Jim Plank f0c32c94bc Removed GROUP/128/SSE. It wasn't compiling, and it needed an overhaul.
I'll do it someday when I'm bored.
2014-01-01 11:00:40 -05:00
Kevin Greenan 5687b9c2cc Third.1 time's a charm (autoconf non-sense for PCLMUL). 2013-12-30 22:50:04 -08:00
Kevin Greenan 137b7ccd75 Revert "Third time's a charm (autoconf non-sense for PCLMUL)."
The commit was not successfully pushed (not sure what happened).

This reverts commit 762926920a.
2013-12-30 22:40:18 -08:00
Kevin Greenan 762926920a Third time's a charm (autoconf non-sense for PCLMUL). 2013-12-30 21:26:47 -08:00
Kevin Greenan a98f6c1115 Added entry to configure.ac to avoid running autotools during normal build. 2013-12-30 16:31:54 -08:00
Kevin Greenan a97563f0e4 Added PCLMUL to the autoconf macro... 2013-12-30 14:14:08 -08:00
Jim Plank 393fa02fd9 Some wordsmithing. 2013-12-30 15:55:37 -05:00
Jim Plank 88bb18c651 Added time_tool.sh to tools for quick timing.
Modified gf_methods to be a little more flexible.
2013-12-29 16:51:37 -05:00
Kevin Greenan e1c76b4dd4 Added exhaustive test support (Ethan's changes to gf_unit and gf_methods) and overrode autoconf's defaults for CFLAGS. 2013-12-07 16:05:31 -08:00
Kevin Greenan 153dd20988 Setting up autoconf/automake for GF-Complete
Also re-organized the directory structure.

Signed-off-by: Kevin Greenan <kmgreen2@gmail.com>
2013-12-04 21:24:29 -08:00