Virtual channel data processing method and related device

By retaining the corresponding reserved space for the virtual channel that already exists in the virtual channel sharing buffer and retaining an idle reserved space for the virtual channel to be stored, the resource waste caused by the long-term idle storage space of the virtual channel is solved, and the transmission performance of the virtual channel is improved.

CN119988261APending Publication Date: 2025-05-13SMARTER SILICON (SHANGHAI) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510128113.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-27
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

In the virtual channel shared buffer, since the virtual channels are independent of each other and the access behavior is different, the storage space of some virtual channels is idle for a long time, resulting in waste of resources and affecting transmission performance.

Method used

By retaining the corresponding reserved space for the virtual channels of existing data in the cache and a free reserved space for the virtual channels of data to be stored, the storage and access policies are optimized to avoid wasting resources.

Benefits of technology

Effectively utilize cache area resources, improve the transmission performance of virtual channels, and reduce resource waste.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119988261A_ABST
    Figure CN119988261A_ABST
Patent Text Reader

Abstract

The invention discloses a virtual channel data processing method and a related device, and relates to the field of information processing, the method is applied to a cache region, and the method comprises the following steps: based on each virtual channel with data in the cache region, respectively reserving a reservation space corresponding to each virtual channel, at least one cache block in the reserved space is occupied by data corresponding to the virtual channel; and on the basis of the virtual channel with the to-be-stored data, reserving an idle reserved space in the cache region.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information processing, and in particular to a method for processing virtual channel data and a related device. Background Art

[0002] A virtual channel (VC) is used to share a physical connection between multiple logical connections, thereby improving network efficiency and flexibility.

[0003] In the design of interconnection buses, virtual channel technology is widely used. This virtual channel technology allocates free space to each virtual channel through a shared buffer method to improve resource utilization.

[0004] Figure 1 What is shown is a schematic diagram of a virtual channel shared buffer in the prior art, including n virtual channels VC0~VCn-1. The buffer allocates 2 storage blocks (slots) as reserved space for each virtual channel, which are arranged from left to right according to the number of the virtual channels. Virtual channel VC0 corresponds to storage block 0 and storage block 1, virtual channel VC0 corresponds to storage block 2 and storage block 3, ..., virtual channel VCn-1 corresponds to storage block 2n-2 and storage block 2n-1, and the remaining free space is on the right side of all reserved spaces.

[0005] However, since each virtual channel is independent of each other, the access behavior may be completely different. If a virtual channel is not accessed for a period of time, or even for a long time, the storage space reserved for the virtual channel will be idle. When multiple virtual channels have similar behaviors, the shared buffer resources may be significantly wasted, which will affect the transmission performance of some virtual channels. Summary of the invention

[0006] The first aspect of the present application provides a method for processing virtual channel data, which is applied to a buffer area, comprising:

[0007] Based on each virtual channel having data in the cache area, respectively reserve a reserved space corresponding to each virtual channel, and at least one cache block in the reserved space is occupied by the data corresponding to the virtual channel;

[0008] Based on the virtual channel where data to be stored exists, a free reserved space is reserved in the cache area.

[0009] In a possible implementation, the step of reserving the reserved space corresponding to each virtual channel based on the virtual channels having data in the cache area includes:

[0010] Taking a data unit as a transmission unit, receiving the first data to be written, and storing one data unit into a cache block;

[0011] Determine a first virtual channel corresponding to the first data;

[0012] Based on the fact that the first virtual channel is a virtual channel in which data already exists in the cache area, determining whether there is a free cache block in the first reserved space corresponding to the first virtual channel;

[0013] Based on the existence of free cache blocks in the first reserved space, storing the first data into the free cache blocks according to a set storage order;

[0014] Based on the fact that there is no free cache block in the first reserved space, the first data is stored in a storage space subsequent to the first reserved space according to a set storage order.

[0015] In a possible implementation, storing the first data in a storage space subsequent to the first reserved space according to a set storage order based on the absence of free cache blocks in the first reserved space includes:

[0016] Based on the absence of free cache blocks in the first reserved space, each reserved space after the first reserved space is moved backward by a first specific number of cache blocks according to a set storage order, where the first specific number is consistent with the number of data units corresponding to the first data;

[0017] The first data is stored in a storage space subsequent to the first reserved space, where the storage space includes a first specific number of cache blocks.

[0018] In a possible implementation, the method further includes:

[0019] Based on the fact that the first virtual channel is a virtual channel in the cache area where data is to be stored, storing the first data in an idle reserved space to form a reserved space for the first virtual channel;

[0020] Based on the virtual channel that still has data to be stored, a free reserved space is reserved in the cache area; according to the set storage order, the free reserved space is after the reserved space of the first virtual channel.

[0021] In a possible implementation, the step of reserving the reserved space corresponding to each virtual channel based on the virtual channels having data in the cache area includes:

[0022] In response to the read request, second data is sent to the requesting party according to the data unit as a transmission unit, and one data unit is stored in one cache block;

[0023] Determine a second virtual channel corresponding to the second data;

[0024] Determining remaining data units of the second virtual channel in the buffer area;

[0025] Based on the number of remaining data units in the cache area of ​​the second virtual channel being greater than the number of cache blocks in the second reserved space, the reserved spaces after the second reserved space are sequentially moved forward by a second specific number of cache blocks according to a set storage order, where the second specific number is consistent with the number of data units corresponding to the second data;

[0026] Based on the fact that the number of remaining data units is not greater than the number of cache blocks in the second reserved space and is not zero, the second reserved space is reserved, and cache blocks without data in the second reserved space are marked as free.

[0027] In a possible implementation, the method further includes:

[0028] Based on the number of remaining data units of the second virtual channel in the buffer area being zero, canceling the second reserved space corresponding to the second virtual channel;

[0029] According to the set storage order, each reserved space after the second reserved space is moved forward by a preset number of cache blocks, and any reserved space contains the preset number of cache blocks;

[0030] A free reserved space is reserved after the storage queue in the buffer area, and the storage queue contains the reserved space of each virtual channel of each existing data.

[0031] In a possible implementation, the step of reserving a free reserved space in a cache area based on a virtual channel having data to be stored includes:

[0032] Based on changes in cached data in the cache area, determining the number of channels of virtual channels having data in the cache area;

[0033] Based on the number of channels being less than the preset number of virtual channels, a free reserved space is reserved after the storage queue in the buffer area, the storage queue includes the reserved space of each virtual channel of each existing data, and the reserved space of each virtual channel in the storage queue is sorted according to the set storage order;

[0034] Based on the number of channels being equal to the set number of virtual channels, no free reserved space is reserved in the buffer area.

[0035] In a possible implementation, the method further includes:

[0036] Determine the first cache block in the reserved space corresponding to each virtual channel;

[0037] A head pointer of each virtual channel is generated according to the first cache block of each virtual channel.

[0038] In a possible implementation, determining the first cache block in the reserved space corresponding to each virtual channel includes:

[0039] By counting, the number of data units currently stored in each virtual channel is determined, and one data unit is stored in one cache block;

[0040] Along the sorting direction of the reserved space corresponding to each virtual channel, the number of cache blocks before any virtual channel is counted in sequence;

[0041] According to the number of cache blocks before any virtual channel, the first cache block in the reserved space corresponding to any virtual channel is determined.

[0042] A second aspect of the present application provides a virtual channel data processing device, which is applied to a buffer area, comprising:

[0043] A first reservation module is used to reserve the reserved space corresponding to each virtual channel based on the virtual channels having data in the cache area, and at least one cache block in the reserved space is occupied by the data corresponding to the virtual channel;

[0044] The second reservation module is used to reserve a free reserved space in the cache area based on the virtual channel where the data to be stored exists.

[0045] A third aspect of the present application provides a computer program product, comprising computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the method for processing virtual channel data of the first aspect or any implementation of the first aspect.

[0046] A fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:

[0047] The memory is used to store computer programs;

[0048] The processor is used to execute the computer program so that the electronic device can implement the method for processing virtual channel data of the first aspect or any implementation manner of the first aspect.

[0049] A fifth aspect of the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement the method for processing virtual channel data of the first aspect or any implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0051] Figure 1 is a schematic diagram of a virtual channel shared buffer in the prior art;

[0052] Figure 2 It is a flowchart of a method for processing virtual channel data provided by an embodiment of the present application;

[0053] Figure 3 is a schematic diagram of the initial state of the cache area provided in an embodiment of the present application;

[0054] Figure 4 is a schematic diagram of the working state of the cache area provided in an embodiment of the present application;

[0055] Figure 5 A flowchart of reserving a reserved space corresponding to each virtual channel based on the first virtual channel being a virtual channel that has stored data in the cache area provided by an embodiment of the present application;

[0056] Figure 6 is a schematic diagram of storing first data provided by an embodiment of the present application;

[0057] Figure 7 It is a flowchart of storing the first data into a storage space subsequent to the first reserved space according to a set storage order based on the absence of free cache blocks in the first reserved space provided in an embodiment of the present application;

[0058] Figure 8 is another schematic diagram of storing first data provided by an embodiment of the present application;

[0059] Fig. 9 It is a flow chart of reserving a reserved space corresponding to the first virtual channel in the cache area based on that the first virtual channel is a virtual channel to store data in the cache area provided by an embodiment of the present application;

[0060] Fig.10 is another schematic diagram of storing first data provided by an embodiment of the present application;

[0061] Fig.11 is another schematic diagram of storing first data provided by an embodiment of the present application;

[0062] Fig.12It is a flowchart of reserving the reserved space corresponding to each virtual channel under the data reading operation based on each virtual channel having data in the cache area provided by the embodiment of the present application;

[0063] Fig.13 is a schematic diagram of reading second data provided by an embodiment of the present application;

[0064] Fig.14 is another schematic diagram of reading second data provided by an embodiment of the present application;

[0065] Fig.15 It is another flow chart of reserving the reserved space corresponding to each virtual channel based on each virtual channel having data in the cache area provided by the embodiment of the present application;

[0066] Fig.16 is another schematic diagram of reading second data provided by an embodiment of the present application;

[0067] Fig.17 is another schematic diagram of reading second data provided by an embodiment of the present application;

[0068] Fig.18 A schematic diagram of a process for reserving a free reserved space in a cache area based on a virtual channel having data to be stored provided in an embodiment of the present application;

