adf::headers Constraint and aie_api Include Files - 2021.2 English

Versal ACAP AI Engine Programming Environment User Guide (UG1076)

Document ID
English (United States)
Release Date
2021.2 English

If a header file appears in a adf::headers constraint and that header file includes aie_api/aie.hpp directly or indirectly, aiecompiler --target=x86sim will fail. As a workaround, you can move the include of aie_api/aie.hpp from the kernel header to the kernel source file.

For example, the kernel kernel1 has an adf::headers constraint (project.h), which specifies the header file, kernels.h.


#pragma once
#include "kernels.h"
class MyGraph: public adf::graph {
   adf::kernel kernel1;
     kernel1 = adf::kernel::create(F1);
     adf::source(kernel1) = "kernels.cpp";
     adf::headers(kernel1) = {"kernels.h"};

Header file, kernels.h, includes aie_api/aie.hpp (lines 3-5).


#pragma once
#include "adf.h"
#include <aie_api/aie.hpp>
#include <aie_api/aie_adf.hpp>
#include "aie_api/utils.hpp"
void F1(input_stream<int32> *streamin,
  output_stream<acc80> *cascout,output_stream<int32> *streamout);

aiecompiler --target=x86sim fails.

Compiler Output

aiecompiler --target=x86sim project.cpp
In file included from .../aietools/include/aie_api/aie.hpp:70:0,
                 from ../.././src/kernels.h:3,
                 from PthreadSim.cpp:11:
.../aietools/include/aie_api/aie_declaration.hpp:62:12: error: multiple definition of 'enum class aie_dm_resource'
 enum class aie_dm_resource {
In file included from ...aietools/include/adf/x86sim/x86sim.h:8:0,
                 from PthreadSim.cpp:8:
.../aietools/include/adf/x86sim/x86simResourceTypes.h:4:12: note: previous definition here
 enum class aie_dm_resource {

There are several ways to work around this issue:

  • The adf::headers constraint is needed only if the graph has graph scoped tables (see Global Graph-scoped Tables). If it does not, the adf::headers constraint can be omitted.
  • The include of the aie_api headers can be moved from kernels.h to kernel.cpp because the high-level kernel API aie_api/aie.hpp is typically needed only in the kernel source file.