diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-04-24 11:22:49 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-04-24 11:26:46 -0700 |
commit | 9d2972e6ceb4911458e867d75466e14a31fa1773 (patch) | |
tree | 1d418ef02fd5ae4f937865d12f3c4f95f86debcb /tensorflow/core/grappler/costs/virtual_scheduler.cc | |
parent | 4a82acf286df1bc10581d91e13e0ab17458e83b4 (diff) |
show breakdown of execution cost with compute and memory cost for op summarization
PiperOrigin-RevId: 194117030
Diffstat (limited to 'tensorflow/core/grappler/costs/virtual_scheduler.cc')
-rw-r--r-- | tensorflow/core/grappler/costs/virtual_scheduler.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tensorflow/core/grappler/costs/virtual_scheduler.cc b/tensorflow/core/grappler/costs/virtual_scheduler.cc index 0e5c654acf..7f68272950 100644 --- a/tensorflow/core/grappler/costs/virtual_scheduler.cc +++ b/tensorflow/core/grappler/costs/virtual_scheduler.cc @@ -850,14 +850,16 @@ Costs VirtualScheduler::Summary() const { VLOG(1) << "Expected max per-op streaming buffers: " << graph_costs_.max_per_op_streaming; - VLOG(1) << "Per-op execution time:"; + VLOG(1) << "Per-op execution time / compute time / memory time:"; for (const auto& op_cost_pair : op_to_cost_) { const auto& op = op_cost_pair.first; const auto& cost = op_cost_pair.second.execution_time.count(); + const auto& compute_cost = op_cost_pair.second.compute_time.count(); + const auto& memory_cost = op_cost_pair.second.memory_time.count(); const bool is_op_cost_accurate = !op_cost_pair.second.inaccurate; if (cost) { // Skip printing out zero-cost ops. VLOG(1) << " + " << op << " : " << (is_op_cost_accurate ? "" : "~") - << cost; + << cost << " / " << compute_cost << " / " << memory_cost; } } @@ -898,7 +900,8 @@ Costs VirtualScheduler::Summary() const { << ", at the end: " << strings::HumanReadableNumBytes(state.memory_usage); - VLOG(1) << "Per-op execution time (and memory usage at peak memory usage):"; + VLOG(1) << "Per-op execution time compute time / memory time " + "(and memory usage at peak memory usage):"; // Profile non-persistent op memory usage. for (const auto& node_port : state.mem_usage_snapshot_at_peak) { @@ -912,6 +915,8 @@ Costs VirtualScheduler::Summary() const { for (const auto& op_cost_pair : state.op_to_cost) { const auto& op = op_cost_pair.first; const auto& cost = op_cost_pair.second.execution_time.count(); + const auto& compute_cost = op_cost_pair.second.compute_time.count(); + const auto& memory_cost = op_cost_pair.second.memory_time.count(); total_compute_time_ns += op_cost_pair.second.execution_time; const bool is_op_cost_accurate = !op_cost_pair.second.inaccurate; if (!is_op_cost_accurate) { @@ -930,8 +935,9 @@ Costs VirtualScheduler::Summary() const { if (cost || mem_usage_percent > 1.0) { // Print out only non-zero cost ops or ops with > 1% memory usage. VLOG(1) << " + " << op << " : " << (is_op_cost_accurate ? "" : "~") - << cost << " (" << strings::HumanReadableNumBytes(op_mem_usage) - << " [" << mem_usage_percent << "%] " + << cost << " / " << compute_cost << " / " << memory_cost << " (" + << strings::HumanReadableNumBytes(op_mem_usage) << " [" + << mem_usage_percent << "%] " << (persisent_ops.count(op) > 0 ? ": persistent op)" : ")"); } } |