SWDEV-412393 - Force alloc memory to avoid another hsa image creation.

Change-Id: Ia3cd99eb736231e6dfe013ebae6c41fd4cc657bc
Este commit está contenido en:
Jaydeep Patel
2023-08-17 05:18:07 +00:00
padre d6dc82b220
commit 289535e805
Se han modificado 3 ficheros con 12 adiciones y 9 borrados
+2 -1
Ver fichero
@@ -2674,7 +2674,8 @@ Memory* KernelBlitManager::createView(const Memory& parent, cl_image_format form
auto parent_dev_image = static_cast<Image*>(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;
+3 -2
Ver fichero
@@ -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) &&
+7 -6
Ver fichero
@@ -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.