From 7746a3a7ab041334a5284cb706990e0766244118 Mon Sep 17 00:00:00 2001 From: Vadim Gimpelson <156319763+vadiklyutiy@users.noreply.github.com> Date: Thu, 1 Aug 2024 04:48:16 +0400 Subject: [PATCH] [DEBUG] Save `Task` pickle in translations cache (#380) Save `Task` pickle in the translations cache. The reason - it is very convenient during performance analysis to get smaller test case. Supporting scripts will come soon --- python/hidet/drivers/build_task.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python/hidet/drivers/build_task.py b/python/hidet/drivers/build_task.py index c24f69c26..6a5f9d960 100644 --- a/python/hidet/drivers/build_task.py +++ b/python/hidet/drivers/build_task.py @@ -270,7 +270,11 @@ def build_task(task: Task, target='cuda', load=True) -> Optional[CompiledTask]: # write task with open(os.path.join(task_dir, 'task.txt'), 'w') as f: f.write(task_string) - + try: + hidet.save_task(task, os.path.join(task_dir, 'task.pickle')) + except Exception as e: # pylint: disable=broad-except, unused-variable + # Some object can not be serialized with pickle. Just ignore them. + pass # write version with open(version_path, 'w') as f: f.write(hidet.__version__)