P4 to Git Change 1309005 by lmoriche@lmoriche_opencl_dev on 2016/08/31 00:08:03
SWDEV-94644 - Generate a relocatable PCH for opencl-c.h. Use -isysroot to point to $(LLVM_BIN)/../../include where opencl-c.h should be installed.
Affected files ...
... //depot/stg/opencl/drivers/opencl/make/amdgcn.git/headers/build/Makefile.headers#8 edit
... //depot/stg/opencl/drivers/opencl/make/amdgcn.git/irif/build/Makefile.irif#5 edit
... //depot/stg/opencl/drivers/opencl/make/amdgcn.git/ockl/build/Makefile.ockl#6 edit
... //depot/stg/opencl/drivers/opencl/make/amdgcn.git/oclc/build/Makefile.oclc#8 edit
... //depot/stg/opencl/drivers/opencl/make/amdgcn.git/ocml/build/Makefile.ocml#6 edit
... //depot/stg/opencl/drivers/opencl/make/amdgcn.git/opencl/build/Makefile.opencl#8 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompiler.cpp#12 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.cpp#20 edit
[ROCm/clr commit: 1d6b47602d]
This commit is contained in:
@@ -20,6 +20,15 @@
|
||||
#include "utils/options.hpp"
|
||||
#include <cstdio>
|
||||
|
||||
#if defined(ATI_OS_LINUX)
|
||||
#include <dlfcn.h>
|
||||
#include <libgen.h>
|
||||
#endif // defined(ATI_OS_LINUX)
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
static std::string llvmBin_(amd::Os::getEnvironment("LLVM_BIN"));
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
//CLC_IN_PROCESS_CHANGE
|
||||
extern int openclFrontEnd(const char* cmdline, std::string*, std::string* typeInfo = NULL);
|
||||
|
||||
@@ -167,8 +176,9 @@ HSAILProgram::compileImpl_LC(const std::string& sourceCode,
|
||||
return false;
|
||||
}
|
||||
|
||||
driverOptions.append(" -Xclang -include-pch -Xclang " + pch->Name());
|
||||
driverOptions.append(" -include-pch " + pch->Name());
|
||||
driverOptions.append(" -Xclang -fno-validate-pch");
|
||||
driverOptions.append(" -isysroot " + llvmBin_ + "/../../include");
|
||||
|
||||
driverOptions.append(hsailOptions(options));
|
||||
if (clVer >= 200) {
|
||||
@@ -356,5 +366,45 @@ HSAILProgram::compileImpl(const std::string& sourceCode,
|
||||
return true;
|
||||
#endif // !defined(WITH_LIGHTNING_COMPILER)
|
||||
}
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
#if defined(ATI_OS_LINUX)
|
||||
static pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||
|
||||
static void
|
||||
checkLLVM_BIN()
|
||||
{
|
||||
if (llvmBin_.empty()) {
|
||||
Dl_info info;
|
||||
if (dladdr((const void*)&amd::Device::init, &info)) {
|
||||
llvmBin_ = dirname(strdup(info.dli_fname));
|
||||
size_t pos = llvmBin_.rfind("lib");
|
||||
if (pos != std::string::npos) {
|
||||
llvmBin_.replace(pos, 3, "bin");
|
||||
}
|
||||
}
|
||||
}
|
||||
#if defined(DEBUG)
|
||||
std::string clangExe(llvmBin_ + "/clang");
|
||||
struct stat buf;
|
||||
if (stat(clangExe.c_str(), &buf)) {
|
||||
std::string msg("Could not find the Clang binary in " + llvmBin_);
|
||||
LogWarning(msg.c_str());
|
||||
}
|
||||
#endif // defined(DEBUG)
|
||||
}
|
||||
#endif // defined(ATI_OS_LINUX)
|
||||
|
||||
std::auto_ptr<amd::opencl_driver::Compiler>
|
||||
HSAILProgram::newCompilerInstance()
|
||||
{
|
||||
#if defined(ATI_OS_LINUX)
|
||||
pthread_once(&once, checkLLVM_BIN);
|
||||
#endif // defined(ATI_OS_LINUX)
|
||||
return std::auto_ptr<amd::opencl_driver::Compiler>(
|
||||
amd::opencl_driver::CompilerFactory().CreateAMDGPUCompiler(llvmBin_));
|
||||
}
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
} // namespace roc
|
||||
#endif // WITHOUT_GPU_BACKEND
|
||||
|
||||
@@ -44,11 +44,6 @@
|
||||
#include <iostream>
|
||||
#include <istream>
|
||||
|
||||
#if defined(ATI_OS_LINUX)
|
||||
#include <dlfcn.h>
|
||||
#include <libgen.h>
|
||||
#endif // defined(ATI_OS_LINUX)
|
||||
|
||||
#endif // WITHOUT_HSA_BACKEND
|
||||
|
||||
namespace roc {
|
||||
@@ -1489,49 +1484,6 @@ namespace roc {
|
||||
}
|
||||
return hsailOptions;
|
||||
}
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
static std::string llvmBin_(amd::Os::getEnvironment("LLVM_BIN"));
|
||||
|
||||
#if defined(ATI_OS_LINUX)
|
||||
static pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||
|
||||
static void
|
||||
checkLLVM_BIN()
|
||||
{
|
||||
if (llvmBin_.empty()) {
|
||||
Dl_info info;
|
||||
if (dladdr((const void*)&amd::Device::init, &info)) {
|
||||
llvmBin_ = dirname(strdup(info.dli_fname));
|
||||
size_t pos = llvmBin_.rfind("lib");
|
||||
if (pos != std::string::npos) {
|
||||
llvmBin_.replace(pos, 3, "bin");
|
||||
}
|
||||
}
|
||||
}
|
||||
#if defined(DEBUG)
|
||||
std::string clangExe(llvmBin_ + "/clang");
|
||||
struct stat buf;
|
||||
if (stat(clangExe.c_str(), &buf)) {
|
||||
std::string msg("Could not find the Clang binary in " + llvmBin_);
|
||||
LogWarning(msg.c_str());
|
||||
}
|
||||
#endif // defined(DEBUG)
|
||||
}
|
||||
#endif // defined(ATI_OS_LINUX)
|
||||
|
||||
std::auto_ptr<amd::opencl_driver::Compiler>
|
||||
HSAILProgram::newCompilerInstance()
|
||||
{
|
||||
#if defined(ATI_OS_LINUX)
|
||||
pthread_once(&once, checkLLVM_BIN);
|
||||
#endif // defined(ATI_OS_LINUX)
|
||||
return std::auto_ptr<amd::opencl_driver::Compiler>(
|
||||
amd::opencl_driver::CompilerFactory().CreateAMDGPUCompiler(llvmBin_));
|
||||
}
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
#endif // WITHOUT_HSA_BACKEND
|
||||
} // namespace roc
|
||||
|
||||
|
||||
Viittaa uudesa ongelmassa
Block a user