Forum Discussion

m4n1c22's avatar
m4n1c22
Icon for New Contributor rankNew Contributor
6 years ago

How to list nested functions used in OpenCL kernel in the final report?

Hi,

I am new to Intel Altera.

I am trying to list the resource utilization for the nested functions.

Lets consider the following example:

int foo(int a) {
...
}
 
//Kernel function
void  my_kernel_function( // Input and output matrices
                __global int *axi,
                // Widths of matrices.
                int A_width)
{
 int a;
a  = foo(axi[0]);
....
}

When I generate the report after running the aoc compiler, I am not a getting detailed report containing utilization from "foo" function but, only from my_kernel function. I believe this is because of compiler inlining the functions.

How can make changes in the program to adapt and find the necessary resources for the same?

4 Replies

  • MEIYAN_L_Intel's avatar
    MEIYAN_L_Intel
    Icon for Frequent Contributor rankFrequent Contributor

    Hi,

    May I have the full design code and I would like to compile at my side for further investigate?

    Also, may I know the information as below:

    1. OS version
    2. OpenCL SDK edition and version

    Thanks

    • m4n1c22's avatar
      m4n1c22
      Icon for New Contributor rankNew Contributor

      Hi,

      1. OS Version - CentOS Linux release 7.7.1908 (core)
      2. OpenCL SDK edition and version - Intel(R) FPGA SDK for OpenCL(TM). version 18.1.2 Build 277 Pro Edition
      3. The target board is pac_s10_dc

      My code is a test code not a real project more like a helloworld program for testing nested functions. I have attached the source code as a zip along with this post.

      You can run the cl file after unzipping it with the following compiler options:

      aoc -rtl -report -v -board=pac_s10_dc -fp-relaxed -fpc test_nesed_functions.cl

      Thanks

  • HRZ's avatar
    HRZ
    Icon for Frequent Contributor rankFrequent Contributor

    What "report" are you looking at? The HTML report includes detailed line-by-line and block-by-block area utilization. There is no function call on FPGAs and all functions are inlined/flattened without exception; a function call does not represent anything meaningful in an FPGA kernel after synthesis.

  • MEIYAN_L_Intel's avatar
    MEIYAN_L_Intel
    Icon for Frequent Contributor rankFrequent Contributor

    Hi,

    For the foo function with an empty body, the compiler will optimize it away and could not find the utilization for the foo function.

    For the foo function without an empty body, the compiler will inline the function.

    However, you should still see the area usage for that function in the reports. It will first point to the call in my_kernel_function and then foo function.

    Thanks