SWDEV-401781 - Auto Clean removes from map so check before remove while submit mem alloc node command.

Change-Id: Id004f75b307c2c769dee556c3d18e781830bcae1


[ROCm/clr commit: a8164d3e12]
Cette révision appartient à :
Jaydeep Patel
2023-06-23 13:03:10 +00:00
révisé par Jaydeepkumar Patel
Parent 8969a60e98
révision 621b266d71
2 fichiers modifiés avec 8 ajouts et 6 suppressions
+3 -3
Voir le fichier
@@ -578,9 +578,11 @@ hipError_t hipGraphExec::Run(hipStream_t stream) {
if (hip::getStream(stream) == nullptr) {
return hipErrorInvalidResourceHandle;
}
auto hip_stream = (stream == nullptr) ? hip::getCurrentDevice()->NullStream()
: reinterpret_cast<hip::Stream*>(stream);
if (flags_ & hipGraphInstantiateFlagAutoFreeOnLaunch) {
if (!topoOrder_.empty()) {
topoOrder_[0]->GetParentGraph()->FreeAllMemory();
topoOrder_[0]->GetParentGraph()->FreeAllMemory(hip_stream);
}
}
@@ -597,8 +599,6 @@ hipError_t hipGraphExec::Run(hipStream_t stream) {
repeatLaunch_ = true;
}
auto hip_stream = (stream == nullptr) ? hip::getCurrentDevice()->NullStream()
: reinterpret_cast<hip::Stream*>(stream);
UpdateStream(parallelLists_, hip_stream, this);
std::vector<amd::Command*> rootCommands;
amd::Command* endCommand = nullptr;
+5 -3
Voir le fichier
@@ -525,8 +525,8 @@ struct ihipGraph {
return false;
}
void FreeAllMemory() {
mem_pool_->FreeAllMemory();
void FreeAllMemory(hip::Stream* stream) {
mem_pool_->FreeAllMemory(stream);
}
bool IsGraphInstantiated() const {
@@ -1940,7 +1940,9 @@ class hipGraphMemAllocNode : public hipGraphNode {
virtual void submit(device::VirtualDevice& device) final {
// Remove VA reference from the global mapping. Runtime has to keep a dummy reference for
// validation logic during the capture or creation of the nodes
amd::MemObjMap::RemoveMemObj(va_->getSvmPtr());
if (amd::MemObjMap::FindMemObj(va_->getSvmPtr())) {
amd::MemObjMap::RemoveMemObj(va_->getSvmPtr());
}
// Allocate real memory for mapping
const auto& dev_info = queue()->device().info();
auto aligned_size = amd::alignUp(size_, dev_info.virtualMemAllocGranularity_);