@@ -184,6 +184,7 @@ function benchmark_rules!!(test_case_data, default_ratios, include_other_framewo
184
184
# Benchmark primal.
185
185
@info " Primal"
186
186
primals = map (x -> x isa CoDual ? primal (x) : x, args)
187
+ include_other_frameworks && GC. gc (true )
187
188
suite[" primal" ] = Chairmarks. benchmark (
188
189
() -> primals,
189
190
primals -> (primals[1 ], _deepcopy (primals[2 : end ])),
@@ -197,6 +198,7 @@ function benchmark_rules!!(test_case_data, default_ratios, include_other_framewo
197
198
rule = Mooncake. build_rrule (args... )
198
199
coduals = map (x -> x isa CoDual ? x : zero_codual (x), args)
199
200
to_benchmark (rule, coduals... )
201
+ include_other_frameworks && GC. gc (true )
200
202
suite[" mooncake" ] = Chairmarks. benchmark (
201
203
() -> (rule, coduals),
202
204
identity,
@@ -208,6 +210,7 @@ function benchmark_rules!!(test_case_data, default_ratios, include_other_framewo
208
210
if include_other_frameworks
209
211
if should_run_benchmark (Val (:zygote ), args... )
210
212
@info " Zygote"
213
+ GC. gc (true )
211
214
suite[" zygote" ] = @be (
212
215
_,
213
216
_,
@@ -222,6 +225,7 @@ function benchmark_rules!!(test_case_data, default_ratios, include_other_framewo
222
225
tape = ReverseDiff. GradientTape (primals[1 ], primals[2 : end ])
223
226
compiled_tape = ReverseDiff. compile (tape)
224
227
result = map (x -> randn (size (x)), primals[2 : end ])
228
+ GC. gc (true )
225
229
suite[" rd" ] = @be (
226
230
_,
227
231
_,
@@ -235,6 +239,7 @@ function benchmark_rules!!(test_case_data, default_ratios, include_other_framewo
235
239
@info " Enzyme"
236
240
_rand_similiar (x) = x isa Real ? randn () : randn (size (x))
237
241
dup_args = map (x -> Duplicated (x, _rand_similiar (x)), primals[2 : end ])
242
+ GC. gc (true )
238
243
suite[" enzyme" ] = @be (
239
244
_,
240
245
_,
0 commit comments