Skip to content

Commit 59bcfba

Browse files
authored
Fix segfaults from fusion panics with simple workaround (#3777)
1 parent 5fecb44 commit 59bcfba

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

crates/burn-fusion/src/tensor.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ impl<R: FusionRuntime> Drop for FusionTensor<R> {
187187
fn drop(&mut self) {
188188
let count = self.count.fetch_sub(1, Ordering::Relaxed);
189189

190+
// Workaround to prevent segfaults when an operation panics
191+
if std::thread::panicking() {
192+
return;
193+
}
194+
190195
match self.status(count) {
191196
TensorStatus::ReadWrite => {
192197
let mut shape = Vec::new();

0 commit comments

Comments
 (0)