P4 to Git Change 1725283 by gandryey@gera-lnx-rcf on 2019/01/02 19:03:17
SWDEV-79445 - OCL generic changes and code clean-up
- Keep the body of all methods in the Program interface
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.cpp#97 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.hpp#44 edit
[ROCm/clr commit: 9b98cc97e6]
This commit is contained in:
@@ -111,13 +111,14 @@ bool Program::initClBinary(char* binaryIn, size_t size) {
|
||||
return clBinary()->setBinary(bin, sz, (decryptedBin != nullptr));
|
||||
}
|
||||
|
||||
#if defined(WITH_COMPILER_LIB)
|
||||
HSAILProgram::HSAILProgram(roc::NullDevice& device) : roc::Program(device) {
|
||||
xnackEnabled_ = dev().deviceInfo().xnackEnabled_;
|
||||
machineTarget_ = dev().deviceInfo().complibTarget_;
|
||||
}
|
||||
|
||||
|
||||
HSAILProgram::~HSAILProgram() {
|
||||
#if defined(WITH_COMPILER_LIB)
|
||||
acl_error error;
|
||||
// Free the elf binary
|
||||
if (binaryElf_ != nullptr) {
|
||||
@@ -126,13 +127,11 @@ HSAILProgram::~HSAILProgram() {
|
||||
LogWarning("Error while destroying the acl binary \n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool HSAILProgram::createBinary(amd::option::Options* options) {
|
||||
return true;
|
||||
#endif // defined(WITH_COMPILER_LIB)
|
||||
}
|
||||
|
||||
bool HSAILProgram::saveBinaryAndSetType(type_t type) {
|
||||
#if defined(WITH_COMPILER_LIB)
|
||||
void* rawBinary;
|
||||
size_t size;
|
||||
|
||||
@@ -147,10 +146,12 @@ bool HSAILProgram::saveBinaryAndSetType(type_t type) {
|
||||
|
||||
// Free memory containing rawBinary
|
||||
binaryElf_->binOpts.dealloc(rawBinary);
|
||||
#endif // defined(WITH_COMPILER_LIB)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HSAILProgram::setKernels(amd::option::Options* options, void* binary, size_t binSize) {
|
||||
#if defined(WITH_COMPILER_LIB)
|
||||
// Stop compilation if it is an offline device - HSA runtime does not
|
||||
// support ISA compiled offline
|
||||
if (!dev().isOnline()) {
|
||||
@@ -309,20 +310,30 @@ bool HSAILProgram::setKernels(amd::option::Options* options, void* binary, size_
|
||||
std::string::npos);
|
||||
kernels()[kernelName] = aKernel;
|
||||
}
|
||||
#endif // defined(WITH_COMPILER_LIB)
|
||||
return true;
|
||||
}
|
||||
#endif // defined(WITH_COMPILER_LIB)
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
|
||||
LightningProgram::LightningProgram(roc::NullDevice& device)
|
||||
: roc::Program(device) {
|
||||
isLC_ = true;
|
||||
xnackEnabled_ = dev().deviceInfo().xnackEnabled_;
|
||||
machineTarget_ = dev().deviceInfo().machineTargetLC_;
|
||||
}
|
||||
|
||||
bool LightningProgram::createBinary(amd::option::Options* options) {
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
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)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LightningProgram::saveBinaryAndSetType(type_t type, void* rawBinary, size_t size) {
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
// Write binary to memory
|
||||
if (type == TYPE_EXECUTABLE) { // handle code object binary
|
||||
assert(rawBinary != nullptr && size != 0 && "must pass in the binary");
|
||||
@@ -339,10 +350,12 @@ bool LightningProgram::saveBinaryAndSetType(type_t type, void* rawBinary, size_t
|
||||
|
||||
// Set the type of binary
|
||||
setType(type);
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LightningProgram::setKernels(amd::option::Options* options, void* binary, size_t binSize) {
|
||||
#if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
// Find the size of global variables from the binary
|
||||
if (!FindGlobalVarSize(binary, binSize)) {
|
||||
return false;
|
||||
@@ -481,10 +494,9 @@ bool LightningProgram::setKernels(amd::option::Options* options, void* binary, s
|
||||
std::string::npos);
|
||||
kernels()[kernelName] = aKernel;
|
||||
}
|
||||
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
return true;
|
||||
}
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
|
||||
} // namespace roc
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class HSAILProgram : public roc::Program {
|
||||
virtual ~HSAILProgram();
|
||||
|
||||
protected:
|
||||
virtual bool createBinary(amd::option::Options* options) final;
|
||||
virtual bool createBinary(amd::option::Options* options) { return true; }
|
||||
|
||||
virtual bool setKernels(amd::option::Options* options, void* binary, size_t binSize) override;
|
||||
|
||||
@@ -80,12 +80,7 @@ private:
|
||||
|
||||
class LightningProgram : public roc::Program {
|
||||
public:
|
||||
LightningProgram(roc::NullDevice& device)
|
||||
: roc::Program(device) {
|
||||
isLC_ = true;
|
||||
xnackEnabled_ = dev().deviceInfo().xnackEnabled_;
|
||||
machineTarget_ = dev().deviceInfo().machineTargetLC_;
|
||||
}
|
||||
LightningProgram(roc::NullDevice& device);
|
||||
virtual ~LightningProgram() {}
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user