P4 to Git Change 1725166 by gandryey@gera-w8 on 2019/01/02 15:41:59
SWDEV-79445 - OCL generic changes and code clean-up - Add dynamic switch between HSAIL and LC in ROCr path Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#108 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.cpp#48 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.hpp#26 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.cpp#95 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.hpp#42 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.cpp#71 edit
Šī revīzija ir iekļauta:
@@ -19,9 +19,9 @@
|
||||
#include "device/rocm/rocblit.hpp"
|
||||
#include "device/rocm/rocvirtual.hpp"
|
||||
#include "device/rocm/rocprogram.hpp"
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#include "driver/AmdCompiler.h"
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#include "device/rocm/rocmemory.hpp"
|
||||
#include "device/rocm/rocglinterop.hpp"
|
||||
#ifdef WITH_AMDGPU_PRO
|
||||
@@ -644,10 +644,11 @@ bool Device::create() {
|
||||
|
||||
const char* scheduler = nullptr;
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
std::string sch = SchedulerSourceCode;
|
||||
scheduler = sch.c_str();
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
if (settings().useLightning_) {
|
||||
std::string sch = SchedulerSourceCode;
|
||||
scheduler = sch.c_str();
|
||||
}
|
||||
// create compilation object with cache support
|
||||
int gfxipMajor = deviceInfo_.gfxipVersion_ / 100;
|
||||
int gfxipMinor = deviceInfo_.gfxipVersion_ / 10 % 10;
|
||||
@@ -744,22 +745,33 @@ bool Device::create() {
|
||||
}
|
||||
|
||||
device::Program* NullDevice::createProgram(amd::option::Options* options) {
|
||||
#if defined(WITH_COMPILER_LIB)
|
||||
return new roc::HSAILProgram(*this);
|
||||
#else // !defined(WITH_COMPILER_LIB)
|
||||
return NULL;
|
||||
#endif // !defined(WITH_COMPILER_LIB)
|
||||
device::Program* program;
|
||||
if (settings().useLightning_) {
|
||||
program = new LightningProgram(*this);
|
||||
} else {
|
||||
program = new HSAILProgram(*this);
|
||||
}
|
||||
|
||||
if (program == nullptr) {
|
||||
LogError("Memory allocation has failed!");
|
||||
}
|
||||
|
||||
return program;
|
||||
}
|
||||
|
||||
device::Program* Device::createProgram(amd::option::Options* options) {
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
if (!compilerHandle_ || !options->oVariables->Legacy) {
|
||||
return new roc::LightningProgram(*this);
|
||||
device::Program* program;
|
||||
if (settings().useLightning_) {
|
||||
program = new LightningProgram(*this);
|
||||
} else {
|
||||
program = new HSAILProgram(*this);
|
||||
}
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
#if defined(WITH_COMPILER_LIB)
|
||||
return new roc::HSAILProgram(*this);
|
||||
#endif // defined(WITH_COMPILER_LIB)
|
||||
|
||||
if (program == nullptr) {
|
||||
LogError("Memory allocation has failed!");
|
||||
}
|
||||
|
||||
return program;
|
||||
}
|
||||
|
||||
hsa_status_t Device::iterateGpuMemoryPoolCallback(hsa_amd_memory_pool_t pool, void* data) {
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
|
||||
#ifndef WITHOUT_HSA_BACKEND
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#include "driver/AmdCompiler.h"
|
||||
#include "llvm/Support/AMDGPUMetadata.h"
|
||||
|
||||
typedef llvm::AMDGPU::HSAMD::Metadata CodeObjectMD;
|
||||
typedef llvm::AMDGPU::HSAMD::Kernel::Metadata KernelMD;
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
|
||||
namespace roc {
|
||||
|
||||
@@ -31,7 +31,7 @@ Kernel::Kernel(std::string name, Program* prog, const uint64_t& kernelCodeHandle
|
||||
kernargSegmentByteSize_(kernargSegmentByteSize),
|
||||
kernargSegmentAlignment_(kernargSegmentAlignment) {}
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#if defined(USE_COMGR_LIBRARY)
|
||||
bool LightningKernel::init() {
|
||||
|
||||
@@ -261,7 +261,7 @@ bool LightningKernel::init() {
|
||||
return true;
|
||||
}
|
||||
#endif // defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
|
||||
#if defined(WITH_COMPILER_LIB)
|
||||
bool HSAILKernel::init() {
|
||||
|
||||
@@ -49,7 +49,6 @@ class Kernel : public device::Kernel {
|
||||
size_t kernelDirectiveOffset_;
|
||||
};
|
||||
|
||||
#if defined(WITH_COMPILER_LIB)
|
||||
class HSAILKernel : public roc::Kernel {
|
||||
public:
|
||||
HSAILKernel(std::string name, Program* prog, const uint64_t& kernelCodeHandle,
|
||||
@@ -64,9 +63,7 @@ class HSAILKernel : public roc::Kernel {
|
||||
//! Initializes the metadata required for this kernel
|
||||
virtual bool init() final;
|
||||
};
|
||||
#endif // defined(WITH_COMPILER_LIB)
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
class LightningKernel : public roc::Kernel {
|
||||
public:
|
||||
LightningKernel(std::string name, Program* prog, const uint64_t& kernelCodeHandle,
|
||||
@@ -80,7 +77,6 @@ class LightningKernel : public roc::Kernel {
|
||||
//! Initializes the metadata required for this kernel
|
||||
virtual bool init() final;
|
||||
};
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
} // namespace roc
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
|
||||
#include "utils/options.hpp"
|
||||
#include "rockernel.hpp"
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
#include <gelf.h>
|
||||
#include "driver/AmdCompiler.h"
|
||||
#include "libraries.amdgcn.inc"
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
|
||||
#include "utils/bif_section_labels.hpp"
|
||||
#include "amd_hsa_kernel_code.h"
|
||||
@@ -313,7 +313,7 @@ bool HSAILProgram::setKernels(amd::option::Options* options, void* binary, size_
|
||||
}
|
||||
#endif // defined(WITH_COMPILER_LIB)
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
LightningProgram::LightningProgram(roc::NullDevice& device)
|
||||
: roc::Program(device) {
|
||||
isLC_ = true;
|
||||
@@ -491,7 +491,7 @@ bool LightningProgram::setKernels(amd::option::Options* options, void* binary, s
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
|
||||
} // namespace roc
|
||||
|
||||
|
||||
@@ -62,7 +62,6 @@ protected:
|
||||
hsa_code_object_reader_t hsaCodeObjectReader_; //!< Handle to HSA code reader
|
||||
};
|
||||
|
||||
#if defined(WITH_COMPILER_LIB)
|
||||
class HSAILProgram : public roc::Program {
|
||||
public:
|
||||
HSAILProgram(roc::NullDevice& device);
|
||||
@@ -78,9 +77,7 @@ private:
|
||||
|
||||
bool saveBinaryAndSetType(type_t type);
|
||||
};
|
||||
#endif // defined(WITH_COMPILER_LIB)
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
class LightningProgram : public roc::Program {
|
||||
public:
|
||||
LightningProgram(roc::NullDevice& device);
|
||||
@@ -96,7 +93,6 @@ private:
|
||||
|
||||
virtual bool setKernels(amd::option::Options* options, void* binary, size_t binSize) override;
|
||||
};
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
/*@}*/} // namespace roc
|
||||
|
||||
|
||||
@@ -347,9 +347,9 @@ bool VirtualGPU::processMemObjects(const amd::Kernel& kernel, const_address para
|
||||
"Unsupported address qualifier");
|
||||
|
||||
const bool readOnly =
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
desc.typeQualifier_ == CL_KERNEL_ARG_TYPE_CONST ||
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
(mem->getMemFlags() & CL_MEM_READ_ONLY) != 0;
|
||||
|
||||
if (!readOnly) {
|
||||
|
||||
Atsaukties uz šo jaunā problēmā
Block a user