Fix a deadlock in ROCr backend
When OCL ROCr backend performs CL_MEM_COPY_HOST_PTR it may attempt to have access to amd::Memory object it's currently creating, but it's not ready yet. The logic creates a temporary dummy object to perform a copy transfer. The new change will make sure runtime skips allocation of the same device::Memory object second time. Change-Id: I14c6a00a3941fdcaa6aea299e9f096e4c3f5cadf
This commit is contained in:
@@ -1167,10 +1167,10 @@ Image* Image::createView(const Context& context, const Format& format, device::V
|
||||
// Find the image dimensions and create a corresponding object
|
||||
view = new (context) Image(format, *this, baseMipLevel, flags);
|
||||
|
||||
// Set GPU virtual device for this view
|
||||
view->setVirtualDevice(vDev);
|
||||
|
||||
if (view != nullptr) {
|
||||
// Set GPU virtual device for this view
|
||||
view->setVirtualDevice(vDev);
|
||||
|
||||
view->resetAllocationState();
|
||||
|
||||
// Initialize array of the device memory pointers
|
||||
@@ -1178,7 +1178,14 @@ Image* Image::createView(const Context& context, const Format& format, device::V
|
||||
|
||||
// Check if runtime has to allocate memory
|
||||
if ((context.devices().size() == 1) || DISABLE_DEFERRED_ALLOC) {
|
||||
device::Memory* mem = view->getDeviceMemory(*context.devices()[0]);
|
||||
for (uint i = 0; i < numDevices_; ++i) {
|
||||
// Make sure the parent's device memory is avaialbe
|
||||
if ((deviceMemories_[i].ref_ == context.devices()[i]) &&
|
||||
(deviceMemories_[i].value_ != nullptr)) {
|
||||
device::Memory* mem = view->getDeviceMemory(*context.devices()[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user