Skip to content

Commit 77b7a23

Browse files
committed
Update base for Update on "update cuda delegate resource free pipeline for safety and segfault-free"
This diff survives `clear_all_tensors()` function and enable it during backend destroy stage. Furthermore, we defer the container handle deletion to OS to avoid potential segfault if there's more than one .so files. Differential Revision: [D84135792](https://our.internmc.facebook.com/intern/diff/D84135792/) [ghstack-poisoned]
1 parent 59a20ff commit 77b7a23

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

backends/cuda/runtime/cuda_backend.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,12 @@ class ET_EXPERIMENTAL CudaBackend final
337337
// Remove the temporary shared library file
338338
if (!handle->so_path.empty()) {
339339
std::error_code remove_error;
340+
std::filesystem::remove(handle->so_path, remove_error);
340341
ET_CHECK_OR_LOG(
341342
!remove_error,
342343
"Failed to remove temporary shared library %s: %s",
343344
handle->so_path.c_str(),
344-
remove_error.message().c_str())
345+
remove_error.message().c_str());
345346
}
346347

347348
delete handle;

0 commit comments

Comments
 (0)