> -----Original Message-----
> From: Pavan Nikhilesh Bhagavatula <pbhagavat...@marvell.com>
> Sent: Thursday, April 27, 2023 10:59 PM
> To: Yan, Zhirun <zhirun....@intel.com>; dev@dpdk.org; Jerin Jacob
> Kollanukkaran <jer...@marvell.com>; Kiran Kumar Kokkilagadda
> <kirankum...@marvell.com>; Nithin Kumar Dabilpuram
> <ndabilpu...@marvell.com>; step...@networkplumber.org
> Cc: Liang, Cunming <cunming.li...@intel.com>; Wang, Haiyue
> <haiyue.w...@intel.com>
> Subject: RE: [EXT] [PATCH v5 11/15] graph: introduce graph walk by cross-core
> dispatch
> 
> > This patch introduces the task scheduler mechanism to enable
> > dispatching tasks to another worker cores. Currently, there is only a
> > local work queue for one graph to walk. We introduce a scheduler
> > worker queue in each worker core for dispatching tasks. It will
> > perform the walk on scheduler work queue first, then handle the local work
> queue.
> >
> > Signed-off-by: Haiyue Wang <haiyue.w...@intel.com>
> > Signed-off-by: Cunming Liang <cunming.li...@intel.com>
> > Signed-off-by: Zhirun Yan <zhirun....@intel.com>
> > ---
> >  lib/graph/rte_graph_model_dispatch.h | 42
> > ++++++++++++++++++++++++++++
> >  1 file changed, 42 insertions(+)
> >
> > diff --git a/lib/graph/rte_graph_model_dispatch.h
> > b/lib/graph/rte_graph_model_dispatch.h
> > index 18fa7ce0ab..65b2cc6d87 100644
> > --- a/lib/graph/rte_graph_model_dispatch.h
> > +++ b/lib/graph/rte_graph_model_dispatch.h
> > @@ -73,6 +73,48 @@ __rte_experimental
> >  int rte_graph_model_dispatch_lcore_affinity_set(const char *name,
> >                                             unsigned int lcore_id);
> >
> > +/**
> > + * Perform graph walk on the circular buffer and invoke the process
> > function
> > + * of the nodes and collect the stats.
> > + *
> > + * @param graph
> > + *   Graph pointer returned from rte_graph_lookup function.
> > + *
> > + * @see rte_graph_lookup()
> > + */
> > +__rte_experimental
> > +static inline void
> > +rte_graph_walk_mcore_dispatch(struct rte_graph *graph) {
> > +   const rte_graph_off_t *cir_start = graph->cir_start;
> > +   const rte_node_t mask = graph->cir_mask;
> > +   uint32_t head = graph->head;
> > +   struct rte_node *node;
> 
> I think we should add a RTE_ASSERT here to make sure that the graph object is 
> a
> cloned graph.
> 
Ok, I will add RTE_ASSERT in next version. 

> > +
> > +   if (graph->wq != NULL)
> > +           __rte_graph_sched_wq_process(graph);
> > +
> > +   while (likely(head != graph->tail)) {
> > +           node = (struct rte_node *)RTE_PTR_ADD(graph,
> > cir_start[(int32_t)head++]);
> > +
> > +           /* skip the src nodes which not bind with current worker */
> > +           if ((int32_t)head < 0 && node->lcore_id != graph->lcore_id)
> > +                   continue;
> > +
> > +           /* Schedule the node until all task/objs are done */
> > +           if (node->lcore_id != RTE_MAX_LCORE &&
> > +               graph->lcore_id != node->lcore_id && graph->rq != NULL
> > &&
> > +               __rte_graph_sched_node_enqueue(node, graph->rq))
> > +                   continue;
> > +
> > +           __rte_node_process(graph, node);
> > +
> > +           head = likely((int32_t)head > 0) ? head & mask : head;
> > +   }
> > +
> > +   graph->tail = 0;
> > +}
> > +
> >  #ifdef __cplusplus
> >  }
> >  #endif
> > --
> > 2.37.2

Reply via email to