File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed
Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -3377,12 +3377,29 @@ bool VirtualGPU::waitAllEngines(CommandBatch* cb) {
33773377}
33783378
33793379void VirtualGPU::waitEventLock (CommandBatch* cb) {
3380- bool earlyDone = false ;
3380+ bool earlyDone = true ;
3381+ GpuEvent eventsCopy[AllEngines];
3382+
33813383 {
3382- // Make sure VirtualGPU has an exclusive access to the resources
33833384 amd::ScopedLock lock (execution ());
3384- earlyDone = waitAllEngines (cb);
3385+
3386+ GpuEvent* events = (cb == nullptr ) ? events_ : cb->events_ ;
3387+
3388+ // The first loop is to flush all engines and/or check if
3389+ // engines are idle already
3390+ for (uint i = 0 ; i < AllEngines; ++i) {
3391+ eventsCopy[i] = events[i];
3392+ earlyDone &= isDone (&events[i]);
3393+ }
3394+
3395+ // Release all pinned memory
3396+ releasePinnedMem ();
3397+ }
3398+
3399+ for (uint i = 0 ; i < AllEngines; ++i) {
3400+ waitForEvent (&eventsCopy[i]);
33853401 }
3402+
33863403 // Get timestamp, incase readjustTimeGPU_ needs to be updated
33873404 uint64_t endTimeStampCPU = amd::Os::timeNanos ();
33883405
You can’t perform that action at this time.
0 commit comments