Model Composer supports template specialization. This lets you override the
default template implementation to handle a particular type in a different way. Consider
the following example where a function myFunc has one
specialized version declared to implement an int16
datatype along with a generic template function.
kernel.cpp
#ifndef _AIE_CLASS_KERNELS_H_
#define _AIE_CLASS_KERNELS_H_
#include <adf.h>
template<typename T, int N>
void myFunc(input_buffer<T> &i1,
output_buffer<T> &o1
);
template<>
void myFunc<int16,8>(input_buffer<int16> &i1,
output_buffer<int16> &o1);
#endif
When you try to import the kernel myFunc as a
block into Vitis Model Composer using the AIE
Template Kernel block, the Function tab in the block GUI parameter looks as shown.
If you select the function variant corresponding to the base template, the Function
Template Parameters table shows the values corresponding to that. If you select the
specialization variant instead, the table shows the values of the template
parameters of that specialization. You cannot change these values.