onnxruntime/onnxruntime/core/codegen/common/profile.h
KeDengMS c9240f4e93
Implementation of Nuphar execution provider (#881)
* Implement Nuphar execution provider

Nuphar execution provider is a TVM-based compilation provider. It has shown great speedups for RNN models using Scan.
This PR is mainly for a preview of the shared codegen library for other TVM-based providers.

* Fix submodules

* Fix TVM submodule

* Update Nuphar to latest and resolve confliction

* Remove stale files caused by merge -X theirs

* Revert heap buffer change to not introduce onnxruntime_framework into onnxruntime_perf_test

* Fix bad merge

* Merge from Nuphar

* Fix warning treated as error, revert some unnecessary changes

* Revert some more test changes

* Some more test revert or comments to make review easier
New tests could be added later

* One more revert of unnecessary changes

* More change revert. Test could be added back later.
2019-09-01 23:01:47 -07:00

37 lines
858 B
C++

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
// uncomment this line or use -DCODEGEN_ENABLE_PROFILER in compiler options to enable profiler events in codegen
//#define CODEGEN_ENABLE_PROFILER
#ifdef CODEGEN_ENABLE_PROFILER
#include "core/common/profiler.h"
namespace onnxruntime {
class ProfilerEvent {
public:
ProfilerEvent(const std::string& name) : name_(name) {
ts_ = profiling::Profiler::Instance().StartTime();
}
~ProfilerEvent() {
profiling::Profiler::Instance().EndTimeAndRecordEvent(profiling::EventCategory::NODE_EVENT, name_, ts_);
}
private:
TimePoint ts_;
const std::string name_;
};
} // namespace onnxruntime
#define CODEGEN_PROFILER_EVENT(name) onnxruntime::ProfilerEvent profiler_event(name)
#else
#define CODEGEN_PROFILER_EVENT(name)
#endif