File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,9 @@ Template of `LocalPreferences.toml` with all options:
136
136
137
137
```toml
138
138
[AMDGPU]
139
+ # If `true` (default), eagerly run GC to keep the pool from growing too big.
140
+ # GC is triggered during new allocatoins or synchronization points.
141
+ eager_gc = false
139
142
# If `true` then use ROCm libraries provided by artifacts.
140
143
# However, not all ROCm libraries are available as artifacts.
141
144
use_artifacts = false
Original file line number Diff line number Diff line change @@ -110,7 +110,16 @@ function account!(stats::MemoryStats, bytes::Integer)
110
110
Base. @atomic stats. live += bytes
111
111
end
112
112
113
+ const EAGER_GC:: Ref{Bool} = Ref {Bool} (@load_preference (" eager_gc" , true ))
114
+
115
+ function eager_gc! (flag:: Bool )
116
+ global EAGER_GC[] = flag
117
+ @set_preferences! (" eager_gc" => flag)
118
+ end
119
+
113
120
function maybe_collect (; blocking:: Bool = false )
121
+ EAGER_GC[] || return
122
+
114
123
stats = memory_stats ()
115
124
current_time = time ()
116
125
You can’t perform that action at this time.
0 commit comments