SWDEV-353281 - Move VirtualMem map update to memobj

- The implementation in mempool graphs requires refcounting VA object.
That requires release() to update the map only on the actual destruction.
- Add GPU event tracking for paging operation. Otherwise, runtime
may not always flush IB.

Change-Id: Idf99ffb894321a38e04b490116a7ca435635918d
Αυτή η υποβολή περιλαμβάνεται σε:
German
2023-04-25 17:28:28 -04:00
υποβλήθηκε από German Andryeyev
γονέας 22eae6ac9e
υποβολή 7ef2da5aba
3 αρχεία άλλαξαν με 30 προσθήκες και 21 διαγραφές
+12 -1
Προβολή Αρχείου
@@ -260,6 +260,7 @@ bool Memory::allocHostMemory(void* initFrom, bool allocHostMem, bool forceCopy)
return true;
}
// ================================================================================================
bool Memory::create(void* initFrom, bool sysMemAlloc, bool skipAlloc, bool forceAlloc) {
static const bool forceAllocHostMem = false;
@@ -310,12 +311,16 @@ bool Memory::create(void* initFrom, bool sysMemAlloc, bool skipAlloc, bool force
}
}
}
// Add a VA range into VA range map
if (getMemFlags() & CL_MEM_VA_RANGE_AMD) {
amd::MemObjMap::AddVirtualMemObj(getSvmPtr(), this);
}
// Store the unique id for each memory allocation
uniqueId_ = ++numAllocs;
return true;
}
// ================================================================================================
bool Memory::addDeviceMemory(const Device* dev) {
bool result = false;
AllocState create = AllocCreate;
@@ -401,6 +406,7 @@ device::Memory* Memory::getDeviceMemory(const Device& dev, bool alloc) {
return dm;
}
// ================================================================================================
Memory::~Memory() {
// For_each destructor callback:
DestructorCallBackEntry* entry;
@@ -443,8 +449,13 @@ Memory::~Memory() {
parent_->release();
}
hostMemRef_.deallocateMemory(context_());
if (getMemFlags() & CL_MEM_VA_RANGE_AMD) {
amd::MemObjMap::RemoveVirtualMemObj(getSvmPtr());
}
}
// ================================================================================================
bool Memory::setDestructorCallback(DestructorCallBackFunction callback, void* data) {
DestructorCallBackEntry* entry = new DestructorCallBackEntry(callback, data);
if (entry == NULL) {