This patch adds the API to get DSPM size of DSP HW.
Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
float output_seg_quant_s[MAX_TENSORS]; /**< output quantization parameter (scale) */
/** DSP-specific variables */
- uint32_t dspm_size; /**< The size of DSP memory */
+ uint32_t dspm_size; /**< The data scratch-pad memory (dspm) size of the DSP */
/** vISA instructions */
uint32_t visa_num_plus_one; /**< Number of vISA insts + 1 (i.e., unknown if zero) */
int getNPU_tops (npudev_h dev, uint32_t *tops);
/**
+ * @brief Get the DSP DSPM size of the opened NPU device
+ * @param[in] dev the NPU device handle
+ * @param[out] dspm dspm size
+ * @return 0 if no error, otherwise a negative errno
+ * @note this does not support for emulated devices
+ */
+int getNPU_dspmSize (npudev_h dev, uint32_t *dspm);
+
+/**
* @brief Get metadata for NPU model
* @param[in] model The path of model binary file
* @param[in] need_extra whether you want to extract the extra data in metadata
}
/**
+ * @brief Get the DSP DSPM size of the opened NPU device
+ * @param[in] dev the NPU device handle
+ * @param[out] dspm dspm size
+ * @return 0 if no error, otherwise a negative errno
+ * @note this does not support for emulated devices
+ */
+int
+HostHandler::getDspmSize (uint32_t *dspm)
+{
+ const DriverAPI * api = device_->getDriverAPI ();
+ assert (api != nullptr);
+
+ return api->getDspmSize (dspm);
+}
+/**
* @brief Set the data layout for input/output tensors
* @param[in] modelid The ID of model whose layouts are set
* @param[in] in the layout/type info for input tensors
int getProfile (int run_id, npu_profile *profile);
int getAPILevel (uint32_t *level);
int getTops (uint32_t *tops);
+ int getDspmSize (uint32_t *dspm);
int setDataInfo (uint32_t modelid, tensors_data_info *in, tensors_data_info *out);
int setConstraint (uint32_t modelid, npuConstraint constraint);
virtual int open () { return -ENODEV; }
virtual int getAPILevel (uint32_t *level) const { return -EPERM; }
virtual int getTops (uint32_t *tops) const { return -EPERM; }
+ virtual int getDspmSize (uint32_t *dspm) const { return -EPERM; }
virtual int checkSanity () { return 0; }
int checkSanity ();
int getAPILevel (uint32_t *level) const;
int getTops (uint32_t *tops) const;
+ int getDspmSize (uint32_t *dspm) const;
device_state_t isReady () const;
uint32_t numRequests () const;
}
int
+TrinityVision2API::getDspmSize (uint32_t *dspm) const
+{
+ int ret;
+
+ if (!this->initialized())
+ return -EPERM;
+
+ ret = ioctl (this->getDeviceFD (), TRINITY_IOCTL_GET_DSPM, dspm);
+ if (ret != 0)
+ return -errno;
+
+ return ret;
+}
+
+int
TrinityVision2API::getStatApps (npu_stat_apps *stat) const
{
struct trinity_ioctl_stat_apps stat_apps;
}
/**
+ * @brief Get the DSP DSPM size of the opened NPU device
+ * @param[in] dev the NPU device handle
+ * @param[out] dspm dspm size
+ * @return 0 if no error, otherwise a negative errno
+ * @note this does not support for emulated devices
+ */
+int getNPU_dspmSize (npudev_h dev, uint32_t *dspm)
+{
+ INIT_HOST_HANDLER (host_handler, dev);
+
+ if (dspm == nullptr)
+ return -EINVAL;
+
+ return host_handler->getDspmSize (dspm);
+}
+
+/**
* @brief Get the profile information from NPU
* @param[in] dev The NPU device handle
* @param[in] task_id The identifier for each inference