Download AMD Accelerated Parallel Processing OpenCL User Guide
Transcript
AMD ACCELERATED PARALLEL PROCESSING This means that the extensions must be explicitly enabled to be used in kernel programs. Each extension that affects kernel code compilation must add a defined macro with the name of the extension. This allows the kernel code to be compiled differently, depending on whether the extension is supported and enabled, or not. For example, for extension cl_khr_fp64 there should be a #define directive for macro cl_khr_fp64, so that the following code can be preprocessed: #ifdef cl_khr_fp64 // some code #else // some code #endif A.5 Getting Extension Function Pointers Use the following function to get an extension function pointer. void* clGetExtensionFunctionAddress(const char* FunctionName). This returns the address of the extension function specified by the FunctionName string. The returned value must be appropriately cast to a function pointer type, specified in the extension spec and header file. A return value of NULL means that the specified function does not exist in the CL implementation. A non-NULL return value does not guarantee that the extension function actually exists – queries described in sec. 2 or 3 must be done to ensure the extension is supported. The clGetExtensionFunctionAddress() function cannot be used to get core API function addresses. A.6 List of Supported Extensions that are Khronos-Approved Supported extensions approved by the Khronos Group are: cl_khr_global_int32_base_atomics – basic atomic operations on 32-bit integers in global memory. cl_khr_global_int32_extended_atomics – extended atomic operations on 32-bit integers in global memory. cl_khr_local_int32_base_atomics – basic atomic operations on 32-bit integers in local memory. cl_khr_local_int32_extended_atomics – extended atomic operations on 32-bit integers in local memory. cl_khr_int64_base_atomics – basic atomic operations on 64-bit integers in both global and local memory. cl_khr_int64_extended_atomics – extended atomic operations on 64-bit integers in both global and local memory. A.5 Getting Extension Function Pointers Copyright © 2013 Advanced Micro Devices, Inc. All rights reserved. A-3