@@ -35,13 +35,16 @@ namespace EthosU {
#define ETHOSU_CORE_BUFFER_MAX 16
/** Maximum number of PMU counters to be returned for inference */
-#define ETHOSU_CORE_PMU_MAX 8
+#define ETHOSU_CORE_PMU_MAX 4
#define ETHOSU_CORE_MSG_MAGIC 0x41457631
#define ETHOSU_CORE_MSG_VERSION_MAJOR 0
#define ETHOSU_CORE_MSG_VERSION_MINOR 2
#define ETHOSU_CORE_MSG_VERSION_PATCH 0
+#define ETHOSU_CORE_INFERENCE_MODEL 0
+#define ETHOSU_CORE_INFERENCE_OP 1
+
/**
* enum ethosu_core_msg_type - Message types
*
@@ -107,6 +110,7 @@ struct ethosu_core_inference_req {
struct ethosu_core_buffer network;
uint8_t pmu_event_config[ETHOSU_CORE_PMU_MAX];
uint32_t pmu_cycle_counter_enable;
+ uint32_t inference_type;
};
struct ethosu_core_inference_rsp {
@@ -92,7 +92,8 @@ static int ethosu_inference_send(struct ethosu_inference *inf)
inf->net->buf,
inf->pmu_event_config,
ETHOSU_PMU_EVENT_MAX,
- inf->pmu_cycle_counter_enable);
+ inf->pmu_cycle_counter_enable,
+ inf->inference_type);
if (ret)
return ret;
@@ -233,6 +234,17 @@ int ethosu_inference_create(struct ethosu_device *edev,
inf = devm_kzalloc(edev->dev, sizeof(*inf), GFP_KERNEL);
if (!inf)
return -ENOMEM;
+ switch (uapi->inference_type) {
+ case ETHOSU_UAPI_INFERENCE_MODEL:
+ inf->inference_type = ETHOSU_CORE_INFERENCE_MODEL;
+ break;
+ case ETHOSU_UAPI_INFERENCE_OP:
+ inf->inference_type = ETHOSU_CORE_INFERENCE_OP;
+ break;
+ default:
+ inf->inference_type = ETHOSU_CORE_INFERENCE_MODEL;
+ break;
+ }
inf->edev = edev;
inf->net = net;
@@ -74,6 +74,7 @@ struct ethosu_inference {
uint32_t pmu_event_count[ETHOSU_PMU_EVENT_MAX];
uint32_t pmu_cycle_counter_enable;
uint64_t pmu_cycle_counter_count;
+ uint32_t inference_type;
struct list_head list;
};
@@ -107,7 +107,8 @@ int ethosu_rpmsg_inference(struct ethosu_rpmsg *erp,
struct ethosu_buffer *network,
uint8_t *pmu_event_config,
uint8_t pmu_event_config_count,
- uint8_t pmu_cycle_counter_enable)
+ uint8_t pmu_cycle_counter_enable,
+ uint32_t inference_type)
{
struct ethosu_core_msg msg = {
.magic = ETHOSU_CORE_MSG_MAGIC,
@@ -132,6 +133,7 @@ int ethosu_rpmsg_inference(struct ethosu_rpmsg *erp,
req.ifm_count = ifm_count;
req.ofm_count = ofm_count;
req.pmu_cycle_counter_enable = pmu_cycle_counter_enable;
+ req.inference_type = inference_type;
for (i = 0; i < ifm_count; i++)
ethosu_core_set_size(ifm[i], &req.ifm[i]);
@@ -63,7 +63,8 @@ int ethosu_rpmsg_inference(struct ethosu_rpmsg *erp,
struct ethosu_buffer *network,
uint8_t *pmu_event_config,
uint8_t pmu_event_config_count,
- uint8_t pmu_cycle_counter_enable
+ uint8_t pmu_cycle_counter_enable,
+ uint32_t inference_type
);
int ethosu_rpmsg_init(struct ethosu_rpmsg *erp,
@@ -62,7 +62,7 @@ namespace EthosU {
#define ETHOSU_FD_MAX 16
/* Maximum number of PMUs available */
-#define ETHOSU_PMU_EVENT_MAX 8
+#define ETHOSU_PMU_EVENT_MAX 4
/****************************************************************************
* Types
@@ -173,6 +173,14 @@ struct ethosu_uapi_device_capabilities {
__u32 driver_major_rev;
};
+/**
+ * enum ethosu_uapi_inference_type - Inference type
+ */
+enum ethosu_uapi_inference_type {
+ ETHOSU_UAPI_INFERENCE_MODEL = 0,
+ ETHOSU_UAPI_INFERENCE_OP
+};
+
/**
* struct ethosu_uapi_inference_create - Create network request
* @ifm_count: Number of IFM file descriptors
@@ -185,6 +193,7 @@ struct ethosu_uapi_inference_create {
__u32 ifm_fd[ETHOSU_FD_MAX];
__u32 ofm_count;
__u32 ofm_fd[ETHOSU_FD_MAX];
+ enum ethosu_uapi_inference_type inference_type;
struct ethosu_uapi_pmu_config pmu_config;
};