[0069] Fig.19 It is a schematic diagram of a flow chart of generating a head pointer of each virtual channel provided in an embodiment of the present application;

[0070] Fig. 20 It is a schematic diagram of a process for determining the first cache block in the reserved space corresponding to each virtual channel provided by an embodiment of the present application;

[0071] Fig.21 It is a schematic diagram of changes in a buffer area in an application scenario of a method for processing virtual channel data provided by the present application;

[0072] Fig. 22 It is a structural schematic diagram of a virtual channel data processing device provided in an embodiment of the present application;

[0073] Fig.23 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0074] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.

[0075] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0076] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0077] To facilitate understanding of this solution, the professional terms involved in the embodiments of this application are now explained.

[0078] The interconnection bus is a general term for a group of common signal lines and related control circuits that connect and communicate multiple components within a computer system. As a common channel for transmitting information between various computer components, the interconnection bus is responsible for transmitting address, data and control information between various components of the system.

[0079] Virtual channels are multiple independent communication paths formed by logical division based on physical channels. These paths may share the same set of bus lines physically, but are logically independent of each other. Each virtual channel has its own identification and transmission rules, thus realizing parallel transmission and flexible scheduling of data on the bus.

[0080] Accordingly, the virtual channel of the interconnect bus is a logically divided channel used to achieve more efficient and flexible data transmission on the interconnect bus. The method for processing virtual channel data in the present application is to control the reserved space in the buffer area of ​​the virtual channel in the interconnect bus.

[0081] Reference Figure 2 , Figure 2 is a flow chart of a method for processing virtual channel data provided by an embodiment of the present application, such as Figure 2 As shown, a method for processing virtual channel data provided by an embodiment of the present application may include steps 201 to 202, and these steps are described in detail below.

[0082] 201. Based on each virtual channel having data in the cache area, respectively reserve a reserved space corresponding to each virtual channel, and at least one cache block in the reserved space is occupied by the data corresponding to the virtual channel;

[0083] The buffer area is used to store data transmitted from each virtual channel, and when each processing unit processes the data in the buffer area, the data is read out from the buffer area.

[0084] The interconnect bus can be divided into multiple virtual channels, each of which transmits data independently but shares the same interconnect bus. During operation, the cache area caches the data transmitted by each virtual channel, and the processing unit reads the required data from the cache area for processing; once the data is read by the processing unit, the corresponding cache area will no longer cache the read data.

[0085] Therefore, during the working process, data of some virtual channels may already exist in the buffer area, while data of some virtual channels may not have arrived yet and are in a state of data to be stored.

[0086] Among them, when a virtual channel with data already exists in the cache area, a corresponding reserved space is reserved for the virtual channel in the cache area. The corresponding reserved space in the cache area for the virtual channel with data already exists can be the reserved space set for the virtual channel for the first time, or it can be the reserved space continuously maintained for the virtual channel. The data of each virtual channel occupies the reserved space first. When the data in the reserved space of the virtual channel is read out, the data in the non-reserved space of the channel can continue to occupy the reserved space; if all the data of a virtual channel has been read, the reserved space of the virtual channel will no longer be reserved.

[0087] The reserved space includes one or more cache slots, each of which is used to store data. The size of the cache slot can be based on the size of the smallest data transmission unit during bus data transmission, such as the size of a single data packet. In other embodiments, the size of a single cache slot can also be larger than the smallest data transmission unit.

[0088] The reserved space reserved for the virtual channel includes one or more cache blocks, wherein at least one cache block in the reserved space is occupied by data corresponding to the virtual channel, and the data corresponding to the virtual channel may be data transmitted through the virtual channel.

[0089] In the cache area, the reserved space corresponding to each virtual channel can be cancelled. When all the data stored in the cache area of ​​any virtual channel is taken out, the reserved space corresponding to the virtual channel is cancelled, and the cache blocks in the reserved space can be occupied by other reserved spaces or free reserved spaces.

[0090] In a possible implementation, an identifier is set for each virtual channel with existing data in the cache area. The identifier can be a digital number. The number is specifically numbered according to the order in which any virtual channel is received in the cache area. The number is different from the ID (Identity document) sorting method of each virtual channel in the interconnect bus.

[0091] In a possible implementation, when the first data is received, the virtual channel corresponding to the first data can be determined, and then the first data can be stored in which cache block of the corresponding reserved space in the cache area. If the channel corresponding to the first data has data stored in the cache area, the subsequent Figure 5 The specific process of reserving the reserved space corresponding to each virtual channel based on the data already existing in the cache area is described in detail; if the first virtual channel corresponding to the first data has no data in the cache area, the first virtual channel is to store data, and the subsequent Fig. 9 The specific process for reserving the reserved space corresponding to the first virtual channel in the cache area is described in detail.

[0092] In a possible implementation, when the second data is read from the cache area, the virtual channel corresponding to the second data can be determined, and then after the second data is read, the influence of the second reserved space corresponding to the second virtual channel is determined, and the corresponding cache block in the second reserved space is controlled to be moved, and then Fig.12 The specific process of reserving the reserved space corresponding to each virtual channel based on the data already existing in the cache area is described in detail.

[0093] 202. Based on the virtual channel where the data to be stored exists, reserve a free reserved space in the cache area.

[0094] There may be one or more virtual channels for storing data.

[0095] There is a virtual channel for storing data, and the virtual channel has not transmitted data yet. Therefore, the virtual channel has data to be stored in the buffer area.

[0096] Among them, when there are virtual channels for data to be stored, no matter the number of virtual channels for data to be stored is one or more, only one free reserved space is reserved in the cache area, and the free reserved space can be occupied by any virtual channel for data to be stored and become the reserved space of the virtual channel. At the same time, if there are still virtual channels for data to be stored, a new free reserved space will continue to be opened in the cache area.

[0097] The virtual channel to store data may be a virtual channel in which data has never been cached, or may be a virtual channel in which data has been cached but all the data has been read out, resulting in that the cache area no longer contains data of the virtual channel.

[0098] When all virtual channels have corresponding data stored in the cache area, it is only necessary to reserve the reserved space corresponding to each virtual channel, and there is no need to reserve idle reserved channels.

[0099] In a possible implementation, the cache blocks in the cache area, except for the reserved space reserved for each virtual channel and the cache blocks occupied by the free reserved space, the remaining cache blocks are free cache blocks, which can store data of any virtual channel and can also be in an idle state.

[0100] Figure 3 3 is a schematic diagram of the initial state of the cache area provided in the embodiment of the present application. In the initial state, the cache area has not received any data transmitted by the virtual channel. The cache area contains a number of cache blocks. In the initial state, only one free reserved space 301 is set in the cache area, and the free reserved space contains two cache blocks. The remaining cache blocks in the cache area are free cache blocks. The figure uses squares to represent cache blocks.

[0101] Figure 4 : is a schematic diagram of the working state of the cache area provided in an embodiment of the present application. The working state is a state in which the cache area is in operation. In the schematic diagram, there are reserved spaces 401 corresponding to a total of i virtual channels VC1~VCi in the cache area, and there is also a free reserved space 402 in the cache area. The free reserved space includes two cache blocks. The reserved space 401 of each virtual channel includes two cache blocks. The remaining cache blocks in the cache area are free cache blocks. The figure uses squares to represent cache blocks.

[0102] The virtual channel to store data may be a virtual channel that has never had data cached, or may be a virtual channel that has had data cached but has been read out of the cache so that the cache no longer has data for the virtual channel. In a possible implementation, when the cached data in the cache changes, the number of virtual channels that already have data in the cache determines whether to keep the free reserved space. Fig.18 In the figure, a specific process of reserving a free reserved space in a cache area based on a virtual channel having data to be stored is described.

[0103] It should be noted that for each virtual channel in the cache area where data already exists, the reserved space corresponding to each virtual channel is reserved, and a free reserved space is reserved in the cache area for the virtual channel to store data. The execution order of the two steps is not limited to the order in this embodiment. The two parts can be executed simultaneously or in any order.

[0104] In a possible implementation, for each reserved space, a head pointer of each virtual channel is set so that the data stored in the reserved space can be read and processed later. Fig.19 The process of generating the head pointer of each virtual channel is described in detail.

[0105] In the present embodiment, based on each virtual channel in which data already exists in the cache area, reserved space corresponding to each virtual channel is reserved respectively, and at least one cache block in the reserved space is occupied by data corresponding to the virtual channel; based on the virtual channel in which data to be stored exists, a free reserved space is reserved in the cache area, so that only one free reserved space is reserved in the cache area for the virtual channel in which data to be stored is stored, and the free reserved space can be used as data of the virtual channel for subsequent data to be stored, and there is no need to reserve reserved space for each virtual channel in which data to be stored, so that the free reserved space is shared, the utilization rate of the cache blocks in the cache area is improved, and the overall transmission performance of the virtual channel can be improved.

[0106] Figure 5 The embodiment of the present application provides a flow chart of reserving the reserved space corresponding to each virtual channel based on the first virtual channel being a virtual channel that already has stored data in the cache area, and the reserved space corresponding to each virtual channel based on the virtual channels that already have data in the cache area. The flow chart may include steps 501 to 505, and these steps are described in detail below.

[0107] 501. Receive first data to be written, taking a data unit as a transmission unit, and store one data unit into a cache block;

[0108] The data in the virtual channel is received according to data units (flits) and written into the buffer area.

[0109] The amount of data contained in the data unit is consistent with the amount of data stored in the cache block in the cache area. Accordingly, one data unit is stored in one cache block.

[0110] The first data may include one or more data units, and accordingly, the first data is stored in one or more cache blocks in the cache area.

[0111] 502. Determine a first virtual channel corresponding to the first data;

[0112] The received first data carries identification information of a virtual channel, and the first virtual channel corresponding to the first data can be obtained by analyzing the first data.

[0113] The first data may include one data unit or multiple data units.

[0114] When the first data includes one data unit, the data unit can be analyzed to obtain its corresponding first virtual channel; when the first data includes multiple data units, each received data unit can be analyzed separately to determine its corresponding first virtual channel.

[0115] In a possible implementation, at a certain moment, the buffer area may receive multiple first data, and the present solution may be executed for each first data respectively. The multiple first data may belong to the same virtual channel or different virtual channels.

[0116] 503. Based on the fact that the first virtual channel is a virtual channel in which data already exists in the cache area, determine whether there is a free cache block in the first reserved space corresponding to the first virtual channel;

