P4 to Git Change 1553193 by gandryey@gera-lnx-rcf-lc on 2018/05/10 13:55:21
SWDEV-79445 - OCL generic changes and code clean-up - Following CL#1552596. Add a flag to skip memory allocation. ROCr backend requires access to the parent object in the blit manager, but it's not fully initialized and a view creation is required. However a view creation with not fully initialized object can cause a dead lock if device memory is allocated during the object create. Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocmemory.cpp#35 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.cpp#132 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.hpp#104 edit
Этот коммит содержится в:
@@ -708,7 +708,7 @@ bool Buffer::create() {
|
||||
// data transfer to the view of the buffer.
|
||||
amd::Buffer* bufferView = new (owner()->getContext())
|
||||
amd::Buffer(*owner(), 0, owner()->getOrigin(), owner()->getSize());
|
||||
bufferView->create();
|
||||
bufferView->create(nullptr, false, true);
|
||||
|
||||
roc::Buffer* devBufferView = new roc::Buffer(dev_, *bufferView);
|
||||
devBufferView->deviceMemory_ = deviceMemory_;
|
||||
|
||||
@@ -205,7 +205,7 @@ bool Memory::allocHostMemory(void* initFrom, bool allocHostMem, bool forceCopy)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Memory::create(void* initFrom, bool sysMemAlloc) {
|
||||
bool Memory::create(void* initFrom, bool sysMemAlloc, bool skipAlloc) {
|
||||
static const bool forceAllocHostMem = false;
|
||||
|
||||
initDeviceMemory();
|
||||
@@ -238,7 +238,7 @@ bool Memory::create(void* initFrom, bool sysMemAlloc) {
|
||||
deviceMemories_[i].ref_ = devices[i];
|
||||
deviceMemories_[i].value_ = NULL;
|
||||
|
||||
if ((devices.size() == 1) || DISABLE_DEFERRED_ALLOC) {
|
||||
if (!skipAlloc && ((devices.size() == 1) || DISABLE_DEFERRED_ALLOC)) {
|
||||
device::Memory* mem = getDeviceMemory(*devices[i]);
|
||||
if (NULL == mem) {
|
||||
LogPrintfError("Can't allocate memory size - 0x%08X bytes!", getSize());
|
||||
@@ -436,7 +436,7 @@ void Buffer::initDeviceMemory() {
|
||||
memset(deviceMemories_, 0, context_().devices().size() * sizeof(DeviceMemory));
|
||||
}
|
||||
|
||||
bool Buffer::create(void* initFrom, bool sysMemAlloc) {
|
||||
bool Buffer::create(void* initFrom, bool sysMemAlloc, bool skipAlloc) {
|
||||
if ((getMemFlags() & CL_MEM_EXTERNAL_PHYSICAL_AMD) && (initFrom != NULL)) {
|
||||
busAddress_ = *(reinterpret_cast<cl_bus_address_amd*>(initFrom));
|
||||
initFrom = NULL;
|
||||
@@ -444,7 +444,7 @@ bool Buffer::create(void* initFrom, bool sysMemAlloc) {
|
||||
busAddress_.surface_bus_address = 0;
|
||||
busAddress_.marker_bus_address = 0;
|
||||
}
|
||||
return Memory::create(initFrom, sysMemAlloc);
|
||||
return Memory::create(initFrom, sysMemAlloc, skipAlloc);
|
||||
}
|
||||
|
||||
bool Buffer::isEntirelyCovered(const Coord3D& origin, const Coord3D& region) const {
|
||||
|
||||
@@ -228,7 +228,8 @@ class Memory : public amd::RuntimeObject {
|
||||
|
||||
//! Creates and initializes device (cache) memory for all devices
|
||||
virtual bool create(void* initFrom = NULL, //!< Pointer to the initialization data
|
||||
bool sysMemAlloc = false //!< Allocate device memory in system memory
|
||||
bool sysMemAlloc = false, //!< Allocate device memory in system memory
|
||||
bool skipAlloc = false //!< Skip device memory allocation
|
||||
);
|
||||
|
||||
//! Allocates device (cache) memory for a specific device
|
||||
@@ -338,7 +339,8 @@ class Buffer : public Memory {
|
||||
: Memory(parent, flags, origin, size) {}
|
||||
|
||||
bool create(void* initFrom = NULL, //!< Pointer to the initialization data
|
||||
bool sysMemAlloc = false //!< Allocate device memory in system memory
|
||||
bool sysMemAlloc = false, //!< Allocate device memory in system memory
|
||||
bool skipAlloc = false //!< Skip device memory allocation
|
||||
);
|
||||
|
||||
//! static_cast to Buffer with sanity check
|
||||
|
||||
Ссылка в новой задаче
Block a user