diff --git a/rocclr/runtime/device/rocm/rocdevice.cpp b/rocclr/runtime/device/rocm/rocdevice.cpp index 222bafd405..d77537bb1f 100644 --- a/rocclr/runtime/device/rocm/rocdevice.cpp +++ b/rocclr/runtime/device/rocm/rocdevice.cpp @@ -744,22 +744,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("We failed memory allocation for program!"); + } + + 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); } -#endif // defined(WITH_LIGHTNING_COMPILER) -#if defined(WITH_COMPILER_LIB) - return new roc::HSAILProgram(*this); -#endif // defined(WITH_COMPILER_LIB) + else { + program = new HSAILProgram(*this); + } + if (program == nullptr) { + LogError("We failed memory allocation for program!"); + } + + return program; } hsa_status_t Device::iterateGpuMemoryPoolCallback(hsa_amd_memory_pool_t pool, void* data) {