Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions projects/clr/hipamd/src/hip_vm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ hipError_t hipMemAddressFree(void* devPtr, size_t size) {
if (!(g_devices[0]->devices()[0]->virtualFree(devPtr))) {
status = hipErrorUnknown;
}
amd::MemObjMap::RemoveVirtualMemObj(devPtr);
memObj->release();
HIP_RETURN(status);
}
Expand Down
12 changes: 0 additions & 12 deletions projects/clr/rocclr/platform/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,18 +461,6 @@ Memory::~Memory() {
parent_->release();
}
hostMemRef_.deallocateMemory(context_());
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
// for graph validation logic during execution. And the reason it's not unmaped
// in graph itself because the app can have a graph without a free node
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gandryey This is a hack. If the graph doesn't have a free node then the runtime should add one implicitly to avoid removing / unmapping here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't add anything implicitly, since the destruction can occur outside of the graph. In other words the allocations don't belong to the graph.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general the object must control the location inside the maps. Our current code has explicit Add/Remove outside of mem object, which isn't right.

if (amd::MemObjMap::FindMemObj(getSvmPtr())) {
amd::MemObjMap::RemoveMemObj(getSvmPtr());
}
}
}

// ================================================================================================
Expand Down