Message processing method and device, equipment and storage medium
By listening and accumulating request and response commands of producer devices, setting conditional trigger command mappings solves the problems of blocking and data conflicts in the multi-producer-multi-consumer model, improving execution efficiency and data accuracy.
Patent Information
- Application Number
- CN202510386299.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-28
- Publication Date
- 2025-07-08
AI Technical Summary
In the multi-producer-multi-consumer model, write requests with the same ID must be strictly executed in order, resulting in blocking and backpressure, affecting producer task creation and data accuracy.
By listening to the request commands and response commands of the producer device, accumulating the number of request commands and response commands, setting preset conditions for command mapping, ensuring the consistency and integrity of the data, and avoiding order conflicts caused by direct issuance.
Improve the efficiency of write request issuance of producer equipment, reduce blocking and backpressure, and ensure data integrity and consistency.
Smart Images

Figure CN120277024A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular, to a message processing method, apparatus, device, and storage medium. Background Art
[0002] The Producer-Consumer Model is a model used to describe task synchronization and resource sharing problems in concurrent systems. Producers are responsible for writing data into a buffer, while consumers read data from the buffer. In actual application scenarios, there are cases where multiple producers use multiple consumers, that is, the multi-producer-multi-consumer model. In this model, each producer issues write requests with the same ID. At the same time, the data stream and message stream sent by the producers flow to different buffers and consumers.
[0003] However, in the above solution, write requests with the same ID must be executed strictly in order, resulting in blocking and backpressure, reducing the efficiency of task creation and issuance by producers. Moreover, multiple producers may send write requests to the same consumer simultaneously, resulting in data conflicts or losses, affecting data accuracy. Summary of the Invention
[0004] This application provides a message processing method, apparatus, device, and storage medium to at least solve the problems of low execution efficiency and low accuracy in the multi-producer-multi-consumer model in related technologies.
[0005] This application provides a message processing method applied to a message processing device. The message processing device is connected to an on-chip interconnect network; the on-chip interconnect network is connected to multiple producer devices; the on-chip interconnect network is also connected to multiple consumer devices; the method includes:
[0006] Listening to the request commands and response commands corresponding to the multiple producer devices to obtain a listening result;
[0007] According to the listening result, performing a quantity accumulation on the request commands and response commands corresponding to the multiple producer devices to obtain a request command accumulation value corresponding to the producer identifier and a response command accumulation value corresponding to the producer identifier;
[0008] If the request command accumulation value and the response command accumulation value of the same producer identifier meet a preset condition, then mapping the request command and request data of the producer device corresponding to the same producer identifier;
[0009] Sending the request command and request data after command mapping to the on-chip interconnect network for the on-chip interconnect network to forward to the multiple consumer devices.
[0010] The present application also provides a message processing apparatus, which is applied to a message processing device. The message processing device is connected to an on-chip interconnect network; the on-chip interconnect network is connected to a plurality of producer devices; the on-chip interconnect network is also connected to a plurality of consumer devices; the apparatus includes:
[0011] A listening module, configured to listen to request commands and response commands corresponding to the plurality of producer devices, and obtain a listening result;
[0012] An accumulation module, configured to accumulate the quantities of the request commands and response commands corresponding to the plurality of producer devices according to the listening result, and obtain a request command accumulation value corresponding to a producer identifier and a response command accumulation value corresponding to the producer identifier;
[0013] A command mapping module, configured to, if the request command accumulation value and the response command accumulation value of the same producer identifier meet a preset condition, map the request commands and request data of the producer device corresponding to the same producer identifier;
[0014] A sending module, configured to send the request commands and request data after command mapping to the on-chip interconnect network for the on-chip interconnect network to forward to the plurality of consumer devices.
[0015] The present application also provides a message processing device. The message processing device is connected to an on-chip interconnect network; the on-chip interconnect network is connected to a plurality of producer devices; the on-chip interconnect network is also connected to a plurality of consumer devices; the device includes:
[0016] A request channel listening unit, configured to listen to request commands in a request path between the on-chip interconnect network and the plurality of producer devices, so as to obtain a request command accumulation value corresponding to a producer identifier;
[0017] A response channel listening unit, configured to listen to response commands in a response path between the on-chip interconnect network and the plurality of producer devices, so as to obtain a response command accumulation value corresponding to a producer identifier;
[0018] A receiving buffer unit, configured to buffer request commands and request data received and forwarded by the on-chip interconnect network from the plurality of producer devices;
[0019] A main interface processing unit, configured to obtain a request command accumulation value corresponding to a producer identifier and a response command accumulation value corresponding to the producer identifier; if the request command accumulation value and the response command accumulation value of the same producer identifier meet a preset condition, map the request commands and request data of the producer device corresponding to the same producer identifier, and send the request commands and request data after command mapping to the on-chip interconnect network for the on-chip interconnect network to forward to the plurality of consumer devices.
[0020] The present application also provides an electronic device, including: a memory for storing a computer program; a processor for implementing the steps of any of the above message processing methods when executing the computer program.
[0021] The present application also provides a computer-readable storage medium storing a computer program, wherein the computer program implements the steps of any of the above message processing methods when executed by a processor.
[0022] Through the present application, by listening to request commands and response commands and accumulating the quantities of the request commands and response commands corresponding to the multiple producer devices, it is possible to ensure that the request commands and response commands corresponding to each producer device can be correctly recorded and processed, guaranteeing the consistency and integrity of data; by setting preset conditions and performing command mapping on the request commands and request data only when the accumulated value of the request commands meets the preset conditions with the accumulated value of the response commands, a conditional trigger mechanism for command mapping is implemented, guaranteeing the integrity and consistency of the request commands and request data. By receiving and storing the request commands and request data, direct distribution is avoided to prevent sequence conflicts, and the blocking and backpressure of write requests issued to the producer are reduced, improving the overall execution efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] To illustrate the embodiments of the present application more clearly, the following will briefly introduce the drawings required for the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0024] Figure 1 Schematic flow chart of a message processing method provided by an embodiment of the present invention;
[0025] Figure 2 Schematic flow chart of another message processing method provided by an embodiment of the present invention;
[0026] Figure 3 Schematic structural diagram of a message processing device provided by an embodiment of the present invention;
[0027] Figure 4 Schematic structural diagram of a main interface control unit provided by an embodiment of the present invention;
[0028] Figure 5 Schematic diagram of the order of data flow and message flow issued in the current on-chip interconnection network provided by an embodiment of the present invention;
[0029] Figure 6 Schematic diagram of the command flow of the request path in the current on-chip interconnection network provided by an embodiment of the present invention;
[0030] Figure 7 It is a schematic diagram of the data format of the receive buffer unit provided by an embodiment of the present invention;
[0031] Figure 8 It is a schematic diagram of the accumulated value of the response command provided by an embodiment of the present invention;
[0032] Figure 9 It is a schematic diagram of the data format of the consumer buffer unit provided by an embodiment of the present invention;
[0033] Figure 10 It is a block diagram of a message processing device according to an embodiment of the present application;
[0034] Figure 11 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present application. Detailed implementation manners
[0035] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0036] It should be noted that in the description of the present application, the terms "include", "comprise" or any other variant thereof are intended to cover a non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present application are used to distinguish similar objects, rather than to describe a specific order or sequence.
[0037] In order to enable those skilled in the art of the present technology to better understand the solution of the present application, the present application will be further described in detail below in conjunction with the accompanying drawings and specific implementation manners.
[0038] The producer - consumer model is an abstract model in computer science used to describe task synchronization and resource sharing problems in concurrent systems. The producer first writes data into the buffer and then notifies the consumer that the data has been created. After receiving the notification message, the consumer reads the data from the buffer for processing. Therefore, the producer issues write requests in the order of data stream first and then message stream. In actual application scenarios, one consumer may be used by multiple producers, and thus there is a situation where multiple producers use multiple consumers, that is, the multi - producer - multi - consumer model. To ensure the order of the data stream and the message stream, the same producer generally issues write requests with the same ID. At the same time, the data stream and the message stream sent by the producer flow to different devices, that is, different buffers and consumers. Therefore, from the perspective of hardware processing, according to the bus protocol specification, the write requests corresponding to the same ID are strictly executed in order in the on - chip interconnect network, and the next write request cannot be issued until the write response from the previous device is received, resulting in the blocking of subsequent data streams and message streams, causing backpressure on the write tasks created by the producer and affecting the execution efficiency of the producer - consumer model. Moreover, multiple producers may send write requests to the same consumer simultaneously, resulting in data conflicts or losses and affecting data accuracy.
[0039] Based on this, an embodiment of the present application provides a message processing method, which is applied to a message processing device. The message processing device is connected to the on - chip interconnect network, and the on - chip interconnect network is connected to multiple producer devices and is also connected to multiple consumer devices. The on - chip interconnect network is a key component in modern multi - core processors and system - on - a - chip (SoC) used to connect various cores, caches, memory controllers, and other functional modules. In this embodiment, the on - chip interconnect network is used to implement interconnection communication among the message processing device, multiple producer devices, and multiple consumer devices. The producer device can be a device that generates data or tasks and sends them to the target device, such as a sensor, a computing unit, a storage device, an input device, etc. The consumer device can be a device that receives and processes the data or tasks sent by the producer device, such as a computing unit, a storage device, an execution device, etc.
[0040] An embodiment of the present application provides a message processing method, Figure 1 which is a schematic flow diagram of a message processing method provided by an embodiment of the present invention. As Figure 1 shown, the process includes the following steps.
[0041] Specific method steps are as follows:
[0042] Step S101, monitor the request commands and response commands corresponding to the multiple producer devices to obtain the monitoring result.
[0043] The on-chip interconnect network has a reorder buffer mechanism, which aims to solve the problem that the transmission order of multiple data packets is inconsistent with the reception order. These multiple data packets will arrive at the destination in an order different from the sending order. The reorder buffer mechanism stores these out-of-order response data packets and feeds them back to the upper-layer protocol or application in the order of data packet sending at an appropriate time, so as to ensure the orderly processing of data. Each of the multiple producer devices has a reorder buffer function. The message processing device can monitor the communication channel between the multiple producer devices and the on-chip interconnect network, so as to monitor the request commands sent by the producer devices to the on-chip interconnect network and the response commands fed back by the on-chip interconnect network to the producer devices in the communication channel, so as to obtain the monitoring results. Among them, the request commands and response commands contain producer identifiers corresponding to the producer devices one by one. It should be noted that the producer devices also send a message flow for control, coordination or management and a data flow containing actual service data to the on-chip interconnect network through the communication channel. The message flow, as request data, is forwarded to the message processing device by the on-chip interconnect network together with the request commands. The data flow is cached in the on-chip interconnect network for the on-chip interconnect network to subsequently forward the data flow along with the request commands and request data after command mapping to the corresponding consumer devices. That is to say, the message processing device in this embodiment processes the message flow. When a producer device needs to send data or tasks to a consumer device, the data flow and the message flow are first sent to the on-chip interconnect network, and then the message processing device processes the message flow to determine whether the sending conditions are met. When the sending conditions are met, the on-chip interconnect network forwards the message flow and the data flow to the consumer device.
[0044] Step S102, according to the monitoring result, accumulate the quantities of the request commands and response commands corresponding to the multiple producer devices to obtain a request command accumulation value corresponding to the producer identifier and a response command accumulation value corresponding to the producer identifier.
[0045] Specifically, every time a request command is monitored, the request command accumulation value of the producer identifier corresponding to the request command is incremented by one; every time a response command is monitored, the response command accumulation value of the producer identifier corresponding to the response command is incremented by one. And so on, the request command accumulation values corresponding to each producer identifier and the response command accumulation values corresponding to each producer identifier are obtained. By monitoring the request commands and response commands and accumulating the quantities of the request commands and response commands corresponding to the multiple producer devices, it can be ensured that the request commands and response commands corresponding to each producer device can be correctly recorded and processed, ensuring data consistency and integrity.
[0046] Step S103, if the accumulated value of the request command and the accumulated value of the response command with the same producer identifier meet the preset conditions, map the request command and the request data of the producer device corresponding to the same producer identifier.
[0047] The preset conditions can be set according to actual requirements to ensure the sequential relationship between the request command and the response command. For example, set a first threshold for the accumulated value of the request command and a second threshold for the accumulated value of the response command, where the first threshold is greater than the second threshold. Then, when the accumulated value of the request command is greater than the first threshold and the accumulated value of the response command is greater than the second threshold, perform command mapping, thereby implementing a conditional trigger mechanism for command mapping, ensuring that the request command and the request data are command-mapped only when the preset conditions are met, guaranteeing the integrity and consistency of the request command and the request data. By receiving and storing the request command and the request data, it avoids direct issuance that may cause sequential conflicts and reduces the blocking and backpressure on the producer for issuing write requests, improving the overall execution efficiency. When performing command mapping, the request command and the request data will be mapped to the corresponding consumer device according to the consumer address information contained in the request instruction and the request data. The request commands and request data corresponding to each producer device can be processed in parallel, that is, it can be determined in parallel whether the accumulated value of the request command and the accumulated value of the response command of each producer identifier meet the preset conditions, and command mapping is performed separately when the preset conditions are met.
[0048] Step S104, send the request command and the request data after command mapping to the on-chip interconnection network for the on-chip interconnection network to forward to the multiple consumer devices.
[0049] Optionally, set an arbitration mechanism to arbitrate the request commands and request data after command mapping corresponding to each producer identifier to determine the order of sending the request commands and request data after command mapping to the on-chip interconnection network. The arbitration mechanism can be set according to actual requirements, such as polling, or set the priorities of each producer identifier, and send the corresponding request commands and request data after command mapping in the order of the priorities of each producer identifier. After receiving the request commands and request data after command mapping, the on-chip interconnection network forwards the request commands and request data after command mapping to the corresponding consumer device according to the consumer device address information corresponding to the request commands and request data after command mapping.
[0050] The message processing method provided in this embodiment can ensure that the request commands and response commands corresponding to each producer device can be correctly recorded and processed, and guarantee the consistency and integrity of data by listening to the request commands and response commands and accumulating the quantities of the request commands and response commands corresponding to the multiple producer devices; by setting preset conditions, a command mapping for the request commands and request data is performed only when the accumulated value of the request commands and the accumulated value of the response commands meet the preset conditions, realizing a conditional trigger mechanism for command mapping, and ensuring the integrity and consistency of the request commands and request data. By receiving and storing the request commands and request data, it avoids direct issuance that may cause sequence conflicts, reduces the blocking and backpressure on the producer for writing requests, and improves the overall execution efficiency.
[0051] In this embodiment, a message processing method is provided, which can be used in laptop computers, desktop computers, servers, etc. Figure 2 It is another schematic diagram of the message processing method flow provided by the embodiment of the present invention. As Figure 2 shown, the process includes the following steps.
[0052] Specific method steps are as follows:
[0053] Step S201, listen to the request commands and response commands corresponding to the multiple producer devices to obtain a listening result.
[0054] Specifically, the above step S201 includes:
[0055] S2011, listen to the request path between the on-chip interconnect network and the multiple producer devices to obtain a request command listening result.
[0056] A request path is set between the on-chip interconnect network and the multiple producer devices. The multiple producer devices send request commands and request data to the on-chip interconnect network through the request path. The message processing device can obtain a request command listening result by listening to the request path.
[0057] S2012, listen to the response path between the on-chip interconnect network and the multiple producer devices to obtain a response command listening result.
[0058] A response path is set between the on-chip interconnect network and the multiple producer devices. The on-chip interconnect network sends response instructions to the multiple producer devices through the response path. The message processing device can obtain a response command listening result by listening to the response path.
[0059] Step S202, according to the listening result, accumulate the quantities of the request commands and response commands corresponding to the multiple producer devices to obtain a request command accumulated value corresponding to the producer identifier and a response command accumulated value corresponding to the producer identifier.
[0060] Specifically, the above step S202 includes:
[0061] S2021, obtaining the cumulative value of the request commands corresponding to the producer identifier according to the monitoring result of the request command.
[0062] Specifically, when a request command in the request path is monitored, the producer identifier in the request command is read, and then the number of request commands is cumulated according to the producer identifier to obtain the cumulative value of the request commands corresponding to the producer identifier.
[0063] Optionally, the request command includes a data stream command and a message stream command, and the data stream command and the message stream command correspond one by one. That is, the producer device first sends a data stream command for requesting to write data to the on-chip interconnection network, and then sends a message stream command for notifying the consumer device, in the order of the data stream command first and then the message stream command. When generating the cumulative value of the request commands, for each producer identifier, the number of the request commands is cumulated respectively, and each time a data stream command or a message stream command is received, it is cumulated once to obtain the cumulative value of the request commands corresponding to each producer identifier.
[0064] Optionally, the cumulative value of the request commands is sent to the request channel and synchronously sent to the on-chip interconnection network with the request channel, so that the on-chip interconnection network forwards the cumulative value of the request commands to the message processing device, so that the speed of the message processing device for processing the request commands is synchronized with the speed of the producer device for sending the request commands.
[0065] S2022, obtaining the cumulative value of the response commands corresponding to the producer identifier according to the monitoring result of the response command.
[0066] Specifically, when a response command in the response path is monitored, the producer identifier in the response command is read, and the number of response commands is cumulated according to the producer identifier to obtain the cumulative value of the response commands corresponding to the producer identifier.
[0067] Step S203, if the cumulative value of the request commands of the same producer identifier and the cumulative value of the response commands meet the preset conditions, the request commands and request data of the producer device corresponding to the same producer identifier are command-mapped.
[0068] The preset conditions can be set according to requirements. Optionally, if the cumulative value of the response commands of the same producer identifier is not less than the cumulative value of the request commands, it indicates that the request commands of the producer device corresponding to the producer identifier are fully responded, and then the request commands and request data of the producer device corresponding to the same producer identifier are command-mapped.
[0069] Optionally, the request command includes a request address for indicating the consumer device corresponding to the request command. The message processing device includes a plurality of consumer buffer units corresponding one-to-one to the plurality of consumer devices. When mapping the request command and request data of the producer device corresponding to the same producer identifier, first read the request address in the request command of the producer device corresponding to the same producer identifier, then map the request address to determine the consumer address hit by the mapped request address, and then map the consumer number corresponding to the consumer address to a consumer identifier, where the consumer identifier corresponds one-to-one to the consumer device. Finally, cache the consumer address, consumer identifier, and the request data of the producer device corresponding to the same producer identifier into the corresponding consumer buffer unit according to the consumer number.
[0070] Step S204: Send the request command and request data after command mapping to the on-chip interconnection network for the on-chip interconnection network to forward to the plurality of consumer devices.
[0071] When sending the request command and request data after command mapping to the on-chip interconnection network, first obtain the working state of the consumer buffer unit and the on-chip interconnection network state. When the working state of the consumer buffer unit and the on-chip interconnection network state meet the preset working conditions, read the consumer address, consumer identifier, and request data in the consumer buffer unit and convert them into the main interface protocol for the message processing device to send the main interface protocol to the on-chip interconnection network. The working state of the consumer buffer unit is used to indicate whether the request command and request data after command mapping are stored in the consumer buffer unit, and the on-chip interconnection network state is used to indicate the working performance of the on-chip interconnection network. The preset working conditions are used to indicate whether the working state of the consumer buffer unit and the on-chip interconnection network state meet the requirements. For example, read and send only when the request command and request data after command mapping are stored in the consumer buffer unit and the working performance of the on-chip interconnection network is good.
[0072] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases, the former is a better implementation method.
[0073] An embodiment of the present application further provides a message processing device, which is connected to the on-chip interconnection network; the on-chip interconnection network is connected to a plurality of producer devices; the on-chip interconnection network is also connected to a plurality of consumer devices. Figure 3 is a schematic structural diagram of a message processing device provided by an embodiment of the present invention, as Figure 3As shown, in this embodiment, the on-chip interconnection network refers to the current on-chip interconnection network. A hardware interface is correspondingly provided between each producer device among the multiple producer devices and the upper-level on-chip interconnection network as the master device interface. Each master device interface is routed to the upper-level on-chip interconnection network, and data streams and message streams are sent through the master device interface. Furthermore, as a slave interface through the upper-level on-chip interconnection network, communication is established with the current on-chip interconnection network to send the data streams and message streams to the current on-chip interconnection network. A request channel (Req Channel) and a response channel (Resp Channel) are provided between the upper-level on-chip interconnection network and the current on-chip interconnection network. The current on-chip interconnection network receives the data streams and message streams sent down by the upper-level on-chip interconnection network. Among them, the data streams are written into the buffer area, and the message streams are written into the message processing device. After being processed by the message processing device, the message streams are sent to each consumer device. At the same time, reorder buffers corresponding to the number of producer devices are provided in the on-chip interconnection network for feedback response command sorting of the response channel. Wherein, Wdata represents the request data.
[0074] The message processing device includes a request channel monitoring unit, a response channel monitoring unit, a receive buffer unit, and a main interface processing unit.
[0075] The request channel monitoring unit is used to monitor the request commands in the request channel between the on-chip interconnection network and the multiple producer devices to obtain the request command accumulation value corresponding to the producer identifier. Specifically, the request channel monitoring unit receives the valid identifier (valid) of the request command (Req Command) and the producer identifier (ID_Tag) in the request channel, indexes the request command ID table according to the producer identifier, accumulates and updates the number of request commands corresponding to the producer identifier, and obtains the request command accumulation value (Req[ID_Tag]_Cnt). Among them, the producer identifier is the ID identifier of the request command defined by the bus protocol, which corresponds to the producer device one by one. The number of entries in the request command ID table is 2 to the power of ID_Tag, and 1 request command counter is correspondingly provided for each producer identifier.
[0076] In an optional implementation manner, the request channel monitoring unit is further used to send the request command accumulation value to the request channel and synchronously send it to the on-chip interconnection network with the request channel for the on-chip interconnection network to forward the request command accumulation value to the receive buffer unit. Among them, the request channel monitoring unit splices and converts the producer identifier and the request command accumulation value into a request command accumulation value signal (Command User) that conforms to the bus protocol and passes it to the request channel.
[0077] The response channel monitoring unit is used to monitor the response commands in the response path between the on-chip interconnection network and the multiple producer devices, so as to obtain the response command accumulation value corresponding to the producer identifier. Specifically, the response channel monitoring unit receives the valid identifier (valid) and the producer identifier (ID_Tag) of the response command (Resp Command) in the response path, indexes the response command ID table according to the producer identifier, accumulates and updates the number of response commands corresponding to the producer identifier, and obtains the response command accumulation value (Resp[ID_Tag]_Cnt). Among them, the number of entries in the response command ID table is 2 to the power of ID_Tag, and each producer identifier is correspondingly provided with 1 response command counter. The response channel monitoring unit is also used to receive the response command accumulation value query instruction sent by the main interface control unit to query the response command accumulation value corresponding to the producer identifier. The response channel monitoring unit indexes the response command ID table according to the producer identifier and feeds back the queried response command accumulation value corresponding to the producer identifier to the main interface control unit.
[0078] The receive buffer unit is used to buffer the request commands and request data received and forwarded by the on-chip interconnection network from the multiple producer devices.
[0079] The main interface processing unit is used to obtain the request command accumulation value corresponding to the producer identifier and the response command accumulation value corresponding to the producer identifier; if the request command accumulation value and the response command accumulation value of the same producer identifier meet the preset conditions, the request commands and request data of the producer device corresponding to the same producer identifier are command-mapped, and the command-mapped request commands and request data are sent to the on-chip interconnection network for the on-chip interconnection network to forward to the multiple consumer devices.
[0080] In an alternative embodiment, the main interface processing unit is further used to read the request command accumulation value from the receive buffer unit; the main interface processing unit is further used to read the response command accumulation value from the response channel monitoring unit.
[0081] In an alternative embodiment, the message processing device further includes a slave interface processing unit. The slave interface processing unit is connected to the current on-chip interconnect network and is also connected to the receive buffer unit. The slave interface processing unit is used as a slave device interface of the current on-chip interconnect network and is responsible for receiving the request commands and request data sent down by the current on-chip interconnect network according to the buffer status fed back by the receive buffer unit and writing them into the receive buffer unit. The request commands at least include a request address (Address) and a request command accumulation value signal (Command User), and the request data is a message stream sent from a producer device to a consumer device. The slave interface processing unit is also used to respond to slave device interface commands and feedback them to the current on-chip interconnect network. The buffer depth of the receive buffer unit is not less than 1. The receive buffer unit is used to maintain the receive buffer status, which includes but is not limited to the buffer empty status and the buffer full status. The receive buffer unit is also used to respond to the write buffer requests initiated by the slave interface processing unit according to the receive buffer status to cache the request commands and request data; the receive buffer unit is also used to respond to the read buffer requests initiated by the master interface control unit according to the receive buffer status.
[0082] Figure 4It is a schematic structural diagram of the main interface control unit provided by an embodiment of the present invention. In an optional implementation manner, the main interface processing unit includes a comparison unit, a command mapping unit, multiple consumer buffer units, and an interface control unit. The comparison unit is configured to compare the request command accumulation value read from the receive buffer unit with the response command accumulation value read from the response channel monitoring unit, and when a preset condition is satisfied, initiate a request to the command mapping unit. The command mapping unit is configured to receive the request initiated by the comparison unit, map the read request address to a consumer address (Address-Mapped), and then remap it to a consumer device ID (hereinafter referred to as Device ID) according to the consumer number W (W≥1). The consumer number is the number corresponding to the consumer address hit after the address mapping of the request address. The mapping relationship, the number of mappings, and the consumer number can be obtained through parameter passing or configuration, which is not limited here. The multiple consumer buffer units correspond to the consumer devices one by one. The buffer depth of each consumer buffer unit is not less than 1. Each consumer buffer unit is configured to maintain its own consumer buffer status, and the consumer buffer status includes but is not limited to the buffer empty status and the buffer full status. After the command mapping, the command mapping unit initiates a write command and write data to the corresponding consumer buffer unit among the multiple consumer buffer units according to the consumer address, so as to store the request command and request data after the command mapping into the corresponding consumer buffer unit. The consumer buffer unit is also configured to respond to the read request initiated by the interface control unit and send the read data to the interface control unit. The interface control unit is connected to a main device interface of the current on-chip interconnection network. A main device interface request channel is included between the interface control unit and the main device interface. The interface control unit is responsible for converting the request command and request data after the command mapping stored in the multiple consumer buffer units into a main interface protocol, sending it to the current on-chip interconnection network, and then sending it to the corresponding consumer device. Specifically, the interface control unit is configured to obtain the status of the multiple consumer buffer units and the status of the current on-chip interconnection network, initiate a read request to the multiple consumer buffer units, convert the request command and request data after the command mapping read into a main interface protocol, and send it to the main device interface request channel to be sent to the current on-chip interconnection network. When the multiple consumer buffer units simultaneously meet the read conditions, the interface control unit is also configured to arbitrate the multiple consumer buffer units by using an arbitration mechanism to determine the data read order. The interface control unit is also configured to receive and respond to the commands in the main device interface request channel.
[0083] As one or more specific application embodiments of the embodiments of the present invention, the optimal implementation scheme or the scheme that the inventor most wants to embody is described below in combination with specific application scenarios.
[0084] In this embodiment, taking 2 producer devices-2 consumer devices and 2 buffer areas as an example, producer device 0 and producer device 1 establish a multi-producer-multi-consumer model with consumer device 0 and consumer device 1 in turn, wherein the request command is a write command and the request data is write data as an example, Figure 5 This is a schematic diagram of the data flow and message flow sequence sent in the current on-chip interconnection network provided by an embodiment of the present invention. The request address corresponding to the notification message is the address of the written message processing device, which is converted into the consumer address after address mapping by the message processing device. The message processing device monitors the request path and generates a request command accumulated value signal (Command User). Figure 6 The present invention provides a schematic diagram of the current on-chip interconnect network request path command flow. The message processing device receives the request command and request data and saves them to the receiving cache unit. Figure 7 1 is a schematic diagram of the data format of the receiving cache unit provided by an embodiment of the present invention, wherein it is assumed that the request addresses are Address0, Address1, Address2 and Address3 respectively. The message processing device monitors the response channel to generate a response command accumulation value, Figure 8 It is a schematic diagram of the response command accumulated value provided by an embodiment of the present invention. After comparison and command mapping, the main interface control unit in the message processing device saves the command mapped information to the corresponding consumer cache unit, and makes a judgment. When the cache status of the receiving cache unit is not empty, the main interface control unit reads the data of the receiving cache unit. Exemplarily, the first request command accumulated value Req[0]_Cnt and the first response command accumulated value Resp[0]_Cnt are compared. When Resp[0]_Cnt≥Req[0]_Cnt, it indicates that the producer device 0 has written the data stream into the cache area 0 in the on-chip interconnection network. At this time, the comparison unit initiates a request to the command mapping unit. After receiving the request, the command mapping unit performs command mapping and saves the data to the corresponding consumer cache unit according to the consumer number, wherein the command mapping at least includes mapping of the address and mapping of the consumer number, that is, mapping the request address to the consumer address, and mapping the consumer device ID according to the consumer number. Figure 9It is a schematic diagram of the data format of the consumer cache unit provided by an embodiment of the present invention. Among them, Address0-Mapped, Address1-Mapped, Address2-Mapped, and Address3-Mapped are the corresponding consumer addresses after address mapping of Address0, Address1, Address2, and Address3 respectively. Finally, when the cache status of the consumer cache unit is non-empty and the on-chip interconnect network is idle, according to the arbitration mechanism, the data in the consumer 0 cache unit and the consumer 1 cache unit is read and sent to the current on-chip interconnect network, and finally sent to the consumer device 0 and the consumer device 1. After receiving the message, the consumer device 0 and the consumer device 1 read the data from the corresponding buffer area in the on-chip interconnect network for subsequent operations.
[0085] An embodiment of the present application also provides a message processing device, as Figure 10 shown, including: a listening module 1001, an accumulation module 1002, a command mapping module 1003, and a sending module 1004.
[0086] The listening module 1001 is used to listen to the request commands and response commands corresponding to the multiple producer devices to obtain a listening result;
[0087] The accumulation module 1002 is used to accumulate the request commands and response commands corresponding to the multiple producer devices according to the listening result to obtain a request command accumulation value corresponding to the producer identifier and a response command accumulation value corresponding to the producer identifier;
[0088] The command mapping module 1003 is used to map the request commands and request data of the producer device corresponding to the same producer identifier if the request command accumulation value and the response command accumulation value of the same producer identifier meet a preset condition;
[0089] The sending module 1004 is used to send the request commands and request data after command mapping to the on-chip interconnect network for the on-chip interconnect network to forward to the multiple consumer devices.
[0090] For the description of the features in the corresponding embodiment of the message processing device, reference can be made to the relevant description of the corresponding embodiment of the message processing method, which will not be elaborated here one by one.
[0091] An embodiment of the present application also provides an electronic device, as Figure 11 shown, including a memory 10 and a processor 20. A computer program is stored in the memory 10, and the processor 20 is configured to run the computer program to execute the steps in any one of the above message processing method embodiments.
[0092] Embodiments of the present application further provide a computer-readable storage medium storing a computer program, where the computer program is configured to execute the steps in any of the above-described message processing method embodiments when running.
[0093] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: various media capable of storing computer programs such as USB flash drives, read-only memories (ROM), random access memories (RAM), external hard disks, magnetic disks, or optical discs.
[0094] Embodiments of the present application further provide a computer program product including a computer program that, when executed by a processor, implements the steps in any of the above-described message processing method embodiments.
[0095] Embodiments of the present application further provide another computer program product including a non-volatile computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps in any of the above-described message processing method embodiments.
[0096] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Skilled professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0097] The above has introduced in detail a message processing method, apparatus, device, and storage medium provided by the present application. Specific examples are used herein to illustrate the principles and implementation manners of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the protection scope of the present application.
Claims
1. A message processing method, characterized in that, Applied to a message processing device, the message processing device being connected to an on-chip interconnect network; the on-chip interconnect network being connected to a plurality of producer devices; The on-chip interconnect network is further connected to a plurality of consumer devices; the method includes: Listening to request commands and response commands corresponding to the plurality of producer devices to obtain a listening result; According to the listening result, accumulating the quantities of the request commands and response commands corresponding to the plurality of producer devices to obtain a request command accumulation value corresponding to the producer identifier and a response command accumulation value corresponding to the producer identifier; If the request command accumulation value and the response command accumulation value of the same producer identifier meet a preset condition, then map the request commands and request data of the producer device corresponding to the same producer identifier; Send the request commands and request data after command mapping to the on-chip interconnect network for the on-chip interconnect network to forward to the plurality of consumer devices.
2. The message processing method according to claim 1, wherein Listening to the request commands corresponding to the plurality of producer devices includes: Listening to the request paths between the on-chip interconnect network and the plurality of producer devices; Obtaining the request command accumulation value corresponding to the producer identifier includes: When a request command in the request path is listened to, read the producer identifier in the request command; Accumulate the quantity of the request commands according to the producer identifier to obtain the request command accumulation value corresponding to the producer identifier.
3. The message processing method according to claim 2, wherein The request commands include data stream commands and message stream commands, and the data stream commands and message stream commands are in one-to-one correspondence; Accumulating the quantity of the request commands according to the producer identifier to obtain the request command accumulation value corresponding to the producer identifier includes: For each producer identifier, respectively accumulate the quantity of the request commands, and accumulate once for each received data stream command or message stream command to obtain the request command accumulation value corresponding to each producer identifier.
4. The message processing method according to claim 1, wherein Listening to the response commands corresponding to the plurality of producer devices includes: Listening to the response paths between the on-chip interconnect network and the plurality of producer devices; Obtaining the response command accumulation value corresponding to the producer identifier includes: When a response command in the response path is listened to, read the producer identifier in the response command; Accumulate the quantity of the response commands according to the producer identifier to obtain the response command accumulation value corresponding to the producer identifier.
5. The message processing method according to any one of claims 1 to 4, characterized in that The request commands include request addresses; the request addresses are used to indicate the consumer devices corresponding to the request commands; the message processing device includes a plurality of consumer buffer units corresponding one-to-one to the plurality of consumer devices; Mapping the request commands and request data of the producer device corresponding to the same producer identifier includes: Read the request address in the request command of the producer device corresponding to the same producer identifier; Map the request address to determine the consumer address hit by the mapped request address; Map the consumer number corresponding to the consumer address to a consumer identifier; the consumer identifier corresponds one-to-one to the consumer device; Cache the request data of the producer device corresponding to the consumer address, consumer identifier, and the same producer identifier into the corresponding consumer cache unit according to the consumer number. The step of sending the request command and request data after command mapping to the on-chip interconnect network includes: Obtain the working status of the consumer cache unit and the status of the on-chip interconnect network. When the working status of the consumer cache unit and the status of the on-chip interconnect network meet the preset working conditions, read the consumer address, consumer identifier, and request data in the consumer cache unit, and convert them into the main interface protocol for the message processing device to send the main interface protocol to the on-chip interconnect network.
6. The message processing method according to claim 1, characterized in that The step of performing command mapping on the request command and request data of the producer device corresponding to the same producer identifier if the accumulated value of the request commands and the accumulated value of the response commands of the same producer identifier meet the preset conditions includes: If the accumulated value of the response commands of the same producer identifier is not less than the accumulated value of the request commands, perform command mapping on the request command and request data of the producer device corresponding to the same producer identifier.
7. A message processing device, characterized in that, Applied to a message processing device, the message processing device is connected to an on-chip interconnect network; the on-chip interconnect network is connected to multiple producer devices; The on-chip interconnect network is also connected to multiple consumer devices; the device includes: A listening module, configured to listen to the request commands and response commands corresponding to the multiple producer devices to obtain a listening result. An accumulation module, configured to accumulate the quantities of the request commands and response commands corresponding to the multiple producer devices according to the listening result to obtain an accumulated value of the request commands corresponding to the producer identifier and an accumulated value of the response commands corresponding to the producer identifier. A command mapping module, configured to perform command mapping on the request command and request data of the producer device corresponding to the same producer identifier if the accumulated value of the request commands and the accumulated value of the response commands of the same producer identifier meet the preset conditions. A sending module, configured to send the request command and request data after command mapping to the on-chip interconnect network for the on-chip interconnect network to forward to the multiple consumer devices.
8. A message processing device, characterized in that, The message processing device is connected to an on-chip interconnect network; the on-chip interconnect network is connected to multiple producer devices; the on-chip interconnect network is also connected to multiple consumer devices; the device includes: A request channel listening unit, configured to listen to the request commands in the request path between the on-chip interconnect network and the multiple producer devices to obtain an accumulated value of the request commands corresponding to the producer identifier. A response channel listening unit, configured to listen to the response commands in the response path between the on-chip interconnect network and the multiple producer devices to obtain an accumulated value of the response commands corresponding to the producer identifier. A receive cache unit, configured to cache the request commands and request data received and forwarded by the on-chip interconnect network from the multiple producer devices. The main interface processing unit is used to obtain the accumulated value of the request command corresponding to the producer identifier and the accumulated value of the response command corresponding to the producer identifier; if the accumulated value of the request command and the accumulated value of the response command of the same producer identifier meet the preset conditions, the request command and request data of the producer device corresponding to the same producer identifier are command-mapped, and the command-mapped request command and request data are sent to the on-chip interconnection network for the on-chip interconnection network to forward to the multiple consumer devices.
9. The message processing device according to claim 8, wherein The request channel monitoring unit is further used to send the accumulated value of the request command to the request channel and synchronously issue it to the on-chip interconnection network with the request channel for the on-chip interconnection network to forward the accumulated value of the request command to the receive buffer unit; The main interface processing unit is further used to read the accumulated value of the request command from the receive buffer unit; The main interface processing unit is further used to read the accumulated value of the response command from the response channel monitoring unit.
10. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, wherein when the computer program is executed by a processor, the steps of the message processing method according to any one of claims 1 to 6 are implemented.