diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2017-07-21 14:07:14 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-07-21 14:11:06 -0700 |
commit | 74057361032bc4d9a9fbfced1f433b06c06c09ec (patch) | |
tree | bf6453e743bcd002619166a525bcf9907388b1e1 /tensorflow/core/grappler/costs/op_level_cost_estimator.cc | |
parent | 51cbb58ca5147218b3995dc124bd92927d93e913 (diff) |
Add option to use compute_memory_overlap; if true, use max of memory_cost and compute_cost, instead of sum for op level cost in analytical cost estimator.
PiperOrigin-RevId: 162782658
Diffstat (limited to 'tensorflow/core/grappler/costs/op_level_cost_estimator.cc')
-rw-r--r-- | tensorflow/core/grappler/costs/op_level_cost_estimator.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tensorflow/core/grappler/costs/op_level_cost_estimator.cc b/tensorflow/core/grappler/costs/op_level_cost_estimator.cc index 5148a4b99e..f13b426b3c 100644 --- a/tensorflow/core/grappler/costs/op_level_cost_estimator.cc +++ b/tensorflow/core/grappler/costs/op_level_cost_estimator.cc @@ -268,6 +268,9 @@ OpLevelCostEstimator::OpLevelCostEstimator() { Eigen::internal::scalar_quotient_op<float>>::Cost}, {"TruncateMod", Eigen::internal::functor_traits< Eigen::internal::scalar_mod_op<float>>::Cost}}; + + // By default, use sum of memory_time and compute_time for execution_time. + compute_memory_overlap_ = false; } Costs OpLevelCostEstimator::PredictCosts(const OpInfo& op_features) const { @@ -395,7 +398,11 @@ Costs OpLevelCostEstimator::PredictOpCountBasedCost( Costs costs; costs.compute_time = compute_cost; costs.memory_time = memory_cost; - costs.execution_time = compute_cost + memory_cost; + if (compute_memory_overlap_) { + costs.execution_time = std::max(compute_cost, memory_cost); + } else { + costs.execution_time = compute_cost + memory_cost; + } costs.inaccurate = found_unknown_shapes; return costs; } |