Skip to content

Commit

Permalink
Clear caches on jax exit.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 681529928
  • Loading branch information
BrianWieder authored and Google-ML-Automation committed Oct 2, 2024
1 parent c88b612 commit 6b2237c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion xla/python/pjit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ class PjitFunctionCache {

int Size() const { return lru_list_.Size(); }
int Capacity() const { return lru_list_.Capacity(); }
void Clear() { lru_list_.Clear(); }
void Clear() {
lru_list_.Clear();
functions_.clear();
}

private:
struct Key {
Expand Down Expand Up @@ -347,6 +350,7 @@ class PjitFunctionStore {
for (auto* function : compiled_functions_) {
function->ClearCache();
}
compiled_functions_.clear();
}

private:
Expand Down

0 comments on commit 6b2237c

Please sign in to comment.