diff --git a/projects/clr/rocclr/runtime/device/devprogram.cpp b/projects/clr/rocclr/runtime/device/devprogram.cpp index 2b400778d4..b40c0a96bd 100644 --- a/projects/clr/rocclr/runtime/device/devprogram.cpp +++ b/projects/clr/rocclr/runtime/device/devprogram.cpp @@ -3182,7 +3182,12 @@ bool Program::getUndefinedVarFromCodeObj(std::vector* var_names) co } bool Program::getUndefinedVarInfo(std::string var_name, void** var_addr, size_t* var_size) { - return owner()->varcallback(as_cl(owner()), var_name.c_str(), var_addr, var_size); + if (owner()->varcallback != nullptr) { + return owner()->varcallback(as_cl(owner()), var_name.c_str(), var_addr, var_size); + } else { + buildLog_ += "SVAR HIP Call back is not set \n"; + return false; + } } bool Program::defineUndefinedVars() { diff --git a/projects/clr/rocclr/runtime/device/pal/palprogram.cpp b/projects/clr/rocclr/runtime/device/pal/palprogram.cpp index ad5f9373bf..5377cde2a1 100644 --- a/projects/clr/rocclr/runtime/device/pal/palprogram.cpp +++ b/projects/clr/rocclr/runtime/device/pal/palprogram.cpp @@ -250,7 +250,9 @@ bool HSAILProgram::setKernels(amd::option::Options* options, void* binary, size_ hsa_code_object_t code_object; code_object.handle = reinterpret_cast(binary); - defineUndefinedVars(); + if (amd::IS_HIP) { + defineUndefinedVars(); + } hsa_status_t status = executable_->LoadCodeObject(agent, code_object, nullptr); if (status != HSA_STATUS_SUCCESS) { @@ -745,7 +747,9 @@ bool LightningProgram::setKernels(amd::option::Options* options, void* binary, s hsa_code_object_t code_object; code_object.handle = reinterpret_cast(binary); - defineUndefinedVars(); + if (amd::IS_HIP) { + defineUndefinedVars(); + } hsa_status_t status = executable_->LoadCodeObject(agent, code_object, nullptr); if (status != HSA_STATUS_SUCCESS) { diff --git a/projects/clr/rocclr/runtime/device/rocm/rocprogram.cpp b/projects/clr/rocclr/runtime/device/rocm/rocprogram.cpp index e02c7f97c1..53f68dd7d8 100644 --- a/projects/clr/rocclr/runtime/device/rocm/rocprogram.cpp +++ b/projects/clr/rocclr/runtime/device/rocm/rocprogram.cpp @@ -273,7 +273,9 @@ bool HSAILProgram::setKernels(amd::option::Options* options, void* binary, size_ return false; } - defineUndefinedVars(); + if (amd::IS_HIP) { + defineUndefinedVars(); + } // Load the code object. hsa_code_object_reader_t codeObjectReader; @@ -478,7 +480,9 @@ bool LightningProgram::setKernels(amd::option::Options* options, void* binary, s return false; } - defineUndefinedVars(); + if (amd::IS_HIP) { + defineUndefinedVars(); + } // Load the code object. status = hsa_code_object_reader_create_from_memory(binary, binSize, &hsaCodeObjectReader_);