Visible to Intel only — GUID: ewa1399469100533
Ixiasoft
Visible to Intel only — GUID: ewa1399469100533
Ixiasoft
6.3. Triggering Collection Profiling Data During Kernel Execution
The Intel® FPGA dynamic profiler for OpenCL™ can be used to collect performance information from the hardware when the design is executed. For instructions about how to add the profiler to your hardware design and how to view the collected data, refer to Chapter 5 of Intel® FPGA SDK for OpenCL™ Best Practices Guide.
In cases where kernel execution finishes after the host application completes and temporal profiling is disabled, you can query the FPGA explicitly to collect profile data during kernel execution.
extern CL_API_ENTRY cl_int CL_API_CALL
clGetProfileInfoIntelFPGA(cl_event);
where cl_event is the kernel event. The kernel event you pass to this host library call must be the same one you pass to the clEnqueueNDRangeKernel call.
- If kernel execution completes before the invocation of clGetProfileInfoIntelFPGA, the function returns an event error message.
- Host programs that use clGetProfileInfoIntelFPGA and clGetProfileDataDeviceIntelFPGA function calls must include the CL/cl_ext_intelfpga.h header file.
int main()
{ ...
clEnqueueNDRangeKernel(queue, kernel, ..., NULL);
...
clEnqueueNDRangeKernel(queue, kernel, .. , NULL);
...
}
This host application runs on the assumption that a kernel launches twice and then completes. In the profile.mon file, there are two sets of profile data, one for each kernel invocation. To collect profile data while the kernel is running, modify the host code in the following manner:
int main()
{
...
clEnqueueNDRangeKernel(queue, kernel, ..., &event);
//Get the profile data before the kernel completes
clGetProfileInfoIntelFPGA(event);
//Wait until the kernel completes
clFinish(queue);
...
clEnqueueNDRangeKernel(queue, kernel, ..., NULL);
...
}
The call to clGetProfileInfoIntelFPGA adds a new entry in the profile.mon file.