P4 to Git Change 1299127 by lmoriche@lmoriche_opencl_dev on 2016/08/04 14:18:16

SWDEV-94610 - Remove the g_complib instance from the ROCm device when building OpenCL/LC

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/build/Makefile.api#138 edit
... //depot/stg/opencl/drivers/opencl/runtime/build/Makefile.runtime#64 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#276 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/build/Makefile.oclrocm#6 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompiler.cpp#4 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompilerlib.cpp#4 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompilerlib.hpp#4 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#5 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.hpp#4 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.cpp#4 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.cpp#5 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.hpp#4 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.cpp#5 edit
Этот коммит содержится в:
foreman
2016-08-04 14:24:34 -04:00
родитель 1c7eee3d8b
Коммит dcdd293036
9 изменённых файлов: 112 добавлений и 16 удалений
+21 -1
Просмотреть файл
@@ -18,7 +18,11 @@
#include "device/rocm/rocblit.hpp"
#include "device/rocm/rocvirtual.hpp"
#include "device/rocm/rocprogram.hpp"
#if defined(WITH_LIGHTNING_COMPILER)
#include "driver/AmdCompiler.h"
#else // !defined(WITH_LIGHTNING_COMPILER)
#include "device/rocm/roccompilerlib.hpp"
#endif // !defined(WITH_LIGHTNING_COMPILER)
#include "device/rocm/rocmemory.hpp"
#include "device/rocm/rocglinterop.hpp"
#include "kv_id.h"
@@ -41,7 +45,7 @@ extern const char* BlitSourceCode;
}
namespace roc {
aclCompiler* NullDevice::compilerHandle_;
amd::Device::Compiler* NullDevice::compilerHandle_;
bool roc::Device::isHsaInitialized_ = false;
hsa_agent_t roc::Device::cpu_agent_ = { 0 };
std::vector<hsa_agent_t> roc::Device::gpu_agents_;
@@ -226,6 +230,16 @@ Device::~Device()
}
}
bool NullDevice::initCompiler(bool isOffline) {
#if defined(WITH_LIGHTNING_COMPILER)
if (!compilerHandle_) {
const std::string llvmbin(amd::Os::getEnvironment("LLVM_BIN"));
compilerHandle_ = amd::opencl_driver::CompilerFactory()
.CreateAMDGPUCompiler(llvmbin);
if (!compilerHandle_) {
return false;
}
}
#else // !defined(WITH_LIGHTNING_COMPILER)
// Initializes g_complibModule and g_complibApi if they were not initialized
if( g_complibModule == NULL ){
if (!LoadCompLib(isOffline)) {
@@ -245,10 +259,15 @@ bool NullDevice::initCompiler(bool isOffline) {
return false;
}
}
#endif // !defined(WITH_LIGHTNING_COMPILER)
return true;
}
bool NullDevice::destroyCompiler() {
#if defined(WITH_LIGHTNING_COMPILER)
delete compilerHandle_;
compilerHandle_ = NULL;
#else // !defined(WITH_LIGHTNING_COMPILER)
if (compilerHandle_ != NULL) {
acl_error error = g_complibApi._aclCompilerFini(compilerHandle_);
if (error != ACL_SUCCESS) {
@@ -259,6 +278,7 @@ bool NullDevice::destroyCompiler() {
if( g_complibModule != NULL ){
UnloadCompLib();
}
#endif // !defined(WITH_LIGHTNING_COMPILER)
return true;
}