SWDEV-342010 - in progress keeping track of events

Change-Id: Ic87e4b46d4eebe9922a34af5867e9fc32fcb4066
Tento commit je obsažen v:
pghafari
2022-07-11 15:19:09 -04:00
odevzdal Maneesh Gupta
rodič 8ac20e5e38
revize ec16be77fc
+10
Zobrazit soubor
@@ -27,6 +27,9 @@
namespace hip {
static amd::Monitor eventSetLock{"Guards global event set"};
static std::unordered_set<hipEvent_t> eventSet;
bool Event::ready() {
if (event_->status() != CL_COMPLETE) {
event_->notifyCmdQueue();
@@ -280,6 +283,8 @@ hipError_t ihipEventCreateWithFlags(hipEvent_t* event, unsigned flags) {
return hipErrorOutOfMemory;
}
*event = reinterpret_cast<hipEvent_t>(e);
amd::ScopedLock lock(hip::eventSetLock);
hip::eventSet.insert(*event);
} else {
return hipErrorInvalidValue;
}
@@ -313,6 +318,11 @@ hipError_t hipEventDestroy(hipEvent_t event) {
HIP_RETURN(hipErrorInvalidHandle);
}
amd::ScopedLock lock(hip::eventSetLock);
if (hip::eventSet.erase(event) == 0 ) {
return hipErrorContextIsDestroyed;
}
hip::Event* e = reinterpret_cast<hip::Event*>(event);
delete e;
HIP_RETURN(hipSuccess);