There was an error while loading. Please reload this page.
1 parent 846d176 commit 1038679Copy full SHA for 1038679
1 file changed
python/src/transforms.cpp
@@ -1538,4 +1538,11 @@ void init_transforms(nb::module_& m) {
1538
A callable that recomputes intermediate states during gradient
1539
computation.
1540
)pbdoc");
1541
+
1542
+ // Clean up main thread compile cache before python interpreter shuts down.
1543
+ auto atexit = nb::module_::import_("atexit");
1544
+ atexit.attr("register")(
1545
+ nb::cpp_function([cache = mx::detail::compile_cache()]() {
1546
+ mx::detail::compile_clear_cache(cache);
1547
+ }));
1548
}
0 commit comments