[0117] If the first virtual channel is a virtual channel in which data already exists in the cache area, then the cache area already has a reserved space corresponding to the first virtual channel. Since the reserved space is occupied by data first, at least one cache block in the cache area is occupied, and it is necessary to determine whether there is any free cache block.

[0118] Wherein, each cache block in the first reserved space in the cache area is judged to determine whether there is a free cache block in the first reserved space, and the free cache block is a cache block in the reserved space that does not store data.

[0119] Whether there is a free cache block in the first reserved space determines the location of the cache block storing the first data.

[0120] If there is a free cache block in the first reserved space, the subsequent step 504 is executed; if there is no free cache block in the first reserved space, the subsequent step 505 is executed.

[0121] 504. Based on the existence of a free cache block in the first reserved space, store the first data into the free cache block according to a set storage order;

[0122] If there are free cache blocks in the first reserved space, it means that the cache blocks in the first reserved space are not all occupied, and the first data can be stored in the free cache blocks in the first reserved space.

[0123] When storing data in the cache area, the order of storage is set, and generally the data is stored in sequence according to the arrangement order of each cache block.

[0124] The first reserved space also stores the data received from the first virtual channel in sequence according to the arrangement order of the cache blocks therein.

[0125] For example, the first reserved space contains cache block 1, cache block 2, and cache block 3 in order, and cache block 2 and cache block 3 are free cache blocks, so the received first data is stored in cache block 2.

[0126] Figure 6 This is a schematic diagram of storing first data provided by an embodiment of the present application. In the figure, the cache area includes 2 reserved spaces and 1 free reserved space, as well as other cache spaces to be allocated after these reserved spaces and free reserved spaces. Each reserved space has 3 cache blocks. Reserved space 1 corresponds to virtual channel VC1, and reserved space 2 corresponds to virtual channel VC2. The three cache blocks in the reserved space 1 are cache block 0, cache block 1, and cache block 2. Cache block 0 has stored data, and cache block 1 and cache block 2 are free cache blocks. The first data includes a data unit, which occupies a cache block for storage. The first data is stored in cache block 1 in order, wherein the Figure 6 (a) is a schematic diagram of the cache area before storing the first data. Figure 6 (b) is a buffer area after storing the first data. Figure 6 Gray is used to indicate that the cache block has stored data.

[0127] 505 . Based on the absence of free cache blocks in the first reserved space, store the first data into a storage space subsequent to the first reserved space according to a set storage order.

[0128] Among them, if there is no free cache block in the first reserved space, all cache blocks in the first reserved space have been written with data. In order to ensure continuous storage of data of the same virtual channel, the cache blocks that need to store their data are located adjacently. Then, according to the set storage data, the first data is stored in the subsequent storage space adjacent to the reserved space.

[0129] Among them, in the cache area, the reserved spaces and the free reserved spaces are arranged in sequence from front to back according to the set storage order, and the reserved spaces are arranged in sequence from front to back according to the start time of the reservation.

[0130] In a possible implementation, if there is no reserved space corresponding to other virtual channels after the first reserved space, and there is only free reserved space, the free reserved space can be moved backward by one or more cache blocks to reserve corresponding cache blocks for the first data, thereby providing the storage space required for storing the first data.

[0131] It should be noted that the movement of the reserved space in the present application may specifically be the movement of the sorting of the pointers corresponding to the reserved space, so as to achieve the effect of moving the reserved space.

[0132] In a possible implementation, if there is no free cache block in the first reserved space, the data can be stored in a cache block after the first reserved space and continuous with the first reserved space, and the reserved space corresponding to other virtual channels after the first reserved space is moved backwards. Figure 7 The process of storing the first data in the storage space subsequent to the first reserved space according to the set storage order is described in detail.

[0133] In this embodiment, the first data to be written is received according to the data unit as the transmission unit, and one data unit is stored in a cache block, and the first virtual channel corresponding to the first data is determined; based on the fact that the first virtual channel is a virtual channel in which data already exists in the cache area, it is determined whether there is a free cache block in the first reserved space corresponding to the first virtual channel; based on the fact that there is a free cache block in the first reserved space, the first data is stored in the free cache block according to the set storage order; based on the fact that there is no free cache block in the first reserved space, the first data is stored in the subsequent storage space of the first reserved space according to the set storage order. The virtual channel transmits data according to the data unit. When the cache area receives the first data, it is determined whether the virtual channel corresponding to the first data already has data in the cache area. If it is existing data, the reserved space of the virtual channel corresponding to the first data can be used to store the first data, thereby realizing the process of storing the data of the virtual channel received in the reserved area.

[0134] Figure 7 It is a flowchart provided in an embodiment of the present application for storing the first data into the storage space subsequent to the first reserved space according to the set storage order based on the absence of free cache blocks in the first reserved space. It can include steps 701 to 702, and these steps are described in detail below.

[0135] 701. Based on the fact that there is no free cache block in the first reserved space, each reserved space after the first reserved space is moved backward by a first specific number of cache blocks according to a set storage order, where the first specific number is consistent with the number of data units corresponding to the first data;

[0136] Wherein, in the cache area, when the reserved space and the free reserved space are arranged in a sequential order, each reserved space after the first reserved space includes the reserved space and the free reserved space (if there is a free reserved space) corresponding to each virtual channel.

[0137] If there is no free cache block in the first reserved space, it is necessary to move the reserved spaces after the first reserved space backwards to reserve a corresponding number of cache blocks for the first data.

[0138] The first data includes a first specific number of data units, and accordingly, a first specific number of cache blocks are required in the cache area to store the first data.

[0139] For example, if the first data includes one data unit, each reserved space after the first reserved space is moved backward by one cache block; for another example, if the first data includes three data units, each reserved space after the first reserved space is moved backward by three cache blocks.

[0140] Among them, the number of cache blocks included in the cache area will be relatively large. In actual usage scenarios, there are free cache blocks in the cache area. If there is no free reserved space in the cache area, the free cache blocks in the cache area are located after the reserved space at the end of the sort; if there is free reserved space in the cache area, the free cache blocks are after the free reserved space.

[0141] Correspondingly, if there is still free reserved space in the cache area, the free reserved space and each reserved space after the first reserved space are moved backward by a first specific number of cache blocks.

[0142] It should be noted that, since the data of the first virtual channel occupies the position after the first reserved space, the subsequent adjacent free cache blocks that do not store data are used as new free reserved space, so as to achieve the effect of moving the free reserved space backwards.

[0143] If there is no free reserved space in the cache area, only the first specific number of cache blocks will be moved backward together with the reserved spaces after the first reserved space.

[0144] 702. Store the first data into a storage space subsequent to the first reserved space, where the storage space includes a first specific number of cache blocks.

[0145] The storage space that is continuous with the first reserved space after the first data is stored in the first reserved space is also a component of the first reserved space, and the storage space stores the first data transmitted through the first virtual channel.

[0146] The storage space subsequent to the first reserved space is the storage space vacated by moving the reserved spaces after the first reserved space backward by a first specific number of cache blocks, and the storage space includes the first specific number of cache blocks.

[0147] Figure 8This is another schematic diagram of storing first data provided by an embodiment of the present application. In this figure, the cache area includes 2 reserved spaces and 1 free reserved space. Each reserved space has 2 cache blocks. Reserved space 1 corresponds to virtual channel VC1, and reserved space 2 corresponds to virtual channel VC2. The two cache blocks in the reserved space 1 are cache block 0 and cache block 1, and cache blocks 0~1 have stored virtual channel VC1 data; the two cache blocks in the reserved space 2 are cache block 2 and cache block 3, and cache block 2 has stored virtual channel VC2 data. Cache block 3 is a free cache block in reserved space 2; the two cache blocks in the free reserved space are cache block 4 and cache block 5. The first data is received through virtual channel VC1, including a data unit, which occupies a cache block for storage, wherein the Figure 8 (a) is a buffer area before storing the first data. Figure 8 In (b), the reserved space 2 and the free reserved space are moved backward by one cache block. The reserved space 1 contains cache blocks 0~1, cache block 2 is a free cache block, the cache blocks contained in the reserved space 2 are cache blocks 3~4, a total of 2, and the cache blocks contained in the free reserved space are cache blocks 5~6, a total of 2; Figure 8 In (c), the first data is stored in the cache block 2, the cache blocks 0-1 in the reserved space 1 store data, and the virtual channel VC1 corresponds to the cache blocks 0-2. In the figure, squares are used to represent cache blocks, and gray indicates that the cache blocks store data.

[0148] If data transmitted by the virtual channel corresponding to the reserved space 1 is received later, the execution process can refer to the above Figure 8 process.

[0149] In this embodiment, if there are no free cache blocks in the first reserved space, each reserved space after the first reserved space is moved backward by a first specific number of cache blocks according to a set storage order, and the first specific number is consistent with the number of data units corresponding to the first data; the first data is stored in a storage space subsequent to the first reserved space, and the storage space includes a first specific number of cache blocks. Based on the fact that there are no free cache blocks in the first reserved space, other free cache blocks that are continuous with the first reserved space after the first reserved space are controlled to be used as available cache blocks of the first reserved space. Specifically, each reserved space after the first reserved space is moved backward until the available cache blocks between the first reserved space correspond to the first data, thereby ensuring continuous storage of data transmitted through each virtual channel in the cache area.

[0150] Fig. 9The embodiment of the present application provides a flow chart of reserving reserved space corresponding to the first virtual channel in the cache area based on the fact that the first virtual channel is a virtual channel for storing data in the cache area, which may include steps 901 to 904, and these steps are described in detail below.

[0151] 901. Receive first data to be written, taking a data unit as a transmission unit, and store one data unit into a cache block;

[0152] 902. Determine a first virtual channel corresponding to the first data;

[0153] Among them, steps 901~902 and Figure 5 The steps 501 to 502 are the same as those in the embodiment and will not be described in detail in this embodiment.

[0154] 903. Based on the fact that the first virtual channel is a virtual channel in which data is to be stored in the cache area, the first data is stored in the free reserved space to form a reserved space for the first virtual channel.

[0155] When the first virtual channel corresponding to the first data has data to be stored in the cache, that is, no data corresponding to the first virtual channel exists in the cache, then there is no reserved space reserved for the first virtual channel in the cache.

