Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kernels.h file mandatory? #260

Open
1075548 opened this issue Mar 29, 2022 · 1 comment
Open

kernels.h file mandatory? #260

1075548 opened this issue Mar 29, 2022 · 1 comment

Comments

@1075548
Copy link

1075548 commented Mar 29, 2022

Is there something special about having a file named kernels.h?

I removed all references to kernels.h from the code I'm running because I used a differently named header file, but I’m still getting this error:
vsi_sw: In file included from /proj/DSSoC/PLAID/app1_STAP/stap_acap/vsi/substitution_baseline/vsi_auto_gen/sw/system_1/versal_aie/src/main_versal_aie.cxx:9:0:
vsi_sw: /proj/DSSoC/PLAID/app1_STAP/stap_acap/vsi/substitution_baseline/vsi_auto_gen/sw/system_1/versal_aie/src/versal_aie.cxx:6:21: fatal error: kernels.h: No such file or directory
vsi_sw: #include "kernels.h"
vsi_sw: ^
vsi_sw: compilation terminated.

It’s almost like the tool is hardcoded somewhere to look for a file named kernels.h.

@rahimipour317
Copy link

Yes, kernels.h is required when AIE parameter buffers are used in the design.

Because AI Engine local memory is at a premium, it is much more efficient for the AI Engine compiler to manage the arrays explicitly for specific kernels than to leave a large amount of stack or heap space on every processor. The compiler allocates a limited amount of static heap space for such arrays. (These arrays are called AIE parameter buffers)

VSI Approach:
To configure the AIE parameter buffers, two modifications are required:

1- Source code modifications:
The arrays that you want to define as parameter buffers should be first define in a header file called kernels.h, such as:

#ifndef USER_PARAMETER_H
#define USER_PARAMETER_H

#ifndef VSI_AUTOVEC
#ifdef X86SIM
thread_local
#endif
int32 lutarray[8] = {1, 2, 3, 4, 5, 6, 0, 0} ;
#endif

The header file should be included in the kernel source file and the buffers can be accessed inside the kernel function directly.

2- GUI modifications:
2-1- Double click on your kernel’s block ( vsi_gen_ip)
2-2- In the “Advanced AI Parameters tab”, type the name of the arrays in front of the “AIE Memories” as comma separated list
2-3- Deactivate the “AIE Memories” box, then the “Memory Location Constraint” appeared.

AI_param_01

2-4- If you don’t want to put location constraints for these buffers, just type in the type of the array in front of the “Type” box
2-5- If you need to add the location constraints for them, click the box next to each array name and add the “column” “row” and “offset” for them (offset can be in Hex or Decimal).

AI_param_02

So In your design, if any of your kernel’s block (vsi_gen_ip) has one or more array names in “AIE Memories” box in “Advanced AI Parameters tab” then your design must have the kernels.h with mentioned format. And if your arrays are small enough to fit to the AI local memory, you can remove their names from “AIE Memories” and remove the #include "kernels.h" from your source code.

Please let us know if you have any further questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants