P4 to Git Change 1254144 by gandryey@gera-rcf-lnx on 2016/04/04 11:14:17

SWDEV-79445 - OCL generic changes and code clean-up
	- Move prepinned logic to the abstraciton layer

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#193 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#270 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#543 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.hpp#158 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#398 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.cpp#61 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.hpp#29 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsamemory.cpp#23 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsavirtual.cpp#62 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#3 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.hpp#3 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.cpp#3 edit
Este commit está contenido en:
foreman
2016-04-04 11:25:36 -04:00
padre 844c44128e
commit 8756fa14cb
Se han modificado 8 ficheros con 109 adiciones y 222 borrados
+4 -78
Ver fichero
@@ -735,8 +735,6 @@ Device::Device()
, mapCacheOps_(NULL)
, xferRead_(NULL)
, xferWrite_(NULL)
, vaCacheAccess_(NULL)
, vaCacheList_(NULL)
, mapCache_(NULL)
, resourceCache_(NULL)
, heapInitComplete_(false)
@@ -752,9 +750,6 @@ Device::~Device()
delete hwDebugMgr_;
hwDebugMgr_ = NULL;
CondLog(vaCacheList_ == NULL ||
(vaCacheList_->size() != 0), "Application didn't unmap all host memory!");
delete srdManager_;
for (uint s = 0; s < scratch_.size(); ++s) {
@@ -795,8 +790,6 @@ Device::~Device()
delete vgpusAccess_;
delete scratchAlloc_;
delete mapCacheOps_;
delete vaCacheAccess_;
delete vaCacheList_;
if (context_ != NULL) {
context_->release();
@@ -811,6 +804,10 @@ extern const char* SchedulerSourceCode;
bool
Device::create(CALuint ordinal, CALuint numOfDevices)
{
if (!amd::Device::create()) {
return false;
}
appProfile_.init();
bool smallMemSystem = false;
@@ -875,15 +872,6 @@ Device::create(CALuint ordinal, CALuint numOfDevices)
return false;
}
vaCacheAccess_ = new amd::Monitor("VA Cache Ops Lock", true);
if (NULL == vaCacheAccess_) {
return false;
}
vaCacheList_ = new std::list<VACacheEntry*>();
if (NULL == vaCacheList_) {
return false;
}
mapCache_ = new std::vector<amd::Memory*>();
if (mapCache_ == NULL) {
return false;
@@ -1895,68 +1883,6 @@ Device::globalFreeMemory(size_t* freeMemory) const
return true;
}
void
Device::addVACache(Memory* memory) const
{
// Make sure system memory has direct access
if (memory->isHostMemDirectAccess()) {
// VA cache access must be serialised
amd::ScopedLock lk(*vaCacheAccess_);
void* start = memory->owner()->getHostMem();
void* end = reinterpret_cast<address>(start) + memory->owner()->getSize();
size_t offset;
Memory* doubleMap = findMemoryFromVA(start, &offset);
if (doubleMap == NULL) {
// Allocate a new entry
VACacheEntry* entry = new VACacheEntry(start, end, memory);
if (entry != NULL) {
vaCacheList_->push_back(entry);
}
}
else {
LogError("Unexpected double map() call from the app!");
}
}
}
void
Device::removeVACache(const Memory* memory) const
{
// Make sure system memory has direct access
if (memory->isHostMemDirectAccess() && memory->owner()) {
// VA cache access must be serialised
amd::ScopedLock lk(*vaCacheAccess_);
void* start = memory->owner()->getHostMem();
void* end = reinterpret_cast<address>(start) + memory->owner()->getSize();
// Find VA cache entry for the specified memory
for (const auto& entry : *vaCacheList_) {
if (entry->startAddress_ == start) {
CondLog((entry->endAddress_ != end), "Incorrect VA range");
delete entry;
vaCacheList_->remove(entry);
break;
}
}
}
}
Memory*
Device::findMemoryFromVA(const void* ptr, size_t* offset) const
{
// VA cache access must be serialised
amd::ScopedLock lk(*vaCacheAccess_);
for (const auto& entry : *vaCacheList_) {
if ((entry->startAddress_ <= ptr) && (entry->endAddress_ > ptr)) {
*offset = static_cast<size_t>(reinterpret_cast<const char*>(ptr) -
reinterpret_cast<char*>(entry->startAddress_));
return entry->memory_;
}
}
return NULL;
}
amd::Memory*
Device::findMapTarget(size_t size) const
{