From ac08620ab68dba20b21eb75b8a844b92c5e4447b Mon Sep 17 00:00:00 2001 From: x Date: Wed, 16 Oct 2019 19:47:31 +0200 Subject: [PATCH] IcBench App: External libs --- ext/FastPFor | 2 +- ext/JASSv2 | 2 +- ext/c-blosc | 2 +- ext/fastpfor.cc | 128 ++++++++++++++++++++++++++++++++++++++++++++++++ ext/fastpfor.h | 20 ++++++++ ext/lz4 | 2 +- 6 files changed, 152 insertions(+), 4 deletions(-) create mode 100644 ext/fastpfor.cc create mode 100644 ext/fastpfor.h diff --git a/ext/FastPFor b/ext/FastPFor index dfc88a9..14281a0 160000 --- a/ext/FastPFor +++ b/ext/FastPFor @@ -1 +1 @@ -Subproject commit dfc88a9f775958f325982a2699db08324fca0568 +Subproject commit 14281a020ace4fd0bc3282cf905c6f0b320b8f2f diff --git a/ext/JASSv2 b/ext/JASSv2 index 8956368..40a133e 160000 --- a/ext/JASSv2 +++ b/ext/JASSv2 @@ -1 +1 @@ -Subproject commit 8956368f5ac181b2b093785f6745a39104e1bf38 +Subproject commit 40a133e55d0e06b8b1df16752a1e63155dc89f2a diff --git a/ext/c-blosc b/ext/c-blosc index 667b961..aa8ee96 160000 --- a/ext/c-blosc +++ b/ext/c-blosc @@ -1 +1 @@ -Subproject commit 667b961d402ca0aee5b0cedc5c284c25518f51a7 +Subproject commit aa8ee96d5b584bc311e70b4bec1ee16c33b05d07 diff --git a/ext/fastpfor.cc b/ext/fastpfor.cc new file mode 100644 index 0000000..6e9a600 --- /dev/null +++ b/ext/fastpfor.cc @@ -0,0 +1,128 @@ +#if defined(_MSC_VER) && _MSC_VER < 1600 +#include "../vs/stdint.h" +#else +#include +#endif + +#include "fastpfor.h" +#include "FastPFor/headers/variablebyte.h" +#include "FastPFor/headers/simple16.h" +//#include "FastPFor/headers/simple8b_rle.h" +#include "FastPFor/headers/fastpfor.h" + +#include "FastPFor/headers/simdfastpfor.h" +#include "FastPFor/headers/optpfor.h" +#include "FastPFor/headers/simdoptpfor.h" + #ifndef min +#define min(x,y) (((x)<(y)) ? (x) : (y)) + #endif +#define _mm_store_si128 _mm_storeu_si128 +#define _mm_load_si128 _mm_loadu_si128 +#include "FastPFor/headers/simdgroupsimple.h" +#undef min + +#include "FastPFor/headers/compositecodec.h" + +#define ctou32(_cp_) (*(unsigned *)(_cp_)) + +unsigned FastPFore32(const uint32_t *in, unsigned n, unsigned char *out, unsigned outsize) { + size_t nvalue = outsize/4; + FastPForLib::FastPFor<4> ic; + ic.encodeArray((const uint32_t *)in, n & (~127), (uint32_t *)(out+4), nvalue); + if(n & 127) { + size_t nvalue2 = outsize/4 - nvalue; + FastPForLib::VariableByte vc; + vc.encodeArray((const uint32_t *)(in + (n & (~127))), n & 127, (uint32_t *)(out + 4 + nvalue*4), nvalue2); + nvalue += nvalue2; + } + ctou32(out) = nvalue; + return 4+nvalue*4; +} + +unsigned FastPFord32(const unsigned char *in, unsigned n, uint32_t *out) { + size_t nvalue = n; + FastPForLib::FastPFor<4> ic; + const uint32_t *ip = ic.decodeArray((const uint32_t *)(in+4), ctou32(in), out, nvalue); + if(n & 127) { + nvalue = n - nvalue; + FastPForLib::VariableByte vc; + ip = vc.decodeArray(ip, (const uint32_t *)in+1+ctou32(in) - ip, out + (n&(~127)), nvalue); + } + return ctou32(ip); +} + +/*unsigned FastPFore64(const uint64_t *in, unsigned n, unsigned char *out, unsigned outsize) { + size_t nvalue = outsize/8; + FastPForLib::FastPFor<4> ic; + ic.encodeArray(in, (size_t)(n & (~127)), (uint32_t *)(out+4), nvalue); + if(n & 127) { + size_t nvalue2 = outsize/8 - nvalue; + FastPForLib::VariableByte vc; + + vc.encodeArray((const uint64_t *)(in + (n & (~127))), n & 127, (uint32_t *)(out + 4 + nvalue*4), nvalue2); + nvalue += nvalue2; + } + ctou32(out) = nvalue; + return 4+nvalue*4; +} + +unsigned FastPFord64(const unsigned char *in, unsigned n, uint64_t *out) { + size_t nvalue = n; + FastPForLib::FastPFor<4> ic; + const uint32_t *ip = ic.decodeArray((const uint32_t *)(in+4), ctou32(in), (uint64_t *)out, nvalue); + if(n & 127) { + nvalue = n - nvalue; + FastPForLib::VariableByte vc; + ip = vc.decodeArray(ip, (const uint32_t *)in+1+ctou32(in) - ip, out + (n&(~127)), nvalue); + } + return ctou32(ip); +}*/ + +unsigned FastPFore128v32(const uint32_t *in, unsigned n, unsigned char *out, unsigned outsize) { + size_t nvalue = outsize/4; + FastPForLib::SIMDFastPFor<4> ic; + ic.encodeArray(in, n & (~127), (uint32_t *)(out+4), nvalue); + if(n & 127) { + size_t nvalue2 = outsize/4 - nvalue; + FastPForLib::VariableByte vc; vc.encodeArray((const uint32_t *)(in + (n & (~127))), n & 127, (uint32_t *)(out + 4 + nvalue*4), nvalue2); + nvalue += nvalue2; + } + ctou32(out) = nvalue; + return 4+nvalue*4; +} + +unsigned FastPFord128v32(const unsigned char *in, unsigned n, uint32_t *out) { + size_t nvalue = n; + FastPForLib::SIMDFastPFor<4> ic; + const uint32_t *ip = ic.decodeArray((const uint32_t *)(in+4), *(uint32_t *)in, out, nvalue); + if(n & 127) { + nvalue = n - nvalue; + FastPForLib::VariableByte vc; + ip = vc.decodeArray(ip, (const uint32_t *)in+1+ctou32(in) - ip, out + (n&(~127)), nvalue); //return vbdec32((unsigned char *)ip, n & 127, out + mynvalue1); + } + return (unsigned char *)ip - (unsigned char *)in; +} + +unsigned OptPFore128v32(const uint32_t *in, unsigned n, unsigned char *out, unsigned outsize) { + size_t nvalue = outsize/4; + FastPForLib::SIMDOPTPFor<4> ic; ic.encodeArray((const uint32_t *)in, n & (~127), (uint32_t *)(out+4), nvalue); + if(n & 127) { + size_t nvalue2 = outsize/4 - nvalue; + FastPForLib::VariableByte vc; vc.encodeArray((const uint32_t *)(in + (n & (~127))), n & 127, (uint32_t *)(out + 4 + nvalue*4), nvalue2); + nvalue += nvalue2; + } + ctou32(out) = nvalue; + return 4+nvalue*4; +} + +unsigned OptPFord128v32(const unsigned char *in, unsigned n, uint32_t *out) { + size_t nvalue = n; + FastPForLib::SIMDOPTPFor<4> ic; + const uint32_t *ip = ic.decodeArray((const uint32_t *)(in+4), ctou32(in), out, nvalue); + if(n & 127) { + nvalue = n - nvalue; + FastPForLib::VariableByte vc; + return (unsigned char *)vc.decodeArray(ip, (const uint32_t *)in+1+ctou32(in) - ip, out + (n&(~127)), nvalue); //return vbdec32((unsigned char *)ip, n & 127, out + mynvalue1); + } + return (unsigned char *)ip; +} diff --git a/ext/fastpfor.h b/ext/fastpfor.h new file mode 100644 index 0000000..8bbfdc4 --- /dev/null +++ b/ext/fastpfor.h @@ -0,0 +1,20 @@ +#if defined(_MSC_VER) && _MSC_VER < 1600 +#include "vs/stdint.h" +#else +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif +unsigned FastPFore32( const uint32_t *in, unsigned n, unsigned char *out, unsigned outsize); +unsigned FastPFord32( const unsigned char *in, unsigned n, uint32_t *out); + +unsigned FastPFore128v32(const uint32_t *in, unsigned n, unsigned char *out, unsigned outsize); +unsigned FastPFord128v32(const unsigned char *in, unsigned n, uint32_t *out); + +unsigned OptPFore128v32( const uint32_t *in, unsigned n, unsigned char *out, unsigned outsize); +unsigned OptPFord128v32( const unsigned char *in, unsigned n, uint32_t *out); +#ifdef __cplusplus +} +#endif diff --git a/ext/lz4 b/ext/lz4 index e9d8e15..e8baeca 160000 --- a/ext/lz4 +++ b/ext/lz4 @@ -1 +1 @@ -Subproject commit e9d8e15263df4a0529dcd22ca48c82869d19abb9 +Subproject commit e8baeca51ef2003d6c9ec21c32f1563fef1065b9