diff options
author | Rasmus Munk Larsen <rmlarsen@google.com> | 2019-11-11 12:26:41 -0800 |
---|---|---|
committer | Rasmus Munk Larsen <rmlarsen@google.com> | 2019-11-11 12:26:41 -0800 |
commit | 0ed0338593c2423503de4cd12575a6e47a6e95d1 (patch) | |
tree | 722bd9b869e326da20a8159f50636efeda0f8758 /unsupported | |
parent | c952b8dfda1cc161ae8e06c151a3323826e3ddad (diff) |
Fix a race in async tensor evaluation: Don't run on_done() until after device.deallocate() / evaluator.cleanup() complete, since the device might be destroyed after on_done() runs.
Diffstat (limited to 'unsupported')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h b/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h index 4f72156a4..0fb0a9227 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h @@ -592,8 +592,8 @@ class TensorAsyncExecutor<Expression, ThreadPoolDevice, DoneCallback, : evaluator(expr, thread_pool), on_done(std::move(done)) {} ~TensorAsyncExecutorContext() { - on_done(); evaluator.cleanup(); + on_done(); } Evaluator evaluator; @@ -674,9 +674,9 @@ class TensorAsyncExecutor<Expression, ThreadPoolDevice, DoneCallback, on_done(std::move(done)) {} ~TensorAsyncExecutorContext() { - on_done(); device.deallocate(tiling.buffer); evaluator.cleanup(); + on_done(); } const ThreadPoolDevice& device; @@ -755,9 +755,9 @@ class TensorAsyncExecutor<Expression, ThreadPoolDevice, DoneCallback, on_done(std::move(done)) {} ~TensorAsyncExecutorContext() { - on_done(); device.deallocate(tiling.buffer); evaluator.cleanup(); + on_done(); } const ThreadPoolDevice& device; |