diff options
author | Eugene Zhulenev <ezhulenev@google.com> | 2018-07-16 14:26:39 -0700 |
---|---|---|
committer | Eugene Zhulenev <ezhulenev@google.com> | 2018-07-16 14:26:39 -0700 |
commit | 6e654f33794df0b329160d011e6d3ec035e679ae (patch) | |
tree | b6c02b97b4261a4d45c32cb2b8632591f48d32dc /unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h | |
parent | 7ccb623746ea36013689dbdf61f6ce50948e6c29 (diff) |
Reduce number of allocations in TensorContractionThreadPool.
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h b/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h index c774d15e2..8b86d7aaf 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h @@ -598,11 +598,13 @@ struct TensorEvaluator<const TensorContractionOp<Indices, LeftArgType, RightArgT else pack_lhs(start, k); } else { - Index mid = (start + end) / 2; - device_.enqueueNoNotification( - [=]() { enqueue_packing_helper(mid, end, k, rhs); }); - device_.enqueueNoNotification( - [=]() { enqueue_packing_helper(start, mid, k, rhs); }); + while (end - start > 1) { + Index mid = (start + end) / 2; + device_.enqueueNoNotification( + [=]() { enqueue_packing_helper(mid, end, k, rhs); }); + end = mid; + } + enqueue_packing_helper(start, end, k, rhs); } } |