P4 to Git Change 1404293 by lmoriche@lmoriche_opencl_dev2 on 2017/05/01 16:43:07
SWDEV-102726 - [OCL-LC-ROCm] Open source OpenCL Runtime
- Changes required to use the Khronos ICD sources instead of ours.
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/CMakeLists.txt#3 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_gl.cpp#54 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_icd.cpp#29 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_platform.h#7 edit
... //depot/stg/opencl/drivers/opencl/runtime/CMakeLists.txt#2 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpubinary.cpp#12 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpubinary.hpp#5 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#319 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.hpp#127 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.cpp#233 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuresource.cpp#239 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/object.hpp#18 edit
[ROCm/clr commit: 0af2c7043c]
Bu işleme şunda yer alıyor:
@@ -1,11 +1,12 @@
|
||||
set(CMAKE_CXX_FLAGS "-std=c++11")
|
||||
|
||||
add_definitions(-DLINUX -D__x86_64__ -D__AMD64__ -DUNIX_OS -DqLittleEndian -DAMD_LIBELF -DOPENCL_MAJOR=2 -DOPENCL_MINOR=0 -DWITH_AQL -DWITH_ONLINE_COMPILER -DATI_OS_LINUX -DATI_ARCH_X86 -DLITTLEENDIAN_CPU -DATI_BITS_64 -DATI_COMP_GCC -DWITH_HSA_DEVICE -DWITH_TARGET_AMDGCN -DOPENCL_EXPORTS -DCL_USE_DEPRECATED_OPENCL_1_1_APIS -DCL_USE_DEPRECATED_OPENCL_1_2_APIS -DCL_USE_DEPRECATED_OPENCL_2_0_APIS -DWITH_VERSION_0_8=1 -DVEGA10_ONLY=false -DWITH_LIGHTNING_COMPILER -DBSD_LIBELF)
|
||||
add_definitions(-DLINUX -D__x86_64__ -D__AMD64__ -DUNIX_OS -DqLittleEndian -DOPENCL_MAJOR=2 -DOPENCL_MINOR=0 -DWITH_AQL -DWITH_ONLINE_COMPILER -DATI_OS_LINUX -DATI_ARCH_X86 -DLITTLEENDIAN_CPU -DATI_BITS_64 -DATI_COMP_GCC -DWITH_HSA_DEVICE -DWITH_TARGET_AMDGCN -DOPENCL_EXPORTS -DCL_USE_DEPRECATED_OPENCL_1_0_APIS -DCL_USE_DEPRECATED_OPENCL_1_1_APIS -DCL_USE_DEPRECATED_OPENCL_1_2_APIS -DCL_USE_DEPRECATED_OPENCL_2_0_APIS -DVEGA10_ONLY=false -DWITH_LIGHTNING_COMPILER)
|
||||
|
||||
include_directories(/opt/rocm/include/hsa)
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR}/runtime)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/api/opencl)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/api/opencl/khronos)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/api/opencl/khronos/headers)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/api/opencl/khronos/headers/opencl2.0)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/compiler/llvm/lib/Target/AMDGPU/MCTargetDesc)
|
||||
@@ -13,11 +14,13 @@ include_directories(${CMAKE_SOURCE_DIR}/compiler/driver/src)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/compiler/lib)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/backends/common)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/loaders/elf/utils/common)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/loaders/elf/utils/libelf)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/loaders)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/compiler/tools)
|
||||
|
||||
add_definitions(-DBSD_LIBELF)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/loaders/elf/utils/common)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/loaders/elf/utils/libelf)
|
||||
|
||||
add_subdirectory(device/rocm)
|
||||
|
||||
add_library(oclruntime OBJECT
|
||||
|
||||
@@ -27,7 +27,7 @@ ClBinary::FeatureCheckResult ClBinary::checkFeatures() {
|
||||
amd::OclElf::oclElfPlatform platform;
|
||||
if (!elfIn()->getTarget(elf_target, platform)) {
|
||||
LogError("Loading OCL CPU binary: incorrect format");
|
||||
return ERROR;
|
||||
return fcERROR;
|
||||
}
|
||||
uint64_t chip_options = 0x0;
|
||||
if (platform == amd::OclElf::COMPLIB_PLATFORM) {
|
||||
@@ -35,7 +35,7 @@ ClBinary::FeatureCheckResult ClBinary::checkFeatures() {
|
||||
uint32_t flag;
|
||||
if (!elfIn()->getFlags(flag)) {
|
||||
LogError("Loading OCL CPU binary: incorrect format");
|
||||
return ERROR;
|
||||
return fcERROR;
|
||||
}
|
||||
aclTargetInfo tgtInfo = aclGetTargetInfoFromChipID(LP64_SWITCH("x86", "x86-64"), flag, NULL);
|
||||
chip_options = aclGetChipOptions(tgtInfo);
|
||||
@@ -43,13 +43,13 @@ ClBinary::FeatureCheckResult ClBinary::checkFeatures() {
|
||||
((elf_target == EM_386) && (strcmp(LP64_SWITCH("x86", "x86-64"), "x86") != 0)) ||
|
||||
((elf_target == EM_X86_64) && (strcmp(LP64_SWITCH("x86", "x86-64"), "x86-64") != 0))) {
|
||||
LogError("Loading OCL CPU binary: different target");
|
||||
return ERROR;
|
||||
return fcERROR;
|
||||
}
|
||||
} else {
|
||||
// BIF 2.0
|
||||
if ((platform != amd::OclElf::CPU_PLATFORM) || ((target & elf_target) != elf_target)) {
|
||||
LogError("Loading OCL CPU binary: different target");
|
||||
return ERROR;
|
||||
return fcERROR;
|
||||
}
|
||||
}
|
||||
char* section;
|
||||
@@ -64,11 +64,11 @@ ClBinary::FeatureCheckResult ClBinary::checkFeatures() {
|
||||
if (elfIn_->getSection(amd::OclElf::LLVMIR, §ion, &sz)) {
|
||||
if ((section != NULL) && (sz > 0)) {
|
||||
// hasDLL being false to force recompiling
|
||||
RECOMPILE;
|
||||
fcRECOMPILE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
return fcOK;
|
||||
}
|
||||
|
||||
bool ClBinary::loadX86(Program& program, std::string& dllName, bool& hasDLL) {
|
||||
@@ -79,11 +79,11 @@ bool ClBinary::loadX86(Program& program, std::string& dllName, bool& hasDLL) {
|
||||
dllName = tempName + "." WINDOWS_SWITCH("dll", MACOS_SWITCH("dyld", "so"));
|
||||
|
||||
switch (checkFeatures()) {
|
||||
case ERROR:
|
||||
case fcERROR:
|
||||
return false;
|
||||
case RECOMPILE:
|
||||
case fcRECOMPILE:
|
||||
return true;
|
||||
case OK:
|
||||
case fcOK:
|
||||
// Fallthrough
|
||||
break;
|
||||
}
|
||||
@@ -143,11 +143,11 @@ bool ClBinary::loadX86JIT(Program& program, bool& hasJITBinary) {
|
||||
hasJITBinary = false;
|
||||
|
||||
switch (checkFeatures()) {
|
||||
case ERROR:
|
||||
case fcERROR:
|
||||
return false;
|
||||
case RECOMPILE:
|
||||
case fcRECOMPILE:
|
||||
return true;
|
||||
case OK:
|
||||
case fcOK:
|
||||
// Fallthrough
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class ClBinary : public device::ClBinary {
|
||||
bool storeX86Asm(const char* buffer, size_t size);
|
||||
|
||||
private:
|
||||
enum FeatureCheckResult { ERROR, RECOMPILE, OK };
|
||||
enum FeatureCheckResult { fcERROR, fcRECOMPILE, fcOK };
|
||||
|
||||
FeatureCheckResult checkFeatures();
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ const MetaDataConst ArgState[ArgStateTotal] = {
|
||||
// Name Type Properties
|
||||
// Kernel description (special properties)
|
||||
{"memory:compilerwrite", KernelArg::PrivateFixed, {0, 0, 0, 0, 0, 0, 0}},
|
||||
{"uniqueid:", KernelArg::None, {0, 0, 0, 0, 0, 0, 0}},
|
||||
{"uniqueid:", KernelArg::NoType, {0, 0, 0, 0, 0, 0, 0}},
|
||||
{"memory:private:", KernelArg::PrivateSize, {0, 0, 0, 0, 0, 0, 0}},
|
||||
{"memory:local:", KernelArg::LocalSize, {0, 0, 0, 0, 0, 0, 0}},
|
||||
{"memory:hwprivate:", KernelArg::HwPrivateSize, {0, 0, 0, 0, 0, 0, 0}},
|
||||
@@ -37,8 +37,8 @@ const MetaDataConst ArgState[ArgStateTotal] = {
|
||||
{"memory:hwlocal:", KernelArg::HwLocalSize, {0, 0, 0, 0, 0, 0, 0}},
|
||||
{"memory:64bitABI", KernelArg::ABI64Bit, {0, 0, 0, 0, 0, 0, 0}},
|
||||
{"limitgroupsize", KernelArg::Wavefront, {0, 0, 0, 0, 0, 0, 0}},
|
||||
{"function:", KernelArg::None, {1, 1, 0, 0, 0, 0, 0}},
|
||||
{"intrinsic:", KernelArg::None, {1, 0, 0, 0, 0, 0, 0}},
|
||||
{"function:", KernelArg::NoType, {1, 1, 0, 0, 0, 0, 0}},
|
||||
{"intrinsic:", KernelArg::NoType, {1, 0, 0, 0, 0, 0, 0}},
|
||||
{"error:", KernelArg::ErrorMessage, {0, 0, 0, 0, 0, 0, 0}},
|
||||
{"warning:", KernelArg::WarningMessage, {0, 0, 0, 0, 0, 0, 0}},
|
||||
{"printf_fmt:", KernelArg::PrintfFormatStr, {0, 0, 0, 0, 0, 0, 0}},
|
||||
@@ -312,13 +312,13 @@ CalImageReference::~CalImageReference() {
|
||||
}
|
||||
|
||||
KernelArg::KernelArg()
|
||||
: type_(KernelArg::None),
|
||||
: type_(KernelArg::NoType),
|
||||
size_(0),
|
||||
cbIdx_(0),
|
||||
cbPos_(0),
|
||||
index_(0),
|
||||
alignment_(1),
|
||||
dataType_(KernelArg::None) {
|
||||
dataType_(KernelArg::NoType) {
|
||||
name_ = "";
|
||||
buf_ = "";
|
||||
memory_.value_ = 0;
|
||||
@@ -349,7 +349,7 @@ KernelArg& KernelArg::operator=(const KernelArg& data) {
|
||||
|
||||
bool KernelArg::isCbNeeded() const {
|
||||
//! \note not a safe way
|
||||
bool result = ((type_ > None) && (type_ < Sampler)) ? true : false;
|
||||
bool result = ((type_ > NoType) && (type_ < Sampler)) ? true : false;
|
||||
if ((type_ == Sampler) && (location_ == 0)) {
|
||||
// Sampler is defined outside the kernel
|
||||
result = true;
|
||||
@@ -359,7 +359,7 @@ bool KernelArg::isCbNeeded() const {
|
||||
|
||||
size_t KernelArg::size(bool gpuLayer) const {
|
||||
switch (type_) {
|
||||
case None:
|
||||
case NoType:
|
||||
return 0;
|
||||
case PointerConst:
|
||||
case PointerHwConst:
|
||||
@@ -507,7 +507,7 @@ clk_value_type_t KernelArg::type() const {
|
||||
return T_SAMPLER;
|
||||
case PointerPrivate:
|
||||
case PointerHwPrivate:
|
||||
case None:
|
||||
case NoType:
|
||||
default:
|
||||
return T_VOID;
|
||||
}
|
||||
@@ -2188,7 +2188,7 @@ bool NullKernel::parseArguments(const std::string& metaData, uint* uavRefCount)
|
||||
break;
|
||||
}
|
||||
|
||||
arg.type_ = KernelArg::None;
|
||||
arg.type_ = KernelArg::NoType;
|
||||
|
||||
// Loop through all available metadata types
|
||||
for (uint i = 0; i < ArgStateTotal; ++i) {
|
||||
@@ -2196,7 +2196,7 @@ bool NullKernel::parseArguments(const std::string& metaData, uint* uavRefCount)
|
||||
// Find the name tag
|
||||
if (expect(metaData, &pos, ArgState[i].typeName_)) {
|
||||
switch (ArgState[i].type_) {
|
||||
case KernelArg::None:
|
||||
case KernelArg::NoType:
|
||||
// Process next ...
|
||||
continue;
|
||||
case KernelArg::Reflection: {
|
||||
|
||||
@@ -128,7 +128,7 @@ struct KernelArg : public amd::HeapObject {
|
||||
public:
|
||||
//! \enum Kernel argument type
|
||||
enum ArgumentType {
|
||||
None = 0,
|
||||
NoType = 0,
|
||||
PointerGlobal,
|
||||
Value,
|
||||
Image,
|
||||
|
||||
@@ -951,7 +951,7 @@ bool NullProgram::initGlobalData(const std::string& source, size_t start) {
|
||||
failed = true;
|
||||
}
|
||||
} break;
|
||||
case KernelArg::None:
|
||||
case KernelArg::NoType:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
// Copyright (c) 2008 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#if defined(ATI_OS_WIN)
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
#include <GL/gl.h>
|
||||
#include "GL/glATIInternal.h"
|
||||
|
||||
#include "platform/program.hpp"
|
||||
#include "platform/kernel.hpp"
|
||||
#include "os/os.hpp"
|
||||
@@ -13,8 +20,6 @@
|
||||
#include "device/gpu/gputimestamp.hpp"
|
||||
#include "thread/atomic.hpp"
|
||||
#include "hsa_ext_image.h"
|
||||
#include <GL/gl.h>
|
||||
#include "GL/glATIInternal.h"
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
#include "os/alloc.hpp"
|
||||
#include "thread/monitor.hpp"
|
||||
#include "utils/util.hpp"
|
||||
#include <icd/icd_dispatch.h>
|
||||
|
||||
#define CL_TYPES_DO(F) \
|
||||
|
||||
#define KHR_CL_TYPES_DO(F) \
|
||||
/* OpenCL type Runtime type */ \
|
||||
F(cl_context, Context) \
|
||||
F(cl_event, Event) \
|
||||
@@ -19,21 +21,26 @@
|
||||
F(cl_program, Program) \
|
||||
F(cl_device_id, Device) \
|
||||
F(cl_mem, Memory) \
|
||||
F(cl_sampler, Sampler) \
|
||||
F(cl_sampler, Sampler)
|
||||
|
||||
#define AMD_CL_TYPES_DO(F) \
|
||||
F(cl_counter_amd, Counter) \
|
||||
F(cl_perfcounter_amd, PerfCounter) \
|
||||
F(cl_threadtrace_amd, ThreadTrace) \
|
||||
F(cl_file_amd, LiquidFlashFile)
|
||||
|
||||
|
||||
#define CL_TYPES_DO(F) \
|
||||
KHR_CL_TYPES_DO(F) \
|
||||
AMD_CL_TYPES_DO(F)
|
||||
|
||||
// Forward declare ::cl_* types and amd::Class types
|
||||
//
|
||||
|
||||
#define DECLARE_CL_TYPES(CL, AMD) \
|
||||
namespace amd { \
|
||||
class AMD; \
|
||||
} \
|
||||
typedef struct _##CL { \
|
||||
} * CL;
|
||||
}
|
||||
|
||||
CL_TYPES_DO(DECLARE_CL_TYPES);
|
||||
|
||||
@@ -41,6 +48,15 @@ CL_TYPES_DO(DECLARE_CL_TYPES);
|
||||
|
||||
struct KHRicdVendorDispatchRec;
|
||||
|
||||
#define DECLARE_CL_TYPES(CL, AMD) \
|
||||
typedef struct _##CL { \
|
||||
struct KHRicdVendorDispatchRec* dispatch; \
|
||||
} * CL;
|
||||
|
||||
AMD_CL_TYPES_DO(DECLARE_CL_TYPES);
|
||||
|
||||
#undef DECLARE_CL_TYPES
|
||||
|
||||
namespace amd {
|
||||
|
||||
// Define the cl_*_type tokens for type checking.
|
||||
|
||||
Yeni konuda referans
Bir kullanıcı engelle