From b5054395aad981cde947cb47447cf17426a253ee Mon Sep 17 00:00:00 2001 From: Hua Jiang Date: Wed, 19 Jun 2019 20:23:50 -0700 Subject: [PATCH] [VTA] Fix VTA function Vivado Compile Error. (#3375) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: when using vivado compile vta.cc with top function 'vta', vivado report deadlock error like '...with default size is used in a non -dataflow region, which may result in deadlock Please consider to resize the stream using the directive ‘set_directive_stream’ or the ‘HL S stream’ pragma.' Solution: give the queue a default size as 8. --- vta/hardware/xilinx/src/vta.cc | 10 ++++++++++ vta/hardware/xilinx/src/vta.h | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/vta/hardware/xilinx/src/vta.cc b/vta/hardware/xilinx/src/vta.cc index da8ea7435a90..cb6b7b76cd11 100644 --- a/vta/hardware/xilinx/src/vta.cc +++ b/vta/hardware/xilinx/src/vta.cc @@ -586,19 +586,29 @@ void vta( // Instantiate temporary instruction queues (used for peeking) hls::stream tmp_load_queue; + PRAGMA_HLS(HLS stream depth=STREAM_IN_DEPTH variable=tmp_load_queue) hls::stream tmp_gemm_queue; + PRAGMA_HLS(HLS stream depth=STREAM_IN_DEPTH variable=tmp_gemm_queue) hls::stream tmp_store_queue; + PRAGMA_HLS(HLS stream depth=STREAM_IN_DEPTH variable=tmp_store_queue) // Instatiate physical instruction queues hls::stream load_queue; + PRAGMA_HLS(HLS stream depth=STREAM_IN_DEPTH variable=load_queue) hls::stream gemm_queue; + PRAGMA_HLS(HLS stream depth=STREAM_IN_DEPTH variable=gemm_queue) hls::stream store_queue; + PRAGMA_HLS(HLS stream depth=STREAM_IN_DEPTH variable=store_queue) // Dependence queues hls::stream l2g_dep_queue; + PRAGMA_HLS(HLS stream depth=STREAM_IN_DEPTH variable=l2g_dep_queue) hls::stream s2g_dep_queue; + PRAGMA_HLS(HLS stream depth=STREAM_IN_DEPTH variable=s2g_dep_queue) hls::stream g2l_dep_queue; + PRAGMA_HLS(HLS stream depth=STREAM_IN_DEPTH variable=g2s_dep_queue) hls::stream g2s_dep_queue; + PRAGMA_HLS(HLS stream depth=STREAM_IN_DEPTH variable=g2s_dep_queue) // Instantiate memories inp_vec_T inp_mem[VTA_INP_BUFF_DEPTH][VTA_BATCH]; diff --git a/vta/hardware/xilinx/src/vta.h b/vta/hardware/xilinx/src/vta.h index 6480debbe4f9..1395d5eaba8e 100644 --- a/vta/hardware/xilinx/src/vta.h +++ b/vta/hardware/xilinx/src/vta.h @@ -113,6 +113,13 @@ typedef ap_int aluop_imm_T; /* \typedef aluop_opcode_T ALU operation shift immediate datatype*/ typedef ap_int aluop_sh_imm_T; +/*! +* Define HLS stream depth +*/ +#define PRAGMA_SUB(x) _Pragma (#x) +#define PRAGMA_HLS(x) PRAGMA_SUB(x) +#define STREAM_IN_DEPTH 8 + /*! * \brief Fetch module. * Reads in \a insn_count instructions via DMA and pushes them to the