initial commit

[ROCm/clr commit: 3694ab2ce8]
This commit is contained in:
foreman
2014-07-04 16:17:05 -04:00
parent b0b5b33fcf
commit f80f2f233c
351 changed files with 113713 additions and 1 deletions
@@ -0,0 +1,17 @@
//
// Copyright (c) 2012 Advanced Micro Devices, Inc. All rights reserved.
//
// This is a compatibility header file. Either define the version
// of the compiler library that is to be used or include the
// header file for that version directly.
#ifndef ACL_H_
#define ACL_H_
#if WITH_VERSION_0_8
#include "v0_8/acl.h"
#elif WITH_VERSION_0_9
#include "v0_9/acl.h"
#else
#error "The compiler library version was not defined."
#include "v0_8/acl.h"
#endif
#endif // ACL_H_
@@ -0,0 +1,16 @@
//
// Copyright (c) 2011 Advanced Micro Devices, Inc. All rights reserved.
//
// This is a compatibility header file. Either define the version
// of the compiler library that is to be used or include the
// header file for that version directly.
#ifndef ACL_DEFS_H_
#define ACL_DEFS_H_
#if WITH_VERSION_0_8
#include "v0_8/aclDefs.h"
#elif WITH_VERSION_0_9
#else
#error "The compiler library version was not defined."
#include "v0_8/aclDefs.h"
#endif
#endif // ACL_DEFS_H_
@@ -0,0 +1,16 @@
//
// Copyright (c) 2012 Advanced Micro Devices, Inc. All rights reserved.
//
// This is a compatibility header file. Either define the version
// of the compiler library that is to be used or include the
// header file for that version directly.
#ifndef ACL_ENUMS_H_
#define ACL_ENUMS_H_
#if WITH_VERSION_0_8
#include "v0_8/aclEnums.h"
#elif WITH_VERSION_0_9
#else
#error "The compiler library version was not defined."
#include "v0_8/aclEnums.h"
#endif
#endif // ACL_ENUMS_H_
@@ -0,0 +1,16 @@
//
// Copyright (c) 2012 Advanced Micro Devices, Inc. All rights reserved.
//
// This is a compatibility header file. Either define the version
// of the compiler library that is to be used or include the
// header file for that version directly.
#ifndef ACL_FUNCTORS_H_
#define ACL_FUNCTORS_H_
#if WITH_VERSION_0_8
#include "v0_8/aclFunctors.h"
#elif WITH_VERSION_0_9
#else
#error "The compiler library version was not defined."
#include "v0_8/aclFunctors.h"
#endif
#endif // ACL_FUNCTORS_H_
@@ -0,0 +1,16 @@
//
// Copyright (c) 2012 Advanced Micro Devices, Inc. All rights reserved.
//
// This is a compatibility header file. Either define the version
// of the compiler library that is to be used or include the
// header file for that version directly.
#ifndef ACL_STRUCTS_H_
#define ACL_STRUCTS_H_
#if WITH_VERSION_0_8
#include "v0_8/aclStructs.h"
#elif WITH_VERSION_0_9
#else
#error "The compiler library version was not defined."
#include "v0_8/aclStructs.h"
#endif
#endif // ACL_STRUCTS_H_
@@ -0,0 +1,17 @@
//
// Copyright (c) 2012 Advanced Micro Devices, Inc. All rights reserved.
//
// This is a compatibility header file. Either define the version
// of the compiler library that is to be used or include the
// header file for that version directly.
#ifndef ACL_TYPES_H_
#define ACL_TYPES_H_
#if WITH_VERSION_0_8
#include "v0_8/aclTypes.h"
#elif WITH_VERSION_0_9
#include "v0_9/aclTypes.h"
#else
#error "The compiler library version was not defined."
#include "v0_8/aclTypes.h"
#endif
#endif // ACL_TYPES_H_
@@ -0,0 +1,250 @@
//
// Copyright (c) 2012 Advanced Micro Devices, Inc. All rights reserved.
//
#ifndef _ACL_0_8_H_
#define _ACL_0_8_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "aclTypes.h"
//!--------------------------------------------------------------------------!//
// Functions that deal with aclCompiler objects.
//!--------------------------------------------------------------------------!//
aclCompiler* ACL_API_ENTRY
aclCompilerInit(aclCompilerOptions *opts, acl_error *error_code) ACL_API_0_8;
acl_error ACL_API_ENTRY
aclCompilerFini(aclCompiler *cl) ACL_API_0_8;
aclCLVersion ACL_API_ENTRY
aclCompilerVersion(aclCompiler *cl, acl_error *error_code) ACL_API_0_8;
uint32_t ACL_API_ENTRY
aclVersionSize(aclCLVersion num, acl_error *error_code) ACL_API_0_8;
const char* ACL_API_ENTRY
aclGetErrorString(acl_error error_code) ACL_API_0_8;
//!--------------------------------------------------------------------------!//
// Functions that deal with target specific information.
//!--------------------------------------------------------------------------!//
//! Returns in the names argument, if non-NULL, a pointer to each of the arch
// names that the compiler supports. If names is NULL and arch_size is
// non-NULL, returns the number of arch entries that are required.
acl_error ACL_API_ENTRY
aclGetArchInfo(const char** arch_names,
size_t *arch_size) ACL_API_0_8;
//! Returns in the arch argument, if non-NULL, a pointer to each device
// name that the compiler supports. If device_size is non-NULL,
// returns the number of device entries that are used.
acl_error ACL_API_ENTRY
aclGetDeviceInfo(const char* arch,
const char **names,
size_t *device_size) ACL_API_0_8;
//! Function that returns a correctly filled out aclTargetInfo structure based
// on the information passed into the kernel.
aclTargetInfo ACL_API_ENTRY
aclGetTargetInfo(const char *arch,
const char *device,
acl_error *error_code) ACL_API_0_8;
//! Function that returns a correctly filled out aclTargetInfo structure based
// on the information passed into the kernel.
aclTargetInfo ACL_API_ENTRY
aclGetTargetInfoFromChipID(const char *arch,
const uint32_t chip_id,
acl_error *error_code) ACL_API_0_8;
//! Function that returns a string representation of the target architecture.
const char* ACL_API_ENTRY
aclGetArchitecture(const aclTargetInfo &target) ACL_API_0_8;
//! Function that returns a string representation of the target chip options.
const uint64_t ACL_API_ENTRY
aclGetChipOptions(const aclTargetInfo &target) ACL_API_0_8;
//! Function that returns a string representation of the target family.
const char* ACL_API_ENTRY
aclGetFamily(const aclTargetInfo &target) ACL_API_0_8;
//! Function that returns a string representation of the target chip.
const char* ACL_API_ENTRY
aclGetChip(const aclTargetInfo &target) ACL_API_0_8;
//!--------------------------------------------------------------------------!//
// Functions that deal with aclBinary objects.
//!--------------------------------------------------------------------------!//
aclBinary* ACL_API_ENTRY
aclBinaryInit(
size_t struct_version,
const aclTargetInfo *target,
const aclBinaryOptions *options,
acl_error *error_code) ACL_API_0_8;
acl_error ACL_API_ENTRY
aclBinaryFini(aclBinary *bin) ACL_API_0_8;
aclBinary* ACL_API_ENTRY
aclReadFromFile(const char *str,
acl_error *error_code) ACL_API_0_8;
aclBinary* ACL_API_ENTRY
aclReadFromMem(const void *mem,
size_t size, acl_error *error_code) ACL_API_0_8;
acl_error ACL_API_ENTRY
aclWriteToFile(aclBinary *bin,
const char *str) ACL_API_0_8;
acl_error ACL_API_ENTRY
aclWriteToMem(aclBinary *bin,
void **mem, size_t *size) ACL_API_0_8;
aclBinary* ACL_API_ENTRY
aclCreateFromBinary(const aclBinary *binary,
aclBIFVersion version) ACL_API_0_8;
aclBIFVersion ACL_API_ENTRY
aclBinaryVersion(const aclBinary *binary) ACL_API_0_8;
acl_error ACL_API_ENTRY
aclInsertSection(aclCompiler *cl,
aclBinary *binary,
const void *data,
size_t data_size,
aclSections id) ACL_API_0_8;
acl_error ACL_API_ENTRY
aclInsertSymbol(aclCompiler *cl,
aclBinary *binary,
const void *data,
size_t data_size,
aclSections id,
const char *symbol) ACL_API_0_8;
const void* ACL_API_ENTRY
aclExtractSection(aclCompiler *cl,
const aclBinary *binary,
size_t *size,
aclSections id,
acl_error *error_code) ACL_API_0_8;
const void* ACL_API_ENTRY
aclExtractSymbol(aclCompiler *cl,
const aclBinary *binary,
size_t *size,
aclSections id,
const char *symbol,
acl_error *error_code) ACL_API_0_8;
acl_error ACL_API_ENTRY
aclRemoveSection(aclCompiler *cl,
aclBinary *binary,
aclSections id) ACL_API_0_8;
acl_error ACL_API_ENTRY
aclRemoveSymbol(aclCompiler *cl,
aclBinary *binary,
aclSections id,
const char *symbol) ACL_API_0_8;
//!--------------------------------------------------------------------------!//
// Functions that deal with debug/metdata.
//!--------------------------------------------------------------------------!//
acl_error ACL_API_ENTRY
aclQueryInfo(aclCompiler *cl,
const aclBinary *binary,
aclQueryType query,
const char *kernel,
void *data_ptr,
size_t *ptr_size) ACL_API_0_8;
acl_error ACL_API_ENTRY
aclDbgAddArgument(aclCompiler *cl,
aclBinary *binary,
const char* kernel,
const char* name,
bool byVal)
ACL_API_0_8;
acl_error ACL_API_ENTRY
aclDbgRemoveArgument(aclCompiler *cl,
aclBinary *binary,
const char* kernel,
const char* name)
ACL_API_0_8;
//!--------------------------------------------------------------------------!//
// Functions that deal with various compilation phases.
//!--------------------------------------------------------------------------!//
acl_error ACL_API_ENTRY
aclCompile(aclCompiler *cl,
aclBinary *bin,
const char *options,
aclType from,
aclType to,
aclLogFunction compile_callback) ACL_API_0_8;
acl_error ACL_API_ENTRY
aclLink(aclCompiler *cl,
aclBinary *src_bin,
unsigned int num_libs,
aclBinary **libs,
aclType link_mode,
const char *options,
aclLogFunction link_callback) ACL_API_0_8;
const char* ACL_API_ENTRY
aclGetCompilerLog(aclCompiler *cl) ACL_API_0_8;
const void* ACL_API_ENTRY
aclRetrieveType(aclCompiler *cl,
const aclBinary *bin,
const char *name,
size_t *data_size,
aclType type,
acl_error *error_code) ACL_API_0_8;
acl_error ACL_API_ENTRY
aclSetType(aclCompiler *cl,
aclBinary *bin,
const char *name,
aclType type,
const void *data,
size_t size) ACL_API_0_8;
acl_error ACL_API_ENTRY
aclConvertType(aclCompiler *cl,
aclBinary *bin,
const char *name,
aclType type) ACL_API_0_8;
acl_error ACL_API_ENTRY
aclDisassemble(aclCompiler *cl,
aclBinary *bin,
const char *kernel,
aclLogFunction disasm_callback) ACL_API_0_8;
const void* ACL_API_ENTRY
aclGetDeviceBinary(aclCompiler *cl,
const aclBinary *bin,
const char *kernel,
size_t *size,
acl_error *error_code) ACL_API_0_8;
//!--------------------------------------------------------------------------!//
// Debug functionality
//!--------------------------------------------------------------------------!//
void aclDumpBinary(const aclBinary *bin);
//!--------------------------------------------------------------------------!//
// Functions that deal with memory.
// Free memory allocated by aclWriteToMem
//!--------------------------------------------------------------------------!//
acl_error ACL_API_ENTRY
aclFreeMem(aclBinary *bin,
void *mem);
#ifdef __cplusplus
}
#endif
#endif // _ACL_0_8_H_
@@ -0,0 +1,35 @@
//
// Copyright (c) 2011 Advanced Micro Devices, Inc. All rights reserved.
//
#ifndef _ACL_DEFS_0_8_H_
#define _ACL_DEFS_0_8_H_
#ifndef ACL_API_ENTRY
#if defined(_WIN32) || defined(__CYGWIN__)
#define ACL_API_ENTRY __stdcall
#else
#define ACL_API_ENTRY
#endif
#endif
#ifndef ACL_API_0_8
#define ACL_API_0_8
#endif
#ifndef AOC_API_0_7
#define AOC_API_0_7
#endif
#ifndef BIF_API_2_0
#define BIF_API_2_0
#endif
#ifndef BIF_API_2_1
#define BIF_API_2_1
#endif
#ifndef BIF_API_3_0
#define BIF_API_3_0
#endif
#endif // _ACL_DEFS_0_8_H_
@@ -0,0 +1,318 @@
//
// Copyright (c) 2012 Advanced Micro Devices, Inc. All rights reserved.
//
#ifndef _ACL_ENUMS_0_8_H_
#define _ACL_ENUMS_0_8_H_
typedef enum _acl_error_enum_0_8 {
ACL_SUCCESS = 0,
ACL_ERROR = 1,
ACL_INVALID_ARG = 2,
ACL_OUT_OF_MEM = 3,
ACL_SYS_ERROR = 4,
ACL_UNSUPPORTED = 5,
ACL_ELF_ERROR = 6,
ACL_INVALID_FILE = 7,
ACL_INVALID_COMPILER= 8,
ACL_INVALID_TARGET = 9,
ACL_INVALID_BINARY = 10,
ACL_INVALID_OPTION = 11,
ACL_INVALID_TYPE = 12,
ACL_INVALID_SECTION = 13,
ACL_INVALID_SYMBOL = 14,
ACL_INVALID_QUERY = 15,
ACL_FRONTEND_FAILURE= 16,
ACL_INVALID_BITCODE = 17,
ACL_LINKER_ERROR = 18,
ACL_OPTIMIZER_ERROR = 19,
ACL_CODEGEN_ERROR = 20,
ACL_ISAGEN_ERROR = 21,
ACL_INVALID_SOURCE = 22,
ACL_LIBRARY_ERROR = 23,
ACL_INVALID_SPIR = 24,
ACL_LWVERIFY_FAIL = 25,
ACL_HWVERIFY_FAIL = 26,
ACL_LAST_ERROR = 27
} acl_error_0_8;
typedef enum _comp_device_caps_enum_0_8 {
capError = 0,
capFMA = 1,
capImageSupport = 2,
capSaveSOURCE = 3, // input source
capSaveLLVMIR = 4, // output LLVMIR from frontend
capSaveCG = 5, // output from LLVM-BE
capSaveEXE = 6, // output executable
capSaveAMDIL = 7, // Save per-kernel AMDIL
capSaveHSAIL = 8, // Save per-kernel HSAIL
capEncrypted = 9,
capSaveDISASM = 10,
capSaveAS = 11,
capSaveSPIR = 12,
capDumpLast = 13
} compDeviceCaps_0_8;
typedef enum _comp_opt_settings_enum_0_8 {
optO0 = 0, // No optimization setting.
optO1 = 1,
optO2 = 2,
optO3 = 3,
optO4 = 4,
optOs = 5,
optError = 6, // Invalid optimization set
optLast = 7
} compOptSettings_0_8;
#define FLAG_SHIFT_VALUE 5
#define FLAG_MASK_VALUE ((1 << capDumpLast) - 1)
#define FLAG_BITLOC(A) (1 << ((A) & FLAG_MASK_VALUE))
#define FLAG_ARRAY_SIZE 4
//! An enumeration that defines the possible valid device types that
// can be compiled for.
typedef enum _acl_dev_type_enum_0_8 {
aclError = 0, // aclDevType of 0 is an error.
aclX86 = 1, // Targeting a 32bit X86 CPU device.
aclAMDIL = 2, // Targeting an AMDIL GPU device.
aclHSAIL = 3, // Targeting an HSAIL GPU device.
aclX64 = 4, // Targeting a 64bit X86 CPU device.
aclHSAIL64= 5, // Targeting a 64bit HSAIL GPU device.
aclAMDIL64= 6, // Targeting a 64bit AMDIL GPU device
aclLast = 7
} aclDevType_0_8;
//! Enum that represents the versions of the compiler
typedef enum _acl_cl_version_enum_0_8 {
ACL_VERSION_ERROR = 0,
ACL_VERSION_0_7 = 1,
ACL_VERSION_0_8 = 2,
ACL_VERSION_0_8_1 = 3,
ACL_VERSION_0_9 = 4,
ACL_VERSION_1_0 = 5,
ACL_VERSION_LAST = 6
} aclCLVersion_0_8;
//! Enum of the various aclTypes that are supported
typedef enum _acl_type_enum_0_8 {
ACL_TYPE_DEFAULT = 0,
ACL_TYPE_OPENCL = 1,
ACL_TYPE_LLVMIR_TEXT = 2,
ACL_TYPE_LLVMIR_BINARY = 3,
ACL_TYPE_SPIR_TEXT = 4,
ACL_TYPE_SPIR_BINARY = 5,
ACL_TYPE_AMDIL_TEXT = 6,
ACL_TYPE_AMDIL_BINARY = 7,
ACL_TYPE_HSAIL_TEXT = 8,
ACL_TYPE_HSAIL_BINARY = 9,
ACL_TYPE_X86_TEXT = 10,
ACL_TYPE_X86_BINARY = 11,
ACL_TYPE_CG = 12,
ACL_TYPE_SOURCE = 13,
ACL_TYPE_ISA = 14,
ACL_TYPE_HEADER = 15,
ACL_TYPE_RSLLVMIR_BINARY = 16,
ACL_TYPE_LAST = 17
} aclType_0_8;
//! Enum of the various loader types that are supported.
typedef enum _acl_loader_type_enum_0_8 {
ACL_LOADER_COMPLIB = 0,
ACL_LOADER_FRONTEND = 1,
ACL_LOADER_LINKER = 2,
ACL_LOADER_OPTIMIZER= 3,
ACL_LOADER_CODEGEN = 4,
ACL_LOADER_BACKEND = 5,
ACL_LOADER_SC = 6,
ACL_LOADER_LAST = 7
} aclLoaderType_0_8;
// Enumeration for the various acl versions
typedef enum _bif_version_enum_0_8 {
aclBIFVersionError = 0, // Error
aclBIFVersion20 = 1, // Version 2.0 of the OpenCL BIF
aclBIFVersion21 = 2, // Version 2.1 of the OpenCL BIF
aclBIFVersion30 = 3, // Version 3.0 of the OpenCL BIF
aclBIFVersionLatest = aclBIFVersion30, // Most recent version of the BIF
aclBIFVersionCAL = 4,
aclBIFVersionLast = 5
} aclBIFVersion_0_8;
// Enumeration for the various platform types
typedef enum _bif_platform_enum_0_8 {
aclPlatformCAL = 0, // For BIF 2.0 backward compatibility
aclPlatformCPU = 1, // For BIF 2.0 backward compatibility
aclPlatformCompLib = 2,
aclPlatformLast = 3
} aclPlatform_0_8;
// Enumeration for the various bif sections
typedef enum _bif_sections_enum_0_8 {
aclLLVMIR = 0,
aclSOURCE = 1,
aclILTEXT = 2, // For BIF 2.0 backward compatibility
aclASTEXT = 3, // For BIF 2.0 backward compatibility
aclCAL = 4, // For BIF 2.0 backward compatibility
aclDLL = 5, // For BIF 2.0 backward compatibility
aclSTRTAB = 6,
aclSYMTAB = 7,
aclRODATA = 8,
aclSHSTRTAB = 9,
aclNOTES = 10,
aclCOMMENT = 11,
aclILDEBUG = 12, // For BIF 2.0 backward compatibility
aclDEBUG_INFO = 13,
aclDEBUG_ABBREV = 14,
aclDEBUG_LINE = 15,
aclDEBUG_PUBNAMES = 16,
aclDEBUG_PUBTYPES = 17,
aclDEBUG_LOC = 18,
aclDEBUG_ARANGES = 19,
aclDEBUG_RANGES = 20,
aclDEBUG_MACINFO = 21,
aclDEBUG_STR = 22,
aclDEBUG_FRAME = 23,
aclJITBINARY = 24, // For BIF 2.0 backward compatibility
aclCODEGEN = 25,
aclTEXT = 26,
aclINTERNAL = 27,
aclSPIR = 28,
aclHEADER = 29,
aclBRIGcode = 30,
aclBRIGdirs = 31,
aclBRIGoprs = 32,
aclBRIGstrs = 33,
aclHSADEBUG = 34,
aclLAST = 35
} aclSections_0_8;
//! An enumeration that defines what are valid queries for aclQueryInfo.
typedef enum _rt_query_types_enum_0_8 {
RT_ABI_VERSION = 0,
RT_DEVICE_NAME = 1,
RT_MEM_SIZES = 2,
RT_GPU_FUNC_CAPS = 3,
RT_GPU_FUNC_ID = 4,
RT_GPU_DEFAULT_ID = 5,
RT_WORK_GROUP_SIZE = 6,
RT_WORK_REGION_SIZE = 7,
RT_ARGUMENT_ARRAY = 8,
RT_GPU_PRINTF_ARRAY = 9,
RT_CPU_BARRIER_NAMES= 10,
RT_DEVICE_ENQUEUE = 11,
RT_KERNEL_INDEX = 12,
RT_LAST_TYPE = 13
} aclQueryType_0_8;
//! An enumeration for the various GPU capabilities
typedef enum _rt_gpu_caps_enum_0_8 {
RT_COMPILER_WRITE = 1 << 0,
RT_DATA_SECTION = 1 << 1,
RT_WGS = 1 << 2,
RT_LIMIT_WGS = 1 << 3,
RT_PACKED_REGS = 1 << 4,
RT_64BIT_ABI = 1 << 5,
RT_PRINTF = 1 << 6,
RT_ARENA_UAV = 1 << 7,
RT_LRP_MEM = 1 << 8, // Local/Region/Private Memory
RT_INDEX_TEMPS = 1 << 9,
RT_WRS = 1 << 10,
RT_GWS = 1 << 11,
RT_SWGWS = 1 << 12,
RT_GPU_CAPS_MASK = 0xFFF
} aclGPUCaps_0_8;
//! An enumeration for the various CPU capabilities.
typedef enum _rt_cpu_caps_enum_0_8 {
RT_KERNEL_BARRIER = 1 << 0,
RT_PROGRAM_BARRIER = 1 << 1,
RT_CPU_CAPS_MASK = 0x3
} aclCPUCaps_0_8;
//! An enumeration that maps Resource type to index values
typedef enum _rt_gpu_resource_enum_0_8 {
RT_RES_UAV = 0, // UAV resources
RT_RES_PRI = 1, // Private resources
RT_RES_LDS = 2, // LDS resources
RT_RES_GDS = 3, // GDS resources
RT_RES_CON = 4, // Constant resources
RT_RES_LAST = 5
} aclGPUResource_0_8;
//! An enumeration that maps memory types to index values
typedef enum _rt_gpu_mem_sizes_enum_0_8 {
RT_MEM_HW_LOCAL = 0,
RT_MEM_SW_LOCAL = 1,
RT_MEM_HW_PRIVATE = 2,
RT_MEM_SW_PRIVATE = 3,
RT_MEM_HW_REGION = 4,
RT_MEM_SW_REGION = 5,
RT_MEM_LAST = 6
} aclGPUMemSizes_0_8;
// Enumerations for the various argument types.
typedef enum _acl_arg_type_enum_0_8 {
ARG_TYPE_ERROR = 0,
ARG_TYPE_SAMPLER = 1,
ARG_TYPE_IMAGE = 2,
ARG_TYPE_COUNTER = 3,
ARG_TYPE_VALUE = 4,
ARG_TYPE_POINTER = 5,
ARG_TYPE_SEMAPHORE = 6,
ARG_TYPE_LAST = 7
} aclArgType_0_8;
// Enumerations of the valid data types for pass by value and
// pass by pointer kernel arguments.
typedef enum _acl_data_type_enum_0_8 {
DATATYPE_ERROR = 0,
DATATYPE_i1 = 1,
DATATYPE_i8 = 2,
DATATYPE_i16 = 3,
DATATYPE_i32 = 4,
DATATYPE_i64 = 5,
DATATYPE_u8 = 6,
DATATYPE_u16 = 7,
DATATYPE_u32 = 8,
DATATYPE_u64 = 9,
DATATYPE_f16 = 10,
DATATYPE_f32 = 11,
DATATYPE_f64 = 12,
DATATYPE_f80 = 13,
DATATYPE_f128 = 14,
DATATYPE_struct = 15,
DATATYPE_union = 16,
DATATYPE_event = 17,
DATATYPE_opaque = 18,
DATATYPE_unknown = 19,
DATATYPE_LAST = 20
} aclArgDataType_0_8;
// Enumerations of the valid memory types for pass by pointer
// kernel arguments
typedef enum _acl_memory_type_enum_0_8 {
PTR_MT_ERROR = 0, // Error
PTR_MT_GLOBAL = 1, // global buffer
PTR_MT_SCRATCH_EMU = 2, // SW emulated private memory
PTR_MT_LDS_EMU = 3, // SW emulated local memory
PTR_MT_UAV = 4, // uniformed access vector memory
PTR_MT_CONSTANT_EMU = 5, // SW emulated constant memory
PTR_MT_GDS_EMU = 6, // SW emulated region memory
PTR_MT_LDS = 7, // HW local memory
PTR_MT_SCRATCH = 8, // HW private memory
PTR_MT_CONSTANT = 9, // HW constant memory
PTR_MT_GDS = 10, // HW region memory
PTR_MT_UAV_SCRATCH = 11, // SI and later HW private memory
PTR_MT_UAV_CONSTANT = 12, // SI and later HW constant memory
PTR_MT_LAST = 13
} aclMemoryType_0_8;
// Enumeration that specifies the various access types for a pointer/image.
typedef enum _acl_access_type_enum_0_8 {
ACCESS_TYPE_ERROR = 0,
ACCESS_TYPE_RO = 1,
ACCESS_TYPE_WO = 2,
ACCESS_TYPE_RW = 3,
ACCESS_TYPE_LAST = 4
} aclAccessType_0_8;
#endif // _ACL_ENUMS_0_8_H_
@@ -0,0 +1,182 @@
//
// Copyright (c) 2012 Advanced Micro Devices, Inc. All rights reserved.
//
#ifndef _ACL_FUNCTORS_0_8_H_
#define _ACL_FUNCTORS_0_8_H_
//! Callback for the log function function pointer that many
// API calls take to have the calling application receive
// information on what errors occur.
typedef void (*aclLogFunction_0_8)(const char *msg, size_t size);
typedef acl_error
(ACL_API_ENTRY *InsertSec_0_8)(aclCompiler *cl,
aclBinary *binary,
const void *data,
size_t data_size,
aclSections id) ACL_API_0_8;
typedef acl_error
(ACL_API_ENTRY *InsertSym_0_8)(aclCompiler *cl,
aclBinary *binary,
const void *data,
size_t data_size,
aclSections id,
const char *symbol) ACL_API_0_8;
typedef const void *
(ACL_API_ENTRY *ExtractSec_0_8)(aclCompiler *cl,
const aclBinary *binary,
size_t *size,
aclSections id,
acl_error *error_code) ACL_API_0_8;
typedef const void *
(ACL_API_ENTRY *ExtractSym_0_8)(aclCompiler *cl,
const aclBinary *binary,
size_t *size,
aclSections id,
const char *symbol,
acl_error *error_code) ACL_API_0_8;
typedef acl_error
(ACL_API_ENTRY *RemoveSec_0_8)(aclCompiler *cl,
aclBinary *binary,
aclSections id) ACL_API_0_8;
typedef acl_error
(ACL_API_ENTRY *RemoveSym_0_8)(aclCompiler *cl,
aclBinary *binary,
aclSections id,
const char *symbol) ACL_API_0_8;
typedef acl_error
(ACL_API_ENTRY *QueryInfo_0_8)(aclCompiler *cl,
const aclBinary *binary,
aclQueryType query,
const char *kernel,
void *data_ptr,
size_t *ptr_size) ACL_API_0_8;
typedef acl_error
(ACL_API_ENTRY *AddDbgArg_0_8)(aclCompiler *cl,
aclBinary *bin,
const char *kernel,
const char *name,
bool byVal) ACL_API_0_8;
typedef acl_error
(ACL_API_ENTRY *RemoveDbgArg_0_8)(aclCompiler *cl,
aclBinary *bin,
const char *kernel,
const char *name) ACL_API_0_8;
typedef acl_error
(ACL_API_ENTRY *Compile_0_8)(aclCompiler *cl,
aclBinary *bin,
const char *options,
aclType from,
aclType to,
aclLogFunction_0_8 compile_callback) ACL_API_0_8;
typedef acl_error
(ACL_API_ENTRY *Link_0_8)(aclCompiler *cl,
aclBinary *src_bin,
unsigned int num_libs,
aclBinary **libs,
aclType link_mode,
const char *options,
aclLogFunction_0_8 link_callback) ACL_API_0_8;
typedef const char *
(ACL_API_ENTRY *CompLog_0_8)(aclCompiler *cl) ACL_API_0_8;
typedef const void *
(ACL_API_ENTRY *RetrieveType_0_8)(aclCompiler *cl,
const aclBinary *bin,
const char *name,
size_t *data_size,
aclType type,
acl_error *error_code) ACL_API_0_8;
typedef acl_error
(ACL_API_ENTRY *SetType_0_8)(aclCompiler *cl,
aclBinary *bin,
const char *name,
aclType type,
const void *data,
size_t size) ACL_API_0_8;
typedef acl_error
(ACL_API_ENTRY *ConvertType_0_8)(aclCompiler *cl,
aclBinary *bin,
const char *name,
aclType type) ACL_API_0_8;
typedef acl_error
(ACL_API_ENTRY *Disassemble_0_8)(aclCompiler *cl,
aclBinary *bin,
const char *kernel,
aclLogFunction_0_8 disasm_callback) ACL_API_0_8;
typedef const void *
(ACL_API_ENTRY *GetDevBinary_0_8)(aclCompiler *cl,
const aclBinary *bin,
const char *kernel,
size_t *size,
acl_error *error_code) ACL_API_0_8;
typedef aclLoaderData *
(ACL_API_ENTRY *LoaderInit_0_8)(aclCompiler *cl,
aclBinary *bin,
aclLogFunction_0_8 callback,
acl_error *error);
typedef acl_error
(ACL_API_ENTRY *LoaderFini_0_8)(aclLoaderData *data);
typedef aclModule *
(ACL_API_ENTRY *FEToIR_0_8)(aclLoaderData *ald,
const char *source,
size_t data_size,
aclContext *ctx,
acl_error *error) ACL_API_0_8;
typedef acl_error
(ACL_API_ENTRY *SourceToISA_0_8)(aclLoaderData *ald,
const char *source,
size_t data_size) ACL_API_0_8;
typedef aclModule *
(ACL_API_ENTRY *IRPhase_0_8)(aclLoaderData *data,
aclModule *ir,
aclContext *ctx,
acl_error *error) ACL_API_0_8;
typedef aclModule *
(ACL_API_ENTRY *LinkPhase_0_8)(aclLoaderData *data,
aclModule *ir,
unsigned int num_libs,
aclModule **libs,
aclContext *ctx,
acl_error *error) ACL_API_0_8;
typedef const void *
(ACL_API_ENTRY *CGPhase_0_8)(aclLoaderData *data,
aclModule *ir,
aclContext *ctx,
acl_error *error) ACL_API_0_8;
typedef acl_error
(ACL_API_ENTRY *DisasmISA_0_8)(aclLoaderData *data,
const char *kernel,
const void *isa_code,
size_t isa_size) ACL_API_0_8;
typedef void*
(*AllocFunc_0_8)(size_t size) ACL_API_0_8;
typedef void
(*FreeFunc_0_8)(void *ptr) ACL_API_0_8;
#endif // _ACL_FUNCTORS_0_8_H_
@@ -0,0 +1,305 @@
//
// Copyright (c) 2012 Advanced Micro Devices, Inc. All rights reserved.
//
#ifndef _ACL_STRUCTS_0_8_H_
#define _ACL_STRUCTS_0_8_H_
#define ACL_STRUCT_HEADER \
size_t struct_size
//! A structure that holds information on the various types of arguments
// The format in memory of this structure is
// -------------
// | aclArgData |
// -------------
// |->argStr |
// -------------
// |->typeStr |
// -------------
typedef struct _acl_md_arg_type_0_8 {
ACL_STRUCT_HEADER;
size_t argNameSize;
size_t typeStrSize;
const char *argStr;
const char *typeStr;
union {
struct { // Struct for sampler arguments
unsigned ID;
unsigned isKernelDefined;
unsigned value;
} sampler;
struct { // Struct for image arguments
unsigned resID;
unsigned cbNum;
unsigned cbOffset;
aclAccessType type;
bool is2D;
bool is1D;
bool isArray;
bool isBuffer;
} image;
struct { // struct for atomic counter arguments
unsigned is32bit;
unsigned resID;
unsigned cbNum;
unsigned cbOffset;
} counter;
struct { // struct for semaphore arguments
unsigned resID;
unsigned cbNum;
unsigned cbOffset;
} sema;
struct { // struct for pass by value arguments
unsigned numElements;
unsigned cbNum;
unsigned cbOffset;
aclArgDataType data;
} value;
struct { // struct for pass by pointer arguments
unsigned numElements;
unsigned cbNum;
unsigned cbOffset;
unsigned bufNum;
unsigned align;
aclArgDataType data;
aclMemoryType memory;
aclAccessType type;
bool isVolatile;
bool isRestrict;
bool isPipe;
} pointer;
} arg;
aclArgType type;
bool isConst;
} aclArgData_0_8;
//! A structure that holds information for printf
// The format in memory of this structure is
// --------------
// | aclPrintfFmt|
// --------------
// |->argSizes |
// --------------
// |->fmrStr |
// --------------
typedef struct _acl_md_printf_fmt_0_8 {
ACL_STRUCT_HEADER;
unsigned ID;
size_t numSizes;
size_t fmtStrSize;
uint32_t *argSizes;
const char *fmtStr;
} aclPrintfFmt_0_8;
//! A structure that holds the metadata in the RODATA section.
typedef struct _acl_metadata_0_8 {
ACL_STRUCT_HEADER; // This holds the size of the structure itself for versioning.
size_t data_size; // This holds the size of all the memory allocated for this structure.
uint32_t major, minor, revision, gpuCaps, funcID;
uint32_t gpuRes[5];
size_t wgs[3];
uint32_t wrs[3];
size_t kernelNameSize;
size_t deviceNameSize;
size_t mem[6];
size_t numArgs;
size_t numPrintf;
aclArgData_0_8 *args;
aclPrintfFmt_0_8 *printf;
const char *kernelName;
const char *deviceName;
bool enqueue_kernel;
uint32_t kernel_index;
} aclMetadata_0_8;
//! An structure that holds information on the capabilities of the bif device.
typedef struct _acl_device_caps_rec_0_8 {
ACL_STRUCT_HEADER;
uint32_t flags[4];
uint32_t encryptCode;
} aclDevCaps_0_8;
//! Structure that holds information on the target that the source is
// being compiled for.
typedef struct _acl_target_info_rec_0_8 {
ACL_STRUCT_HEADER;
aclDevType arch_id; // An identifier for the architecture.
uint32_t chip_id; // A identifier for the chip.
} aclTargetInfo_0_8;
// Structure for the version 0.8 of the structure.
typedef struct _acl_binary_opts_rec_0_8 {
ACL_STRUCT_HEADER;
uint32_t elfclass;
uint32_t bitness;
const char *temp_file;
uint32_t kernelArgAlign;
} aclBinaryOptions_0_8;
// Structure for the version 0.8.1 of the structure.
// This versions addes in alloc/dealloc functions.
typedef struct _acl_binary_opts_rec_0_8_1 {
ACL_STRUCT_HEADER;
uint32_t elfclass;
uint32_t bitness;
const char *temp_file;
uint32_t kernelArgAlign;
AllocFunc_0_8 alloc;
FreeFunc_0_8 dealloc;
} aclBinaryOptions_0_8_1;
//! Structure that holds the OpenCL binary information.
typedef struct _acl_bif_rec_0_8 {
ACL_STRUCT_HEADER;
aclTargetInfo_0_8 target; // Information about the target device.
aclBIF* bin; // Pointer to the acl.
aclOptions* options; // Pointer to acl options.
aclBinaryOptions_0_8 binOpts; // Pointer to the binary options.
aclDevCaps_0_8 caps; // Capabilities of the BIF.
} aclBinary_0_8;
//! Version of the aclBinary that uses the 0_8_1 version of the aclBinaryOptions.
typedef struct _acl_bif_rec_0_8_1 {
ACL_STRUCT_HEADER;
aclTargetInfo_0_8 target; // Information about the target device.
aclBIF* bin; // Pointer to the acl.
aclOptions* options; // Pointer to acl options.
aclBinaryOptions_0_8_1 binOpts; // Pointer to the binary options.
aclDevCaps_0_8 caps; // Capabilities of the BIF.
} aclBinary_0_8_1;
#define ACL_LOADER_COMMON\
ACL_STRUCT_HEADER; \
bool isBuiltin; \
const char *libName; \
void *handle; \
LoaderInit init; \
LoaderFini fini;
// Struct that maps to the common structure between all loaders.
typedef struct _acl_common_loader_rec_0_8 {
ACL_LOADER_COMMON;
} aclCommonLoader_0_8;
typedef struct _acl_cl_loader_rec_0_8 {
ACL_LOADER_COMMON;
Compile compile;
Link link;
CompLog getLog;
RetrieveType_0_8 retrieveType;
SetType_0_8 setType;
ConvertType_0_8 convertType;
Disassemble disassemble;
GetDevBinary_0_8 devBinary;
InsertSec insSec;
ExtractSec extSec;
RemoveSec remSec;
InsertSym insSym;
ExtractSym extSym;
RemoveSym remSym;
QueryInfo getInfo;
AddDbgArg addDbg;
RemoveDbgArg removeDbg;
} aclCLLoader_0_8;
//! Structure that holds the required functions
// that sc exports for the SCDLL infrastructure.
typedef struct _acl_sc_loader_rec_0_8 {
ACL_LOADER_COMMON;
uint32_t /*SC_UINT32*/ sc_interface_version;
void /**SC_EXPORT_FUNCTIONS**/ *scef;
// Any version specific fields go here.
} aclSCLoader_0_8;
typedef struct _acl_fe_loader_rec_0_8 {
ACL_LOADER_COMMON;
FEToIR toIR; // Used for Source to aclModule containing LLVMIR
FEToIR toModule; // Used to convert raw SPIR/LLVM-IR to aclModule
SourceToISA toISA; // Used for Source to ISA
} aclFELoader_0_8;
typedef struct _acl_opt_loader_rec_0_8 {
ACL_LOADER_COMMON;
IRPhase optimize; // Used for IR to IR transformation
} aclOptLoader_0_8;
typedef struct _acl_link_loader_rec_0_8 {
ACL_LOADER_COMMON;
LinkPhase link; // Used for Linking in IR modules
IRPhase toLLVMIR; // Used for converting SPIR to LLVMIR
IRPhase toSPIR; // Used for converting LLVMIR to SPIR
} aclLinkLoader_0_8;
typedef struct _acl_cg_loader_rec_0_8 {
ACL_LOADER_COMMON;
CGPhase codegen; // Used for converting from LLVMIR to target ASM.
} aclCGLoader_0_8;
typedef struct _acl_be_loader_rec_0_8 {
ACL_LOADER_COMMON;
SourceToISA finalize; // Used for converting from target source to target ISA.
SourceToISA assemble; // Used for converting from target text to target binary.
DisasmISA disassemble; // Used for converting from target binary to target ISA.
} aclBELoader_0_8;
typedef struct _acl_compiler_opts_rec_0_8 {
ACL_STRUCT_HEADER; // Size of the structure for version checking.
const char *clLib;
const char *feLib;
const char *optLib;
const char *linkLib;
const char *cgLib;
const char *beLib;
const char *scLib;
} aclCompilerOptions_0_8;
typedef struct _acl_compiler_opts_rec_0_8_1 {
ACL_STRUCT_HEADER; // Size of the structure for version checking.
const char* clLib;
const char *feLib;
const char *optLib;
const char *linkLib;
const char *cgLib;
const char *beLib;
const char *scLib;
AllocFunc alloc;
FreeFunc dealloc;
} aclCompilerOptions_0_8_1;
//! Structure that holds the OpenCL compiler and various loaders.
typedef struct _acl_compiler_rec_0_8 {
ACL_STRUCT_HEADER; // Size of structure for version checking.
aclCLLoader clAPI; // Pointer to the compiler API.
aclFELoader feAPI; // Pointer to the FE Loader API.
aclOptLoader optAPI; // Pointer to the Opt Loader API.
aclLinkLoader linkAPI; // Pointer to the Link Loader API.
aclCGLoader cgAPI; // Pointer to the CG Loader API.
aclBELoader beAPI; // Pointer to the BE Loader API.
aclSCLoader scAPI; // Pointer to the SC Loader API.
aclCompilerOptions *opts; // The options structure for the compiler.
void *llvm_shutdown; // Pointer to the llvm shutdown object.
char *buildLog; // Pointer to the current build log.
unsigned logSize; // Size of the current build log.
aclLoaderData *apiData; // pointer to data store for the compiler API loader.
} aclCompilerHandle_0_8;
//! Structure that holds the OpenCL compiler and various loaders.
typedef struct _acl_compiler_rec_0_8_1 {
ACL_STRUCT_HEADER;
aclCLLoader clAPI; // Pointer to the compiler API.
aclFELoader feAPI; // Pointer to the FE Loader API.
aclOptLoader optAPI; // Pointer to the Opt Loader API.
aclLinkLoader linkAPI; // Pointer to the Link Loader API.
aclCGLoader cgAPI; // Pointer to the CG Loader API.
aclBELoader beAPI; // Pointer to the BE Loader API.
aclSCLoader scAPI; // Pointer to the SC Loader API.
AllocFunc alloc;
FreeFunc dealloc;
aclCompilerOptions *opts; // The options structure for the compiler.
void *llvm_shutdown; // Pointer to the llvm shutdown object.
char *buildLog; // Pointer to the current build log.
unsigned logSize; // Size of the current build log.
aclLoaderData *apiData; // pointer to data store for the compiler API loader.
} aclCompilerHandle_0_8_1;
#endif // _ACL_STRUCTS_0_8_H_
@@ -0,0 +1,88 @@
//
// Copyright (c) 2012 Advanced Micro Devices, Inc. All rights reserved.
//
#ifndef _ACL_API_TYPES_0_8_H_
#define _ACL_API_TYPES_0_8_H_
#include "aclDefs.h"
#include <stdint.h>
#include <stddef.h>
// Typedefs that always point to the most recent versions of the objects.
typedef struct _acl_md_arg_type_0_8 aclArgData;
typedef struct _acl_md_printf_fmt_0_8 aclPrintfFmt;
typedef struct _acl_metadata_0_8 aclMetadata;
typedef struct _acl_device_caps_rec_0_8 aclDevCaps;
typedef struct _acl_target_info_rec_0_8 aclTargetInfo;
typedef struct _acl_bif_rec_0_8_1 aclBinary;
typedef struct _acl_binary_opts_rec_0_8_1 aclBinaryOptions;
typedef struct _acl_compiler_rec_0_8_1 aclCompiler;
typedef struct _acl_compiler_opts_rec_0_8_1 aclCompilerOptions;
typedef struct _acl_options_0_8* aclOptions; // Opaque pointer to amd::Options
typedef struct _acl_binary_0_8* aclBIF; // Opaque pointer to bifbase
typedef struct _acl_common_loader_rec_0_8 aclCommonLoader;
typedef struct _acl_cl_loader_rec_0_8 aclCLLoader;
typedef struct _acl_sc_loader_rec_0_8 aclSCLoader;
typedef struct _acl_fe_loader_rec_0_8 aclFELoader;
typedef struct _acl_link_loader_rec_0_8 aclLinkLoader;
typedef struct _acl_opt_loader_rec_0_8 aclOptLoader;
typedef struct _acl_cg_loader_rec_0_8 aclCGLoader;
typedef struct _acl_be_loader_rec_0_8 aclBELoader;
typedef struct _acl_llvm_module_0_8* aclModule; // Opaque pointer to llvm::Module
typedef struct _acl_llvm_context_0_8* aclContext; // Opaque pointer to llvm::Context
typedef struct _acl_loader_data_0_8* aclLoaderData; // Opaque pointer to loader data
#include "aclEnums.h"
// Typedefs for enumerations
typedef enum _acl_error_enum_0_8 acl_error;
typedef enum _comp_device_caps_enum_0_8 compDeviceCaps;
typedef enum _comp_opt_settings_enum_0_8 compOptSettings;
typedef enum _acl_dev_type_enum_0_8 aclDevType;
typedef enum _acl_cl_version_enum_0_8 aclCLVersion;
typedef enum _acl_type_enum_0_8 aclType;
typedef enum _rt_query_types_enum_0_8 aclQueryType;
typedef enum _rt_gpu_caps_enum_0_8 aclGPUCaps;
typedef enum _rt_gpu_resource_enum_0_8 aclGPUResource;
typedef enum _rt_gpu_mem_sizes_enum_0_8 aclGPUMemSizes;
typedef enum _acl_arg_type_enum_0_8 aclArgType;
typedef enum _acl_data_type_enum_0_8 aclArgDataType;
typedef enum _acl_memory_type_enum_0_8 aclMemoryType;
typedef enum _acl_access_type_enum_0_8 aclAccessType;
typedef enum _bif_version_enum_0_8 aclBIFVersion;
typedef enum _bif_platform_enum_0_8 aclPlatform;
typedef enum _bif_sections_enum_0_8 aclSections;
typedef enum _acl_loader_type_enum_0_8 aclLoaderType;
#include "aclFunctors.h"
// Typedefs for function pointers
typedef aclLogFunction_0_8 aclLogFunction;
typedef InsertSec_0_8 InsertSec;
typedef RemoveSec_0_8 RemoveSec;
typedef ExtractSec_0_8 ExtractSec;
typedef InsertSym_0_8 InsertSym;
typedef RemoveSym_0_8 RemoveSym;
typedef ExtractSym_0_8 ExtractSym;
typedef QueryInfo_0_8 QueryInfo;
typedef Compile_0_8 Compile;
typedef Link_0_8 Link;
typedef AddDbgArg_0_8 AddDbgArg;
typedef RemoveDbgArg_0_8 RemoveDbgArg;
typedef CompLog_0_8 CompLog;
typedef RetrieveType_0_8 RetrieveType;
typedef SetType_0_8 SetType;
typedef ConvertType_0_8 ConvertType;
typedef Disassemble_0_8 Disassemble;
typedef GetDevBinary_0_8 GetDevBinary;
typedef LoaderInit_0_8 LoaderInit;
typedef LoaderFini_0_8 LoaderFini;
typedef FEToIR_0_8 FEToIR;
typedef SourceToISA_0_8 SourceToISA;
typedef IRPhase_0_8 IRPhase;
typedef LinkPhase_0_8 LinkPhase;
typedef CGPhase_0_8 CGPhase;
typedef DisasmISA_0_8 DisasmISA;
typedef AllocFunc_0_8 AllocFunc;
typedef FreeFunc_0_8 FreeFunc;
#include "aclStructs.h"
#endif // _CL_API_TYPES_0_8_H_