- Add assertions to enforce that objects are of the correct kind and
  have been allocated.

- Make destructors check if objects have been allocated before
  deleting.

- Operations that require a non-NullDevice return failure if given a
  NullDevice.

- Use static_cast rather than reinterpret_cast when cohersing from a
  base class to a derived class.

Change-Id: I02ee0ea9d7982fd7ca29d49c9b02cfae111b7127
Этот коммит содержится в:
Tony Tye
2021-01-10 02:09:00 +00:00
родитель 001fd66cac
Коммит e5431676d4
11 изменённых файлов: 96 добавлений и 13 удалений
+14
Просмотреть файл
@@ -126,6 +126,10 @@ bool Program::initClBinary(char* binaryIn, size_t size) {
bool Program::defineGlobalVar(const char* name, void* dptr) {
if (!device().isOnline()) {
return false;
}
hsa_status_t status = HSA_STATUS_SUCCESS;
hsa_agent_t hsa_device = rocDevice().getBackendDevice();
@@ -141,6 +145,10 @@ bool Program::defineGlobalVar(const char* name, void* dptr) {
bool Program::createGlobalVarObj(amd::Memory** amd_mem_obj, void** device_pptr,
size_t* bytes, const char* global_name) const {
if (!device().isOnline()) {
return false;
}
hsa_status_t status = HSA_STATUS_SUCCESS;
const roc::Device* roc_device = nullptr;
hsa_agent_t hsa_device;
@@ -470,6 +478,12 @@ bool LightningProgram::saveBinaryAndSetType(type_t type, void* rawBinary, size_t
bool LightningProgram::setKernels(amd::option::Options* options, void* binary, size_t binSize,
amd::Os::FileDesc fdesc, size_t foffset, std::string uri) {
#if defined(USE_COMGR_LIBRARY)
// Stop compilation if it is an offline device - HSA runtime does not
// support ISA compiled offline
if (!device().isOnline()) {
return true;
}
// Find the size of global variables from the binary
if (!FindGlobalVarSize(binary, binSize)) {
buildLog_ += "Error: Cannot Global Var Sizes ";