diff --git a/projects/clr/rocclr/runtime/device/rocm/rocblit.cpp b/projects/clr/rocclr/runtime/device/rocm/rocblit.cpp index 5704e05b2f..c06a90fbf2 100644 --- a/projects/clr/rocclr/runtime/device/rocm/rocblit.cpp +++ b/projects/clr/rocclr/runtime/device/rocm/rocblit.cpp @@ -733,7 +733,9 @@ bool KernelBlitManager::create(amd::Device& device) { bool KernelBlitManager::createProgram(Device& device) { if (device.blitProgram() == nullptr) { - return false; + if (!device.createBlitProgram()) { + return false; + } } std::vector devices; diff --git a/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp b/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp index 2cc53cd4b8..49eadce97b 100644 --- a/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp +++ b/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp @@ -656,18 +656,6 @@ bool Device::create(bool sramEccEnabled) { return false; } - const char* scheduler = nullptr; - -#if defined(USE_COMGR_LIBRARY) - std::string sch = SchedulerSourceCode; - if (settings().useLightning_) { - if (info().cooperativeGroups_) { - sch.append(GwsInitSourceCode); - } - scheduler = sch.c_str(); - } -#endif // USE_COMGR_LIBRARY - amd::Context::Info info = {0}; std::vector devices; devices.push_back(this); @@ -678,15 +666,6 @@ bool Device::create(bool sramEccEnabled) { return false; } - blitProgram_ = new BlitProgram(context_); - // Create blit programs - if (blitProgram_ == nullptr || !blitProgram_->create(this, scheduler)) { - delete blitProgram_; - blitProgram_ = nullptr; - LogError("Couldn't create blit kernels!"); - return false; - } - mapCacheOps_ = new amd::Monitor("Map Cache Lock", true); if (nullptr == mapCacheOps_) { return false; @@ -757,8 +736,6 @@ bool Device::create(bool sramEccEnabled) { } } - xferQueue(); - return true; } @@ -809,6 +786,32 @@ void Device::ReleaseExclusiveGpuAccess(VirtualGPU& vgpu) const { vgpusAccess().unlock(); } +bool Device::createBlitProgram() { + bool result = true; + const char* scheduler = nullptr; + +#if defined(USE_COMGR_LIBRARY) + std::string sch = SchedulerSourceCode; + if (settings().useLightning_) { + if (info().cooperativeGroups_) { + sch.append(GwsInitSourceCode); + } + scheduler = sch.c_str(); + } +#endif // USE_COMGR_LIBRARY + + blitProgram_ = new BlitProgram(context_); + // Create blit programs + if (blitProgram_ == nullptr || !blitProgram_->create(this, scheduler)) { + delete blitProgram_; + blitProgram_ = nullptr; + LogError("Couldn't create blit kernels!"); + return false; + } + + return result; +} + device::Program* Device::createProgram(amd::Program& owner, amd::option::Options* options) { device::Program* program; if (settings().useLightning_) { diff --git a/projects/clr/rocclr/runtime/device/rocm/rocdevice.hpp b/projects/clr/rocclr/runtime/device/rocm/rocdevice.hpp index b257e1cf6d..0e499845d4 100644 --- a/projects/clr/rocclr/runtime/device/rocm/rocdevice.hpp +++ b/projects/clr/rocclr/runtime/device/rocm/rocdevice.hpp @@ -380,6 +380,9 @@ class Device : public NullDevice { amd::Context& context() const { return *context_; } + //! Create internal blit program + bool createBlitProgram(); + // Returns AMD GPU Pro interfaces const IProDevice& iPro() const { return *pro_device_; } bool ProEna() const { return pro_ena_; }