diff options
author | Nick Foster <nick@nerdnetworks.org> | 2010-12-14 22:58:33 -0800 |
---|---|---|
committer | Nick Foster <nick@nerdnetworks.org> | 2010-12-14 22:58:33 -0800 |
commit | f9ee6a55cb397f9302769a25a8c959fa162354f0 (patch) | |
tree | 194211146c78f5cb56ea9ab8c72b231eaba31986 | |
parent | 21426265324c883c91eeaaf75a81f2ccdc6e249d (diff) |
Volk: Some new basic Orc implementations with QA code
-rw-r--r-- | volk/include/volk/volk_16u_byteswap_aligned16.h | 4 | ||||
-rw-r--r-- | volk/include/volk/volk_32f_divide_aligned16.h | 13 | ||||
-rw-r--r-- | volk/include/volk/volk_32f_multiply_aligned16.h | 14 | ||||
-rw-r--r-- | volk/include/volk/volk_32f_subtract_aligned16.h | 14 | ||||
-rw-r--r-- | volk/lib/qa_16u_byteswap_aligned16.cc | 1 | ||||
-rw-r--r-- | volk/lib/qa_32f_divide_aligned16.cc | 10 | ||||
-rw-r--r-- | volk/lib/qa_32f_multiply_aligned16.cc | 9 | ||||
-rw-r--r-- | volk/lib/qa_32f_subtract_aligned16.cc | 9 | ||||
-rw-r--r-- | volk/orc/Makefile.am | 7 | ||||
-rw-r--r-- | volk/orc/volk_16u_byteswap_aligned16_orc_impl.orc | 3 | ||||
-rw-r--r-- | volk/orc/volk_32f_divide_aligned16_orc_impl.orc | 5 | ||||
-rw-r--r-- | volk/orc/volk_32f_multiply_aligned16_orc_impl.orc | 5 | ||||
-rw-r--r-- | volk/orc/volk_32f_subtract_aligned16_orc_impl.orc | 5 |
13 files changed, 92 insertions, 7 deletions
diff --git a/volk/include/volk/volk_16u_byteswap_aligned16.h b/volk/include/volk/volk_16u_byteswap_aligned16.h index 8e628ab17a..9d19d1a456 100644 --- a/volk/include/volk/volk_16u_byteswap_aligned16.h +++ b/volk/include/volk/volk_16u_byteswap_aligned16.h @@ -67,9 +67,9 @@ static inline void volk_16u_byteswap_aligned16_generic(uint16_t* intsToSwap, uns \param intsToSwap The vector of data to byte swap \param numDataPoints The number of data points */ -extern void volk_16u_byteswap_aligned16_orc_impl(uint16_t* intsToSwap, uint16_t* intsToSwapAgain, unsigned int num_points); +extern void volk_16u_byteswap_aligned16_orc_impl(uint16_t* intsToSwap, unsigned int num_points); static inline void volk_16u_byteswap_aligned16_orc(uint16_t* intsToSwap, unsigned int num_points){ - volk_16u_byteswap_aligned16_orc_impl(intsToSwap, intsToSwap, num_points); + volk_16u_byteswap_aligned16_orc_impl(intsToSwap, num_points); } #endif /* LV_HAVE_ORC */ diff --git a/volk/include/volk/volk_32f_divide_aligned16.h b/volk/include/volk/volk_32f_divide_aligned16.h index c00700cd8a..c595b5e92c 100644 --- a/volk/include/volk/volk_32f_divide_aligned16.h +++ b/volk/include/volk/volk_32f_divide_aligned16.h @@ -63,6 +63,19 @@ static inline void volk_32f_divide_aligned16_generic(float* cVector, const float } #endif /* LV_HAVE_GENERIC */ +#if LV_HAVE_ORC +/*! + \brief Divides the two input vectors and store their results in the third vector + \param cVector The vector where the results will be stored + \param aVector The vector to be divideed + \param bVector The divisor vector + \param num_points The number of values in aVector and bVector to be divideed together and stored into cVector +*/ +extern void volk_32f_divide_aligned16_orc_impl(float* cVector, const float* aVector, const float* bVector, unsigned int num_points); +static inline void volk_32f_divide_aligned16_orc(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){ + volk_32f_divide_aligned16_orc_impl(cVector, aVector, bVector, num_points); +} +#endif /* LV_HAVE_ORC */ diff --git a/volk/include/volk/volk_32f_multiply_aligned16.h b/volk/include/volk/volk_32f_multiply_aligned16.h index b557580aba..87ae7bcf8c 100644 --- a/volk/include/volk/volk_32f_multiply_aligned16.h +++ b/volk/include/volk/volk_32f_multiply_aligned16.h @@ -63,7 +63,19 @@ static inline void volk_32f_multiply_aligned16_generic(float* cVector, const flo } #endif /* LV_HAVE_GENERIC */ - +#if LV_HAVE_ORC +/*! + \brief Multiplys the two input vectors and store their results in the third vector + \param cVector The vector where the results will be stored + \param aVector One of the vectors to be multiplied + \param bVector One of the vectors to be multiplied + \param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector +*/ +extern void volk_32f_multiply_aligned16_orc_impl(float* cVector, const float* aVector, const float* bVector, unsigned int num_points); +static inline void volk_32f_multiply_aligned16_orc(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){ + volk_32f_multiply_aligned16_orc_impl(cVector, aVector, bVector, num_points); +} +#endif /* LV_HAVE_ORC */ #endif /* INCLUDED_VOLK_32f_MULTIPLY_ALIGNED16_H */ diff --git a/volk/include/volk/volk_32f_subtract_aligned16.h b/volk/include/volk/volk_32f_subtract_aligned16.h index ac3f5e5d17..e152429016 100644 --- a/volk/include/volk/volk_32f_subtract_aligned16.h +++ b/volk/include/volk/volk_32f_subtract_aligned16.h @@ -63,5 +63,19 @@ static inline void volk_32f_subtract_aligned16_generic(float* cVector, const flo } #endif /* LV_HAVE_GENERIC */ +#if LV_HAVE_ORC +/*! + \brief Subtracts bVector form aVector and store their results in the cVector + \param cVector The vector where the results will be stored + \param aVector The initial vector + \param bVector The vector to be subtracted + \param num_points The number of values in aVector and bVector to be subtracted together and stored into cVector +*/ +extern void volk_32f_subtract_aligned16_orc_impl(float* cVector, const float* aVector, const float* bVector, unsigned int num_points); +static inline void volk_32f_subtract_aligned16_orc(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){ + volk_32f_subtract_aligned16_orc_impl(cVector, aVector, bVector, num_points); +} +#endif /* LV_HAVE_ORC */ + #endif /* INCLUDED_VOLK_32f_SUBTRACT_ALIGNED16_H */ diff --git a/volk/lib/qa_16u_byteswap_aligned16.cc b/volk/lib/qa_16u_byteswap_aligned16.cc index c30b6ba41f..b740f91df9 100644 --- a/volk/lib/qa_16u_byteswap_aligned16.cc +++ b/volk/lib/qa_16u_byteswap_aligned16.cc @@ -30,6 +30,7 @@ void qa_16u_byteswap_aligned16::t1() { output0[i] = (uint16_t) ((rand() - (RAND_MAX/2)) / (RAND_MAX/2)); } memcpy(output01, output0, vlen*sizeof(uint16_t)); + memcpy(output02, output0, vlen*sizeof(uint16_t)); printf("16u_byteswap_aligned\n"); diff --git a/volk/lib/qa_32f_divide_aligned16.cc b/volk/lib/qa_32f_divide_aligned16.cc index 8826bf94f5..f104e04439 100644 --- a/volk/lib/qa_32f_divide_aligned16.cc +++ b/volk/lib/qa_32f_divide_aligned16.cc @@ -35,6 +35,7 @@ void qa_32f_divide_aligned16::t1() { float input1[vlen] __attribute__ ((aligned (16))); float output0[vlen] __attribute__ ((aligned (16))); + float output1[vlen] __attribute__ ((aligned (16))); float output_known[vlen] __attribute__ ((aligned (16))); for(int i = 0; i < vlen; ++i) { @@ -51,6 +52,14 @@ void qa_32f_divide_aligned16::t1() { end = clock(); total = (double)(end-start)/(double)CLOCKS_PER_SEC; printf("generic_time: %f\n", total); + + start = clock(); + for(int count = 0; count < ITERS; ++count) { + volk_32f_divide_aligned16_manual(output1, input0, input1, vlen, "orc"); + } + end = clock(); + total = (double)(end-start)/(double)CLOCKS_PER_SEC; + printf("orc_time: %f\n", total); /* for(int i = 0; i < 10; ++i) { @@ -61,6 +70,7 @@ void qa_32f_divide_aligned16::t1() { for(int i = 0; i < vlen; ++i) { CPPUNIT_ASSERT_EQUAL(output0[i], output_known[i]); + CPPUNIT_ASSERT_EQUAL(output1[i], output_known[i]); } } diff --git a/volk/lib/qa_32f_multiply_aligned16.cc b/volk/lib/qa_32f_multiply_aligned16.cc index e527484663..f9c034d706 100644 --- a/volk/lib/qa_32f_multiply_aligned16.cc +++ b/volk/lib/qa_32f_multiply_aligned16.cc @@ -78,6 +78,7 @@ void qa_32f_multiply_aligned16::t1() { float output0[vlen] __attribute__ ((aligned (16))); float output01[vlen] __attribute__ ((aligned (16))); + float output02[vlen] __attribute__ ((aligned (16))); for(int i = 0; i < vlen; ++i) { input0[i] = ((float) (rand() - (RAND_MAX/2))) / static_cast<float>((RAND_MAX/2)); @@ -94,6 +95,13 @@ void qa_32f_multiply_aligned16::t1() { printf("generic_time: %f\n", total); start = clock(); for(int count = 0; count < ITERS; ++count) { + volk_32f_multiply_aligned16_manual(output02, input0, input1, vlen, "orc"); + } + end = clock(); + total = (double)(end-start)/(double)CLOCKS_PER_SEC; + printf("orc_time: %f\n", total); + start = clock(); + for(int count = 0; count < ITERS; ++count) { volk_32f_multiply_aligned16_manual(output01, input0, input1, vlen, "sse"); } end = clock(); @@ -107,6 +115,7 @@ void qa_32f_multiply_aligned16::t1() { for(int i = 0; i < vlen; ++i) { //printf("%d...%d\n", output0[i], output01[i]); CPPUNIT_ASSERT_EQUAL(output0[i], output01[i]); + CPPUNIT_ASSERT_EQUAL(output0[i], output02[i]); } } diff --git a/volk/lib/qa_32f_subtract_aligned16.cc b/volk/lib/qa_32f_subtract_aligned16.cc index a7e1b5ae34..5a5a7c9b68 100644 --- a/volk/lib/qa_32f_subtract_aligned16.cc +++ b/volk/lib/qa_32f_subtract_aligned16.cc @@ -25,6 +25,7 @@ void qa_32f_subtract_aligned16::t1() { float output0[vlen] __attribute__ ((aligned (16))); float output01[vlen] __attribute__ ((aligned (16))); + float output02[vlen] __attribute__ ((aligned (16))); for(int i = 0; i < vlen; ++i) { input0[i] = ((float) (rand() - (RAND_MAX/2))) / static_cast<float>((RAND_MAX/2)); @@ -41,6 +42,13 @@ void qa_32f_subtract_aligned16::t1() { printf("generic_time: %f\n", total); start = clock(); for(int count = 0; count < ITERS; ++count) { + volk_32f_subtract_aligned16_manual(output02, input0, input1, vlen, "orc"); + } + end = clock(); + total = (double)(end-start)/(double)CLOCKS_PER_SEC; + printf("orc_time: %f\n", total); + start = clock(); + for(int count = 0; count < ITERS; ++count) { volk_32f_subtract_aligned16_manual(output01, input0, input1, vlen, "sse"); } end = clock(); @@ -54,6 +62,7 @@ void qa_32f_subtract_aligned16::t1() { for(int i = 0; i < vlen; ++i) { //printf("%d...%d\n", output0[i], output01[i]); CPPUNIT_ASSERT_EQUAL(output0[i], output01[i]); + CPPUNIT_ASSERT_EQUAL(output0[i], output02[i]); } } diff --git a/volk/orc/Makefile.am b/volk/orc/Makefile.am index 3f155d0be6..c71625d87b 100644 --- a/volk/orc/Makefile.am +++ b/volk/orc/Makefile.am @@ -25,12 +25,15 @@ lib_LTLIBRARIES = libvolk_orc.la libvolk_orc_la_LDFLAGS = $(ORC_LDFLAGS) libvolk_orc_la_SOURCES = \ -volk_32f_sqrt_aligned16_orc_impl.orc \ volk_8s_convert_16s_aligned16_orc_impl.orc \ volk_8s_convert_32f_aligned16_orc_impl.orc \ +volk_16u_byteswap_aligned16_orc_impl.orc \ volk_32s_and_aligned16_orc_impl.orc \ volk_32f_add_aligned16_orc_impl.orc \ -volk_16u_byteswap_aligned16_orc_impl.orc +volk_32f_subtract_aligned16_orc_impl.orc \ +volk_32f_divide_aligned16_orc_impl.orc \ +volk_32f_multiply_aligned16_orc_impl.orc \ +volk_32f_sqrt_aligned16_orc_impl.orc diff --git a/volk/orc/volk_16u_byteswap_aligned16_orc_impl.orc b/volk/orc/volk_16u_byteswap_aligned16_orc_impl.orc index 73c3e345ea..3ffd12ec0e 100644 --- a/volk/orc/volk_16u_byteswap_aligned16_orc_impl.orc +++ b/volk/orc/volk_16u_byteswap_aligned16_orc_impl.orc @@ -1,4 +1,3 @@ .function volk_16u_byteswap_aligned16_orc_impl .dest 2 dst -.source 2 src -swapw dst, src +swapw dst, dst diff --git a/volk/orc/volk_32f_divide_aligned16_orc_impl.orc b/volk/orc/volk_32f_divide_aligned16_orc_impl.orc new file mode 100644 index 0000000000..870843f2af --- /dev/null +++ b/volk/orc/volk_32f_divide_aligned16_orc_impl.orc @@ -0,0 +1,5 @@ +.function volk_32f_divide_aligned16_orc_impl +.dest 4 dst +.source 4 src1 +.source 4 src2 +divf dst, src1, src2 diff --git a/volk/orc/volk_32f_multiply_aligned16_orc_impl.orc b/volk/orc/volk_32f_multiply_aligned16_orc_impl.orc new file mode 100644 index 0000000000..23619af4ed --- /dev/null +++ b/volk/orc/volk_32f_multiply_aligned16_orc_impl.orc @@ -0,0 +1,5 @@ +.function volk_32f_multiply_aligned16_orc_impl +.dest 4 dst +.source 4 src1 +.source 4 src2 +mulf dst, src1, src2 diff --git a/volk/orc/volk_32f_subtract_aligned16_orc_impl.orc b/volk/orc/volk_32f_subtract_aligned16_orc_impl.orc new file mode 100644 index 0000000000..17dbcad465 --- /dev/null +++ b/volk/orc/volk_32f_subtract_aligned16_orc_impl.orc @@ -0,0 +1,5 @@ +.function volk_32f_subtract_aligned16_orc_impl +.dest 4 dst +.source 4 src1 +.source 4 src2 +subf dst, src1, src2 |