Add device type for triv2.4
authorJiho Chu <jiho.chu@samsung.com>
Mon, 27 Feb 2023 05:38:24 +0000 (14:38 +0900)
committer추지호/NPU Lab(SR)/삼성전자 <jiho.chu@samsung.com>
Tue, 7 Mar 2023 00:45:20 +0000 (09:45 +0900)
It divides device type for trinity 2.3 and 2.4.
And it declared device group and device version for the future use.

Signed-off-by: Jiho Chu <jiho.chu@samsung.com>
include/common/typedef.h
src/core/ne-handler.h
src/core/npu/NPUdrvAPI_emul.cc

index fde7446d8ef378c9abbd50c48eab34db8cfdf88a..1b4abb39010f6feccf8e06ba32dc909849facc96 100644 (file)
 #define DEVICETYPE_TRIV2 (0x40000) /** VD/SR-NPU 2020 */
 /** TODO: there will be other device variants */
 #define DEVICETYPE_MASK (0xFFFF0000)
+#define DEVICEGROUP_MASK (0x0000FF00)
+#define DEVICEVERSION_MASK (0x000000FF)
+
+#define DEVICEGROUP_SOCIP (0x00000100)
 
 /**
  * @brief Represents an "opened" single NPU device (e.g., TRIV2).
@@ -36,12 +40,17 @@ typedef void *npudev_h;
 
 /**
  * @brief Description of npu device types.
+ * @note The enum format is
+ *        0b|0000 0000|0000 0000|
+ *        0b|dev group| version |
  */
 typedef enum {
   NPUCOND_CONN_UNKNOWN = DEVICETYPE_TRIV2,
   /* TRIV2 */
-  NPUCOND_TRIV2_CONN_UNKNOWN = (DEVICETYPE_TRIV2 | 0),
-  NPUCOND_TRIV2_CONN_SOCIP = (DEVICETYPE_TRIV2 | 2),
+  NPUCOND_TRIV2_CONN_UNKNOWN = (DEVICETYPE_TRIV2 | 3),
+  NPUCOND_TRIV2_CONN_SOCIP = (NPUCOND_TRIV2_CONN_UNKNOWN | DEVICEGROUP_SOCIP),
+  NPUCOND_TRIV24_CONN_UNKNOWN = (DEVICETYPE_TRIV2 | 4),
+  NPUCOND_TRIV24_CONN_SOCIP = (NPUCOND_TRIV24_CONN_UNKNOWN | DEVICEGROUP_SOCIP),
   /* deprecated */
   NPUCOND_TRIV_CONN_UNKNOWN = (DEVICETYPE_TRIV | 0),
   NPUCOND_TRIV_CONN_SOCIP = (DEVICETYPE_TRIV | 2),
index 3e44f7b9713ccd3d069122ba1da263094e4f8c14..17d509f8d1fad89fec3d4d25726150a65750e68f 100644 (file)
@@ -180,7 +180,7 @@ class Device {
 /** @brief Trinity Vision2 (TRIV2) class */
 class TrinityVision2 : public Device {
  public:
-  TrinityVision2 (int id) : Device (NPUCOND_TRIV2_CONN_SOCIP, id) {}
+  TrinityVision2 (int id) : Device (NPUCOND_TRIV23_CONN_SOCIP, id) {}
   ~TrinityVision2 () {}
 
   static size_t manipulateData (const Model *model, uint32_t idx, bool is_input, void *dst,
index 5891701272bbc06832bb67be9fc0c47badcf0b1c..d25bfcc02389b0ad857b350e3fc6f6930691e347 100644 (file)
@@ -26,8 +26,9 @@
 #include <iostream>
 
 #define TAG _N94
-#define MAX_EMUL_DEVICES (3)
-#define DEFAULT_DSPM_SIZE (128 * 1024) /* 128 KiB */
+#define MAX_EMUL_DEVICES (4)
+#define TRIV23_DEFAULT_DSPM_SIZE (128 * 1024) /* 128 KiB */
+#define TRIV24_DEFAULT_DSPM_SIZE (256 * 1024) /* 128 KiB */
 #define RESERVED_DSPM_SIZE (64 * 1024) /* 64 KiB */
 #define ENVNAME_DSPM_SIZE ("MRPSIM_SPM_SIZE")
 
@@ -440,7 +441,7 @@ TrinityEmulAPI::getDspmSize (uint32_t *dspm) const {
     return -EINVAL;
   }
 
-  *dspm = DEFAULT_DSPM_SIZE;
+  *dspm = TRIV23_DEFAULT_DSPM_SIZE;
 
   char *dspm_str = getenv (ENVNAME_DSPM_SIZE);
   if (dspm_str != NULL) {