From e757691f5a70fff2ed74317b30f5527abd2485fb Mon Sep 17 00:00:00 2001 From: dingminghui Date: Wed, 27 May 2020 18:58:47 +0800 Subject: [PATCH] refactor: reduce hwtime log to ease analyzing for CI subgraph will rebuild while batchsize changable is on and encounter a unsupported operator. graph will be destructed and recreated, in which Nan hw perf log is printed --- lite/kernels/mlu/bridges/graph.h | 10 ++++++---- lite/kernels/mlu/subgraph_compute.h | 7 +++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lite/kernels/mlu/bridges/graph.h b/lite/kernels/mlu/bridges/graph.h index 0c7ca7db83..7a4f2af6e5 100644 --- a/lite/kernels/mlu/bridges/graph.h +++ b/lite/kernels/mlu/bridges/graph.h @@ -54,11 +54,13 @@ class Graph { CNRT_CALL(cnrtDestroyNotifier(¬ifier_start_)); CNRT_CALL(cnrtDestroyNotifier(¬ifier_end_)); double total_time = 0; - for (auto& f : time_log_) { - total_time += f; + if (!time_log_.empty()) { + for (auto& f : time_log_) { + total_time += f; + } + std::cout << "cnml hardware time for " << time_log_.size() + << " process:" << total_time / time_log_.size() << std::endl; } - std::cout << "cnml hardware time for " << time_log_.size() - << " process:" << total_time / time_log_.size() << std::endl; #endif } // Data node diff --git a/lite/kernels/mlu/subgraph_compute.h b/lite/kernels/mlu/subgraph_compute.h index 971b83027f..ec9b69ebcb 100644 --- a/lite/kernels/mlu/subgraph_compute.h +++ b/lite/kernels/mlu/subgraph_compute.h @@ -55,6 +55,8 @@ class SubgraphEngine : public subgraph::Engine { << GetBoolFromEnv("PADDLE_LITE_MLU_SAVE_OFFLINE_MODEL"); VLOG(4) << "[MLU] PADDLE_LITE_MLU_DISABLE_BATCH_SIZE_CHANGEABLE is " << GetBoolFromEnv("PADDLE_LITE_MLU_DISABLE_BATCH_SIZE_CHANGEABLE"); + VLOG(4) << "[MLU] LITE_DISABLE_MLU_CAST is " + << GetBoolFromEnv("LITE_DISABLE_MLU_CAST"); if (GetBoolFromEnv("PADDLE_LITE_MLU_DISABLE_BATCH_SIZE_CHANGEABLE")) { disable_batch_size_changeable_ = true; } @@ -105,6 +107,7 @@ class SubgraphEngine : public subgraph::Engine { if (shape_graph_map_.count(inputs_shape_) > 0) { return false; } + VLOG(3) << "MLU graph input shape changed" << std::endl; return true; } @@ -131,8 +134,8 @@ class SubgraphEngine : public subgraph::Engine { if (subgraph::CHECK_SUCCESS(status)) { return status; } - VLOG(4) << "[MLU] build batch_size changeable subgraph op failed, " - "changed to input_shape changeable"; + LOG(INFO) << "[MLU] build batch_size changeable subgraph op failed, " + "changed to input_shape changeable"; } error_compile_batch_size_changeable_ = true; disable_batch_size_changeable_ = true; -- GitLab