-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[VitisAI] Add profiler interface for vitisai
- Loading branch information
1 parent
09c9843
commit ed9668f
Showing
6 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. | ||
Check warning Code scanning / lintrunner CLANGFORMAT/format Warning
See https://clang.llvm.org/docs/ClangFormat.html.
Run lintrunner -a to apply this patch. |
||
// Licensed under the MIT License. | ||
|
||
#include "vitisai_profiler.h" | ||
Check warning on line 4 in onnxruntime/core/providers/vitisai/vitisai_profiler.cc GitHub Actions / Optional Lint C++
|
||
|
||
namespace onnxruntime { | ||
namespace profiling { | ||
|
||
#if defined(USE_VITISAI) | ||
|
||
bool VitisaiProfiler::StartProfiling(TimePoint tp) { | ||
return true; | ||
} | ||
|
||
void VitisaiProfiler::EndProfiling(TimePoint tp, Events& events) { | ||
|
||
auto time_point = \ | ||
std::chrono::duration_cast<std::chrono::microseconds>(tp.time_since_epoch()).count(); | ||
|
||
std::vector<EventInfo> api_events; | ||
std::vector<EventInfo> kernel_events; | ||
Check warning on line 21 in onnxruntime/core/providers/vitisai/vitisai_profiler.cc GitHub Actions / Optional Lint C++
|
||
profiler_collect(api_events, kernel_events); | ||
|
||
std::unordered_map<std::string, std::string> event_args; | ||
|
||
for (auto& a : api_events) { | ||
events.emplace_back(EventCategory::API_EVENT, | ||
std::get<1>(a), //pid | ||
std::get<2>(a), //tid | ||
std::get<0>(a), //name | ||
std::get<3>(a) - time_point, //timestamp | ||
std::get<4>(a), //duration | ||
event_args); | ||
} | ||
|
||
for (auto& k : kernel_events) { | ||
events.emplace_back(EventCategory::KERNEL_EVENT, | ||
std::get<1>(k), | ||
std::get<2>(k), | ||
std::get<0>(k), | ||
std::get<3>(k) - time_point, | ||
std::get<4>(k), | ||
event_args); | ||
} | ||
} | ||
|
||
#endif | ||
|
||
} // namespace profiling | ||
} // namespace onnxruntime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. | ||
Check warning Code scanning / lintrunner CLANGFORMAT/format Warning
See https://clang.llvm.org/docs/ClangFormat.html.
Run lintrunner -a to apply this patch. |
||
// Licensed under the MIT License. | ||
|
||
#include "core/providers/vitisai/include/vaip/global_api.h" | ||
|
||
namespace onnxruntime { | ||
namespace profiling { | ||
|
||
#if defined(USE_VITISAI) | ||
class VitisaiProfiler final: public EpProfiler { | ||
public: | ||
VitisaiProfiler() = default; | ||
ORT_DISALLOW_COPY_ASSIGNMENT_AND_MOVE(VitisaiProfiler); | ||
~VitisaiProfiler() {} | ||
bool StartProfiling(TimePoint) override; | ||
void EndProfiling(TimePoint, Events&) override; | ||
void Start(uint64_t) override{}; | ||
void Stop(uint64_t) override{}; | ||
}; | ||
#endif | ||
|
||
} // namespace profiling | ||
} // namespace onnxruntime |