[Core/NPU/Emul] Add skeleton code for ReLU, AVGP, CONVE, TCNV, TCNVE
authorWook Song <wook16.song@samsung.com>
Fri, 15 Nov 2019 05:17:19 +0000 (14:17 +0900)
committer채동주/On-Device Lab(SR)/Staff Engineer/삼성전자 <dongju.chae@samsung.com>
Tue, 19 Nov 2019 03:03:24 +0000 (12:03 +0900)
This patch adds skeleton code for running operators, ReLU, AVGP, CONVE,
TCNV, and TCNVE, in the test mode.

Signed-off-by: Wook Song <wook16.song@samsung.com>
src/core/npu/NPUemul.cpp

index 6fa578c..e9a3bc4 100644 (file)
@@ -210,6 +210,67 @@ class NPUCoreEmul : public TrinityCore<64>, public DataGen {
       PC += sizeof(conv_fields);
     }
 
+    /** @brief run ReLU op */
+    void run_relu_op (TRINITY_CORE_PARA_OP& op) {
+      relu_fields relu;
+
+      memcpy(&relu, PC, sizeof(relu));
+
+      /* TODO: Fill here */
+
+      PC += sizeof(relu);
+    }
+
+    /** @brief run AVGP (average pooling) op */
+    void run_avgp_op (TRINITY_CORE_PARA_OP& op) {
+      avgp_fields avgp;
+
+      memcpy(&avgp, PC, sizeof(avgp));
+
+      /* TODO: Fill here */
+
+      PC += sizeof(avgp);
+    }
+
+    /** @brief run CONVE (convolution and elementwise sum) op */
+    void run_conve_op (TRINITY_CORE_PARA_OP& op) {
+      conve_fields conve;
+
+      memcpy(&conve, PC, sizeof(conve));
+
+      /* TODO: Fill here */
+
+      PC += sizeof(conve);
+    }
+
+    /**
+     * @brief run TCONV (transposed convolution) op
+     * @note this instruction is not supported yet
+     */
+    void run_tcnv_op (TRINITY_CORE_PARA_OP& op) {
+      tcnv_fields tcnv;
+
+      memcpy(&tcnv, PC, sizeof(tcnv));
+
+      /* TODO: Fill here */
+
+      PC += sizeof(tcnv);
+    }
+
+    /**
+     * @brief run TCONVE (transposed convolution and elementwise sum) op
+     * @note this instruction is not supported yet
+     */
+    void run_tcnve_op (TRINITY_CORE_PARA_OP& op) {
+      tcnve_fields tcnve;
+
+      memcpy(&tcnve, PC, sizeof(tcnve));
+
+      /* TODO: Fill here */
+
+      PC += sizeof(tcnve);
+    }
+
     /** @brief allocate data for emulation */
     bool alloc_trinity_data (TRINITY_CORE_PARA_OP& op,
         int32_t in0_eaddr, int32_t in1_eaddr, int32_t wgt_eaddr) {