From 6fb98972cc65992f4322d908ac6d7aaf8a887d1d Mon Sep 17 00:00:00 2001 From: Zhang Hao Date: Tue, 28 Apr 2020 12:20:21 +0800 Subject: [PATCH] bugfix: explicitly specify acc dep distance to avoid hidden pitfall --- config/pkg_config.py | 5 +++++ config/vta_config.json | 3 ++- hardware/xilinx/src/vta.cc | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config/pkg_config.py b/config/pkg_config.py index 9c57706e..abd99af3 100644 --- a/config/pkg_config.py +++ b/config/pkg_config.py @@ -60,6 +60,7 @@ class PkgConfig(object): "LOG_INP_BUFF_SIZE", "LOG_WGT_BUFF_SIZE", "LOG_ACC_BUFF_SIZE", + "ACC_DEP_DISTANCE", ] def __init__(self, cfg): @@ -73,6 +74,10 @@ def __init__(self, cfg): cfg["LOG_OUT_WIDTH"] - cfg["LOG_ACC_WIDTH"]) + # export VTA_ACC_DEP_DISTANCE env so that VTA runtime can use it to VerifyDep + if "ACC_DEP_DISTANCE" in cfg: + os.environ['VTA_ACC_DEP_DISTANCE'] = str(cfg['ACC_DEP_DISTANCE']) + # Update cfg now that we've extended it self.__dict__.update(cfg) diff --git a/config/vta_config.json b/config/vta_config.json index 0591bb48..a2fb1225 100644 --- a/config/vta_config.json +++ b/config/vta_config.json @@ -9,5 +9,6 @@ "LOG_UOP_BUFF_SIZE" : 15, "LOG_INP_BUFF_SIZE" : 15, "LOG_WGT_BUFF_SIZE" : 18, - "LOG_ACC_BUFF_SIZE" : 17 + "LOG_ACC_BUFF_SIZE" : 17, + "ACC_DEP_DISTANCE" : 3 } diff --git a/hardware/xilinx/src/vta.cc b/hardware/xilinx/src/vta.cc index 11ababf1..4521d684 100644 --- a/hardware/xilinx/src/vta.cc +++ b/hardware/xilinx/src/vta.cc @@ -447,7 +447,11 @@ PRAGMA_HLS(HLS INTERFACE s_axilite port = done bundle = CONTROL_BUS offset = VTA static bus_T acc_mem[VTA_ACC_BUFF_DEPTH][ACC_MAT_AXI_RATIO]; #pragma HLS ARRAY_RESHAPE variable = acc_mem complete dim=2 // This is necessary to obtain II=1 +#ifdef VTA_ACC_DEP_DISTANCE +#pragma HLS DEPENDENCE variable = acc_mem inter distance=VTA_ACC_DEP_DISTANCE true +#else #pragma HLS DEPENDENCE variable = acc_mem inter false +#endif // Pop GEMM instruction insn_T raw_insn = gemm_queue.read();