Download AMD Accelerated Parallel Processing OpenCL User Guide
Transcript
AMD ACCELERATED P ARALLEL P ROCESSING Appendix C OpenCL Binary Image Format (BIF) v2.0 C.1 Overview OpenCL Binary Image Format (BIF) 2.0 is in the ELF format. BIF2.0 allows the OpenCL binary to contain the OpenCL source program, the LLVM IR, and the executable. The BIF defines the following special sections: .source: for storing the OpenCL source program. .llvmir: for storing the OpenCL immediate representation (LLVM IR). .comment: for storing the OpenCL version and the driver version that created the binary. The BIF can have other special sections for debugging, etc. It also contains several ELF special sections, such as: .text for storing the executable. .rodata for storing the OpenCL runtime control data. other ELF special sections required for forming an ELF (for example: .strtab, .symtab, .shstrtab). By default, OpenCL generates a binary that has LLVM IR, and the executable for the GPU (,.llvmir, .amdil, and .text sections), as well as LLVM IR and the executable for the CPU (.llvmir and .text sections). The BIF binary always contains a .comment section, which is a readable C string. The default behavior can be changed with the BIF options described in Section C.2, “BIF Options,” page C-3. The LLVM IR enables recompilation from LLVM IR to the target. When a binary is used to run on a device for which the original program was not generated and the original device is feature-compatible with the current device, OpenCL recompiles the LLVM IR to generate a new code for the device. Note that the LLVM IR is only universal within devices that are feature-compatible in the same device type, not across different device types. This means that the LLVM IR for the CPU is not compatible with the LLVM IR for the GPU. The LLVM IR for a GPU works only for GPU devices that have equivalent feature sets. BIF2.0 is supported since Stream SDK 2.2. AMD Accelerated Parallel Processing - OpenCL Programming Guide Copyright © 2013 Advanced Micro Devices, Inc. All rights reserved. C-1