diff --git a/rocclr/device/rocm/rocblit.cpp b/rocclr/device/rocm/rocblit.cpp index caabbf7469..c1033007e4 100644 --- a/rocclr/device/rocm/rocblit.cpp +++ b/rocclr/device/rocm/rocblit.cpp @@ -2674,7 +2674,8 @@ Memory* KernelBlitManager::createView(const Memory& parent, cl_image_format form auto parent_dev_image = static_cast(parentImage->getDeviceMemory(dev())); amd::Image* image = parent_dev_image->FindView(format); if (image == nullptr) { - image = parentImage->createView(parent.owner()->getContext(), format, &gpu(), 0, flags); + image = parentImage->createView(parent.owner()->getContext(), format, &gpu(), 0, flags, + false, true); if (image == nullptr) { LogError("[OCL] Fail to allocate view of image object"); return nullptr; diff --git a/rocclr/platform/memory.cpp b/rocclr/platform/memory.cpp index d33b862520..5867177004 100644 --- a/rocclr/platform/memory.cpp +++ b/rocclr/platform/memory.cpp @@ -1195,7 +1195,8 @@ bool Image::Format::isSupported(const Context& context, cl_mem_object_type image // ================================================================================================ Image* Image::createView(const Context& context, const Format& format, device::VirtualDevice* vDev, - uint baseMipLevel, cl_mem_flags flags, bool createMipmapView) { + uint baseMipLevel, cl_mem_flags flags, bool createMipmapView, + bool forceAlloc) { // Find the image dimensions and create a corresponding object Image* view = new (context) Image(format, *this, baseMipLevel, flags, createMipmapView); @@ -1210,7 +1211,7 @@ Image* Image::createView(const Context& context, const Format& format, device::V view->initDeviceMemory(); // Check if runtime has to allocate memory - if ((context.devices().size() == 1) || DISABLE_DEFERRED_ALLOC) { + if ((context.devices().size() == 1) || DISABLE_DEFERRED_ALLOC || forceAlloc) { for (uint i = 0; i < numDevices_; ++i) { // Make sure the parent's device memory is avaialbe if ((deviceMemories_[i].ref_ != nullptr) && diff --git a/rocclr/platform/memory.hpp b/rocclr/platform/memory.hpp index e5ee54b2df..9534ebc76c 100644 --- a/rocclr/platform/memory.hpp +++ b/rocclr/platform/memory.hpp @@ -601,12 +601,13 @@ class Image : public Memory { ) const; //! Creates a view memory object - virtual Image* createView(const Context& context, //!< Context for a view creation - const Format& format, //!< The new format for a view - device::VirtualDevice* vDev, //!< Virtual device object - uint baseMipLevel = 0, //!< Base mip level for a view - cl_mem_flags flags = 0, //!< Memory allocation flags - bool createMipmapView = false //!< To create mipmap view based on this image + virtual Image* createView(const Context& context, //!< Context for a view creation + const Format& format, //!< The new format for a view + device::VirtualDevice* vDev, //!< Virtual device object + uint baseMipLevel = 0, //!< Base mip level for a view + cl_mem_flags flags = 0, //!< Memory allocation flags + bool createMipmapView = false, //!< To create mipmap view based on this image + bool forceAlloc = false //!< To bypass deffered alloc ); //! Returns the impl for this image.