aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h
diff options
context:
space:
mode:
authorGravatar Rasmus Munk Larsen <rmlarsen@google.com>2017-09-08 16:35:58 -0700
committerGravatar Rasmus Munk Larsen <rmlarsen@google.com>2017-09-08 16:35:58 -0700
commit1b7294f6fc5661ef196acf95f0eafa3242939be1 (patch)
tree7450be8bfc931f8fc7be00db74471698547b7527 /unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h
parent94e2213b3823ec1141077a7a7cc4f0b0af11876b (diff)
Fix cut-and-paste error.
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h')
-rw-r--r--unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h b/unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h
index ac6717977..b148dae39 100644
--- a/unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h
+++ b/unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h
@@ -174,6 +174,7 @@ class TensorCostModel {
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE int numThreads(
double output_size, const TensorOpCost& cost_per_coeff, int max_threads) {
double cost = totalCost(output_size, cost_per_coeff);
+ double threads = (cost - kStartupCycles) / kPerThreadCycles + 0.9;
// Make sure we don't invoke undefined behavior when we convert to an int.
threads = numext::mini<double>(threads, GenericNumTraits<int>::highest());
return numext::mini(max_threads, numext::maxi<int>(1, threads));