mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-13 09:53:13 +08:00
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.
This commit is contained in:
parent
c952b8dfda
commit
0ed0338593
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user