folly_memcpy is ready for benchmarking

This commit is contained in:
Russell Sears 2020-04-28 12:41:56 -07:00
parent 937baedd44
commit b84fcbc828
4 changed files with 16 additions and 10 deletions

View File

@ -255,6 +255,7 @@ else()
if (GCC) if (GCC)
add_compile_options(-Wno-pragmas) add_compile_options(-Wno-pragmas)
add_compile_options(-mavx) add_compile_options(-mavx)
# add_compile_options(-fno-builtin-memcpy)
# Otherwise `state [[maybe_unused]] int x;` will issue a warning. # Otherwise `state [[maybe_unused]] int x;` will issue a warning.
# https://stackoverflow.com/questions/50646334/maybe-unused-on-member-variable-gcc-warns-incorrectly-that-attribute-is # https://stackoverflow.com/questions/50646334/maybe-unused-on-member-variable-gcc-warns-incorrectly-that-attribute-is
add_compile_options(-Wno-attributes) add_compile_options(-Wno-attributes)

View File

@ -75,6 +75,7 @@ set(FLOW_SRCS
flat_buffers.h flat_buffers.h
flow.cpp flow.cpp
flow.h flow.h
folly_memcpy.S
genericactors.actor.cpp genericactors.actor.cpp
genericactors.actor.h genericactors.actor.h
network.cpp network.cpp

View File

@ -79,9 +79,9 @@ _memcpy_short:
* *
*/ */
.align 16 .align 16
.globl memcpy .globl folly_memcpy
.type memcpy, @function .type folly_memcpy, @function
memcpy: folly_memcpy:
.cfi_startproc .cfi_startproc
mov %rdx, %rcx mov %rdx, %rcx
@ -173,6 +173,6 @@ memcpy:
ret ret
.cfi_endproc .cfi_endproc
.size memcpy, .-memcpy .size folly_memcpy, .-folly_memcpy
#endif #endif

View File

@ -12,6 +12,10 @@
#include "flow/IRandom.h" #include "flow/IRandom.h"
#include "flow/UnitTest.h" #include "flow/UnitTest.h"
extern "C" {
void* folly_memcpy(void* dst, void* src, uint32_t length);
}
/* /*
* Set this to the maximum buffer size you want to test. If it is 0, then the * Set this to the maximum buffer size you want to test. If it is 0, then the
* values in the buf_sizes[] array below will be used. * values in the buf_sizes[] array below will be used.
@ -46,13 +50,13 @@ static size_t buf_sizes[TEST_VALUE_RANGE];
#define TEST_BATCH_SIZE 100 #define TEST_BATCH_SIZE 100
/* Data is aligned on this many bytes (power of 2) */ /* Data is aligned on this many bytes (power of 2) */
#ifdef RTE_MACHINE_CPUFLAG_AVX512F // #ifdef RTE_MACHINE_CPUFLAG_AVX512F
#define ALIGNMENT_UNIT 64 #define ALIGNMENT_UNIT 64
#elif defined RTE_MACHINE_CPUFLAG_AVX2 // #elif defined RTE_MACHINE_CPUFLAG_AVX2
#define ALIGNMENT_UNIT 32 // #define ALIGNMENT_UNIT 32
#else /* RTE_MACHINE_CPUFLAG */ // #else /* RTE_MACHINE_CPUFLAG */
#define ALIGNMENT_UNIT 16 // #define ALIGNMENT_UNIT 16
#endif /* RTE_MACHINE_CPUFLAG */ // #endif /* RTE_MACHINE_CPUFLAG */
/* /*
* Pointers used in performance tests. The two large buffers are for uncached * Pointers used in performance tests. The two large buffers are for uncached