From a49bf57e265b5fa19c5ec2ee03c7e5ce7832cd18 Mon Sep 17 00:00:00 2001 From: huajsj Date: Fri, 17 May 2019 21:00:54 -0700 Subject: [PATCH] =?UTF-8?q?[BugFix][VTA]=20Fix=20vta=5Fconv2d=20crash=20is?= =?UTF-8?q?sue=20after=20change=20vta=5Fconfig.json=20configuration.=20Iss?= =?UTF-8?q?ue:=20Once=20change=20LOG=5FBLOCK=5FIN=20or=20LOG=5FBLOCK=5FOUT?= =?UTF-8?q?=20into=20>=204=20value,=20when=20run=20vta=20=E2=80=9CSimple?= =?UTF-8?q?=20Matrix=20Multiply=E2=80=9D=20or=20load=20vta,=20vta=20would?= =?UTF-8?q?=20crash=20at=20vta=5Fconv2d.py.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Analysis: This issue caused by resnet18 logic of vta_conv2d.py which have in_filter minmum size that is 16. > 4 value would cause such in_filter check failed then make xfer_size be empty and find_schedules function return a empty list finally cause crash. Solution: add the empty list check. --- vta/python/vta/top/vta_conv2d.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/vta/python/vta/top/vta_conv2d.py b/vta/python/vta/top/vta_conv2d.py index 0a94ccc2fb7c..ef4f2017381a 100644 --- a/vta/python/vta/top/vta_conv2d.py +++ b/vta/python/vta/top/vta_conv2d.py @@ -165,7 +165,7 @@ def _get_data_movement_byte(schedule, layer): fil_sched.append(schedule) xfer_size.append(_get_data_movement_byte(schedule, layer)) - if best_only: + if best_only and xfer_size: return [fil_sched[xfer_size.index(min(xfer_size))]] return fil_sched @@ -501,5 +501,10 @@ def __str__(self): } for idx in RESNET: - scheds = find_schedules(RESNET[idx], vt_only=True, best_only=True)[0] - _WL2PLAN[RESNET[idx]] = scheds + f_schedules = find_schedules(RESNET[idx], vt_only=True, best_only=True) + if f_schedules: + scheds = f_schedules[0] + _WL2PLAN[RESNET[idx]] = scheds + else: + logging.warning("No valid schedule was found for the workload on current vta configuration") + break