mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-13 18:03: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)) {}
|
: evaluator(expr, thread_pool), on_done(std::move(done)) {}
|
||||||
|
|
||||||
~TensorAsyncExecutorContext() {
|
~TensorAsyncExecutorContext() {
|
||||||
on_done();
|
|
||||||
evaluator.cleanup();
|
evaluator.cleanup();
|
||||||
|
on_done();
|
||||||
}
|
}
|
||||||
|
|
||||||
Evaluator evaluator;
|
Evaluator evaluator;
|
||||||
@ -674,9 +674,9 @@ class TensorAsyncExecutor<Expression, ThreadPoolDevice, DoneCallback,
|
|||||||
on_done(std::move(done)) {}
|
on_done(std::move(done)) {}
|
||||||
|
|
||||||
~TensorAsyncExecutorContext() {
|
~TensorAsyncExecutorContext() {
|
||||||
on_done();
|
|
||||||
device.deallocate(tiling.buffer);
|
device.deallocate(tiling.buffer);
|
||||||
evaluator.cleanup();
|
evaluator.cleanup();
|
||||||
|
on_done();
|
||||||
}
|
}
|
||||||
|
|
||||||
const ThreadPoolDevice& device;
|
const ThreadPoolDevice& device;
|
||||||
@ -755,9 +755,9 @@ class TensorAsyncExecutor<Expression, ThreadPoolDevice, DoneCallback,
|
|||||||
on_done(std::move(done)) {}
|
on_done(std::move(done)) {}
|
||||||
|
|
||||||
~TensorAsyncExecutorContext() {
|
~TensorAsyncExecutorContext() {
|
||||||
on_done();
|
|
||||||
device.deallocate(tiling.buffer);
|
device.deallocate(tiling.buffer);
|
||||||
evaluator.cleanup();
|
evaluator.cleanup();
|
||||||
|
on_done();
|
||||||
}
|
}
|
||||||
|
|
||||||
const ThreadPoolDevice& device;
|
const ThreadPoolDevice& device;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user