SWDEV-276396 - Implement hipDeviceReset
Add a Purge function to MemObjMap Change-Id: Iac51dfda9a7b7c45f2f4a0dc35f7a623121aba1a
This commit is contained in:
committed by
Maneesh Gupta
parent
85c70a7495
commit
d13581efa7
@@ -327,6 +327,20 @@ void MemObjMap::UpdateAccess(amd::Device *peerDev) {
|
||||
}
|
||||
}
|
||||
|
||||
void MemObjMap::Purge(amd::Device* dev) {
|
||||
assert(dev != nullptr);
|
||||
|
||||
amd::ScopedLock lock(AllocatedLock_);
|
||||
for (auto it = MemObjMap_.cbegin() ; it != MemObjMap_.cend() ;) {
|
||||
const std::vector<Device*>& devices = it->second->getContext().devices();
|
||||
if (devices.size() == 1 && devices[0] == dev) {
|
||||
it = MemObjMap_.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Device::BlitProgram::~BlitProgram() {
|
||||
if (program_ != nullptr) {
|
||||
program_->release();
|
||||
|
||||
@@ -1238,6 +1238,7 @@ class MemObjMap : public AllStatic {
|
||||
static amd::Memory* FindMemObj(
|
||||
const void* k); //!< find the mem object based on the input pointer
|
||||
static void UpdateAccess(amd::Device *peerDev);
|
||||
static void Purge(amd::Device*dev); //!< Purge all the memories on the given device
|
||||
private:
|
||||
static std::map<uintptr_t, amd::Memory*>
|
||||
MemObjMap_; //!< the mem object<->hostptr information container
|
||||
|
||||
Reference in New Issue
Block a user