Skip to content

Commit 5c57ced

Browse files
hl475facebook-github-bot
authored andcommitted
change the location of wipe cache (pytorch#24454)
Summary: Pull Request resolved: pytorch#24454 We want to change the place of wipe_cache. From what we observed, the original place does not help. Reviewed By: mingzhe09088 Differential Revision: D16853205 fbshipit-source-id: 1f6224a52433cbe15c0d27000b4ac140fb9cd4c3
1 parent 0b3a63b commit 5c57ced

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

benchmarks/operator_benchmark/benchmark_core.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ def _measure_time(self, launch_test, test_case, iters):
171171
"""
172172
curr_test_total_time = 0
173173
while True:
174+
# Wipe cache
175+
if self.args.wipe_cache:
176+
torch.ops.operator_benchmark._clear_cache()
177+
174178
run_time_sec = launch_test(test_case, iters)
175179
curr_test_total_time += run_time_sec
176180
# Analyze time after each run to decide if the result is stable
@@ -244,9 +248,6 @@ def run(self):
244248
else:
245249
launch_func = self._launch_forward
246250

247-
if self.args.wipe_cache:
248-
torch.ops.operator_benchmark._clear_cache()
249-
250251
# Warmup
251252
launch_func(test_case, self.args.warmup_iterations)
252253
# Actual Execution

0 commit comments

Comments
 (0)