From a395fb1bc51bc2606ed2c7d749b75d3dd774735a Mon Sep 17 00:00:00 2001 From: Yaoyao Ding Date: Thu, 3 Aug 2023 03:49:42 +0800 Subject: [PATCH] [Fixbug] Clear the intermediate object files for kernel tuning (#339) This PR clears the intermediate object files generated during tuning. This should reduce 2/3 cache size without hurting any functionality. #338 --- python/hidet/drivers/build_task.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/hidet/drivers/build_task.py b/python/hidet/drivers/build_task.py index 32a3786ff..1f18b5a8f 100644 --- a/python/hidet/drivers/build_task.py +++ b/python/hidet/drivers/build_task.py @@ -13,6 +13,7 @@ import re import os import json +import shutil from hashlib import sha256 from typing import List, Optional, Tuple @@ -162,6 +163,10 @@ def launch(arg: meta.types(param_types)): # build task ir module build_ir_module(ir_module=task_ir_module, output_dir=task_dir, output_kind='.so', target=target) + # clear the candidate object files that are no longer needed + if not hidet.option.get_option('debug_cache_tuning'): + shutil.rmtree(os.path.join(task_dir, 'candidates'), ignore_errors=True) + def generate_meta_data(task: Task, task_dir: str, build_target: str, num_candidates: int): from hidet.ir.compute import TensorNode