[IE][VPU]: ExpGenerateProposals: added temporary buffer allocation (#3093)
authorAlexey Ershov <alexey.ershov@intel.com>
Mon, 16 Nov 2020 15:03:19 +0000 (18:03 +0300)
committerGitHub <noreply@github.com>
Mon, 16 Nov 2020 15:03:19 +0000 (18:03 +0300)
ExpGenerateProposals: temporary buffer allocation moved from firmware to blob
* Added tmpBuffer
* Changed the amount of allocated memory
* firmware update

Co-authored-by: Ivan Poliksenov <ivan.poliksenov@intel.com>
inference-engine/cmake/vpu_dependencies.cmake
inference-engine/src/vpu/graph_transformer/src/stages/exp_generateproposals.cpp

index d07481d..fcd49b7 100644 (file)
@@ -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")
 
 #
index 1c601ed..ea6e8c2 100644 (file)
@@ -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