Intel® FPGA SDK for OpenCL™ Pro Edition: Programming Guide

ID 683846
Date 6/21/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

6.4. Accessing Custom Platform-Specific Functions

You have the option to include in your application user-accessible functions that are available in your Custom Platform. However, when you link your host application to the FPGA Client Driver (FCD), you cannot directly reference these Custom Platform-specific functions. To reference Custom Platform-specific user-accessible functions while linking to the FCD, include the clGetBoardExtensionFunctionAddressIntelFPGA extension in your host application.

The clGetBoardExtensionFunctionAddressIntelFPGA extension specifies an API that retrieves a pointer to a user-accessible function from the Custom Platform.

Attention: For Linux systems, the clGetBoardExtensionFunctionAddressIntelFPGA function works with or without FCD. For Windows systems, the function only works in conjunction with FCD. Consult with your board vendor to determine if FCD is supported in your Custom Platform.

Definitions of the extension interfaces are available in the INTELFPGAOCLSDKROOT/host/include/CL/cl_ext_intelfpga.h file.

To obtain a pointer to a user-accessible function in your Custom Platform, call the following function in your host application:
void* clGetBoardExtensionFunctionAddressIntelFPGA (
    const char* function_name,
    cl_device_id device
    );

Where:

function_name is the name of the user-accessible function that your Custom Platform vendor provides,

and

device is the device ID returned by the clGetDeviceIDs function.

After locating the user-accessible function, the clGetBoardExtensionFunctionAddressIntelFPGA function returns a pointer to the user-accessible function. If the function does not exist in the Custom Platform, clGetBoardExtensionFunctionAddressIntelFPGA returns NULL.
Attention:

To access the clGetBoardExtensionFunctionAddressIntelFPGA API via the Installable Client Driver (ICD), ensure that the ICD extension API clGetExtensionFunctionAddressIntelFPGA retrieves the pointer to the clGetBoardExtensionFunctionAddressIntelFPGA API first.

The following code example shows how you can access the Custom Platform-specific function via ICD:

clGetBoardExtensionFunctionAddressIntelFPGA_fn 
   clGetBoardExtensionFunctionAddressIntelFPGA = 
      (clGetBoardExtensionFunctionAddressIntelFPGA_fn) 
   clGetExtensionFunctionAddressForPlatform
      (platform, "clGetBoardExtensionFunctionAddressIntelFPGA");
											
if (clGetBoardExtensionFunctionAddressIntelFPGA == NULL){
   printf ("Failed to get
           clGetBoardExtensionFunctionAddressIntelFPGA\n");
}

void * board_extension_function_ptr = 
   clGetBoardExtensionFunctionAddressIntelFPGA("function_name",device_id);