SWDEV-382838 - inetrmittent failure

- test fails intermittently because object is not cleared correctly

Signed-off-by: sdashmiz <shadi.dashmiz@amd.com>
Change-Id: I88daf3dc08bb83d6d3f047ff48a63c8f856fb0bf


[ROCm/clr commit: a69db9b426]
This commit is contained in:
sdashmiz
2023-02-13 13:49:55 -05:00
committed by Shadi Dashmiz
parent a008845d4e
commit bab487caa8
2 changed files with 9 additions and 4 deletions
+4
View File
@@ -2297,6 +2297,10 @@ hipError_t hipUserObjectRelease(hipUserObject_t object, unsigned int count) {
if (object->referenceCount() < count || !hipUserObject::isUserObjvalid(object)) {
HIP_RETURN(hipSuccess);
}
//! If all the counts are gone not longer need the obj in the list
if (object->referenceCount() == count) {
hipUserObject::removeUSerObj(object);
}
object->decreaseRefCount(count);
HIP_RETURN(hipSuccess);
}
@@ -76,8 +76,8 @@ struct hipUserObject : public amd::ReferenceCountedObject {
}
static bool isUserObjvalid(hipUserObject* pUsertObj) {
amd::ScopedLock lock(UserObjectLock_);
if (ObjectSet_.find(pUsertObj) == ObjectSet_.end()) {
auto it = ObjectSet_.find(pUsertObj);
if (it == ObjectSet_.end()) {
return false;
}
return true;
@@ -85,8 +85,9 @@ struct hipUserObject : public amd::ReferenceCountedObject {
static void removeUSerObj(hipUserObject* pUsertObj) {
amd::ScopedLock lock(UserObjectLock_);
if (ObjectSet_.find(pUsertObj) == ObjectSet_.end()) {
ObjectSet_.erase(pUsertObj);
auto it = ObjectSet_.find(pUsertObj);
if (it != ObjectSet_.end()) {
ObjectSet_.erase(it);
}
}