Vitis Model Composer supports importing kernels declared in a namespace. For both templatized and non-templatized kernels you need to qualify the kernel function with the namespace.
Consider the following examples. In these, the non-templatized kernel function
is qualified with the namespace ns1, and the templatized
kernel function is qualified with the namespace ns2.
Kernel.h
namespace ns1 {
void myFunc_1(input_stream<int32> * restrict i1,
output_stream<int32> * restrict o1);
} // namespace ns1
templateKernel.h
namespace ns2 {
template<typename T,int size>
void myFunc_2(input_stream<int32> * restrict i1,
output_stream<int32> * restrict o1);
} // namespace ns2
You can import the above functions using the AIE Kernel and AIE Template Kernel blocks. Update the Kernel function parameter in the Block Parameters dialog box as follows:
- Kernel function
-
ns1::myFunc_1(Non-templatized function) - Kernel function
-
ns2::myFunc_2(Templatized function)
If you have a class kernel declared in a namespace, then only qualify the kernel class field, and not the kernel function.
For example, consider the following kernel class which is qualified with the
namespace ns3.
class_kernel.h
namespace ns3 {
#include "adf.h"
class simple_class
{
private:
int16 val;
int16 numSamples;
public:
simple_class();
void func_q(input_window_int16* in, output_window_int16* out);
static void registerKernelClass()
{
REGISTER_FUNCTION(simple_class::func_q);
}
};
} // namespace ns3
To Import the kernel function func_q as a
block, update the Kernel
class and Kernel
function parameters in the AIE Class Kernel
block as follows:
- Kernel class
-
ns3::simple_class - Kernel function
-
func_q