VolkAddingNewKernels

From GNU Radio
Revision as of 01:36, 8 March 2017 by Mbr0wn (talk | contribs) (Imported from Redmine)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Adding New Volk Kernels

TODO: Explain how to create/register new Volk kernels

Dealing with Volk Profile Puppets

If the Volk kernel does not 'fit' the the standard set of function parameters expected by the volk_profile structure, you need to create a Volk puppet function to help the profiler call the kernel.

This is essentially due to the function run_volk_tests which has the form:

bool run_volk_tests(struct volk_func_desc, void(*)(), std::string, float, lv_32fc_t, int, int, std::vector *, std::string);

However the line in volk_profile.cc expects to have the Volk kernel function to call, tolerance, a scalar, length, number of iterations and a results pointer.
The relevant macro is defined in volk/lib/qa_utils.h:

#define VOLK_PROFILE(func, tol, scalar, len, iter, results) run_volk_tests(func##_get_func_desc(), (void (*)())func##_manual, std::string(#func), tol, scalar, len, iter, results, "NULL")

So - for the puppet function, instead of using the VOLK_PROFILE macro in volk_profile.cc, the VOLK_PUPPET_PROFILE macro is used, which again is defined in volk/lib/qa_utils.h:

#define VOLK_PUPPET_PROFILE(func, puppet_master_func, tol, scalar, len, iter, results) run_volk_tests(func##_get_func_desc(), (void (*)())func##_manual, std::string(#func), tol, scalar, len, iter, results, std::string(#puppet_master_func))

So the relevant parameters to the puppet function are tolerance, scalar, length, iterations, and result/output pointer.