From 1b7294f6fc5661ef196acf95f0eafa3242939be1 Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Fri, 8 Sep 2017 16:35:58 -0700 Subject: Fix cut-and-paste error. --- unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h | 1 + 1 file changed, 1 insertion(+) (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h') 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(threads, GenericNumTraits::highest()); return numext::mini(max_threads, numext::maxi(1, threads)); -- cgit v1.2.3