[0156] Currently, there is free reserved space in the cache area, and the free reserved space can be occupied by any virtual channel to store data. Then, the first data of the first virtual channel will occupy the free reserved space, and the free reserved space serves as the reserved space corresponding to the first virtual channel.

[0157] In a possible implementation, if there is no other virtual channel for storing data after the first virtual channel occupies the free reserved space, the free reserved space is no longer reserved and the subsequent step 904 is not performed.

[0158] In a possible implementation, if the first virtual channel occupies the free reserved space and if there are still virtual channels for storing data, the subsequent step 904 is performed.

[0159] 904. Based on the virtual channel that still has data to be stored, reserve a free reserved space in the cache area; according to the set storage order, the free reserved space is after the reserved space of the first virtual channel.

[0160] If there are still virtual channels for storing data, it is necessary to open up new free reserved space in the subsequent free cache space for the virtual channels for storing data and reserve it.

[0161] The number of cache blocks included in the reserved free reserved space is the same as the number of cache blocks included in the free reserved space occupied by the first virtual channel.

[0162] In the cache area, the reserved space and the free reserved space of each virtual channel are sorted in a set storage order.

[0163] The free reserved space in the cache area is behind the reserved space of each virtual channel. When the previous free reserved space is used as the reserved space of the first virtual channel, the first specific number of cache blocks after the reserved space of the first virtual channel are reserved as free reserved space.

[0164] Among them, any virtual channel to store data in the cache area can preferentially occupy the free reserved space as its own reserved space according to the order in which the data arrives, and reserve free reserved space for other virtual channels that have not arrived or not reserve free reserved space according to the situation.

[0165] Fig.10 This is another schematic diagram of storing first data provided by an embodiment of the present application. Before receiving the first data, the cache area includes 2 reserved spaces and 1 free reserved space. The interconnect bus includes 5 virtual channels. Each reserved space has 2 cache blocks. Reserved space 1 corresponds to virtual channel VC1, and reserved space 2 corresponds to virtual channel VC2. The 2 cache blocks in the reserved space 1 are cache blocks 0~1, and cache block 0 has stored data; the 2 cache blocks in the reserved space 2 are cache blocks 2~3, and cache block 2 has stored data; the 2 cache blocks in the free reserved space are cache blocks 4~5. The first data is received through virtual channel VC3. The first data includes a data unit, which occupies a cache block for storage. There are also virtual channels in the cache area that do not store data. The Fig.10 In (a), the cache area before storing the first data includes 2 reserved spaces and 1 free reserved space; Fig.10 In (b), the first data is written into cache blocks 4-5, and the cache blocks 4-5 serve as reserved space 3 of the virtual channel VC3; Fig.10 In (c), cache blocks 4~5 are used as reserved space 3 of virtual channel VC3, and subsequent cache blocks 6~7 are reserved as new free reserved space. After the free reserved space is the free cache block of the cache area. The free cache blocks after the free reserved space are free. In the figure, squares are used to represent cache blocks, and gray indicates that the cache block stores data.

[0166] Fig.11This is another schematic diagram of storing first data provided by an embodiment of the present application. Before receiving the first data, the cache area includes 3 reserved spaces and 1 free reserved space. The interconnection bus includes 4 virtual channels. Each reserved space has 2 cache blocks. Reserved space 1 corresponds to virtual channel VC1, reserved space 2 corresponds to virtual channel VC2, and reserved space 3 corresponds to virtual channel VC3. The two cache blocks in the reserved space 1 are cache blocks 0~1, and cache block 0 has stored data; the two cache blocks in the reserved space 2 are cache blocks 2~3, and cache block 2 has stored data; the two cache blocks in the reserved space 3 are cache blocks 4~5, and cache block 4 has stored data; the two cache blocks in the free reserved space are cache blocks 6~7. The first data is received through virtual channel VC4. The first data includes a data unit, which occupies a cache block for storage. The interconnection bus supports a total of 4 virtual channels, wherein the Fig.11 In (a), the cache area before storing the first data includes 3 reserved spaces and 1 free reserved space. Fig.11 In (b), cache blocks 6~7 are used as reserved space 4. Since all four virtual channels have data in the cache area, there is no need to reserve new free reserved space. After reserved space 4 is the free cache block of the cache area. In the figure, squares are used to represent cache blocks, and gray indicates that the cache block stores data.

[0167] In this embodiment, if the first virtual channel is a virtual channel for data to be stored in the cache area, the first data is stored in the free reserved space; based on the existence of virtual channels for data to be stored, it is determined to reserve a free reserved space in the cache area, and according to the set storage order, the free reserved space is behind the reserved space of the first virtual channel. When data is received through a virtual channel for data to be stored in any cache area, the free reserved space in the cache area can be occupied by the virtual channel, and when there are virtual channels for data to be stored, new free reserved space is reserved in the cache area, so that when the first data of a virtual channel is received, the reserved space is reserved for the virtual channel. In this process, the free reserved space can be occupied by any virtual channel for data to be stored, and the position can be re-determined and reserved, not for any virtual channel, thereby improving the utilization rate of the cache area.

[0168] Fig.12 It is a flowchart diagram of reserving the reserved space corresponding to each virtual channel based on the existing data in the cache area under the data reading operation provided by the embodiment of the present application, which may include steps 1201 to 1205, and these steps are described in detail below.

[0169] 1201. In response to a read request, second data is sent to a requesting party using a data unit as a transmission unit, and one data unit is stored in one cache block;

[0170] When a read request is received, the second data to be read is determined in the cache area, and the read second data is sent to the requesting party. The data unit is the minimum transmission data amount, and the data amount read each time is 1 or several data units.

[0171] When the data in the cache area is read, it is also read and sent in data units. One data unit is stored in one cache block. Accordingly, when one data unit is read, the data in one cache block is read, and no content is stored in the cache block.

[0172] Then, it is necessary to determine whether to adjust the cache area according to the response to the read request and the situation of the reserved space corresponding to the second virtual channel in the cache area.

[0173] The data of each virtual channel stored in the buffer is processed in a first-in-first-out order, and accordingly, when reading data, the data in the first order is read first. In a specific implementation, the data at a specified position can also be directly obtained according to a read request.

[0174] 1202. Determine a second virtual channel corresponding to the second data;

[0175] The second data is received through the second virtual channel and written into the cache area. Accordingly, when the cache area is cached, the second data is stored in the cache block corresponding to the second virtual channel.

[0176] In order to determine whether the cache area needs to be adjusted due to the current reading, the second virtual channel corresponding to the second data is determined.

[0177] In a possible implementation, the read request may carry identification information that the second data corresponds to the second virtual channel, and by parsing the request, it can be determined that the target read data corresponds to the second virtual channel.

[0178] In a possible implementation, the second data includes identification information of a corresponding second virtual channel, and by parsing the second data in the cache area, it can be determined that the second data corresponds to the second virtual channel.

[0179] 1203. Determine the remaining data units in the buffer area of ​​the second virtual channel;

[0180] Among them, if the second data to be read corresponds to the second virtual channel, after the second data is read, the cache block that originally stored the second data in the cache area no longer stores data, and it is necessary to determine whether the reserved space corresponding to the second virtual channel in the cache area needs to be adjusted.

[0181] Since one data unit is stored in one cache block, by determining the remaining data units of the second virtual channel in the cache area, the number of cache blocks occupied by the second virtual channel in the cache area can be determined.

[0182] Determine the remaining data units of the second virtual channel in the cache area. If the number of the remaining data units is greater than the number of cache blocks in the second reserved space, it indicates that in order to store the data of the second virtual channel, in addition to occupying the cache blocks in the second reserved space, the free cache blocks are also occupied in the cache area; if the number of the remaining data units is not greater than the number of cache blocks in the second reserved space and is not zero, it indicates that in order to store the data of the second virtual channel, only the cache blocks in the second reserved space are occupied in the cache area.

[0183] In a possible implementation, after data is stored in a cache block, the cache block may be marked as occupied; if no data is stored in the cache block or its data is read, it may be marked as free.

[0184] Accordingly, the remaining data units in the cache area of ​​the second virtual channel can be determined by querying the data units written and read by the second virtual channel.

[0185] 1204. Based on the fact that the number of remaining data units in the cache area of ​​the second virtual channel is greater than the number of cache blocks in the second reserved space, the reserved spaces after the second reserved space are sequentially moved forward by a second specific number of cache blocks according to a set storage order, and the second specific number is consistent with the number of data units corresponding to the second data;

[0186] In this application, the cache blocks in each reserved space are pre-set, such as 2, 3, etc.

[0187] When storing data in the reserved space, if the number of cache blocks required for the stored data exceeds the number of cache blocks in the reserved space, the free cache blocks after the reserved space will be occupied. This process can refer to the aforementioned process of writing the first data and will not be repeated here.

[0188] Correspondingly, when a free cache block is occupied after the reserved space, after the data in the cache block is read, the cache block is released and can be used as a free cache block of the cache area. Accordingly, the reserved spaces after the second reserved space are moved forward in sequence to occupy the free cache block, thereby ensuring that the released free cache block can be reused and is not occupied by a specific virtual channel alone.

[0189] Among them, the second data may include one or more data units, and accordingly, the second data may occupy one or more cache blocks. Therefore, after reading the second data, the cache blocks occupied by the second data are released, and the released cache blocks serve as free cache blocks and can be occupied by the reserved space thereafter.

[0190] When the number of remaining data units in the cache area of ​​the second virtual channel is greater than the number of cache blocks in the second reserved space, each reserved space arranged after the second reserved space is moved forward by the number of cache blocks corresponding to the second data.

[0191] The forward movement of the reserved space may specifically be to move the order of the pointers corresponding to the reserved space, so as to achieve the effect of moving the reserved space.

