DPDK patches and discussions
 help / color / mirror / Atom feed
From: Srikanth Yalavarthi <syalavarthi@marvell.com>
To: Srikanth Yalavarthi <syalavarthi@marvell.com>
Cc: <dev@dpdk.org>, <sshankarnara@marvell.com>, <aprabhu@marvell.com>,
	<ptakkar@marvell.com>
Subject: [PATCH v1 1/5] mldev: remove xstats APIs from library
Date: Sat, 22 Apr 2023 22:13:59 -0700	[thread overview]
Message-ID: <20230423051403.31971-2-syalavarthi@marvell.com> (raw)
In-Reply-To: <20230423051403.31971-1-syalavarthi@marvell.com>

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 <syalavarthi@marvell.com>
---
 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


  reply	other threads:[~2023-04-23  5:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-23  5:13 [PATCH v1 0/5] Implementation of revised ML xstats spec Srikanth Yalavarthi
2023-04-23  5:13 ` Srikanth Yalavarthi [this message]
2023-04-23  5:14 ` [PATCH v1 2/5] mldev: introduce revised xstats Srikanth Yalavarthi
2023-04-23  5:14 ` [PATCH v1 3/5] mldev: implement xstats library functions Srikanth Yalavarthi
2023-04-23  5:14 ` [PATCH v1 4/5] app/mldev: enable reporting xstats Srikanth Yalavarthi
2023-04-23  5:14 ` [PATCH v1 5/5] ml/cnxk: implement xstats driver functions Srikanth Yalavarthi
2023-06-06 13:40 ` [PATCH v1 0/5] Implementation of revised ML xstats spec Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230423051403.31971-2-syalavarthi@marvell.com \
    --to=syalavarthi@marvell.com \
    --cc=aprabhu@marvell.com \
    --cc=dev@dpdk.org \
    --cc=ptakkar@marvell.com \
    --cc=sshankarnara@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).