LCOV - code coverage report
Current view: top level - app/test-mldev - test_inference_ordered.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 51 0.0 %
Date: 2025-02-01 18:54:23 Functions: 0 3 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright (c) 2022 Marvell.
       3                 :            :  */
       4                 :            : 
       5                 :            : #include <rte_common.h>
       6                 :            : #include <rte_launch.h>
       7                 :            : 
       8                 :            : #include "ml_common.h"
       9                 :            : #include "test_inference_common.h"
      10                 :            : #include "test_stats.h"
      11                 :            : 
      12                 :            : static int
      13                 :          0 : test_inference_ordered_driver(struct ml_test *test, struct ml_options *opt)
      14                 :            : {
      15                 :            :         struct test_inference *t;
      16                 :            :         uint16_t fid = 0;
      17                 :            :         int ret = 0;
      18                 :            : 
      19                 :            :         t = ml_test_priv(test);
      20                 :            : 
      21                 :          0 :         ret = ml_inference_mldev_setup(test, opt);
      22                 :          0 :         if (ret != 0)
      23                 :            :                 return ret;
      24                 :            : 
      25                 :          0 :         ret = ml_inference_mem_setup(test, opt);
      26                 :          0 :         if (ret != 0)
      27                 :            :                 return ret;
      28                 :            : 
      29                 :          0 : next_model:
      30                 :            :         /* load model */
      31                 :          0 :         ret = ml_model_load(test, opt, &t->model[fid], fid);
      32                 :          0 :         if (ret != 0)
      33                 :          0 :                 goto error;
      34                 :            : 
      35                 :            :         /* start model */
      36                 :          0 :         ret = ml_model_start(test, opt, &t->model[fid], fid);
      37                 :          0 :         if (ret != 0)
      38                 :          0 :                 goto error;
      39                 :            : 
      40                 :          0 :         ret = ml_inference_iomem_setup(test, opt, fid);
      41                 :          0 :         if (ret != 0)
      42                 :          0 :                 goto error;
      43                 :            : 
      44                 :            :         /* launch inferences for one model using available queue pairs */
      45                 :          0 :         ret = ml_inference_launch_cores(test, opt, fid, fid);
      46                 :          0 :         if (ret != 0) {
      47                 :          0 :                 ml_err("failed to launch cores");
      48                 :          0 :                 goto error;
      49                 :            :         }
      50                 :            : 
      51                 :          0 :         rte_eal_mp_wait_lcore();
      52                 :            : 
      53                 :          0 :         ret = ml_inference_result(test, opt, fid);
      54                 :          0 :         if (ret != ML_TEST_SUCCESS)
      55                 :          0 :                 goto error;
      56                 :            : 
      57                 :          0 :         ml_inference_iomem_destroy(test, opt, fid);
      58                 :          0 :         ml_stats_get(test, opt, RTE_ML_DEV_XSTATS_MODEL, fid);
      59                 :          0 :         ml_throughput_get(test, opt);
      60                 :            : 
      61                 :            :         /* stop model */
      62                 :          0 :         ret = ml_model_stop(test, opt, &t->model[fid], fid);
      63                 :          0 :         if (ret != 0)
      64                 :          0 :                 goto error;
      65                 :            : 
      66                 :            :         /* unload model */
      67                 :          0 :         ret = ml_model_unload(test, opt, &t->model[fid], fid);
      68                 :          0 :         if (ret != 0)
      69                 :          0 :                 goto error;
      70                 :            : 
      71                 :          0 :         fid++;
      72                 :          0 :         if (fid < opt->nb_filelist)
      73                 :          0 :                 goto next_model;
      74                 :            : 
      75                 :          0 :         ml_stats_get(test, opt, RTE_ML_DEV_XSTATS_DEVICE, -1);
      76                 :          0 :         ml_inference_mem_destroy(test, opt);
      77                 :            : 
      78                 :          0 :         ret = ml_inference_mldev_destroy(test, opt);
      79                 :          0 :         if (ret != 0)
      80                 :            :                 return ret;
      81                 :            : 
      82                 :          0 :         t->cmn.result = ML_TEST_SUCCESS;
      83                 :            : 
      84                 :          0 :         return 0;
      85                 :            : 
      86                 :          0 : error:
      87                 :          0 :         ml_inference_iomem_destroy(test, opt, fid);
      88                 :          0 :         ml_inference_mem_destroy(test, opt);
      89                 :          0 :         ml_model_stop(test, opt, &t->model[fid], fid);
      90                 :          0 :         ml_model_unload(test, opt, &t->model[fid], fid);
      91                 :            : 
      92                 :          0 :         t->cmn.result = ML_TEST_FAILED;
      93                 :            : 
      94                 :          0 :         return ret;
      95                 :            : }
      96                 :            : 
      97                 :            : static int
      98                 :          0 : test_inference_ordered_result(struct ml_test *test, struct ml_options *opt)
      99                 :            : {
     100                 :            :         struct test_inference *t;
     101                 :            : 
     102                 :            :         RTE_SET_USED(opt);
     103                 :            : 
     104                 :            :         t = ml_test_priv(test);
     105                 :            : 
     106                 :          0 :         return t->cmn.result;
     107                 :            : }
     108                 :            : 
     109                 :            : static const struct ml_test_ops inference_ordered = {
     110                 :            :         .cap_check = test_inference_cap_check,
     111                 :            :         .opt_check = test_inference_opt_check,
     112                 :            :         .opt_dump = test_inference_opt_dump,
     113                 :            :         .test_setup = test_inference_setup,
     114                 :            :         .test_destroy = test_inference_destroy,
     115                 :            :         .test_driver = test_inference_ordered_driver,
     116                 :            :         .test_result = test_inference_ordered_result,
     117                 :            : };
     118                 :            : 
     119                 :          0 : ML_TEST_REGISTER(inference_ordered);

Generated by: LCOV version 1.14