SWDEV-482130 - Fix release of virtual mem obj

Change-Id: I893a8353aa1a25d00e36c8e601caf31cc0fc1f22
이 커밋은 다음에 포함됨:
Branislav Brzak
2024-09-12 14:40:31 +02:00
커밋한 사람 Anusha Godavarthy Surya
부모 522ae8ead4
커밋 43fcac1739
3개의 변경된 파일24개의 추가작업 그리고 9개의 파일을 삭제
+9 -8
파일 보기
@@ -416,21 +416,21 @@ device::Memory* Memory::getDeviceMemory(const Device& dev, bool alloc) {
Memory::~Memory() {
// For_each destructor callback:
DestructorCallBackEntry* entry;
for (entry = destructorCallbacks_; entry != NULL; entry = entry->next_) {
for (entry = destructorCallbacks_; entry != nullptr; entry = entry->next_) {
// invoke the callback function.
entry->callback_(const_cast<cl_mem>(as_cl(this)), entry->data_);
}
// Release the parent.
if (NULL != parent_) {
if (parent_ != nullptr) {
// Update cache if runtime destroys a subbuffer
if (NULL != parent_->getHostMem() && (vDev_ == NULL)) {
if (parent_->getHostMem() != nullptr && (vDev_ == nullptr)) {
cacheWriteBack(nullptr);
}
parent_->removeSubBuffer(this);
}
if (NULL != deviceMemories_) {
if (deviceMemories_ != nullptr) {
// Destroy all device memory objects
for (uint i = 0; i < numDevices_; ++i) {
delete deviceMemories_[i].value_;
@@ -444,19 +444,20 @@ Memory::~Memory() {
// Destroy the destructor callback entries
DestructorCallBackEntry* callback = destructorCallbacks_;
while (callback != NULL) {
while (callback != nullptr) {
DestructorCallBackEntry* next = callback->next_;
delete callback;
callback = next;
}
// Make sure runtime destroys the parent only after subbuffer destruction
if (NULL != parent_) {
if (parent_ != nullptr) {
parent_->release();
}
hostMemRef_.deallocateMemory(context_());
if (getMemFlags() & CL_MEM_VA_RANGE_AMD) {
if (parent_ == nullptr) {
if (parent_ == nullptr && (getMemFlags() & CL_MEM_VA_RANGE_AMD)) {
// The mapping may manually be removed prior to objects destruction
if (amd::MemObjMap::FindVirtualMemObj(getSvmPtr())) {
amd::MemObjMap::RemoveVirtualMemObj(getSvmPtr());
}
// If runtime executes graph mempool with VM, then VA can be mapped in space