VeriSilicon / TIM-VX

VeriSilicon Tensor Interface Module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What does the producer and consumer mean?

engineer1109 opened this issue · comments

I found the graph interface has producer and consumer two means.
What mean?

And function:

UpdateTensorConsumersMap
RenewTensorConsumersMap
UpdateTensorProducerMap
GetConsumersOp
GetProducerOp

means what

  • Hi, these map structures are desined to facilitate obtaining the entire topology of the graph from any location. The TensorProducerMap and TensorConsumerOp are both <tensor, op> type maps, where the former stores the successor operators for the current tensor, and the latter stores the predecessor operators for the current tensor.

  • As for functions,

  1. The Update*** functions are called when initializing the structure of the entire graph, meaning that every time UpdateMap is called, a new binding information between tensor and operation is added to the related map.
  2. RenewTensorConsumersMap is used to handle some const tensor that are not supported by the definitions of operations in lower-level software. We convert the initialized timvx tensor into a new tensor through data conversion and other means, hence we need to modify the map.
  3. The Get*** function returns the smart pointer of the Consumer/Producer Operation for the current tensor.

Thanks for your answer