Article ID: 000077342 Content Type: Troubleshooting Last Reviewed: 11/30/2018

Why do I get the error “‘clGetProfileDataDeviceIntelFPGA’ was not declared in this scope” when compiling OpenCL host code?

Environment

    Intel® Quartus® Prime Standard Edition
    Intel® Quartus® Prime Pro Edition
    Intel® FPGA SDK for OpenCL™ Pro Edition
BUILT IN - ARTICLE INTRO SECOND COMPONENT
Description

The library function clGetProfileDataDeviceIntelFPGA must be called in the host code when dynamically profiling an autorun kernel.  If this function is called directly, the host code compilation may fail with an error like the ones below.

Linux (gcc)

    error: ‘clGetProfileDataDeviceIntelFPGA’ was not declared in this scope

 

Windows (Microsoft Visual Studio)

    error: unresolved external symbol clGetProfileDataDeviceIntelFPGA

 

If the system is using the ICD driver, non-standard functions such as *IntelFPGA functions cannot be used directly. The OpenCL call clGetExtensionFunctionAddress must be used to get a function pointer for the non-standard function and that pointer must be used to call it. 

Resolution

Using the prototype of the function, located in CL/ext.h

    extern CL_API_ENTRY cl_int CL_API_CALL

    clGetProfileDataDeviceIntelFPGA(

            cl_device_id            /*device_id*/,

            cl_program              /*program*/,

            cl_bool                 /*read_enqueue_kernels*/,

            cl_bool                 /*read_auto_enqueued*/,

            cl_bool                 /*clear_counters_after_readback*/,

            size_t                  /*param_value_size*/,

            void *                  /*param_value*/,

            size_t *                /*param_value_size_ret*/,

            cl_int *                /*errcode_ret*/ );

Replace the function call

    cl_int status = clGetProfileDataDeviceIntelFPGA (device, program, false, true, false, 0, NULL, NULL, NULL);

with code using the syntax below

    cl_int (*get_profile_fn)(cl_device_id, cl_program, cl_bool,cl_bool,cl_bool,size_t, void *,size_t *,cl_int *);

    get_profile_fn = (cl_int (*) (cl_device_id, cl_program, cl_bool,cl_bool,cl_bool,size_t, void *,size_t *,cl_int *))clGetExtensionFunctionAddress("clGetProfileDataDeviceIntelFPGA");

    cl_int status = (cl_int)(*get_profile_fn) (device, program, false, true, false, 0, NULL, NULL,  NULL);

 

 

Related Products

This article applies to 1 products

Intel® Programmable Devices

1