From 6efcdb0a218285c1255e4cd5df231269a5ab0071 Mon Sep 17 00:00:00 2001 From: Alexey Ershov Date: Mon, 16 Nov 2020 18:03:19 +0300 Subject: [PATCH] [IE][VPU]: ExpGenerateProposals: added temporary buffer allocation (#3093) ExpGenerateProposals: temporary buffer allocation moved from firmware to blob * Added tmpBuffer * Changed the amount of allocated memory * firmware update Co-authored-by: Ivan Poliksenov --- inference-engine/cmake/vpu_dependencies.cmake | 2 +- .../src/stages/exp_generateproposals.cpp | 25 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/inference-engine/cmake/vpu_dependencies.cmake b/inference-engine/cmake/vpu_dependencies.cmake index d07481d..fcd49b7 100644 --- a/inference-engine/cmake/vpu_dependencies.cmake +++ b/inference-engine/cmake/vpu_dependencies.cmake @@ -19,7 +19,7 @@ set(VPU_SUPPORTED_FIRMWARES usb-ma2x8x pcie-ma248x) # Default packages # -set(FIRMWARE_PACKAGE_VERSION 1474) +set(FIRMWARE_PACKAGE_VERSION 1492) set(VPU_CLC_MA2X8X_VERSION "movi-cltools-20.09.2") # diff --git a/inference-engine/src/vpu/graph_transformer/src/stages/exp_generateproposals.cpp b/inference-engine/src/vpu/graph_transformer/src/stages/exp_generateproposals.cpp index 1c601ed..ea6e8c2 100644 --- a/inference-engine/src/vpu/graph_transformer/src/stages/exp_generateproposals.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/stages/exp_generateproposals.cpp @@ -60,6 +60,8 @@ private: for (auto& outputEdge : outputEdges()) { outputEdge->output()->serializeBuffer(serializer); } + + tempBuffer(0)->serializeBuffer(serializer); } }; @@ -129,6 +131,29 @@ void FrontEnd::parseExpGenerateProposals( outputs); stage->attrs().set("params", params); + + //This structure is needed to compute sizeProposalBuf. + //Since its outside the scope of the file, we write structure here + typedef struct { + int32_t idx; + fp16_t x0; + fp16_t y0; + fp16_t x1; + fp16_t y1; + fp16_t score; + } t_ExpGenerateProposalsProposal; + + const int ALIGN_VALUE = 64; + const int sizeProposalsBuf = sizeof(t_ExpGenerateProposalsProposal) * + inputScores->desc().dim(Dim::H) * + inputScores->desc().dim(Dim::W) * + inputScores->desc().dim(Dim::C) + ALIGN_VALUE; + const int sizeAuxBuf = sizeof(int8_t) * params.pre_nms_topn + ALIGN_VALUE; + const int sizeRoiIndicesBuf = sizeof(int32_t) * params.post_nms_topn + ALIGN_VALUE; + + int buffer_size = 2 * sizeProposalsBuf + sizeAuxBuf + sizeRoiIndicesBuf; + + model->addTempBuffer(stage, buffer_size); } } // namespace vpu -- 2.7.4