mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-29 22:42:59 +00:00 
			
		
		
		
	Merge branch 'new_volk_module' of git+ssh://github.com/gnss-sdr/gnss-sdr
into new_volk_module # Conflicts: # src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_16ic_x2_dot_prod_16ic.h
This commit is contained in:
		| @@ -40,7 +40,6 @@ | |||||||
| #include <volk_gnsssdr/volk_gnsssdr_common.h> | #include <volk_gnsssdr/volk_gnsssdr_common.h> | ||||||
| #include <volk_gnsssdr/volk_gnsssdr_complex.h> | #include <volk_gnsssdr/volk_gnsssdr_complex.h> | ||||||
| #include <volk_gnsssdr/saturation_arithmetic.h> | #include <volk_gnsssdr/saturation_arithmetic.h> | ||||||
| //#include <stdio.h> |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #ifdef LV_HAVE_GENERIC | #ifdef LV_HAVE_GENERIC | ||||||
| @@ -56,11 +55,9 @@ static inline void volk_gnsssdr_16ic_x2_dot_prod_16ic_generic(lv_16sc_t* result, | |||||||
|     result[0] = lv_cmake((int16_t)0, (int16_t)0); |     result[0] = lv_cmake((int16_t)0, (int16_t)0); | ||||||
|     for (unsigned int n = 0; n < num_points; n++) |     for (unsigned int n = 0; n < num_points; n++) | ||||||
|         { |         { | ||||||
|             //r*a.r - i*a.i, i*a.r + r*a.i |  | ||||||
|             lv_16sc_t tmp = in_a[n] * in_b[n]; |             lv_16sc_t tmp = in_a[n] * in_b[n]; | ||||||
|             result[0] = lv_cmake(sat_adds16i(lv_creal(result[0]), lv_creal(tmp)), sat_adds16i(lv_cimag(result[0]), lv_cimag(tmp) )); |             result[0] = lv_cmake(sat_adds16i(lv_creal(result[0]), lv_creal(tmp)), sat_adds16i(lv_cimag(result[0]), lv_cimag(tmp) )); | ||||||
|         } |         } | ||||||
|     	//printf("generic result = %i,%i", lv_creal(result[0]),lv_cimag(result[0])); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| #endif /*LV_HAVE_GENERIC*/ | #endif /*LV_HAVE_GENERIC*/ | ||||||
| @@ -70,7 +67,6 @@ static inline void volk_gnsssdr_16ic_x2_dot_prod_16ic_generic(lv_16sc_t* result, | |||||||
| #include <emmintrin.h> | #include <emmintrin.h> | ||||||
| static inline void volk_gnsssdr_16ic_x2_dot_prod_16ic_a_sse2(lv_16sc_t* out, const lv_16sc_t* in_a, const lv_16sc_t* in_b, unsigned int num_points) | static inline void volk_gnsssdr_16ic_x2_dot_prod_16ic_a_sse2(lv_16sc_t* out, const lv_16sc_t* in_a, const lv_16sc_t* in_b, unsigned int num_points) | ||||||
| { | { | ||||||
|  |  | ||||||
| 	  lv_16sc_t dotProduct = lv_cmake((int16_t)0, (int16_t)0); | 	  lv_16sc_t dotProduct = lv_cmake((int16_t)0, (int16_t)0); | ||||||
|  |  | ||||||
| 	    const unsigned int sse_iters = num_points / 4; | 	    const unsigned int sse_iters = num_points / 4; | ||||||
|   | |||||||
| @@ -110,7 +110,7 @@ static inline void volk_gnsssdr_32fc_convert_16ic_u_sse(lv_16sc_t* outputVector, | |||||||
|     float max_val = 32767; |     float max_val = 32767; | ||||||
|  |  | ||||||
|     __m128 inputVal1, inputVal2; |     __m128 inputVal1, inputVal2; | ||||||
|     __m128i intInputVal1, intInputVal2; |     __m128i intInputVal1, intInputVal2; // is __m128i defined in xmmintrin.h? | ||||||
|     __m128 ret1, ret2; |     __m128 ret1, ret2; | ||||||
|     __m128 vmin_val = _mm_set_ps1(min_val); |     __m128 vmin_val = _mm_set_ps1(min_val); | ||||||
|     __m128 vmax_val = _mm_set_ps1(max_val); |     __m128 vmax_val = _mm_set_ps1(max_val); | ||||||
|   | |||||||
| @@ -77,7 +77,7 @@ static inline void volk_gnsssdr_8i_max_s8i_u_sse4_1(char* target, const char* sr | |||||||
|                         } |                         } | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|             for(unsigned int i = 0; i<(num_points % 16); ++i) |             for(unsigned int i = sse_iters * 16; i< num_points; ++i) | ||||||
|                 { |                 { | ||||||
|                     if(src0[i] > max) |                     if(src0[i] > max) | ||||||
|                         { |                         { | ||||||
| @@ -140,7 +140,7 @@ static inline void volk_gnsssdr_8i_max_s8i_u_sse2(char* target, const char* src0 | |||||||
|                     inputPtr += 16; |                     inputPtr += 16; | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|             for(unsigned int i = 0; i<(num_points % 16); ++i) |             for(unsigned int i = sse_iters * 16; i < num_points; ++i) | ||||||
|                 { |                 { | ||||||
|                     if(src0[i] > max) |                     if(src0[i] > max) | ||||||
|                         { |                         { | ||||||
| @@ -228,7 +228,7 @@ static inline void volk_gnsssdr_8i_max_s8i_a_sse4_1(char* target, const char* sr | |||||||
|                         } |                         } | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|             for(unsigned int i = 0; i<(num_points % 16); ++i) |             for(unsigned int i = sse_iters * 16; i < num_points; ++i) | ||||||
|                 { |                 { | ||||||
|                     if(src0[i] > max) |                     if(src0[i] > max) | ||||||
|                         { |                         { | ||||||
| @@ -291,7 +291,7 @@ static inline void volk_gnsssdr_8i_max_s8i_a_sse2(char* target, const char* src0 | |||||||
|                     inputPtr += 16; |                     inputPtr += 16; | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|             for(unsigned int i = 0; i<(num_points % 16); ++i) |             for(unsigned int i = sse_iters * 16; i < num_points; ++i) | ||||||
|                 { |                 { | ||||||
|                     if(src0[i] > max) |                     if(src0[i] > max) | ||||||
|                         { |                         { | ||||||
| @@ -313,8 +313,6 @@ static inline void volk_gnsssdr_8i_max_s8i_a_sse2(char* target, const char* src0 | |||||||
|  */ |  */ | ||||||
| static inline void volk_gnsssdr_8i_max_s8i_a_generic(char* target, const char* src0, unsigned int num_points) | static inline void volk_gnsssdr_8i_max_s8i_a_generic(char* target, const char* src0, unsigned int num_points) | ||||||
| { | { | ||||||
|     if(num_points > 0) |  | ||||||
|         { |  | ||||||
|     if(num_points > 0) |     if(num_points > 0) | ||||||
|         { |         { | ||||||
|             char max = src0[0]; |             char max = src0[0]; | ||||||
| @@ -327,7 +325,6 @@ static inline void volk_gnsssdr_8i_max_s8i_a_generic(char* target, const char* s | |||||||
|                 } |                 } | ||||||
|             target[0] = max; |             target[0] = max; | ||||||
|         } |         } | ||||||
|         } |  | ||||||
| } | } | ||||||
|  |  | ||||||
| #endif /*LV_HAVE_GENERIC*/ | #endif /*LV_HAVE_GENERIC*/ | ||||||
|   | |||||||
| @@ -39,7 +39,7 @@ | |||||||
| #include <volk_gnsssdr/volk_gnsssdr_malloc.h> | #include <volk_gnsssdr/volk_gnsssdr_malloc.h> | ||||||
|  |  | ||||||
| float uniform() { | float uniform() { | ||||||
|   return M_PI*2.0f * ((float) rand() / RAND_MAX - 0.5f);        // uniformly (-1, 1) |     return 2.0f * ((float) rand() / RAND_MAX - 0.5f);     // uniformly (-1, 1) | ||||||
| } | } | ||||||
|  |  | ||||||
| template <class t> | template <class t> | ||||||
| @@ -72,13 +72,11 @@ void load_random_data(void *data, volk_gnsssdr_type_t type, unsigned int n) | |||||||
|                         else ((uint64_t *)data)[i] = (uint64_t) scaled_rand; |                         else ((uint64_t *)data)[i] = (uint64_t) scaled_rand; | ||||||
|                         break; |                         break; | ||||||
|                     case 4: |                     case 4: | ||||||
|  |  | ||||||
|                         if(type.is_signed) ((int32_t *)data)[i] = (int32_t) scaled_rand; |                         if(type.is_signed) ((int32_t *)data)[i] = (int32_t) scaled_rand; | ||||||
|                         else ((uint32_t *)data)[i] = (uint32_t) scaled_rand; |                         else ((uint32_t *)data)[i] = (uint32_t) scaled_rand; | ||||||
|  |  | ||||||
|                         break; |                         break; | ||||||
|                     case 2: |                     case 2: | ||||||
|                     	// 16 bits dot product saturates very fast even with moderate lenght vectors |                         // 16 bits dot product saturates very fast even with moderate length vectors | ||||||
|                     	// we produce here only 4 bits input range |                     	// we produce here only 4 bits input range | ||||||
|                         if(type.is_signed) ((int16_t *)data)[i] = (int16_t)((int16_t) scaled_rand % 16); |                         if(type.is_signed) ((int16_t *)data)[i] = (int16_t)((int16_t) scaled_rand % 16); | ||||||
|  |  | ||||||
| @@ -190,7 +188,7 @@ static void get_signatures_from_name(std::vector<volk_gnsssdr_type_t> &inputsig, | |||||||
|                 try { |                 try { | ||||||
|                         multiplier = boost::lexical_cast<int>(token.substr(1, token.size()-1)); //will throw if invalid /////////// |                         multiplier = boost::lexical_cast<int>(token.substr(1, token.size()-1)); //will throw if invalid /////////// | ||||||
|                 } catch(...) { |                 } catch(...) { | ||||||
|                         multiplier = 1; // This is our '..._xn' mulriple correlator. Assign a fixed number here for the test? |                         multiplier = 1; // This is our '..._xn' multiple correlator. Assign a fixed number here for the test? | ||||||
|                 } |                 } | ||||||
|                 for(int i=1; i<multiplier; i++) { |                 for(int i=1; i<multiplier; i++) { | ||||||
|                         if(side == SIDE_INPUT) inputsig.push_back(inputsig.back()); |                         if(side == SIDE_INPUT) inputsig.push_back(inputsig.back()); | ||||||
| @@ -221,6 +219,10 @@ inline void run_cast_test2(volk_gnsssdr_fn_2arg func, std::vector<void *> &buffs | |||||||
|     while(iter--) func(buffs[0], buffs[1], vlen, arch.c_str()); |     while(iter--) func(buffs[0], buffs[1], vlen, arch.c_str()); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | //inline void run_cast_test2(volk_gnsssdr_fn_2arg_r func, std::vector<void *> &buffs, float rem_code_phase_chips, float code_phase_step_chips, unsigned int vlen, int code_length_chips, unsigned int iter, std::string arch) { | ||||||
|  | //    while(iter--) func(buffs[0], buffs[1],  rem_code_phase_chips, code_phase_step_chips, vlen, code_length_chips, arch.c_str()); | ||||||
|  | //} | ||||||
|  |  | ||||||
| inline void run_cast_test3(volk_gnsssdr_fn_3arg func, std::vector<void *> &buffs, unsigned int vlen, unsigned int iter, std::string arch) { | inline void run_cast_test3(volk_gnsssdr_fn_3arg func, std::vector<void *> &buffs, unsigned int vlen, unsigned int iter, std::string arch) { | ||||||
|     while(iter--) func(buffs[0], buffs[1], buffs[2], vlen, arch.c_str()); |     while(iter--) func(buffs[0], buffs[1], buffs[2], vlen, arch.c_str()); | ||||||
| } | } | ||||||
| @@ -291,16 +293,25 @@ inline void run_cast_test1_s16ic(volk_gnsssdr_fn_1arg_s16ic func, std::vector<vo | |||||||
|     while(iter--) func(buffs[0], scalar, vlen, arch.c_str()); |     while(iter--) func(buffs[0], scalar, vlen, arch.c_str()); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| inline void run_cast_test2_s16ic(volk_gnsssdr_fn_2arg_s16ic func, std::vector<void *> &buffs, lv_16sc_t scalar, unsigned int vlen, unsigned int iter, std::string arch) | inline void run_cast_test2_s16ic(volk_gnsssdr_fn_2arg_s16ic func, std::vector<void *> &buffs, lv_16sc_t scalar, unsigned int vlen, unsigned int iter, std::string arch) | ||||||
| { | { | ||||||
|     while(iter--) func(buffs[0], buffs[1], scalar, vlen, arch.c_str()); |     while(iter--) func(buffs[0], buffs[1], scalar, vlen, arch.c_str()); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | //inline void run_cast_test2_s16ic(volk_gnsssdr_fn_2arg_s16ic func, std::vector<void *> &buffs, float rem_code_phase_chips, float code_phase_step_chips, int code_length_chips, unsigned int vlen, unsigned int iter, std::string arch) | ||||||
|  | //{ | ||||||
|  | //    while(iter--) func(buffs[0], buffs[1], rem_code_phase_chips,  code_phase_step_chips,  vlen, code_length_chips,  arch.c_str()); | ||||||
|  | //} | ||||||
|  |  | ||||||
| inline void run_cast_test3_s16ic(volk_gnsssdr_fn_3arg_s16ic func, std::vector<void *> &buffs, lv_16sc_t scalar, unsigned int vlen, unsigned int iter, std::string arch) | inline void run_cast_test3_s16ic(volk_gnsssdr_fn_3arg_s16ic func, std::vector<void *> &buffs, lv_16sc_t scalar, unsigned int vlen, unsigned int iter, std::string arch) | ||||||
| { | { | ||||||
|     while(iter--) func(buffs[0], buffs[1], buffs[2], scalar, vlen, arch.c_str()); |     while(iter--) func(buffs[0], buffs[1], buffs[2], scalar, vlen, arch.c_str()); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| // end new | // end new | ||||||
|  |  | ||||||
| inline void run_cast_test8(volk_gnsssdr_fn_8arg func, std::vector<void *> &buffs, unsigned int vlen, unsigned int iter, std::string arch) | inline void run_cast_test8(volk_gnsssdr_fn_8arg func, std::vector<void *> &buffs, unsigned int vlen, unsigned int iter, std::string arch) | ||||||
| @@ -601,7 +612,14 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc, | |||||||
|         case 2: |         case 2: | ||||||
|             if(inputsc.size() == 0) |             if(inputsc.size() == 0) | ||||||
|                 { |                 { | ||||||
|  |                    // if(name.find("resampler") != std::string::npos) | ||||||
|  |                    //     { | ||||||
|  |                    //         run_cast_test2((volk_gnsssdr_fn_2arg_r)(manual_func), test_data[i], 1, 1, vlen, 1000, iter, arch_list[i]); | ||||||
|  |                    //     } | ||||||
|  |                    // else | ||||||
|  |                     //    { | ||||||
|                             run_cast_test2((volk_gnsssdr_fn_2arg)(manual_func), test_data[i], vlen, iter, arch_list[i]); |                             run_cast_test2((volk_gnsssdr_fn_2arg)(manual_func), test_data[i], vlen, iter, arch_list[i]); | ||||||
|  |                    //     } | ||||||
|                 } |                 } | ||||||
|             else if(inputsc.size() == 1 && inputsc[0].is_float) |             else if(inputsc.size() == 1 && inputsc[0].is_float) | ||||||
|                 { |                 { | ||||||
|   | |||||||
| @@ -151,6 +151,7 @@ bool run_volk_gnsssdr_tests( | |||||||
| #define VOLK_PUPPET_PROFILE(func, puppet_master_func, test_params, results) run_volk_gnsssdr_tests(func##_get_func_desc(), (void (*)())func##_manual, std::string(#func), test_params, results, std::string(#puppet_master_func)) | #define VOLK_PUPPET_PROFILE(func, puppet_master_func, test_params, results) run_volk_gnsssdr_tests(func##_get_func_desc(), (void (*)())func##_manual, std::string(#func), test_params, results, std::string(#puppet_master_func)) | ||||||
| typedef void (*volk_gnsssdr_fn_1arg)(void *, unsigned int, const char*); //one input, operate in place | typedef void (*volk_gnsssdr_fn_1arg)(void *, unsigned int, const char*); //one input, operate in place | ||||||
| typedef void (*volk_gnsssdr_fn_2arg)(void *, void *, unsigned int, const char*); | typedef void (*volk_gnsssdr_fn_2arg)(void *, void *, unsigned int, const char*); | ||||||
|  | //typedef void (*volk_gnsssdr_fn_2arg_r)(void *, void *, float, float, unsigned int, float, const char*); | ||||||
| typedef void (*volk_gnsssdr_fn_3arg)(void *, void *, void *, unsigned int, const char*); | typedef void (*volk_gnsssdr_fn_3arg)(void *, void *, void *, unsigned int, const char*); | ||||||
| typedef void (*volk_gnsssdr_fn_4arg)(void *, void *, void *, void *, unsigned int, const char*); | typedef void (*volk_gnsssdr_fn_4arg)(void *, void *, void *, void *, unsigned int, const char*); | ||||||
| typedef void (*volk_gnsssdr_fn_1arg_s32f)(void *, float, unsigned int, const char*); //one input vector, one scalar float input | typedef void (*volk_gnsssdr_fn_1arg_s32f)(void *, float, unsigned int, const char*); //one input vector, one scalar float input | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Carles Fernandez
					Carles Fernandez