[0192] Fig.13 : is a schematic diagram of reading the second data provided by an embodiment of the present application. Before reading the second data, the cache area includes 3 reserved spaces and 1 free reserved space. Reserved space 1 corresponds to virtual channel VC1, reserved space 2 corresponds to virtual channel VC2, and reserved space 3 corresponds to virtual channel VC3. The free reserved space includes 2 cache blocks. Fig.13 (a) is the cache area before reading the second data, including 3 reserved spaces and 1 free reserved space. The cache blocks in the reserved space 1 are cache blocks 0~1, cache block 0 has stored data, and cache block 1 is a free cache block in the reserved space 1; the cache blocks in the reserved space 2 are cache blocks 2~3, and the data of the virtual channel VC2 is stored in cache blocks 2~5, and cache blocks 4~5 are free cache blocks in the cache area; the cache blocks in the reserved space 3 are cache blocks 6~7; the two cache blocks in the free reserved space are cache blocks 8~9. The second data read corresponds to the virtual channel VC2, and the second data includes a data unit and occupies a cache block for storage. Among them, the Fig.11 In (b), the data in the original cache block 2 is read, and the cache block 2 is free. The order of the original cache blocks 3 to 5 is moved forward to cache blocks 2 to 4. The cache block 5 is a free cache block with no data. The other cache blocks are consistent with (a). Fig.11 In (c), the cache blocks in the reserved space 1 are cache blocks 0~1, and cache block 0 has stored data; the reserved space 2 includes cache blocks 2~3, and the data of virtual channel VC2 is stored in cache blocks 2~4; the reserved space 3 includes cache blocks 5~6; the free reserved space includes cache blocks 7~8, and after the free reserved space are the free cache blocks of the cache area. In the figure, squares are used to represent cache blocks, and gray indicates that the cache block stores data.

[0193] 1205. Based on the fact that the number of remaining data units is not greater than the number of cache blocks in the second reserved space and is not zero, the second reserved space is reserved, and cache blocks without data in the second reserved space are marked as free.

[0194] Among them, if the number of remaining data units is not greater than the number of cache blocks in the second reserved space and is not zero, it means that the number of cache blocks occupied by the data of the second virtual channel is less than the number of cache blocks in the second reserved space, but is not zero. Then, the range of the cache blocks corresponding to the second virtual channel will not be further reduced, and only the second reserved space will be used to store the data of the second virtual channel.

[0195] As an example, the preset number is 2, and the number of cache blocks in the second reserved space is 2. The number of cache blocks occupied by the data corresponding to the second virtual channel is 5, the number of cache blocks corresponding to the read second data is 2, and the number of remaining data units corresponding to the second virtual channel is 3 (1 free cache block and 2 cache blocks in the second reserved space). Then, each reserved space after the second reserved space is moved forward by 2 cache blocks.

[0196] Fig.14 is another schematic diagram of reading the second data provided by an embodiment of the present application. Before reading the second data, the cache area includes 3 reserved spaces and 1 free reserved space. Reserved space 1 corresponds to virtual channel VC1, reserved space 2 corresponds to virtual channel VC2, and reserved space 3 corresponds to virtual channel VC3. The reserved space includes 2 cache blocks. Fig.14 (a) is the cache area before reading the second data, including 3 reserved spaces and 1 free reserved space. The cache blocks in the reserved space 1 are cache blocks 0~1, which have stored data; the cache blocks in the reserved space 2 are cache blocks 2~3, which have stored data; the cache blocks in the reserved space 3 are cache blocks 4~5, which have stored data; the two cache blocks in the free reserved space are cache blocks 6~7. The second data read corresponds to the virtual channel VC2, and the second data includes a data unit and occupies a cache block for storage. Among them, the Fig.14 In (b), the cache blocks in the reserved space 1 are cache blocks 0~1, and cache blocks 0~1 have stored data; the data in the original cache block 2 is read out, and the sorting of the data in the original cache block 3 is moved forward to cache block 2, and cache block 3 is free; the cache blocks in the reserved space 3 are cache blocks 4~5; the two cache blocks in the free reserved space are cache blocks 6~7, and the free cache blocks of the cache area are behind the free reserved space. In the figure, squares are used to represent cache blocks, and gray indicates that the cache block stores data.

[0197] In this embodiment, in response to a read request, second data is sent to the requesting party according to the data unit as the transmission unit, and one data unit is stored in a cache block; a second virtual channel corresponding to the second data is determined; the remaining data units of the second virtual channel in the cache area are determined; based on the fact that the number of remaining data units of the second virtual channel in the cache area is greater than the number of cache blocks in the second reserved space, each reserved space after the second reserved space is moved forward by a second specific number of cache blocks in turn according to a set storage order, and the second specific number is consistent with the number of data units corresponding to the second data; based on the fact that the number of remaining data units is not greater than the number of cache blocks in the second reserved space and is not zero, the second reserved space is reserved, and the cache blocks without data in the second reserved space are marked as free. The virtual channel transmits data according to data units. After the cache area reads the second data, the remaining data units of the virtual channel corresponding to the second data storing data in the cache area are determined. If the number of the remaining data units is greater than the number of cache blocks in the reserved space, only the cache block corresponding to the second data is released, and the reserved space sorted later is moved forward to achieve reuse of the released cache block. If the number is not greater than the number of cache blocks in the reserved space and is not zero, the second reserved space still stores data transmitted by the corresponding second virtual channel. The second reserved space is reserved, and only the cache blocks without data in the second reserved space are marked as free, thereby achieving a process of adjusting the cache area after reading the data of the second virtual channel from the cache area.

[0198] Fig.15 Another flowchart diagram of reserving the reserved space corresponding to each virtual channel based on the existing data in the cache area provided by the embodiment of the present application may include steps 1501 to 1506, and these steps are described in detail below.

[0199] 1501. In response to a read request, second data is sent to a requesting party using a data unit as a transmission unit, and one data unit is stored in one cache block;

[0200] 1502. Determine a second virtual channel corresponding to the second data;

[0201] 1503. Determine the remaining data units in the buffer area of ​​the second virtual channel;

[0202] Among them, the steps 1501 to 1503 are the same as the aforementioned Fig.12 The 1201~1203 in the table are consistent and will not be traced back here.

[0203] 1504. Based on the fact that the number of remaining data units of the second virtual channel in the buffer area is zero, cancel the second reserved space corresponding to the second virtual channel;

[0204] Among them, after reading the second data from the second reserved space, if the number of remaining data units of the second virtual channel in the cache area is zero, it means that the second virtual channel has no data stored in the cache area. The second virtual channel can be used as a virtual channel for data to be stored, and it no longer occupies a separate reserved space.

[0205] Correspondingly, the second reserved space reserved by the second virtual channel in the cache area is cancelled, and the cache blocks in the second reserved space are released, so that the space can be occupied by other reserved spaces or by idle reserved spaces.

[0206] The other reserved space is the reserved space after the second reserved space, for example, the reserved space of other virtual channels, or the idle reserved space adjacent to the second reserved space.

[0207] 1505. According to the set storage order, each reserved space after the second reserved space is moved forward by a preset number of cache blocks, and any reserved space contains the preset number of cache blocks;

[0208] The preset number is the number of cache blocks set for each reserved space.

[0209] If there is reserved space reserved for other virtual channels after the second reserved space, the reserved spaces after the second reserved space are moved forward by a set number of cache blocks in sequence according to the set storage order.

[0210] As an example, the second reserved space includes 2 cache blocks. When the second reserved space is cancelled, each reserved space after the second reserved space is moved forward by 2 cache blocks.

[0211] It should be noted that the forward movement of the reserved space in the present application may specifically be to move the sorting of the pointers corresponding to the reserved space forward, so as to achieve the effect of moving the reserved space.

[0212] 1506. A free reserved space is reserved after the storage queue in the buffer area, and the storage queue contains the reserved space of each virtual channel of each existing data.

[0213] Wherein, based on canceling the second reserved space in the cache area, the second virtual channel has data to be stored in the cache area, and therefore, there is at least one virtual channel in the interconnection bus that has data to be stored in the cache area.

[0214] Correspondingly, the reserved spaces of the virtual channels with data in the cache area form a storage queue. After the storage queue of the cache area, a free reserved space is reserved, which can be occupied by any virtual channel to store data in the cache area.

[0215] Fig.16is another schematic diagram of reading the second data provided by an embodiment of the present application. Before reading the second data, the cache area includes 3 reserved spaces, corresponding to all three virtual channels, no idle reserved space (no other virtual channels to be stored with data), reserved space 1 corresponds to virtual channel VC1, reserved space 2 corresponds to virtual channel VC2, and reserved space 3 corresponds to virtual channel VC3, wherein the Fig.16 (a) is the cache area before reading the second data, including 3 reserved spaces. The cache blocks in the reserved space 1 are cache blocks 0~1, and cache blocks 0 and cache block 1 have stored the data of virtual channel VC1; the cache blocks in the reserved space 2 are cache blocks 2~3, and cache blocks 2~3 have stored the data of virtual channel VC2; the cache blocks in the reserved space 3 are cache blocks 4~5, and cache block 4 has stored the data of virtual channel VC3. The second data read corresponds to virtual channel VC2. The second data includes two data units and occupies two cache blocks for storage, that is, all data in reserved space 2 needs to be read. After reading the data in cache block 2, there is no data stored in cache block 2, and reserved space 2 is canceled. Reserved space 3 is moved forward by two cache blocks to occupy the position of the original reserved space 2. Among them, the Fig.16 In (b), the reserved space 1 is consistent with that in (a), there is no reserved space 2, the cache blocks in the reserved space 3 are cache blocks 2~3, the two cache blocks in the free reserved space are cache blocks 4~5, and after the free reserved space are the free cache blocks of the cache area. In the figure, squares are used to represent cache blocks, and gray indicates that the cache block stores data.

[0216] Fig.17 is another schematic diagram of reading the second data provided by an embodiment of the present application, wherein the reserved space 1 corresponds to the virtual channel VC1, the reserved space 2 corresponds to the virtual channel VC2, and the reserved space 3 corresponds to the virtual channel VC3, wherein the Fig.17 (a) is the cache area before reading the second data, including 3 reserved spaces and 1 free reserved space. The cache blocks in the reserved space 1 are cache blocks 0~1, and cache blocks 0 and cache block 1 have stored the data of virtual channel VC1; the cache blocks in the reserved space 2 are cache blocks 2~3, and cache block 2 has stored the data of virtual channel VC2; the cache blocks in the reserved space 3 are cache blocks 4~5, and cache block 4 has stored the data of virtual channel VC3. Since in this embodiment, there are data of other virtual channels that have not entered the cache area, free reserved space is still reserved, and the cache blocks in the free reserved space are 6~7. The second data read corresponds to virtual channel VC3. The second data includes a data unit and occupies one cache block for storage, that is, all the data of virtual channel VC3 needs to be read. Among them, the Fig.17In (b), the reserved space 1 and reserved space 2 are consistent with (a), the data does not change, the reserved space 3 is revoked, and the free reserved space moves forward to occupy the position of the original reserved space 3. In the figure, squares are used to represent cache blocks, and gray indicates that the cache block stores data.

