From fd03c0ee7cb9af71a5e0292569b626ba3dabd885 Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Tue, 15 Feb 2011 21:59:19 -0800 Subject: Moved the fn indices gen from volk.c to volk_registry.h so the qa code has access to the static stuff --- volk/lib/qa_utils.cc | 50 ++++++++------------------------------------------ 1 file changed, 8 insertions(+), 42 deletions(-) (limited to 'volk/lib/qa_utils.cc') diff --git a/volk/lib/qa_utils.cc b/volk/lib/qa_utils.cc index e85e2c1bc..150cef729 100644 --- a/volk/lib/qa_utils.cc +++ b/volk/lib/qa_utils.cc @@ -12,6 +12,7 @@ //#include #include #include +#include #include #include @@ -77,49 +78,14 @@ void make_buffer_for_signature(std::vector &buffs, std::vector get_arch_list(const int archs[]) { +static std::vector get_arch_list(const char **indices, const int archs[]) { std::vector archlist; int num_archs = archs[0]; - - //there has got to be a way to query these arches + for(int i = 0; i < num_archs; i++) { - switch(archs[i+1]) { - case (1< arch_list = get_arch_list(archs); + std::vector arch_list = get_arch_list(indices, archs); if(arch_list.size() < 2) { std::cout << "no architectures to test" << std::endl; -- cgit From 1bf5a3ea4bbb9fd6baf72eb876778d2652c97f2c Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Tue, 15 Feb 2011 22:28:38 -0800 Subject: reverted mktables deletion until i get my act together and make it go straight from python -> .h --- volk/lib/qa_utils.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'volk/lib/qa_utils.cc') diff --git a/volk/lib/qa_utils.cc b/volk/lib/qa_utils.cc index 150cef729..f8fcc7b28 100644 --- a/volk/lib/qa_utils.cc +++ b/volk/lib/qa_utils.cc @@ -83,10 +83,10 @@ static std::vector get_arch_list(const char **indices, const int ar int num_archs = archs[0]; for(int i = 0; i < num_archs; i++) { - //std::cout << "the archs this fn is avail on is " << archs[0] << std::endl; if(!(archs[i+1] & volk_get_lvarch())) continue; //this arch isn't available on this pc archlist.push_back(std::string(indices[i])); } + return archlist; } -- cgit From 668da8bd8874ae71a819d55f046e39c964a4270b Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Sat, 16 Apr 2011 10:47:10 -0700 Subject: Volk: manual funcs implemented, QA code runs. Barfs due to missing Orc arch. --- volk/lib/qa_utils.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'volk/lib/qa_utils.cc') diff --git a/volk/lib/qa_utils.cc b/volk/lib/qa_utils.cc index acf72cfe1..2dee61823 100644 --- a/volk/lib/qa_utils.cc +++ b/volk/lib/qa_utils.cc @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -63,13 +64,12 @@ void load_random_data(void *data, volk_type_t type, unsigned int n) { } } -static std::vector get_arch_list(const int archs[]) { +static std::vector get_arch_list(struct volk_func_desc desc) { std::vector archlist; - int num_archs = archs[0]; - for(int i = 0; i < num_archs; i++) { - if(!(archs[i+1] & volk_get_lvarch())) continue; //this arch isn't available on this pc - archlist.push_back(std::string(indices[i])); + for(int i = 0; i < desc.n_archs; i++) { + //if(!(archs[i+1] & volk_get_lvarch())) continue; //this arch isn't available on this pc + archlist.push_back(std::string(desc.indices[i])); } return archlist; @@ -243,11 +243,11 @@ public: private: std::list > _mems; }; -bool run_volk_tests(const int archs[], void (*manual_func)(), std::string name, float tol, float scalar, int vlen, int iter) { +bool run_volk_tests(struct volk_func_desc desc, void (*manual_func)(), std::string name, float tol, float scalar, int vlen, int iter) { std::cout << "RUN_VOLK_TESTS: " << name << std::endl; //first let's get a list of available architectures for the test - std::vector arch_list = get_arch_list(indices, archs); + std::vector arch_list = get_arch_list(desc); if(arch_list.size() < 2) { std::cout << "no architectures to test" << std::endl; -- cgit From 12413747c90754482582e16c95b551e1b36c6074 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 6 May 2011 11:25:00 -0700 Subject: volk: removed volk_registry.h, it was superseded by the machines --- volk/lib/qa_utils.cc | 3 --- 1 file changed, 3 deletions(-) (limited to 'volk/lib/qa_utils.cc') diff --git a/volk/lib/qa_utils.cc b/volk/lib/qa_utils.cc index 2dee61823..b195ab365 100644 --- a/volk/lib/qa_utils.cc +++ b/volk/lib/qa_utils.cc @@ -3,15 +3,12 @@ #include #include #include -//#include #include #include #include #include #include #include -//#include -#include #include #include #include -- cgit From c40ef84defaeed0c9ec70e45a7e4019fa6d6e1b2 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 6 May 2011 14:27:48 -0700 Subject: volk: various backports from MSVC building 1) Added support for __cpuid intrinsic under MSVC 2) Fixed disambiguation for std::abs overload in qa code 3) Fixed bit128 union, the ifdefs were completely wrong --- volk/lib/qa_utils.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'volk/lib/qa_utils.cc') diff --git a/volk/lib/qa_utils.cc b/volk/lib/qa_utils.cc index b195ab365..fa091ad0d 100644 --- a/volk/lib/qa_utils.cc +++ b/volk/lib/qa_utils.cc @@ -219,7 +219,7 @@ bool icompare(t *in1, t *in2, unsigned int vlen, unsigned int tol) { bool fail = false; int print_max_errs = 10; for(int i=0; i tol) { + if(abs(int(((t *)(in1))[i]) - int(((t *)(in2))[i])) > tol) { fail=true; if(print_max_errs-- > 0) { std::cout << "offset " << i << " in1: " << static_cast(t(((t *)(in1))[i])) << " in2: " << static_cast(t(((t *)(in2))[i])) << std::endl; -- cgit From e3997ada93a25569a05bbfd615d73d00cee6eca5 Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Tue, 10 May 2011 21:52:23 -0700 Subject: Volk: initial profiling support. Profiling works, reading doesn't yet. Need to add name field to volk arch_defs --- volk/lib/qa_utils.cc | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'volk/lib/qa_utils.cc') diff --git a/volk/lib/qa_utils.cc b/volk/lib/qa_utils.cc index fa091ad0d..3eb1da1f1 100644 --- a/volk/lib/qa_utils.cc +++ b/volk/lib/qa_utils.cc @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -240,7 +241,15 @@ public: private: std::list > _mems; }; -bool run_volk_tests(struct volk_func_desc desc, void (*manual_func)(), std::string name, float tol, float scalar, int vlen, int iter) { +bool run_volk_tests(struct volk_func_desc desc, + void (*manual_func)(), + std::string name, + float tol, + float scalar, + int vlen, + int iter, + std::vector *best_arch_vector = 0 + ) { std::cout << "RUN_VOLK_TESTS: " << name << std::endl; //first let's get a list of available architectures for the test @@ -297,6 +306,7 @@ bool run_volk_tests(struct volk_func_desc desc, void (*manual_func)(), std::stri //now run the test clock_t start, end; + std::vector profile_times; for(int i = 0; i < arch_list.size(); i++) { start = clock(); @@ -331,8 +341,12 @@ bool run_volk_tests(struct volk_func_desc desc, void (*manual_func)(), std::stri } end = clock(); - std::cout << arch_list[i] << " completed in " << (double)(end-start)/(double)CLOCKS_PER_SEC << "s" << std::endl; + double arch_time = (double)(end-start)/(double)CLOCKS_PER_SEC; + std::cout << arch_list[i] << " completed in " << arch_time << "s" << std::endl; + + profile_times.push_back(arch_time); } + //and now compare each output to the generic output //first we have to know which output is the generic one, they aren't in order... int generic_offset=0; @@ -344,7 +358,9 @@ bool run_volk_tests(struct volk_func_desc desc, void (*manual_func)(), std::stri bool fail = false; bool fail_global = false; + std::vector arch_results; for(int i=0; i::max(); + std::string best_arch = "generic"; + for(int i=0; i < arch_list.size(); i++) { + if((profile_times[i] < best_time) && arch_results[i]) { + best_time = profile_times[i]; + best_arch = arch_list[i]; + } + } + + std::cout << "Best arch: " << best_arch << std::endl; + if(best_arch_vector) { + best_arch_vector->push_back(name + std::string(" ") + best_arch); } return fail_global; -- cgit From bfb812a4ae8ec750d4452be7ce6b31d33de5796d Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Thu, 12 May 2011 16:55:56 -0700 Subject: Volk: changed size of memory alignment in QA code to 32 for AVX support --- volk/lib/qa_utils.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'volk/lib/qa_utils.cc') diff --git a/volk/lib/qa_utils.cc b/volk/lib/qa_utils.cc index 3eb1da1f1..db606a472 100644 --- a/volk/lib/qa_utils.cc +++ b/volk/lib/qa_utils.cc @@ -233,7 +233,7 @@ bool icompare(t *in1, t *in2, unsigned int vlen, unsigned int tol) { class volk_qa_aligned_mem_pool{ public: - void *get_new(size_t size, size_t alignment = 16){ + void *get_new(size_t size, size_t alignment = 32){ _mems.push_back(std::vector(size + alignment-1, 0)); size_t ptr = size_t(&_mems.back().front()); return (void *)((ptr + alignment-1) & ~(alignment-1)); -- cgit From 3a41b3208e222965e908c6a04e3ab05379c782c4 Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Wed, 18 May 2011 18:03:26 -0700 Subject: Volk: added alignment prop to each machine. call volk_get_alignment() to get your machine's reqd alignment for malloc. --- volk/lib/qa_utils.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'volk/lib/qa_utils.cc') diff --git a/volk/lib/qa_utils.cc b/volk/lib/qa_utils.cc index db606a472..7f86dd78b 100644 --- a/volk/lib/qa_utils.cc +++ b/volk/lib/qa_utils.cc @@ -233,7 +233,8 @@ bool icompare(t *in1, t *in2, unsigned int vlen, unsigned int tol) { class volk_qa_aligned_mem_pool{ public: - void *get_new(size_t size, size_t alignment = 32){ + void *get_new(size_t size){ + size_t alignment = volk_get_alignment(); _mems.push_back(std::vector(size + alignment-1, 0)); size_t ptr = size_t(&_mems.back().front()); return (void *)((ptr + alignment-1) & ~(alignment-1)); -- cgit