|
|
|
@ -149,9 +149,17 @@ void OperatorBase::Run(const Scope& scope, const platform::Place& place) {
|
|
|
|
|
platform::SetDeviceId(dev_id);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
platform::DeviceContextPool& pool = platform::DeviceContextPool::Instance();
|
|
|
|
|
platform::RecordEvent record_event(Type(), pool.Get(place));
|
|
|
|
|
RunImpl(scope, place);
|
|
|
|
|
|
|
|
|
|
// The profile has a process-wide mutex, results in serious performance issue
|
|
|
|
|
// in concurrency scenerio. Here use an `if` to fix this issue.
|
|
|
|
|
// Please not remove the `if`, ask @Superjomn if there are any concern.
|
|
|
|
|
if (platform::IsProfileEnabled()) {
|
|
|
|
|
platform::DeviceContextPool& pool = platform::DeviceContextPool::Instance();
|
|
|
|
|
platform::RecordEvent record_event(Type(), pool.Get(place));
|
|
|
|
|
RunImpl(scope, place);
|
|
|
|
|
} else {
|
|
|
|
|
RunImpl(scope, place);
|
|
|
|
|
}
|
|
|
|
|
VLOG(3) << place << " " << DebugStringEx(&scope);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|