[0217] In this embodiment, based on the fact that the number of remaining data units of the second virtual channel in the cache area is zero, the second reserved space corresponding to the second virtual channel is cancelled; according to the set storage order, each reserved space (including the reserved space and / or the free reserved space) after the second reserved space is moved forward by a preset number of cache blocks, and any reserved space contains a preset number of cache blocks; a free reserved space is reserved after the storage queue in the cache area, and the storage queue contains the reserved space of each virtual channel of each existing data. When all the data stored in the second reserved space is read, the second reserved space is cancelled in the cache area, and each reserved space after the second reserved space is moved forward to occupy the cache block corresponding to the second reserved space, so as to avoid the occupation of the cache area resources by the free virtual channel, realize the reuse of the free cache blocks in the cache area, and improve the utilization rate of the free cache blocks in the cache area. Moreover, a free reserved space is reserved after the storage queue in the cache area to provide an available reserved space for the virtual channel to store data in the cache area.

[0218] Fig.18 The flowchart provided in the embodiment of the present application for reserving a free reserved space in a cache area based on a virtual channel where data to be stored exists may include steps 1801 to 1803, and these steps are described in detail below.

[0219] 1801. Based on a change in cached data in the cache area, determine the number of virtual channels in which data already exists in the cache area;

[0220] The change of data in the buffer area may cause the number of virtual channels with existing data to change. Therefore, each time the data cached in the buffer area changes, the number of virtual channels with existing data in the buffer area is determined.

[0221] The data in the cache changes, including writing data and reading data.

[0222] Among them, when data is written to the virtual channel where data is to be stored, the number of virtual channels with existing data in the cache area is increased by one; when the data in the cache area is read, if reading the data causes all the data in a reserved space to be read out, the reserved space in the cache area is cancelled, and therefore, the number of virtual channels with existing data in the cache area is reduced by one.

[0223] 1802. Based on the number of channels being less than the preset number of virtual channels, a free reserved space is reserved after the storage queue in the buffer area, the storage queue includes the reserved space of each virtual channel of each existing data, and the reserved space of each virtual channel in the storage queue is sorted according to the set storage order;

[0224] The preset number of virtual channels is the number of virtual channels that the cache area can support, and can be the number of virtual channels divided by an interconnect bus.

[0225] When the number of virtual channels with data in the cache is less than the preset number of virtual channels, it indicates that there are virtual channels with data to be stored in the cache, and a free reserved space needs to be reserved in the cache.

[0226] Wherein, in the buffer area, the storage queue composed of the reserved spaces of each virtual channel is sorted according to the set storage order, and then the idle reserved space is set.

[0227] 1803. Based on the number of channels being equal to the set number of virtual channels, no free reserved space is reserved in the cache area.

[0228] Among them, when the number of virtual channels with data in the cache area is equal to the preset number of virtual channels, it means that there are no virtual channels with data to be stored in the cache area, and each virtual channel has a corresponding reserved space, so there is no need to reserve a free reserved space in the cache area.

[0229] In this embodiment, if the cached data in the cache area changes, the number of channels of the virtual channels with existing data in the cache area is determined; based on the number of channels being less than the preset number of virtual channels, a free reserved space is reserved after the storage queue in the cache area, the storage queue contains the reserved space of each virtual channel with existing data, and the reserved space of each virtual channel in the storage queue is sorted according to the set storage order; based on the number of channels being equal to the set number of virtual channels, no free reserved space is reserved in the cache area. When the data cached in the cache area changes, it is determined whether the free reserved space needs to be reserved, which ensures that the reserved space in the cache area can be adjusted in time, and improves the utilization rate of the free cache blocks in the cache area.

[0230] Fig.19 It is a flowchart of generating a head pointer of each virtual channel provided by an embodiment of the present application, which may include steps 1901 to 1902. These steps are described in detail below.

[0231] 1901. Determine the first cache block in the reserved space corresponding to each virtual channel;

[0232] In order to facilitate reading of data of each virtual channel, a head pointer is inserted into the reserved space corresponding to each virtual channel in the buffer area.

[0233] Among them, the first cache block in the reserved space corresponding to each virtual channel can be determined first. In this cache area, the data of each virtual channel is read in a first-in-first-out order. The data cached in the first cache block is the target data to be read the next time. The target data to be read can be determined based on the head pointer.

[0234] In a possible implementation, when determining the first cache block in each reserved space, the number of data units corresponding to each virtual channel can be determined in turn. When a data unit is stored, it occupies one cache block. Then, the first cache block of the reserved space can be determined according to the number of data units corresponding to each virtual channel sorted before a certain reserved space. Fig. 20 The process is detailed for the first cache block in this reserved space.

[0235] 1902. Generate a head pointer of each virtual channel according to the first cache block of each virtual channel.

[0236] The head pointer of each virtual channel corresponds to the first cache block in the reserved space of the corresponding virtual channel.

[0237] Among them, in the reserved space of each virtual channel, when the position of the first cache block of the reserved space changes, the position of its head pointer will also change accordingly.

[0238] In this embodiment, the first cache block in the reserved space corresponding to each virtual channel is determined; based on the first cache block of each virtual channel, a head pointer of each virtual channel is generated, thereby generating a head pointer of the virtual channel for the first cache block of the reserved space corresponding to each virtual channel, providing a basis for subsequent reading of data in each reserved space.

[0239] Fig. 20 This is a flow chart of determining the first cache block in the reserved space corresponding to each virtual channel provided by an embodiment of the present application, which may include steps 2001 to 2003, and these steps are described in detail below.

[0240] 2001. Determine the number of data units currently stored in each virtual channel by counting, and store one data unit in one cache block;

[0241] A counter is set for each virtual channel. When data of a data unit is written through a virtual channel, the corresponding counter is incremented by one. When data of a data unit is read from a virtual channel, the corresponding counter is decremented by one.

[0242] For each virtual channel, the number of data units currently stored in each virtual channel is counted, and one data unit occupies one cache block when stored.

[0243] Correspondingly, the number of cache blocks corresponding to each virtual channel can be determined according to the number of data units currently stored in each virtual channel and the preset number of cache blocks in the corresponding reserved space.

[0244] The number of cache blocks corresponding to the virtual channel may be a larger value between the preset number of cache blocks in the reserved space and the number of stored data units.

[0245] As an example, if the number of data units currently stored in a certain virtual channel is greater than the preset number, the preset number of cache blocks of the reserved space is 2, and the number of data units currently stored in the virtual channel is 3, it is determined that the number of cache blocks occupied by the virtual channel in the corresponding cache area is 3;

[0246] As an example, if the number of data units currently stored in a virtual channel is not greater than the preset number, the number of cache blocks in the reserved space is 2, and the number of data units currently stored in the virtual channel is 1, it is determined that the number of cache blocks occupied by the virtual channel in the corresponding cache area is 2.

[0247] 2002. Count the number of cache blocks before any virtual channel in sequence along the sorting direction of the reserved space corresponding to each virtual channel;

[0248] The reserved spaces corresponding to the virtual channels in the buffer area are sorted according to the order in which the data of the virtual channels are received.

[0249] When counting the number of cache blocks before any virtual channel, the number of cache blocks occupied by each virtual channel before the virtual channel is counted in order.

[0250] As an example, the cache area sequentially reserves reserved spaces 1 to 3 for virtual channels VC1 to 3, each with 2 cache blocks. The number of data units stored in virtual channel VC1 is 1, the number of data units stored in virtual channel VC2 is 5 (2 cache blocks of reserved space and 3 free cache blocks), and the number of data units stored in virtual channel VC3 is 2. Reserved space 1 is sorted first, and there is no reserved space in front of it; reserved space 2 is preceded by reserved space 1, and the number of cache blocks in reserved space 1 is counted, and the number of cache blocks before virtual channel VC2 is 2; reserved space 3 is preceded by reserved space 1 and reserved space 2 as well as 3 free cache blocks occupied by virtual channel VC2, and the number of cache blocks before virtual channel VC3 is 7.

[0251] 2003. Determine the first cache block in the reserved space corresponding to any virtual channel according to the number of cache blocks before the any virtual channel.

[0252] The first cache block in the reserved space corresponding to any virtual channel is the number of cache blocks in the previous reserved spaces plus one.

[0253] If there is no reserved space before a certain virtual channel, then its first cache block is used as the first cache block in the cache area, and the head pointer corresponds to the first cache block.

[0254] Among them, during the operation of the cache area, since the position of the front reserved space will change, the position of the first cache block of the rear reserved space will also change accordingly. Therefore, after the head pointer is created, the cache block position indicated by the head pointer can be adjusted according to the changed position of the first cache position.

[0255] For example, the reserved space corresponding to a certain virtual channel moves forward by one cache block, and the first cache block position thereof also moves forward by one cache block, and the cache block position indicated by the head pointer may be moved forward by one.

[0256] In this embodiment, the number of data units currently stored in each virtual channel is determined by counting, and one data unit is stored in one cache block; along the sorting direction of the reserved space corresponding to each virtual channel, the number of cache blocks before any virtual channel is counted in turn; based on the number of cache blocks before any virtual channel, the first cache block in the reserved space corresponding to any virtual channel is determined, thereby setting a head pointer for each virtual channel, and the head pointer only wants to be in the first cache block of the corresponding reserved space in the cache area, so as to read the data of the virtual channel subsequently.

[0257] Fig.21 This is a schematic diagram of changes in a buffer area in an application scenario of a virtual channel data processing method provided by the present application.

[0258] Among them, in this scenario, the maximum number of virtual channels (VC) is 3, the area marked with R represents the free reserved space, the areas marked with 0, 1, and 2 represent the cache blocks storing data of VC0, VC1, and VC2 respectively, the areas marked with R0, R1, and R2 represent the cache blocks that have been reserved but not yet stored in VC0, VC1, and VC2 respectively, and the unmarked areas represent the free cache blocks of the cache area.

[0259] In this application scenario, 16 clock cycles are executed, and each cycle performs an operation, which can be writing (push) or reading (pop) data. The right side of the figure records the number of data units currently stored in each virtual channel.

