[EMUL] Support simulator cmd changes
authorJiho Chu <jiho.chu@samsung.com>
Thu, 15 Dec 2022 04:49:35 +0000 (13:49 +0900)
committer추지호/NPU Lab(SR)/삼성전자 <jiho.chu@samsung.com>
Thu, 15 Dec 2022 07:26:00 +0000 (16:26 +0900)
This patch is for cmd path changes.

After (triv23-sim >= 1.1.2, triv24-sim >= 1.2.1), cmd file path is
changed to "triv-[major]-[minor]-[extra].cmd".

Signed-off-by: Jiho Chu <jiho.chu@samsung.com>
src/core/npu/NPUdrvAPI_emul.cc

index fd116ad2d3555eea73f0b382f3e9cd9eba3a6c56..5891701272bbc06832bb67be9fc0c47badcf0b1c 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include "NPUdrvAPI.h"
+#include <bits/stdint-uintn.h>
 #include <string.h>
 #include <assert.h>
 #include <atomic>
@@ -753,24 +754,27 @@ TrinityEmulAPI::runInput (input_config_t *input_config) const {
       delete[] segt;
     } else {
       std::string cmd_path (prefix_share_);
-      if (NPU_VERSION_MINOR (elem_model->getNpuVersion ()) == 3) {
-        if (elem_model->getNpuTops () == 2)
-          cmd_path += "/mRPsim/triv-3.9.1_2tops.cmd";
-        else
-          cmd_path += "/mRPsim/triv-3.9.1.cmd";
-      } else if (NPU_VERSION_MINOR (elem_model->getNpuVersion ()) == 4) {
-        cmd_path += "/mRPsim/triv24-latest.cmd";
-      } else {
-        logerr (TAG, "Invalid model version: minor(%d)(%d)\n", model->version,
-                NPU_VERSION_MINOR (model->version));
-        delete[] segt;
-        delete req;
-        return -EINVAL;
-      }
+      cmd_path += "/mRPsim/triv-";
+
+      uint64_t version = elem_model->getNpuVersion ();
+      uint64_t major = NPU_VERSION_MAJOR (version);
+      uint64_t minor = NPU_VERSION_MINOR (version);
+      uint64_t extra = NPU_VERSION_EXTRA (version);
+      uint64_t tops = NPU_VERSION_TOPS (version);
+
+      cmd_path +=
+          std::to_string (major) + "." + std::to_string (minor) + "." + std::to_string (extra);
+
+      if (minor == 3 && tops == 2)
+        cmd_path += "_2tops";
+
+      cmd_path += ".cmd";
 
       std::string prof_path (prefix_profile_);
       prof_path += "/ne_profile_" + std::to_string (getpid ());
 
+      loginfo (TAG, "cmd_path: %s, prof_path: %s", cmd_path.c_str (), prof_path.c_str ());
+
       if (createDirectory (prof_path)) {
         prof_path += "/req_id_" + std::to_string (req_id);
         status = req->run_emul (prog, segt, static_cast<char *> (elem_metadata->getAddr ()),