diff options
Diffstat (limited to 'volk/tmpl/volk.tmpl.h')
-rw-r--r-- | volk/tmpl/volk.tmpl.h | 55 |
1 files changed, 47 insertions, 8 deletions
diff --git a/volk/tmpl/volk.tmpl.h b/volk/tmpl/volk.tmpl.h index 161579e46..464b65598 100644 --- a/volk/tmpl/volk.tmpl.h +++ b/volk/tmpl/volk.tmpl.h @@ -27,20 +27,59 @@ #include <volk/volk_common.h> #include <volk/volk_complex.h> +#include <stdlib.h> +#include <stdbool.h> + __VOLK_DECL_BEGIN -struct volk_func_desc { - const char **indices; - const int *arch_defs; - const int n_archs; -}; +typedef struct volk_func_desc +{ + const char **impl_names; + const int *impl_deps; + const bool *impl_alignment; + const size_t n_impls; +} volk_func_desc_t; + +//! Get the machine alignment in bytes +VOLK_API size_t volk_get_alignment(void); + +/*! + * The VOLK_OR_PTR macro is a convenience macro + * for checking the alignment of a set of pointers. + * Example usage: + * volk_is_aligned(VOLK_OR_PTR((VOLK_OR_PTR(p0, p1), p2))) + */ +#define VOLK_OR_PTR(ptr0, ptr1) \ + (const void *)(((intptr_t)(ptr0)) | ((intptr_t)(ptr1))) -VOLK_API unsigned int volk_get_alignment(void); +/*! + * Is the pointer on a machine alignment boundary? + * + * Note: for performance reasons, this function + * is not usable until another volk API call is made + * which will perform certain initialization tasks. + * + * \param ptr the pointer to some memory buffer + * \return 1 for alignment boundary, else 0 + */ +VOLK_API bool volk_is_aligned(const void *ptr); #for $kern in $kernels + +//! A function pointer to the dispatcher implementation extern VOLK_API $kern.pname $kern.name; -extern VOLK_API void $(kern.name)_manual($kern.arglist_namedefs, const char* arch); -extern VOLK_API struct volk_func_desc $(kern.name)_get_func_desc(void); + +//! A function pointer to the fastest aligned implementation +extern VOLK_API $kern.pname $(kern.name)_a; + +//! A function pointer to the fastest unaligned implementation +extern VOLK_API $kern.pname $(kern.name)_u; + +//! Call into a specific implementation given by name +extern VOLK_API void $(kern.name)_manual($kern.arglist_full, const char* impl_name); + +//! Get description paramaters for this kernel +extern VOLK_API volk_func_desc_t $(kern.name)_get_func_desc(void); #end for __VOLK_DECL_END |