From 908d6f0ad07b39e6e754701646e92cca78105f6a Mon Sep 17 00:00:00 2001 From: foreman Date: Wed, 19 Dec 2018 16:49:05 -0500 Subject: [PATCH] P4 to Git Change 1722556 by gandryey@gera-w8 on 2018/12/19 16:17:02 SWDEV-79445 - OCL generic changes and code clean-up - Change the compilation path base on variable Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#106 edit --- rocclr/runtime/device/rocm/rocdevice.cpp | 35 ++++++++++++++++-------- 1 file changed, 23 insertions(+), 12 deletions(-) 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) {