[0260] Cycle 0 is the initial state, no operation, and the buffer area only has free reserved space consisting of 2 Rs at the head of the queue;

[0261] In cycle1, VC0 writes a data (push VC0), first occupying the first cache block of the free reserved space, and reserving the free reserved space at the time of cycle0 as the reserved space of VC0; because VC0 only writes one data unit, there is still a free storage block R0 left in the reserved space. Therefore, after cycle1 is executed, the cache area includes the reserved space of VC0 and the free reserved space immediately after the reserved space, as well as other free cache blocks after the free reserved space. The reserved space of VC0 includes 1 cache block marked with 0 and 1 cache block marked with R0;

[0262] In cycle2, VC0 writes a data (push VC0) and stores it in the remaining free cache block R0 in the reserved space of VC0. After cycle1 is executed, the cache area includes the reserved space of VC0 that stores full data and the free reserved space after it, and the other free cache blocks after the free reserved space. The reserved space of VC0 includes 2 cache blocks with identifier 0;

[0263] In cycle3, VC0 writes a data (push VC0). Since there is no free storage block in the reserved space of VC0, the free reserved space is moved back and the data is stored in a free cache block generated by the free reserved space. After cycle3 is executed, the cache area includes the reserved space corresponding to VC0, the occupied free cache blocks (corresponding to the 3 positions marked with 0) and the free reserved space, as well as other free cache blocks after the free reserved space. Fig.21 In the figure, the movement of the free reserved space in cycle 3 is illustrated, and the dotted box in the figure shows the change of the position of the free reserved space;

[0264] In cycle4, VC1 writes a data (push VC1), occupies the first cache block of the free reserved space, and reserves the free reserved space at cycle3 as the reserved space of VC1; because VC1 only writes one data unit, there is still a free storage block R1 left in the reserved space. Therefore, after cycle4 is executed, the cache area includes the reserved space corresponding to VC0, and the occupied free cache blocks (corresponding to the 3 positions marked with 0), the reserved space and free reserved space corresponding to VC1, and other free free cache blocks after the free reserved space. The VC1 reserved space includes 1 cache block marked with 1 and 1 cache block marked with R1;

[0265] In cycle5, VC1 writes a data (push VC1) and stores it in the remaining free cache block R1 in the reserved space of VC1. After cycle5 is executed, the cache area includes the reserved space corresponding to VC0, and the occupied free cache blocks (corresponding to the 3 positions marked with 0), the reserved space and free reserved space corresponding to VC1, and other free free cache blocks after the free reserved space. The VC1 reserved space includes 2 cache blocks marked with 1;

[0266] In cycle6, VC0 writes a data (push VC0). Since there is no free storage block in the reserved space of VC0, the reserved space and free reserved space of VC1 are moved backward, and the data is stored in a free free cache block generated by the free reserved space. After cycle6 is executed, the cache area includes the reserved space corresponding to VC0, and the occupied free cache blocks (corresponding to the 4 positions marked with 0), the reserved space and free reserved space corresponding to VC1, and other free free cache blocks after the free reserved space. The VC1 reserved space includes 2 cache blocks marked with 1;

[0267] In cycle7, VC2 writes a data (push VC2), occupies the first cache block of the free reserved space, and reserves the free reserved space at the moment of cycle7 as the reserved space of VC2; because VC2 only writes one data unit, there is still a free storage block R2 left in the reserved space. Therefore, after cycle7 is executed, the cache area includes the reserved space corresponding to VC0, and the occupied free cache blocks (corresponding to the 4 positions marked with 0), the reserved space corresponding to VC1, the reserved space and free reserved space corresponding to VC2, and other free free cache blocks after the free reserved space. The VC1 reserved space includes two cache blocks marked with 1, and the VC2 reserved space includes 1 cache block marked with 2 and 1 cache block marked with R2.

[0268] In cycle8, VC2 writes a data (push VC2) and stores it in the remaining free cache block R2 in the reserved space of VC2. After cycle8 is executed, the cache area includes the reserved space corresponding to VC0, and the occupied free cache blocks (corresponding to the 4 positions marked with 0), the reserved space corresponding to VC1, the reserved space and free reserved space corresponding to VC2, and other free free cache blocks after the free reserved space. The VC1 reserved space includes 2 cache blocks marked with 1, and the VC2 reserved space includes 2 cache blocks marked with 2;

[0269] In cycle9, VC1 reads a data (popVC1), and reads the data in the first cache block of VC1 in a first-in-first-out manner, and there is still one data left in the reserved space; because there is still VC1's data in the cache after reading the data, the reserved space of VC1 continues to be reserved, and the remaining data moves forward to occupy the first position in the reserved space, and the subsequent reserved space and data of VC2 also move forward in sequence. After cycle9 ends, the cache area includes the reserved space of VC0, the reserved space of VC1, and the reserved space of VC2. The 4 data units of VC0 occupy 2 reserved spaces with identification 0, and the subsequent 2 free cache blocks with identification 0; the reserved space of VC1 includes a cache block with identification 1 that stores data and a free cache block with identification R1, and the reserved space of VC2 includes two cache blocks with identification 2 that store data; the Fig.21 In the figure, the data movement in the reserved space of VC1 in cycle9 is illustrated, and the dotted box in the figure shows the position change of the data in the reserved space of VC1;

[0270] In cycle10, VC0 reads a data (pop VC0), and reads the data in the first cache block of VC0 in a first-in-first-out manner, and there are three data left in the reserved space; because there are still VC0 data in the cache after reading the data, the reserved space of VC0 continues to be reserved, and the remaining data moves forward to occupy the first position in the reserved space, and the subsequent reserved space and data of VC1~VC2 also move forward in sequence. After cycle10 ends, the cache area includes the reserved space of VC0, the reserved space of VC1, and the reserved space of VC2. The three data units of VC0 occupy two reserved spaces marked with 0, and the subsequent free cache block marked with 0; the reserved space of VC1 includes one cache block marked with 1 that stores data and one free cache block marked with R1, and the reserved space of VC2 includes two cache blocks marked with 2 that store data;

[0271] In cycle11, VC1 reads a data (pop VC1). VC1 reads a data. There is no data in the reserved space of VC1. The reserved space of VC1 is canceled and the free reserved space is added. After cycle11 ends, the cache area includes the reserved space of VC0, the reserved space of VC2 and the free reserved space. The reserved space of VC0 includes 3 cache blocks with the identifier 0, and the reserved space of VC2 includes two cache blocks with the identifier 2. Since all the data of VC1 is taken out, VC1 becomes the virtual channel for the data to be cached. Therefore, free reserved space (2 areas with the identifier R) must be opened for the virtual channel of the data to be cached to give priority to the data allocated to this channel.

[0272] In cycle12, VC0 reads a data (pop VC0), and reads the data in the first cache block of VC0 in a first-in-first-out manner, and there are 2 data left in the reserved space; because there are still VC0 data in the cache after reading the data, the reserved space of VC0 continues to be reserved, and the remaining data moves forward to occupy the first position in the reserved space, and the subsequent reserved space and data of VC2 also move forward in sequence. After cycle12 ends, the cache area includes the reserved space of VC0, the reserved space of VC2, and the free reserved space. The 2 data units of VC0 occupy the 2 reserved spaces marked with 0; the reserved space of VC2 includes 2 cache blocks marked with 2 that store data; the Fig.21 In FIG. 1 , the position change of VC0 data in cycle 12, the movement of the reserved space of VC2 and the free reserved space are illustrated, and the dotted box in the figure shows the position change of the reserved space of VC2.

[0273] In cycle13, VC0 reads a data (pop VC0), and reads the data in the first cache block of VC0 in a first-in-first-out manner, and there is still one data left in the reserved space; because there is still VC0 data in the cache after reading the data, the reserved space of VC0 continues to be reserved, and the remaining data moves forward to occupy the first position in the reserved space. After cycle13 ends, the cache area includes the reserved space of VC0, the reserved space of VC2, and the free reserved space; the reserved space of VC0 includes one cache block with identification 0 storing data and one free cache block with identification R0, and the reserved space of VC2 includes two cache blocks with identification 2 storing data;

[0274] In cycle 14, VC0 reads a data (pop VC0), VC0 reads a data, and there is no data in the reserved space of VC0, so the reserved space of VC0 is canceled, and the reserved space and data of subsequent VC2 and the free reserved space are also moved forward in sequence. After cycle 14 ends, the cache area includes the reserved space and free reserved space of VC2; the reserved space of VC2 includes 2 cache blocks with identification 2 that store data;

[0275] In cycle15, VC2 reads a data (pop VC2), and reads the data in the first cache block of VC2 in a first-in-first-out manner, and there is still one data left in the reserved space; because there is still VC2's data in the cache after reading the data, the reserved space of VC2 continues to be reserved, and the remaining data moves forward to occupy the first position in the reserved space, and the subsequent free reserved space also moves forward in sequence. After cycle15 ends, the cache area includes VC2's reserved space and free reserved space; VC2's reserved space includes 1 cache block with identification 2 that stores data and 1 free cache block with identification R2;

[0276] In cycle 16, VC2 reads a data (pop VC2), VC2 reads a data, and the reserved space of VC2 has no data, so the reserved space of VC2 is canceled, and the subsequent free reserved space is moved forward. After cycle 16 ends, the buffer area includes free reserved space.

[0277] A method for processing virtual channel data provided by an embodiment of the present application is introduced above. A device for executing the method for processing virtual channel data is introduced below.

[0278] See also Fig. 22 , Fig. 22 Schematic diagram of a virtual channel data processing device provided in an embodiment of the present application. Fig. 22 As shown, the virtual channel data processing device 2200 includes:

[0279] The first reservation module 2201 is used to reserve the reserved space corresponding to each virtual channel based on the virtual channels having data in the cache area, and at least one cache block in the reserved space is occupied by the data corresponding to the virtual channel;

[0280] The second reservation module 2202 is used to reserve a free reserved space in the cache area based on the virtual channel where the data to be stored exists.

[0281] In a possible implementation, the first reservation module includes:

[0282] A receiving unit, used for receiving the first written data according to the data unit as a transmission unit, and storing one data unit in a cache block;

[0283] Determine a first virtual channel corresponding to the first data;

[0284] A second determining unit is used to determine whether there is a free cache block in the first reserved space corresponding to the first virtual channel based on the fact that the first virtual channel is a virtual channel with data already existing in the cache area;

