P4 to Git Change 1717849 by gandryey@gera-w8 on 2018/12/07 18:26:42
SWDEV-162389 - Back out changelist 1717839 due to a weird link error in LiquidFlash for LC Windows build only Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#237 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#326 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/devkernel.cpp#13 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/devkernel.hpp#9 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/devprogram.cpp#18 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/devprogram.hpp#11 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuresource.cpp#248 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#117 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palkernel.cpp#73 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprogram.cpp#84 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palsettings.cpp#62 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/program.cpp#100 edit
This commit is contained in:
@@ -397,7 +397,7 @@ char* Device::getExtensionString() {
|
||||
return result;
|
||||
}
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
CacheCompilation::CacheCompilation(std::string targetStr, std::string postfix, bool enableCache,
|
||||
bool resetCache)
|
||||
: codeCache_(targetStr, 0, AMD_PLATFORM_BUILD_NUMBER, postfix),
|
||||
@@ -482,13 +482,11 @@ bool CacheCompilation::compileToLLVMBitcode(amd::opencl_driver::Compiler* C,
|
||||
StringCache::CachedData cachedData = {bc->Ptr(), bc->Size()};
|
||||
bcSet.push_back(cachedData);
|
||||
} else if (input->Type() == DT_CL_HEADER) {
|
||||
#if !defined(USE_COMGR_LIBRARY)
|
||||
FileReference* bcFile = reinterpret_cast<FileReference*>(input);
|
||||
std::string bc;
|
||||
bcFile->ReadToString(bc);
|
||||
StringCache::CachedData cachedData = {bc.c_str(), bc.size()};
|
||||
bcSet.push_back(cachedData);
|
||||
#endif // !defined(USE_COMGR_LIBRARY)
|
||||
} else {
|
||||
buildLog += "Error: unsupported bitcode type for checking cache.\n";
|
||||
checkCache = false;
|
||||
@@ -566,7 +564,7 @@ bool CacheCompilation::compileAndLinkExecutable(amd::opencl_driver::Compiler* C,
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
} // namespace amd
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
#include "devkernel.hpp"
|
||||
#include "amdocl/cl_profile_amd.h"
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
#include "caching/cache.hpp"
|
||||
#include "driver/AmdCompiler.h"
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
#include "acl.h"
|
||||
|
||||
#include "hwdebug.hpp"
|
||||
@@ -1308,7 +1308,7 @@ class Device : public RuntimeObject {
|
||||
// P2P devices that are accessible from the current device
|
||||
std::vector<cl_device_id> p2pDevices_;
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
amd::CacheCompilation* cacheCompilation() const { return cacheCompilation_.get(); }
|
||||
#endif
|
||||
|
||||
@@ -1322,7 +1322,7 @@ class Device : public RuntimeObject {
|
||||
BlitProgram* blitProgram_; //!< Blit program info
|
||||
static AppProfile appProfile_; //!< application profile
|
||||
HwDebugManager* hwDebugMgr_; //!< Hardware Debug manager
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
//! Compilation with cache support
|
||||
std::unique_ptr<amd::CacheCompilation> cacheCompilation_;
|
||||
#endif
|
||||
@@ -1340,7 +1340,7 @@ class Device : public RuntimeObject {
|
||||
std::map<uintptr_t, device::Memory*>* vaCacheMap_; //!< VA cache map
|
||||
};
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
//! Compilation process with cache support.
|
||||
class CacheCompilation : public amd::HeapObject {
|
||||
public:
|
||||
@@ -1377,7 +1377,7 @@ class CacheCompilation : public amd::HeapObject {
|
||||
StringCache codeCache_; //! Cached codes
|
||||
const bool isCodeCacheEnabled_; //! Code cache enable
|
||||
};
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
/*! @}
|
||||
* @}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "acl.h"
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
#include "llvm/Support/AMDGPUMetadata.h"
|
||||
|
||||
typedef llvm::AMDGPU::HSAMD::Kernel::Arg::Metadata KernelArgMD;
|
||||
@@ -25,7 +25,7 @@ using llvm::AMDGPU::HSAMD::AccessQualifier;
|
||||
using llvm::AMDGPU::HSAMD::AddressSpaceQualifier;
|
||||
using llvm::AMDGPU::HSAMD::ValueKind;
|
||||
using llvm::AMDGPU::HSAMD::ValueType;
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
namespace device {
|
||||
|
||||
@@ -228,7 +228,7 @@ void Kernel::FindLocalWorkSize(size_t workDim, const amd::NDRange& gblWorkSize,
|
||||
}
|
||||
}
|
||||
// ================================================================================================
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
static inline uint32_t GetOclArgumentTypeOCL(const KernelArgMD& lcArg, bool* isHidden) {
|
||||
switch (lcArg.mValueKind) {
|
||||
case ValueKind::GlobalBuffer:
|
||||
@@ -324,7 +324,7 @@ static const clk_value_type_t ClkValueMapType[6][6] = {
|
||||
};
|
||||
|
||||
// ================================================================================================
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
static inline clk_value_type_t GetOclTypeOCL(const KernelArgMD& lcArg, size_t size = 0) {
|
||||
uint sizeType;
|
||||
uint numElements;
|
||||
@@ -481,7 +481,7 @@ static inline clk_value_type_t GetOclTypeOCL(const aclArgData* argInfo, size_t s
|
||||
#endif
|
||||
|
||||
// ================================================================================================
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
static inline size_t GetArgAlignmentOCL(const KernelArgMD& lcArg) { return lcArg.mAlign; }
|
||||
#endif
|
||||
|
||||
@@ -525,7 +525,7 @@ static inline size_t GetArgAlignmentOCL(const aclArgData* argInfo) {
|
||||
#endif
|
||||
|
||||
// ================================================================================================
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
static inline size_t GetArgPointeeAlignmentOCL(const KernelArgMD& lcArg) {
|
||||
if (lcArg.mValueKind == ValueKind::DynamicSharedPointer) {
|
||||
uint32_t align = lcArg.mPointeeAlign;
|
||||
@@ -550,7 +550,7 @@ static inline size_t GetArgPointeeAlignmentOCL(const aclArgData* argInfo) {
|
||||
#endif
|
||||
|
||||
// ================================================================================================
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
static inline bool GetReadOnlyOCL(const KernelArgMD& lcArg) {
|
||||
if ((lcArg.mValueKind == ValueKind::GlobalBuffer) || (lcArg.mValueKind == ValueKind::Image)) {
|
||||
switch (lcArg.mAccQual) {
|
||||
@@ -580,7 +580,7 @@ static inline bool GetReadOnlyOCL(const aclArgData* argInfo) {
|
||||
#endif
|
||||
|
||||
// ================================================================================================
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
static inline int GetArgSizeOCL(const KernelArgMD& lcArg) { return lcArg.mSize; }
|
||||
#endif
|
||||
|
||||
@@ -623,7 +623,7 @@ inline static int GetArgSizeOCL(const aclArgData* argInfo) {
|
||||
#endif
|
||||
|
||||
// ================================================================================================
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
static inline cl_kernel_arg_address_qualifier GetOclAddrQualOCL(const KernelArgMD& lcArg) {
|
||||
if (lcArg.mValueKind == ValueKind::DynamicSharedPointer) {
|
||||
return CL_KERNEL_ARG_ADDRESS_LOCAL;
|
||||
@@ -679,7 +679,7 @@ static inline cl_kernel_arg_address_qualifier GetOclAddrQualOCL(const aclArgData
|
||||
#endif
|
||||
|
||||
// ================================================================================================
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
static inline cl_kernel_arg_access_qualifier GetOclAccessQualOCL(const KernelArgMD& lcArg) {
|
||||
if (lcArg.mValueKind == ValueKind::Image) {
|
||||
switch (lcArg.mAccQual) {
|
||||
@@ -714,7 +714,7 @@ static inline cl_kernel_arg_access_qualifier GetOclAccessQualOCL(const aclArgDat
|
||||
#endif
|
||||
|
||||
// ================================================================================================
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
static inline cl_kernel_arg_type_qualifier GetOclTypeQualOCL(const KernelArgMD& lcArg) {
|
||||
cl_kernel_arg_type_qualifier rv = CL_KERNEL_ARG_TYPE_NONE;
|
||||
if (lcArg.mValueKind == ValueKind::GlobalBuffer ||
|
||||
@@ -769,7 +769,7 @@ static inline cl_kernel_arg_type_qualifier GetOclTypeQualOCL(const aclArgData* a
|
||||
#endif
|
||||
|
||||
// ================================================================================================
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
#if defined(USE_COMGR_LIBRARY)
|
||||
bool Kernel::GetAttrCodePropMetadata(const amd_comgr_metadata_node_t programMD,
|
||||
const uint32_t kernargSegmentByteSize,
|
||||
@@ -1133,7 +1133,7 @@ void Kernel::InitParameters(const KernelMD& kernelMD, uint32_t argBufferSize) {
|
||||
createSignature(params, numParams, amd::KernelSignature::ABIVersion_1);
|
||||
}
|
||||
#endif // defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
// ================================================================================================
|
||||
#if defined(WITH_COMPILER_LIB)
|
||||
@@ -1217,7 +1217,7 @@ void Kernel::InitParameters(const aclArgData* aclArg, uint32_t argBufferSize) {
|
||||
#endif
|
||||
|
||||
// ================================================================================================
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
void Kernel::InitPrintf(const std::vector<std::string>& printfInfoStrings) {
|
||||
for (auto str : printfInfoStrings) {
|
||||
std::vector<std::string> tokens;
|
||||
@@ -1307,7 +1307,7 @@ void Kernel::InitPrintf(const std::vector<std::string>& printfInfoStrings) {
|
||||
// ]
|
||||
}
|
||||
}
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
// ================================================================================================
|
||||
#if defined(WITH_COMPILER_LIB)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "platform/memory.hpp"
|
||||
#include "devwavelimiter.hpp"
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
namespace llvm {
|
||||
namespace AMDGPU {
|
||||
namespace HSAMD {
|
||||
@@ -168,7 +168,7 @@ static const std::map<std::string,CodePropField> CodePropFieldMap =
|
||||
{"NumSpilledVGPRs", CodePropField::NumSpilledVGPRs}
|
||||
};
|
||||
#endif // defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
namespace amd {
|
||||
namespace hsa {
|
||||
@@ -370,7 +370,7 @@ class Kernel : public amd::HeapObject {
|
||||
|
||||
protected:
|
||||
//! Initializes the abstraction layer kernel parameters
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
#if defined(USE_COMGR_LIBRARY)
|
||||
void InitParameters(const amd_comgr_metadata_node_t kernelMD, uint32_t argBufferSize);
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
#include "utils/bif_section_labels.hpp"
|
||||
#include "utils/libUtils.h"
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
#include "driver/AmdCompiler.h"
|
||||
#include "libraries.amdgcn.inc"
|
||||
#include "opencl1.2-c.amdgcn.inc"
|
||||
#include "opencl2.0-c.amdgcn.inc"
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
#include <cstdio>
|
||||
#include <fstream>
|
||||
@@ -34,11 +34,11 @@
|
||||
#include "spirv/spirvUtils.h"
|
||||
#include "acl.h"
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
#include "llvm/Support/AMDGPUMetadata.h"
|
||||
|
||||
typedef llvm::AMDGPU::HSAMD::Kernel::Arg::Metadata KernelArgMD;
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
namespace device {
|
||||
|
||||
@@ -96,7 +96,7 @@ bool Program::compileImpl(const std::string& sourceCode,
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
static std::string llvmBin_(amd::Os::getEnvironment("LLVM_BIN"));
|
||||
|
||||
#if defined(ATI_OS_WIN)
|
||||
@@ -173,14 +173,10 @@ std::unique_ptr<amd::opencl_driver::Compiler> Program::newCompilerInstance() {
|
||||
}
|
||||
#endif // defined(DEBUG)
|
||||
|
||||
#if !defined(USE_COMGR_LIBRARY)
|
||||
return std::unique_ptr<amd::opencl_driver::Compiler>(
|
||||
amd::opencl_driver::CompilerFactory().CreateAMDGPUCompiler(llvmBin_));
|
||||
#else
|
||||
return nullptr;
|
||||
#endif // !defined(USE_COMGR_LIBRARY)
|
||||
}
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
// ================================================================================================
|
||||
|
||||
@@ -610,7 +606,7 @@ bool Program::compileImplLC(const std::string& sourceCode,
|
||||
bool Program::compileImplLC(const std::string& sourceCode,
|
||||
const std::vector<const std::string*>& headers,
|
||||
const char** headerIncludeNames, amd::option::Options* options) {
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
const char* xLang = options->oVariables->XLang;
|
||||
if (xLang != nullptr) {
|
||||
if (strcmp(xLang, "asm") == 0) {
|
||||
@@ -802,7 +798,7 @@ bool Program::compileImplLC(const std::string& sourceCode,
|
||||
// store the original compile options
|
||||
clBinary()->storeCompileOptions(compileOptions_);
|
||||
}
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
return true;
|
||||
}
|
||||
#endif // defined(USE_COMGR_LIBRARY)
|
||||
@@ -1029,7 +1025,7 @@ bool Program::linkImplLC(const std::vector<Program*>& inputPrograms,
|
||||
#else // not using COMgr
|
||||
bool Program::linkImplLC(const std::vector<Program*>& inputPrograms,
|
||||
amd::option::Options* options, bool createLibrary) {
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
using namespace amd::opencl_driver;
|
||||
std::unique_ptr<Compiler> C(newCompilerInstance());
|
||||
|
||||
@@ -1118,7 +1114,7 @@ bool Program::linkImplLC(const std::vector<Program*>& inputPrograms,
|
||||
return linkImpl(options);
|
||||
#else
|
||||
return false;
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
}
|
||||
#endif // defined(USE_COMGR_LIBRARY)
|
||||
|
||||
@@ -1369,7 +1365,7 @@ bool Program::linkImplLC(amd::option::Options* options) {
|
||||
}
|
||||
#else // not using COMgr
|
||||
bool Program::linkImplLC(amd::option::Options* options) {
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
using namespace amd::opencl_driver;
|
||||
internal_ = (compileOptions_.find("-cl-internal-kernel") != std::string::npos) ?
|
||||
true : false;
|
||||
@@ -1601,7 +1597,7 @@ bool Program::linkImplLC(amd::option::Options* options) {
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
}
|
||||
#endif // defined(USE_COMGR_LIBRARY)
|
||||
|
||||
@@ -2055,34 +2051,36 @@ cl_int Program::build(const std::string& sourceCode, const char* origOptions,
|
||||
std::string Program::ProcessOptions(amd::option::Options* options) {
|
||||
std::string optionsStr;
|
||||
|
||||
if (!isLC()) {
|
||||
optionsStr.append(" -D__AMD__=1");
|
||||
#ifndef WITH_LIGHTNING_COMPILER
|
||||
optionsStr.append(" -D__AMD__=1");
|
||||
|
||||
optionsStr.append(" -D__").append(machineTarget_).append("__=1");
|
||||
optionsStr.append(" -D__").append(machineTarget_).append("=1");
|
||||
} else {
|
||||
int major, minor;
|
||||
::sscanf(device().info().version_, "OpenCL %d.%d ", &major, &minor);
|
||||
optionsStr.append(" -D__").append(machineTarget_).append("__=1");
|
||||
optionsStr.append(" -D__").append(machineTarget_).append("=1");
|
||||
#endif
|
||||
|
||||
std::stringstream ss;
|
||||
ss << " -D__OPENCL_VERSION__=" << (major * 100 + minor * 10);
|
||||
optionsStr.append(ss.str());
|
||||
}
|
||||
#ifdef WITH_LIGHTNING_COMPILER
|
||||
int major, minor;
|
||||
::sscanf(device().info().version_, "OpenCL %d.%d ", &major, &minor);
|
||||
|
||||
std::stringstream ss;
|
||||
ss << " -D__OPENCL_VERSION__=" << (major * 100 + minor * 10);
|
||||
optionsStr.append(ss.str());
|
||||
#endif
|
||||
|
||||
if (device().info().imageSupport_ && options->oVariables->ImageSupport) {
|
||||
optionsStr.append(" -D__IMAGE_SUPPORT__=1");
|
||||
}
|
||||
|
||||
if (!isLC()) {
|
||||
// Set options for the standard device specific options
|
||||
// All our devices support these options now
|
||||
if (device().settings().reportFMAF_) {
|
||||
optionsStr.append(" -DFP_FAST_FMAF=1");
|
||||
}
|
||||
if (device().settings().reportFMA_) {
|
||||
optionsStr.append(" -DFP_FAST_FMA=1");
|
||||
}
|
||||
#ifndef WITH_LIGHTNING_COMPILER
|
||||
// Set options for the standard device specific options
|
||||
// All our devices support these options now
|
||||
if (device().settings().reportFMAF_) {
|
||||
optionsStr.append(" -DFP_FAST_FMAF=1");
|
||||
}
|
||||
if (device().settings().reportFMA_) {
|
||||
optionsStr.append(" -DFP_FAST_FMA=1");
|
||||
}
|
||||
#endif
|
||||
|
||||
uint clcStd =
|
||||
(options->oVariables->CLStd[2] - '0') * 100 + (options->oVariables->CLStd[4] - '0') * 10;
|
||||
@@ -2109,7 +2107,7 @@ std::string Program::ProcessOptions(amd::option::Options* options) {
|
||||
std::istream_iterator<std::string> sit(istrstr), end;
|
||||
std::vector<std::string> extensions(sit, end);
|
||||
|
||||
if (isLC()) {
|
||||
if (IS_LIGHTNING && !options->oVariables->Legacy) {
|
||||
// FIXME_lmoriche: opencl-c.h defines 'cl_khr_depth_images', so
|
||||
// remove it from the command line. Should we fix opencl-c.h?
|
||||
auto found = std::find(extensions.begin(), extensions.end(), "cl_khr_depth_images");
|
||||
@@ -2358,7 +2356,7 @@ aclType Program::getCompilationStagesFromBinary(std::vector<aclType>& completeSt
|
||||
bool& needOptionsCheck) {
|
||||
aclType from = ACL_TYPE_DEFAULT;
|
||||
if (isLC()) {
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
completeStages.clear();
|
||||
needOptionsCheck = true;
|
||||
//! @todo Should we also check for ACL_TYPE_OPENCL & ACL_TYPE_LLVMIR_TEXT?
|
||||
@@ -2396,7 +2394,7 @@ aclType Program::getCompilationStagesFromBinary(std::vector<aclType>& completeSt
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
} else {
|
||||
#if defined(WITH_COMPILER_LIB)
|
||||
acl_error errorCode;
|
||||
@@ -2640,7 +2638,7 @@ aclType Program::getNextCompilationStageFromBinary(amd::option::Options* options
|
||||
|
||||
// ================================================================================================
|
||||
bool Program::FindGlobalVarSize(void* binary, size_t binSize) {
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
size_t progvarsTotalSize = 0;
|
||||
size_t dynamicSize = 0;
|
||||
size_t progvarsWriteSize = 0;
|
||||
@@ -2747,7 +2745,7 @@ bool Program::FindGlobalVarSize(void* binary, size_t binSize) {
|
||||
if (progvarsWriteSize != dynamicSize) {
|
||||
hasGlobalStores_ = true;
|
||||
}
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "amd_comgr.h"
|
||||
#endif
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
#include "driver/AmdCompiler.h"
|
||||
//#include "llvm/Support/AMDGPUMetadata.h"
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace llvm {
|
||||
typedef llvm::AMDGPU::HSAMD::Metadata CodeObjectMD;
|
||||
typedef llvm::AMDGPU::HSAMD::Kernel::Metadata KernelMD;
|
||||
//typedef llvm::AMDGPU::HSAMD::Kernel::Arg::Metadata KernelArgMD;
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
#ifndef LC_METADATA
|
||||
typedef char CodeObjectMD;
|
||||
@@ -264,10 +264,10 @@ class Program : public amd::HeapObject {
|
||||
|
||||
void setType(type_t newType) { type_ = newType; }
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
//! Return a new transient compiler instance.
|
||||
static std::unique_ptr<amd::opencl_driver::Compiler> newCompilerInstance();
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
/* \brief Returns the next stage to compile from, based on sections in binary,
|
||||
* also returns completeStages in a vector, which contains at least ACL_TYPE_DEFAULT,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright (c) 2008 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
#include "device/device.hpp"
|
||||
|
||||
#if defined(ATI_OS_WIN)
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
@@ -9,7 +8,10 @@
|
||||
#include <GL/gl.h>
|
||||
#include "GL/glATIInternal.h"
|
||||
|
||||
#include "platform/program.hpp"
|
||||
#include "platform/kernel.hpp"
|
||||
#include "os/os.hpp"
|
||||
#include "device/device.hpp"
|
||||
#include "utils/flags.hpp"
|
||||
#include "thread/monitor.hpp"
|
||||
#include "device/gpu/gpuresource.hpp"
|
||||
|
||||
@@ -116,7 +116,7 @@ bool NullDevice::init() {
|
||||
id < sizeof(Gfx9PlusSubDeviceInfo)/sizeof(AMDDeviceInfo); ++id) {
|
||||
bool foundActive = false;
|
||||
bool foundDuplicate = false;
|
||||
uint gfxipVersion = GPU_ENABLE_LC ? pal::Gfx9PlusSubDeviceInfo[id].gfxipVersionLC_ :
|
||||
uint gfxipVersion = IS_LIGHTNING ? pal::Gfx9PlusSubDeviceInfo[id].gfxipVersionLC_ :
|
||||
pal::Gfx9PlusSubDeviceInfo[id].gfxipVersion_;
|
||||
|
||||
if (pal::Gfx9PlusSubDeviceInfo[id].targetName_[0] == '\0') {
|
||||
@@ -127,7 +127,7 @@ bool NullDevice::init() {
|
||||
for (uint i = 0; i < devices.size(); ++i) {
|
||||
driverVersion = static_cast<amd::Device*>(devices[i])->info().driverVersion_;
|
||||
if (driverVersion.find("PAL") != std::string::npos) {
|
||||
uint gfxIpCurrent = GPU_ENABLE_LC ?
|
||||
uint gfxIpCurrent = IS_LIGHTNING ?
|
||||
static_cast<NullDevice*>(devices[i])->hwInfo()->gfxipVersionLC_ :
|
||||
static_cast<NullDevice*>(devices[i])->hwInfo()->gfxipVersion_;
|
||||
if (gfxIpCurrent == gfxipVersion) {
|
||||
@@ -272,7 +272,7 @@ bool NullDevice::create(Pal::AsicRevision asicRevision, Pal::GfxIpLevel ipLevel,
|
||||
info_.wavefrontWidth_ = (ipLevel >= Pal::GfxIpLevel::GfxIp10) ? 32 : 64;
|
||||
|
||||
if (settings().useLightning_) {
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
// create compilation object with cache support
|
||||
int gfxipMajor = hwInfo_->gfxipVersionLC_ / 100;
|
||||
int gfxipMinor = hwInfo_->gfxipVersionLC_ / 10 % 10;
|
||||
@@ -516,7 +516,7 @@ void NullDevice::fillDeviceInfo(const Pal::DeviceProperties& palProp,
|
||||
const static char* bristol = "Bristol Ridge";
|
||||
::strcpy(info_.name_, bristol);
|
||||
} else {
|
||||
if (GPU_ENABLE_LC && hwInfo()->xnackEnabled_) {
|
||||
if (IS_LIGHTNING && hwInfo()->xnackEnabled_) {
|
||||
::snprintf(info_.name_, sizeof(info_.name_) - 1, "%s-xnack", hwInfo()->targetName_);
|
||||
} else {
|
||||
::strcpy(info_.name_, hwInfo()->targetName_);
|
||||
@@ -610,7 +610,7 @@ void NullDevice::fillDeviceInfo(const Pal::DeviceProperties& palProp,
|
||||
info_.globalMemChannelBankWidth_ = hwInfo()->memChannelBankWidth_;
|
||||
info_.localMemSizePerCU_ = hwInfo()->localMemSizePerCU_;
|
||||
info_.localMemBanks_ = hwInfo()->localMemBanks_;
|
||||
info_.gfxipVersion_ = GPU_ENABLE_LC ? hwInfo()->gfxipVersionLC_ : hwInfo()->gfxipVersion_;
|
||||
info_.gfxipVersion_ = IS_LIGHTNING ? hwInfo()->gfxipVersionLC_ : hwInfo()->gfxipVersion_;
|
||||
|
||||
info_.timeStampFrequency_ = 1000000;
|
||||
info_.numAsyncQueues_ = numComputeRings;
|
||||
@@ -936,7 +936,7 @@ bool Device::create(Pal::IDevice* device) {
|
||||
}
|
||||
|
||||
if (settings().useLightning_) {
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
// create compilation object with cache support
|
||||
int gfxipMajor = hwInfo()->gfxipVersionLC_ / 100;
|
||||
int gfxipMinor = hwInfo()->gfxipVersionLC_ / 10 % 10;
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
#include "utils/options.hpp"
|
||||
#include "acl.h"
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
#include "llvm/Support/AMDGPUMetadata.h"
|
||||
|
||||
typedef llvm::AMDGPU::HSAMD::Kernel::Metadata KernelMD;
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
@@ -377,7 +377,7 @@ const LightningProgram& LightningKernel::prog() const {
|
||||
return reinterpret_cast<const LightningProgram&>(prog_);
|
||||
}
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
static const KernelMD* FindKernelMetadata(const CodeObjectMD* programMD, const std::string& name) {
|
||||
for (const KernelMD& kernelMD : programMD->mKernels) {
|
||||
if (kernelMD.mName == name) {
|
||||
@@ -386,10 +386,10 @@ static const KernelMD* FindKernelMetadata(const CodeObjectMD* programMD, const s
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
bool LightningKernel::init(amd::hsa::loader::Symbol* symbol) {
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
flags_.internalKernel_ =
|
||||
(compileOptions_.find("-cl-internal-kernel") != std::string::npos) ? true : false;
|
||||
|
||||
@@ -519,7 +519,7 @@ bool LightningKernel::init(amd::hsa::loader::Symbol* symbol) {
|
||||
waveLimiter_.enable();
|
||||
*/
|
||||
#endif // defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
#include "hsa.h"
|
||||
#include "hsa_ext_image.h"
|
||||
#include "amd_hsa_loader.hpp"
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
#include "llvm/Support/AMDGPUMetadata.h"
|
||||
#include "driver/AmdCompiler.h"
|
||||
#include "libraries.amdgcn.inc"
|
||||
#include "gelf.h"
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
namespace pal {
|
||||
|
||||
@@ -375,7 +375,7 @@ hsa_isa_t PALHSALoaderContext::IsaFromName(const char* name) {
|
||||
}
|
||||
|
||||
bool PALHSALoaderContext::IsaSupportedByAgent(hsa_agent_t agent, hsa_isa_t isa) {
|
||||
uint32_t gfxipVersion = GPU_ENABLE_LC ?
|
||||
uint32_t gfxipVersion = IS_LIGHTNING ?
|
||||
program_->dev().hwInfo()->gfxipVersionLC_ :
|
||||
program_->dev().hwInfo()->gfxipVersion_;
|
||||
uint32_t majorSrc = gfxipVersion / 10;
|
||||
@@ -546,7 +546,7 @@ hsa_status_t PALHSALoaderContext::SamplerDestroy(hsa_agent_t agent,
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
static hsa_status_t GetKernelNamesCallback(hsa_executable_t hExec, hsa_executable_symbol_t hSymbol,
|
||||
void* data) {
|
||||
@@ -575,20 +575,20 @@ static hsa_status_t GetKernelNamesCallback(hsa_executable_t hExec, hsa_executabl
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
bool LightningProgram::createBinary(amd::option::Options* options) {
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
if (!clBinary()->createElfBinary(options->oVariables->BinEncrypt, type())) {
|
||||
LogError("Failed to create ELF binary image!");
|
||||
return false;
|
||||
}
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LightningProgram::setKernels(amd::option::Options* options, void* binary, size_t binSize) {
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
hsa_agent_t agent;
|
||||
agent.handle = 1;
|
||||
|
||||
@@ -654,7 +654,7 @@ bool LightningProgram::setKernels(amd::option::Options* options, void* binary, s
|
||||
}
|
||||
|
||||
DestroySegmentCpuAccess();
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -439,7 +439,7 @@ bool Settings::create(const Pal::DeviceProperties& palProp,
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
switch (palProp.gfxLevel) {
|
||||
case Pal::GfxIpLevel::GfxIp10_1:
|
||||
case Pal::GfxIpLevel::GfxIp10:
|
||||
|
||||
@@ -118,7 +118,7 @@ cl_int Program::addDeviceProgram(Device& device, const void* image, size_t lengt
|
||||
return CL_INVALID_COMPILER_OPTIONS;
|
||||
}
|
||||
}
|
||||
options->oVariables->Legacy = !GPU_ENABLE_LC ?
|
||||
options->oVariables->Legacy = !IS_LIGHTNING ?
|
||||
isAMDILTarget(*aclutGetTargetInfo(binary)) :
|
||||
isHSAILTarget(*aclutGetTargetInfo(binary));
|
||||
aclBinaryFini(binary);
|
||||
|
||||
Reference in New Issue
Block a user