Cleanup stream from hip:Event class.
Change-Id: I98de07d33bb7fea8f5e2d32b288c15f10ce58902
This commit is contained in:
@@ -95,16 +95,13 @@ hipError_t Event::elapsedTime(Event& eStop, float& ms) {
|
||||
}
|
||||
|
||||
hipError_t Event::streamWait(amd::HostQueue* hostQueue, uint flags) {
|
||||
if (stream_ == hostQueue) return hipSuccess;
|
||||
if ((event_ == nullptr) || (event_->command().queue() == hostQueue)) {
|
||||
return hipSuccess;
|
||||
}
|
||||
|
||||
amd::ScopedLock lock(lock_);
|
||||
bool retain = false;
|
||||
|
||||
if (event_ == nullptr) {
|
||||
event_ = stream_->getLastQueuedCommand(true);
|
||||
retain = true;
|
||||
}
|
||||
|
||||
if (!event_->notifyCmdQueue()) {
|
||||
return hipErrorLaunchOutOfResources;
|
||||
}
|
||||
@@ -118,19 +115,12 @@ hipError_t Event::streamWait(amd::HostQueue* hostQueue, uint flags) {
|
||||
command->enqueue();
|
||||
command->release();
|
||||
|
||||
if (retain) {
|
||||
event_->release();
|
||||
event_ = nullptr;
|
||||
}
|
||||
|
||||
return hipSuccess;
|
||||
}
|
||||
|
||||
void Event::addMarker(amd::HostQueue* queue, amd::Command* command) {
|
||||
amd::ScopedLock lock(lock_);
|
||||
|
||||
stream_ = queue;
|
||||
|
||||
if (event_ == &command->event()) return;
|
||||
|
||||
if (event_ != nullptr) {
|
||||
|
||||
@@ -37,7 +37,10 @@ public:
|
||||
|
||||
class Event {
|
||||
public:
|
||||
Event(unsigned int flags) : flags(flags), lock_("hipEvent_t"), stream_(getNullStream()), event_(nullptr) {}
|
||||
Event(unsigned int flags) : flags(flags), lock_("hipEvent_t"), event_(nullptr) {
|
||||
// No need to init event_ here as addMarker does that
|
||||
}
|
||||
|
||||
~Event() {
|
||||
if (event_ != nullptr) {
|
||||
event_->release();
|
||||
|
||||
Reference in New Issue
Block a user