未验证 提交 3b2d08a6 编写于 作者: Y Yuan Shuai 提交者: GitHub

[LITE][PROFILE] Fix Precison Profiler caused by X86 header (#3506) (#3584)

* [LITE] Set high perf mode as default in mobile_light deme; Fix Precision Profiler caused by X86 header; Enhance profiler for opencl. test=develop
Co-authored-by: NHappyAngel <chenjiaobuaa@126.com>
上级 36945308
......@@ -90,6 +90,9 @@ class KernelBase {
profiler_->StopTiming(profile::Type::kCreate, profile_id_, ctx_.get());
profiler_->StartTiming(profile::Type::kDispatch, profile_id_, ctx_.get());
Run();
#ifdef LITE_WITH_OPENCL
CLRuntime::Global()->command_queue().finish();
#endif
profiler_->StopTiming(profile::Type::kDispatch, profile_id_, ctx_.get());
#else
Run();
......
......@@ -22,7 +22,9 @@
#include <string>
#include <vector>
#include "lite/core/program.h"
#ifdef LITE_WITH_X86
#include "lite/fluid/float16.h"
#endif
#ifdef LITE_WITH_OPENCL
#include "lite/backends/opencl/cl_image_converter.h"
......
......@@ -71,15 +71,17 @@ inline double GetCurrentUS() {
void RunModel(std::string model_dir,
const shape_t& input_shape,
int repeats,
int warmup,
int print_output_elem) {
size_t repeats,
size_t warmup,
size_t print_output_elem,
size_t power_mode) {
// 1. Set MobileConfig
MobileConfig config;
config.set_model_from_file(model_dir);
// NOTE: To load model transformed by model_optimize_tool before
// release/v2.3.0, plese use `set_model_dir` API as listed below.
// config.set_model_dir(model_dir);
config.set_power_mode(static_cast<paddle::lite_api::PowerMode>(power_mode));
// 2. Create PaddlePredictor by MobileConfig
std::shared_ptr<PaddlePredictor> predictor =
......@@ -187,8 +189,15 @@ int main(int argc, char** argv) {
warmup = atoi(argv[7]);
print_output_elem = atoi(argv[8]);
}
RunModel(model_dir, input_shape, repeats, warmup, print_output_elem);
// set arm power mode:
// 0 for big cluster, high performance
// 1 for little cluster
// 2 for all cores
// 3 for no bind
size_t power_mode = 0;
RunModel(
model_dir, input_shape, repeats, warmup, print_output_elem, power_mode);
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册