From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id ED113429BA; Sun, 23 Apr 2023 07:14:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D159542B8C; Sun, 23 Apr 2023 07:14:11 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id D62A240FDF for ; Sun, 23 Apr 2023 07:14:09 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33N4pXa6019841 for ; Sat, 22 Apr 2023 22:14:09 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=c3Tv+IwSTc8Z3KhLybxKl+BnUAtb1iXU35Rd8RfuWzY=; b=Py5fH//c0TwoBEE+ShjTZ4t7V9rR9zRzC7zWL7BEPmBcB99WvQg2ioTwfEqvkvjHhBi2 EoTfW6Yfs9qRk8tcrjQ0pILZtnE/OQtLFLBH8rZaOIFE/PZdv35K8aAlq7D7dTuV50br jVLYLUC3K+qp5X4gRM9LZKylocVpINO/KfbAs7UeQxt6y5JcL/zFjmBl6PdYV2eQOV+s Wh7YmhujDowgijHFpXojc+Ab/keS5N1aSUZU+2f0KEHkSr4VwCXk++FWdUB5TCWmjrhG ZaS/7e5IFakdk+0xrW/2UZHWBaGORAMto4YAHHikpAL15bC34X3NX3XpgNxG9UkB6wVC HQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3q4egjjvcw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sat, 22 Apr 2023 22:14:08 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sat, 22 Apr 2023 22:14:06 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Sat, 22 Apr 2023 22:14:06 -0700 Received: from ml-host-33.caveonetworks.com (unknown [10.110.143.233]) by maili.marvell.com (Postfix) with ESMTP id DA50A3F706A; Sat, 22 Apr 2023 22:14:06 -0700 (PDT) From: Srikanth Yalavarthi To: Srikanth Yalavarthi CC: , , , Subject: [PATCH v1 1/5] mldev: remove xstats APIs from library Date: Sat, 22 Apr 2023 22:13:59 -0700 Message-ID: <20230423051403.31971-2-syalavarthi@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230423051403.31971-1-syalavarthi@marvell.com> References: <20230423051403.31971-1-syalavarthi@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-ORIG-GUID: HNAgS8OsJWwq9dacK5hldbutT3MbvZHR X-Proofpoint-GUID: HNAgS8OsJWwq9dacK5hldbutT3MbvZHR X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-23_02,2023-04-21_01,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This change is a preparatoy step for revised xstats APIs. Revised xstats APIs support reporting device and per model stats, which is based on eventdev xstats. Removed xstats APIs from spec and library implementation. Disabled reporting xstats in test application and disabled xstats functions in drivers. Renamed stats_get function to throughput_get. This change is needed as the revised APIs are not backward compatible with the current xstats. Signed-off-by: Srikanth Yalavarthi --- app/test-mldev/test_inference_common.c | 55 +------------ app/test-mldev/test_inference_common.h | 2 +- app/test-mldev/test_inference_interleave.c | 2 +- app/test-mldev/test_inference_ordered.c | 2 +- drivers/ml/cnxk/cn10k_ml_ops.c | 10 +-- lib/mldev/rte_mldev.c | 88 -------------------- lib/mldev/rte_mldev.h | 90 --------------------- lib/mldev/rte_mldev_core.h | 93 ---------------------- lib/mldev/version.map | 4 - 9 files changed, 7 insertions(+), 339 deletions(-) diff --git a/app/test-mldev/test_inference_common.c b/app/test-mldev/test_inference_common.c index af831fc1bf..1e16608582 100644 --- a/app/test-mldev/test_inference_common.c +++ b/app/test-mldev/test_inference_common.c @@ -1029,7 +1029,7 @@ ml_inference_launch_cores(struct ml_test *test, struct ml_options *opt, uint16_t } int -ml_inference_stats_get(struct ml_test *test, struct ml_options *opt) +ml_inference_throughput_get(struct ml_test *test, struct ml_options *opt) { struct test_inference *t = ml_test_priv(test); uint64_t total_cycles = 0; @@ -1038,56 +1038,10 @@ ml_inference_stats_get(struct ml_test *test, struct ml_options *opt) uint64_t avg_e2e; uint32_t qp_id; uint64_t freq; - int ret; - int i; if (!opt->stats) return 0; - /* get xstats size */ - t->xstats_size = rte_ml_dev_xstats_names_get(opt->dev_id, NULL, 0); - if (t->xstats_size >= 0) { - /* allocate for xstats_map and values */ - t->xstats_map = rte_malloc( - "ml_xstats_map", t->xstats_size * sizeof(struct rte_ml_dev_xstats_map), 0); - if (t->xstats_map == NULL) { - ret = -ENOMEM; - goto error; - } - - t->xstats_values = - rte_malloc("ml_xstats_values", t->xstats_size * sizeof(uint64_t), 0); - if (t->xstats_values == NULL) { - ret = -ENOMEM; - goto error; - } - - ret = rte_ml_dev_xstats_names_get(opt->dev_id, t->xstats_map, t->xstats_size); - if (ret != t->xstats_size) { - printf("Unable to get xstats names, ret = %d\n", ret); - ret = -1; - goto error; - } - - for (i = 0; i < t->xstats_size; i++) - rte_ml_dev_xstats_get(opt->dev_id, &t->xstats_map[i].id, - &t->xstats_values[i], 1); - } - - /* print xstats*/ - printf("\n"); - print_line(80); - printf(" ML Device Extended Statistics\n"); - print_line(80); - for (i = 0; i < t->xstats_size; i++) - printf(" %-64s = %" PRIu64 "\n", t->xstats_map[i].name, t->xstats_values[i]); - print_line(80); - - /* release buffers */ - rte_free(t->xstats_map); - - rte_free(t->xstats_values); - /* print end-to-end stats */ freq = rte_get_tsc_hz(); for (qp_id = 0; qp_id < RTE_MAX_LCORE; qp_id++) @@ -1121,11 +1075,4 @@ ml_inference_stats_get(struct ml_test *test, struct ml_options *opt) print_line(80); return 0; - -error: - rte_free(t->xstats_map); - - rte_free(t->xstats_values); - - return ret; } diff --git a/app/test-mldev/test_inference_common.h b/app/test-mldev/test_inference_common.h index e79344cea4..0a9b930788 100644 --- a/app/test-mldev/test_inference_common.h +++ b/app/test-mldev/test_inference_common.h @@ -70,6 +70,6 @@ void ml_inference_mem_destroy(struct ml_test *test, struct ml_options *opt); int ml_inference_result(struct ml_test *test, struct ml_options *opt, uint16_t fid); int ml_inference_launch_cores(struct ml_test *test, struct ml_options *opt, uint16_t start_fid, uint16_t end_fid); -int ml_inference_stats_get(struct ml_test *test, struct ml_options *opt); +int ml_inference_throughput_get(struct ml_test *test, struct ml_options *opt); #endif /* TEST_INFERENCE_COMMON_H */ diff --git a/app/test-mldev/test_inference_interleave.c b/app/test-mldev/test_inference_interleave.c index bd2c286737..23b8efe4f0 100644 --- a/app/test-mldev/test_inference_interleave.c +++ b/app/test-mldev/test_inference_interleave.c @@ -58,7 +58,7 @@ test_inference_interleave_driver(struct ml_test *test, struct ml_options *opt) ml_inference_iomem_destroy(test, opt, fid); } - ml_inference_stats_get(test, opt); + ml_inference_throughput_get(test, opt); for (fid = 0; fid < opt->nb_filelist; fid++) { ret = ml_model_stop(test, opt, &t->model[fid], fid); diff --git a/app/test-mldev/test_inference_ordered.c b/app/test-mldev/test_inference_ordered.c index 8992358936..f49810c152 100644 --- a/app/test-mldev/test_inference_ordered.c +++ b/app/test-mldev/test_inference_ordered.c @@ -54,7 +54,7 @@ test_inference_ordered_driver(struct ml_test *test, struct ml_options *opt) goto error; ml_inference_iomem_destroy(test, opt, fid); - ml_inference_stats_get(test, opt); + ml_inference_throughput_get(test, opt); /* stop model */ ret = ml_model_stop(test, opt, &t->model[fid], fid); diff --git a/drivers/ml/cnxk/cn10k_ml_ops.c b/drivers/ml/cnxk/cn10k_ml_ops.c index b5eaa24e83..521bad4eea 100644 --- a/drivers/ml/cnxk/cn10k_ml_ops.c +++ b/drivers/ml/cnxk/cn10k_ml_ops.c @@ -1089,7 +1089,7 @@ cn10k_ml_dev_xstats_names_get(struct rte_ml_dev *dev, struct rte_ml_dev_xstats_m return count; } -static int +static int __rte_unused cn10k_ml_dev_xstats_by_name_get(struct rte_ml_dev *dev, const char *name, uint16_t *stat_id, uint64_t *value) { @@ -1136,7 +1136,7 @@ cn10k_ml_dev_xstats_by_name_get(struct rte_ml_dev *dev, const char *name, uint16 return 0; } -static int +static int __rte_unused cn10k_ml_dev_xstats_get(struct rte_ml_dev *dev, const uint16_t *stat_ids, uint64_t *values, uint16_t nb_ids) { @@ -1167,7 +1167,7 @@ cn10k_ml_dev_xstats_get(struct rte_ml_dev *dev, const uint16_t *stat_ids, uint64 return count; } -static int +static int __rte_unused cn10k_ml_dev_xstats_reset(struct rte_ml_dev *dev, const uint16_t *stat_ids, uint16_t nb_ids) { struct rte_ml_dev_info dev_info; @@ -2308,10 +2308,6 @@ struct rte_ml_dev_ops cn10k_ml_ops = { /* Stats ops */ .dev_stats_get = cn10k_ml_dev_stats_get, .dev_stats_reset = cn10k_ml_dev_stats_reset, - .dev_xstats_names_get = cn10k_ml_dev_xstats_names_get, - .dev_xstats_by_name_get = cn10k_ml_dev_xstats_by_name_get, - .dev_xstats_get = cn10k_ml_dev_xstats_get, - .dev_xstats_reset = cn10k_ml_dev_xstats_reset, /* Model ops */ .model_load = cn10k_ml_model_load, diff --git a/lib/mldev/rte_mldev.c b/lib/mldev/rte_mldev.c index f5904a0d4a..72d4d7a165 100644 --- a/lib/mldev/rte_mldev.c +++ b/lib/mldev/rte_mldev.c @@ -438,94 +438,6 @@ rte_ml_dev_stats_reset(int16_t dev_id) (*dev->dev_ops->dev_stats_reset)(dev); } -int -rte_ml_dev_xstats_names_get(int16_t dev_id, struct rte_ml_dev_xstats_map *xstats_map, uint32_t size) -{ - struct rte_ml_dev *dev; - - if (!rte_ml_dev_is_valid_dev(dev_id)) { - RTE_MLDEV_LOG(ERR, "Invalid dev_id = %d\n", dev_id); - return -EINVAL; - } - - dev = rte_ml_dev_pmd_get_dev(dev_id); - if (*dev->dev_ops->dev_xstats_names_get == NULL) - return -ENOTSUP; - - return (*dev->dev_ops->dev_xstats_names_get)(dev, xstats_map, size); -} - -int -rte_ml_dev_xstats_by_name_get(int16_t dev_id, const char *name, uint16_t *stat_id, uint64_t *value) -{ - struct rte_ml_dev *dev; - - if (!rte_ml_dev_is_valid_dev(dev_id)) { - RTE_MLDEV_LOG(ERR, "Invalid dev_id = %d\n", dev_id); - return -EINVAL; - } - - dev = rte_ml_dev_pmd_get_dev(dev_id); - if (*dev->dev_ops->dev_xstats_by_name_get == NULL) - return -ENOTSUP; - - if (name == NULL) { - RTE_MLDEV_LOG(ERR, "Dev %d, name cannot be NULL\n", dev_id); - return -EINVAL; - } - - if (value == NULL) { - RTE_MLDEV_LOG(ERR, "Dev %d, value cannot be NULL\n", dev_id); - return -EINVAL; - } - - return (*dev->dev_ops->dev_xstats_by_name_get)(dev, name, stat_id, value); -} - -int -rte_ml_dev_xstats_get(int16_t dev_id, const uint16_t *stat_ids, uint64_t *values, uint16_t nb_ids) -{ - struct rte_ml_dev *dev; - - if (!rte_ml_dev_is_valid_dev(dev_id)) { - RTE_MLDEV_LOG(ERR, "Invalid dev_id = %d\n", dev_id); - return -EINVAL; - } - - dev = rte_ml_dev_pmd_get_dev(dev_id); - if (*dev->dev_ops->dev_xstats_get == NULL) - return -ENOTSUP; - - if (stat_ids == NULL) { - RTE_MLDEV_LOG(ERR, "Dev %d, stat_ids cannot be NULL\n", dev_id); - return -EINVAL; - } - - if (values == NULL) { - RTE_MLDEV_LOG(ERR, "Dev %d, values cannot be NULL\n", dev_id); - return -EINVAL; - } - - return (*dev->dev_ops->dev_xstats_get)(dev, stat_ids, values, nb_ids); -} - -int -rte_ml_dev_xstats_reset(int16_t dev_id, const uint16_t *stat_ids, uint16_t nb_ids) -{ - struct rte_ml_dev *dev; - - if (!rte_ml_dev_is_valid_dev(dev_id)) { - RTE_MLDEV_LOG(ERR, "Invalid dev_id = %d\n", dev_id); - return -EINVAL; - } - - dev = rte_ml_dev_pmd_get_dev(dev_id); - if (*dev->dev_ops->dev_xstats_reset == NULL) - return -ENOTSUP; - - return (*dev->dev_ops->dev_xstats_reset)(dev, stat_ids, nb_ids); -} - int rte_ml_dev_dump(int16_t dev_id, FILE *fd) { diff --git a/lib/mldev/rte_mldev.h b/lib/mldev/rte_mldev.h index b22234730d..1e967a7c2a 100644 --- a/lib/mldev/rte_mldev.h +++ b/lib/mldev/rte_mldev.h @@ -605,96 +605,6 @@ struct rte_ml_dev_xstats_map { /**< xstat name */ }; -/** - * Retrieve names of extended statistics of an ML device. - * - * @param dev_id - * The identifier of the device. - * @param[out] xstats_map - * Block of memory to insert id and names into. Must be at least size in capacity. - * If set to NULL, function returns required capacity. - * @param size - * Capacity of xstats_map (number of name-id maps). - * - * @return - * - Positive value on success: - * - The return value is the number of entries filled in the stats map. - * - If xstats_map set to NULL then required capacity for xstats_map. - * - Negative value on error: - * - -ENODEV: for invalid *dev_id*. - * - -ENOTSUP: if the device doesn't support this function. - */ -__rte_experimental -int -rte_ml_dev_xstats_names_get(int16_t dev_id, struct rte_ml_dev_xstats_map *xstats_map, - uint32_t size); - -/** - * Retrieve the value of a single stat by requesting it by name. - * - * @param dev_id - * The identifier of the device. - * @param name - * The stat name to retrieve. - * @param stat_id - * If non-NULL, the numerical id of the stat will be returned, so that further requests for - * the stat can be got using rte_ml_dev_xstats_get, which will be faster as it doesn't need to - * scan a list of names for the stat. - * @param[out] value - * Must be non-NULL, retrieved xstat value will be stored in this address. - * - * @return - * - 0: Successfully retrieved xstat value. - * - -EINVAL: invalid parameters. - * - -ENOTSUP: if not supported. - */ -__rte_experimental -int -rte_ml_dev_xstats_by_name_get(int16_t dev_id, const char *name, uint16_t *stat_id, uint64_t *value); - -/** - * Retrieve extended statistics of an ML device. - * - * @param dev_id - * The identifier of the device. - * @param stat_ids - * The id numbers of the stats to get. The ids can be fetched from the stat position in the - * stat list from rte_ml_dev_xstats_names_get(), or by using rte_ml_dev_xstats_by_name_get(). - * @param values - * The values for each stats request by ID. - * @param nb_ids - * The number of stats requested. - * @return - * - Positive value: number of stat entries filled into the values array - * - Negative value on error: - * - -ENODEV: for invalid *dev_id*. - * - -ENOTSUP: if the device doesn't support this function. - */ -__rte_experimental -int -rte_ml_dev_xstats_get(int16_t dev_id, const uint16_t *stat_ids, uint64_t *values, uint16_t nb_ids); - -/** - * Reset the values of the xstats of the selected component in the device. - * - * @param dev_id - * The identifier of the device. - * @param stat_ids - * Selects specific statistics to be reset. When NULL, all statistics will be reset. - * If non-NULL, must point to array of at least *nb_ids* size. - * @param nb_ids - * The number of ids available from the *ids* array. Ignored when ids is NULL. - * @return - * - 0: Successfully reset the statistics to zero. - * - -EINVAL: invalid parameters. - * - -ENOTSUP: if not supported. - */ -__rte_experimental -int -rte_ml_dev_xstats_reset(int16_t dev_id, const uint16_t *stat_ids, uint16_t nb_ids); - -/* Utility operations */ - /** * Dump internal information about *dev_id* to the FILE* provided in *fd*. * diff --git a/lib/mldev/rte_mldev_core.h b/lib/mldev/rte_mldev_core.h index e3c1b2cc2c..926a652397 100644 --- a/lib/mldev/rte_mldev_core.h +++ b/lib/mldev/rte_mldev_core.h @@ -236,87 +236,6 @@ typedef int (*mldev_stats_get_t)(struct rte_ml_dev *dev, struct rte_ml_dev_stats */ typedef void (*mldev_stats_reset_t)(struct rte_ml_dev *dev); -/** - * @internal - * - * Function used to get names of extended stats. - * - * @param dev - * ML device pointer. - * @param xstats_map - * Array to insert id and names into. - * @param size - * Size of xstats_map array. - * - * @return - * - >= 0 and <= size on success. - * - > size, error. Returns the size of xstats_map array required. - * - < 0, error code on failure. - */ -typedef int (*mldev_xstats_names_get_t)(struct rte_ml_dev *dev, - struct rte_ml_dev_xstats_map *xstats_map, uint32_t size); - -/** - * @internal - * - * Function used to get a single extended stat by name. - * - * @param dev - * ML device pointer. - * @param name - * Name of the stat to retrieve. - * @param stat_id - * ID of the stat to be returned. - * @param value - * Value of the stat to be returned. - * - * @return - * - >= 0 stat value. - * - < 0, error code on failure. - */ -typedef int (*mldev_xstats_by_name_get_t)(struct rte_ml_dev *dev, const char *name, - uint16_t *stat_id, uint64_t *value); - -/** - * @internal - * - * Function used to retrieve extended stats of a device. - * - * @param dev - * ML device pointer. - * @param stat_ids - * Array of ID numbers of the stats to be retrieved. - * @param values - * Values of the stats requested by the ID. - * @param nb_ids - * Number of stats requested. - * - * @return - * - >= 0, number of entries filled into the values array. - * - < 0, error code on failure. - */ -typedef int (*mldev_xstats_get_t)(struct rte_ml_dev *dev, const uint16_t *stat_ids, - uint64_t *values, uint16_t nb_ids); - -/** - * @internal - * - * Function used to reset extended stats. - * - * @param dev - * ML device pointer. - * @param stat_ids - * Array of stats IDs to be reset. - * @param nb_ids - * Number of IDs in the stat_ids array. - * - * @return - * - 0 on success. - * - < 0, error code on failure. - */ -typedef int (*mldev_xstats_reset_t)(struct rte_ml_dev *dev, const uint16_t *stat_ids, - uint16_t nb_ids); - /** * @internal * @@ -579,18 +498,6 @@ struct rte_ml_dev_ops { /** Reset device statistics. */ mldev_stats_reset_t dev_stats_reset; - /** Get names of extended stats. */ - mldev_xstats_names_get_t dev_xstats_names_get; - - /** Get value of a single extended stat. */ - mldev_xstats_by_name_get_t dev_xstats_by_name_get; - - /** Get extended stats of a device. */ - mldev_xstats_get_t dev_xstats_get; - - /** Reset extended stats of the device. */ - mldev_xstats_reset_t dev_xstats_reset; - /** Dump ML device debug info. */ mldev_dump_t dev_dump; diff --git a/lib/mldev/version.map b/lib/mldev/version.map index 0706b565be..c774a87a5e 100644 --- a/lib/mldev/version.map +++ b/lib/mldev/version.map @@ -17,10 +17,6 @@ EXPERIMENTAL { rte_ml_dev_stats_get; rte_ml_dev_stats_reset; rte_ml_dev_stop; - rte_ml_dev_xstats_by_name_get; - rte_ml_dev_xstats_get; - rte_ml_dev_xstats_names_get; - rte_ml_dev_xstats_reset; rte_ml_enqueue_burst; rte_ml_io_dequantize; rte_ml_io_input_size_get; -- 2.17.1