MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_inference_setup

Function test_inference_setup

dpdk/app/test-mldev/test_inference_common.c:525–592  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

523}
524
525int
526test_inference_setup(struct ml_test *test, struct ml_options *opt)
527{
528 struct test_inference *t;
529 void *test_inference;
530 uint32_t lcore_id;
531 int ret = 0;
532 uint32_t i;
533
534 test_inference = rte_zmalloc_socket(test->name, sizeof(struct test_inference),
535 RTE_CACHE_LINE_SIZE, opt->socket_id);
536 if (test_inference == NULL) {
537 ml_err("failed to allocate memory for test_model");
538 ret = -ENOMEM;
539 goto error;
540 }
541 test->test_priv = test_inference;
542 t = ml_test_priv(test);
543
544 t->nb_used = 0;
545 t->nb_valid = 0;
546 t->cmn.result = ML_TEST_FAILED;
547 t->cmn.opt = opt;
548 memset(t->error_count, 0, RTE_MAX_LCORE * sizeof(uint64_t));
549
550 /* get device info */
551 ret = rte_ml_dev_info_get(opt->dev_id, &t->cmn.dev_info);
552 if (ret < 0) {
553 ml_err("failed to get device info");
554 goto error;
555 }
556
557 if (opt->burst_size == 1) {
558 t->enqueue = ml_enqueue_single;
559 t->dequeue = ml_dequeue_single;
560 } else {
561 t->enqueue = ml_enqueue_burst;
562 t->dequeue = ml_dequeue_burst;
563 }
564
565 /* set model initial state */
566 for (i = 0; i < opt->nb_filelist; i++)
567 t->model[i].state = MODEL_INITIAL;
568
569 for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
570 t->args[lcore_id].enq_ops = rte_zmalloc_socket(
571 "ml_test_enq_ops", opt->burst_size * sizeof(struct rte_ml_op *),
572 RTE_CACHE_LINE_SIZE, opt->socket_id);
573 t->args[lcore_id].deq_ops = rte_zmalloc_socket(
574 "ml_test_deq_ops", opt->burst_size * sizeof(struct rte_ml_op *),
575 RTE_CACHE_LINE_SIZE, opt->socket_id);
576 t->args[lcore_id].reqs = rte_zmalloc_socket(
577 "ml_test_requests", opt->burst_size * sizeof(struct ml_request *),
578 RTE_CACHE_LINE_SIZE, opt->socket_id);
579 }
580
581 for (i = 0; i < RTE_MAX_LCORE; i++) {
582 t->args[i].start_cycles = 0;

Callers

nothing calls this directly

Calls 5

rte_zmalloc_socketFunction · 0.85
ml_test_privFunction · 0.85
memsetFunction · 0.85
rte_ml_dev_info_getFunction · 0.85
rte_freeFunction · 0.85

Tested by

no test coverage detected