[0285] A second storage unit is used to store the first data into the free cache block according to a set storage order based on the existence of the free cache block in the first reserved space;

[0286] The second storage unit is used to store the first data into a storage space subsequent to the first reserved space according to a set storage order based on the absence of a free cache block in the first reserved space.

[0287] In a possible implementation, the second storage unit is specifically used to:

[0288] Based on the absence of free cache blocks in the first reserved space, each reserved space after the first reserved space is moved backward by a first specific number of cache blocks according to a set storage order, where the first specific number is consistent with the number of data units corresponding to the first data;

[0289] The first data is stored in a storage space subsequent to the first reserved space, where the storage space includes a first specific number of cache blocks.

[0290] In a possible implementation, the first retention module further includes:

[0291] A third storage unit is used to store the first data in the free reserved space to form the reserved space of the first virtual channel based on the fact that the first virtual channel is a virtual channel to store data in the cache area;

[0292] The first reservation unit is used to reserve a free reserved space in the cache area based on a virtual channel that still has data to be stored; according to a set storage order, the free reserved space is after the reserved space of the first virtual channel.

[0293] In a possible implementation, the first retention module includes:

[0294] A sending unit, configured to send the second data to the requesting party in response to the read request, using the data unit as a transmission unit, wherein one data unit is stored in one cache block;

[0295] A third determining unit, configured to determine a second virtual channel corresponding to the second data;

[0296] A fourth determining unit, used to determine remaining data units of the second virtual channel in the buffer area;

[0297] A first moving unit is used to sequentially move the reserved spaces after the second reserved space forward by a second specific number of cache blocks according to a set storage order based on the fact that the number of remaining data units in the cache area of ​​the second virtual channel is greater than the number of cache blocks in the second reserved space, where the second specific number is consistent with the number of data units corresponding to the second data;

[0298] The second reservation unit is used to reserve the second reservation space based on the fact that the number of remaining data units is not greater than the number of cache blocks in the second reservation space and is not zero, and mark the cache blocks without data in the second reservation space as free.

[0299] In a possible implementation, the first retention module further includes:

[0300] a cancelling unit, configured to cancel the second reserved space corresponding to the second virtual channel based on the number of remaining data units in the buffer area of ​​the second virtual channel being zero;

[0301] A second moving unit is used to move each reserved space after the second reserved space forward by a preset number of cache blocks according to a set storage order, and any reserved space contains the preset number of cache blocks;

[0302] The third reservation unit is used to reserve a free reserved space after storing the queue in the buffer area, and the storage queue contains the reserved space of each virtual channel of each existing data.

[0303] In a possible implementation, the second reservation module includes:

[0304] A fifth determining unit, configured to determine the number of virtual channels having data in the cache area based on changes in the cache data in the cache area;

[0305] The fourth reservation unit is used to reserve a free reserved space after storing the queue in the cache area based on the fact that the number of channels is less than the preset number of virtual channels. The storage queue contains the reserved space of each virtual channel with existing data, and the reserved space of each virtual channel in the storage queue is sorted according to the set storage order; based on the fact that the number of channels is equal to the set number of virtual channels, no free reserved space is reserved in the cache area.

[0306] In a possible implementation, the method further includes:

[0307] A determination module, used to determine the first cache block in the reserved space corresponding to each virtual channel;

[0308] The generation module is used to generate a head pointer of each virtual channel according to the first cache block of each virtual channel.

[0309] In a possible implementation, a module is determined, specifically for:

[0310] By counting, the number of data units currently stored in each virtual channel is determined, and one data unit is stored in one cache block;

[0311] Along the sorting direction of the reserved space corresponding to each virtual channel, the number of cache blocks before any virtual channel is counted in sequence;

[0312] According to the number of cache blocks before any virtual channel, the first cache block in the reserved space corresponding to any virtual channel is determined.

[0313] It should be noted that for the functional explanation of each component in the virtual channel data processing device provided in the embodiment of the present application, please refer to the explanation in the aforementioned method embodiment, and it will not be repeated in this embodiment.

[0314] In this embodiment, the first reservation module is used to reserve the reserved space corresponding to each virtual channel based on each virtual channel with data already existing in the cache area, and at least one cache block in the reserved space is occupied by the data corresponding to the virtual channel; the second reservation module is used to reserve a free reserved space in the cache area based on the virtual channel with data to be stored. It is realized that only one free reserved space is reserved for the virtual channel of the data to be stored in the cache area, and the free reserved space can be used as the data of the virtual channel of the subsequent data to be stored. It is not necessary to reserve the reserved space for each virtual channel of the data to be stored, and the free reserved space is shared, which improves the utilization rate of the cache blocks in the cache area and can improve the overall transmission performance of the virtual channel.

[0315] The present application also provides an electronic device in an embodiment. Fig.23 As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the method for processing virtual channel data in the embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Fig.23 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0316] like Fig.23 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 2301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 2302 or a program loaded from a storage device 2308 to a random access memory (RAM) 2303. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 2303. The processing device 2301, the ROM 2302, and the RAM 2303 are connected to each other via a bus 2304. An input / output (I / O) interface 2305 is also connected to the bus 2304.

[0317] Typically, the following devices may be connected to the I / O interface 2305: input devices 2306 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 2307 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 2308 including, for example, a memory card, a hard disk, etc.; and communication devices 2309. The communication device 2309 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Fig.23 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0318] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any method for processing virtual channel data provided in the embodiment of the present application.

[0319] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any virtual channel data processing method provided in an embodiment of the present application.

[0320] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

[0321] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0322] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0323] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.

Claims

1. A method for processing virtual channel data, applied to a buffer area, comprising: Based on each virtual channel having data in the cache area, respectively reserve a reserved space corresponding to each virtual channel, and at least one cache block in the reserved space is occupied by the data corresponding to the virtual channel; Based on the virtual channel where data to be stored exists, a free reserved space is reserved in the cache area.

2. The method for processing virtual channel data according to claim 1, wherein the step of reserving the reserved space corresponding to each virtual channel based on the virtual channels having data in the buffer area comprises: Taking a data unit as a transmission unit, receiving the first data to be written, and storing one data unit into a cache block; Determine a first virtual channel corresponding to the first data; Based on the fact that the first virtual channel is a virtual channel in which data already exists in the cache area, determining whether there is a free cache block in the first reserved space corresponding to the first virtual channel; Based on the existence of free cache blocks in the first reserved space, storing the first data into the free cache blocks according to a set storage order; Based on the fact that there is no free cache block in the first reserved space, the first data is stored in a storage space subsequent to the first reserved space according to a set storage order.

3. The method for processing virtual channel data according to claim 2, wherein based on the absence of free cache blocks in the first reserved space, storing the first data in a storage space subsequent to the first reserved space according to a set storage order comprises: Based on the absence of free cache blocks in the first reserved space, each reserved space after the first reserved space is moved backward by a first specific number of cache blocks according to a set storage order, where the first specific number is consistent with the number of data units corresponding to the first data; The first data is stored in a storage space subsequent to the first reserved space.

4. The method for processing virtual channel data according to claim 2, further comprising: Based on the fact that the first virtual channel is a virtual channel in the cache area where data is to be stored, storing the first data in an idle reserved space to form a reserved space for the first virtual channel; Based on the virtual channel where there is still data to be stored, a free reserved space is reserved in the cache area; According to the set storage order, the free reserved space is after the reserved space of the first virtual channel.

5. The method for processing virtual channel data according to claim 1, wherein the step of reserving the reserved space corresponding to each virtual channel based on the virtual channels having data in the buffer area comprises: In response to the read request, second data is sent to the requesting party according to the data unit as a transmission unit, and one data unit is stored in one cache block; Determine a second virtual channel corresponding to the second data; Determining remaining data units of the second virtual channel in the buffer area; Based on the number of remaining data units in the cache area of ​​the second virtual channel being greater than the number of cache blocks in the second reserved space, the reserved spaces after the second reserved space are sequentially moved forward by a second specific number of cache blocks according to a set storage order, where the second specific number is consistent with the number of data units corresponding to the second data; Based on the fact that the number of remaining data units is not greater than the number of cache blocks in the second reserved space and is not zero, the second reserved space is reserved, and cache blocks without data in the second reserved space are marked as free.

6. The method for processing virtual channel data according to claim 5, further comprising: Based on the number of remaining data units of the second virtual channel in the buffer area being zero, canceling the second reserved space corresponding to the second virtual channel; According to the set storage order, each reserved space after the second reserved space is moved forward by a preset number of cache blocks, and any reserved space contains the preset number of cache blocks; A free reserved space is reserved after the storage queue in the buffer area, and the storage queue contains the reserved space of each virtual channel of each existing data.

7. The method for processing virtual channel data according to claim 1, wherein the step of reserving a free reserved space in a buffer area based on a virtual channel having data to be stored comprises: Based on changes in cached data in the cache area, determining the number of channels of virtual channels having data in the cache area; Based on the number of channels being less than the preset number of virtual channels, a free reserved space is reserved after the storage queue in the buffer area, the storage queue includes the reserved space of each virtual channel of each existing data, and the reserved space of each virtual channel in the storage queue is sorted according to the set storage order; Based on the number of channels being equal to the set number of virtual channels, no free reserved space is reserved in the buffer area.

8. The method for processing virtual channel data according to any one of claims 1 to 7, further comprising: Determine the first cache block in the reserved space corresponding to each virtual channel; A head pointer of each virtual channel is generated according to the first cache block of each virtual channel.

9. The method for processing virtual channel data according to claim 8, wherein determining the first cache block in the reserved space corresponding to each virtual channel comprises: By counting, the number of data units currently stored in each virtual channel is determined, and one data unit is stored in one cache block; Along the sorting direction of the reserved space corresponding to each virtual channel, the number of cache blocks before any virtual channel is counted in sequence; According to the number of cache blocks before any virtual channel, the first cache block in the reserved space corresponding to any virtual channel is determined.

10. A virtual channel data processing device, applied to a buffer area, comprising: A first reservation module is used to reserve the reserved space corresponding to each virtual channel based on the virtual channels having data in the cache area, and at least one cache block in the reserved space is occupied by the data corresponding to the virtual channel; The second reservation module is used to reserve a free reserved space in the cache area based on the virtual channel where the data to be stored exists.