Commit Graph

20 Commits (4339569f14c95a8895a347845f8ed6e18b345ace)

Author SHA1 Message Date
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 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 d1b6bbf706 add -Wsign-compare and address the warnings
* (1 << w) are changed into ((uint32_t)1 << w)
* int are changed into uint32_t

gf.c: gf_composite_get_default_poly:

   a larger unsigned were assigned to unsigned integers in which case
   the type of the assigned variable is changed to be the same as the
   value assigned to it.

gf_w16.c: GF_MULTBY_TWO

   setting the parameter to a variable instead of passing the expression
   resolves the warning for some reason.

Signed-off-by: Loic Dachary <loic@dachary.org>
2015-09-02 19:20:33 +02:00
Danny Al-Gaaf 2f6db512fb gf_w64.c: fix integer overflow
Fix for Coverity issue (from Ceph):

CID 1193089 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
 overflow_before_widen: Potentially overflowing expression 1 << g_r with type
 int (32 bits, signed) is evaluated using 32-bit arithmetic, and then used in
 a context that expects an expression of type uint64_t (64 bits, unsigned).

CID 1193090 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
 overflow_before_widen: Potentially overflowing expression 1 << g_s with type
 int (32 bits, signed) is evaluated using 32-bit arithmetic, and then used in
 a context that expects an expression of type uint64_t (64 bits, unsigned).

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2015-06-18 09:01:37 +02:00
Danny Al-Gaaf 1aef8694bc gf_w64.c: fix integer overflow
Fix for Coverity issue (from Ceph):

CID 1193088 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
 overflow_before_widen: Potentially overflowing expression 1 << g_s with type
 int (32 bits, signed) is evaluated using 32-bit arithmetic, and then used in
 a context that expects an expression of type uint64_t (64 bits, unsigned).

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2015-06-18 09:00:03 +02:00
Danny Al-Gaaf e127bb1fb9 gf_w64.c: fix integer overflow
Fix for Coverity issue (from Ceph):

CID 1193087 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
 overflow_before_widen: Potentially overflowing expression 1 << g_r with type
  int (32 bits, signed) is evaluated using 32-bit arithmetic, and then used
  in a context that expects an expression of type uint64_t (64 bits, unsigned).

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2015-06-18 08:58:20 +02:00
Danny Al-Gaaf 98e5e37159 gf_w64.c: fix integer overflow
Fix for Coverity issue (from Ceph):

CID 1193086 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
 overflow_before_widen: Potentially overflowing expression 1 << g_r with type
  int (32 bits, signed) is evaluated using 32-bit arithmetic, and then used in
  a context that expects an expression of type uint64_t (64 bits, unsigned).

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2015-06-18 08:55:49 +02:00
Danny Al-Gaaf da671b4908 src/gf_w64.c: remove dead code
Fix for Coverity issue:

CID 1297852 (#1 of 1): 'Constant'; variable guards dead code (DEADCODE)
 dead_error_begin: Execution cannot reach this statement:
  fprintf(stderr, "Code conta....
 Local variable no_default_flag is assigned only once, to a constant value,
  making it effectively constant throughout its scope. If this is not the
  intent, examine the logic to see if there is a missing assignment that
  would make no_default_flag not remain constant.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2015-06-17 10:46:21 +02:00
Janne Grunau 6fdd8bc3d3 arm: NEON optimisations for gf_w64
Optimisations for 4,64 split table region multiplications. Only used on
ARMv8-A since it is not faster on ARMv7-A.
2014-10-24 14:54:55 +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
Danny Al-Gaaf c0dd8e0fe2 gf_w64.c: remove dead assignments and unused variable 'm2'
The 'm2' variable in gf_w64_clm_multiply_region_from_single_2() isn't
used except for calculations on 'm2' which are not used later in the code.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2014-05-14 10:49:20 +02:00
Danny Al-Gaaf 277819a972 gf_w64.c: remove dead assigments in gf_w64_shift_multiply()
These assigments are never used and directly overwritten later
in the function.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2014-05-14 10:46:05 +02: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 29899ad443 move #if to avoid unused warning
Signed-off-by: Loic Dachary <loic@dachary.org>
2014-03-06 17:32:30 +01:00
Loic Dachary f043479e3c remove unused variables
In some places move variables in the scope of the CPP define where they
are used.

Signed-off-by: Loic Dachary <loic@dachary.org>
2014-03-06 15:15:22 +01:00
Jim Plank fb0bbdcf62 Fixed the problem with PCLMUL and gf_complete.h. Removed
ARCH_64 from everything but 128/GROUP/SSE.  Fortunately, no
one ever uses that.
2013-12-31 20:08:18 -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 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