Kernel Code Structure - 2025.1 English - XD100

Vitis Tutorials: AI Engine Development (XD100)

Document ID
XD100
Release Date
2025-08-25
Version
2025.1 English

You can use optionally templated functions or C++ classes as kernel programs.

Optionally templated function:

// func_name.cpp
template <…>	// optional
void func_name( /* I/O arguments */ ) {
  // 1. read inputs
  // 2. process inputs
  // 3. write outputs
}

Optionally templated C++ class:

// some_class.hpp
template <…>	 // optional
class some_class {
private:
  // private variables
public:
  // public variables
  some_class( /* constructor arguments */ );	// constructor performs initialization
  void f1( /* I/O arguments */ );		          // function to run on AI engine, same structure as templated function above
  static void registerKernelClass() {
    REGISTER_FUNCTION(some_class::f1);	// macro to tell the build tools that “f1” will run on AI engine
  }
};