Device and method for data compression and decompression

By introducing data compression and decompression modules in the neural network data transmission process, the problem of long communication time caused by large data volume is solved, and the effect of reducing transmission bandwidth requirements and improving transmission efficiency is achieved.

CN112445772BActive Publication Date: 2024-08-23SHANGHAI CAMBRICON INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910819935.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-08-31
Publication Date
2024-08-23
Estimated Expiration
2040-01-23

AI Technical Summary

Technical Problem

In the existing technology, the large amount of data during the neural network data transmission process results in long communication time. There is a lack of effective solutions to reduce the data transmission amount and communication time, which affects performance.

Method used

A device and method including a data compression and decompression module are designed to reduce the amount of data transmission, reduce transmission bandwidth requirements, and improve transmission efficiency by implementing data compression and decompression in the data transmitter and receiver.

Benefits of technology

By adding compression and decompression modules at the transmitter and receiver, the amount of data transmission is reduced, the demand for transmission bandwidth is reduced, and the data transmission efficiency is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112445772B
    Figure CN112445772B
Patent Text Reader

Abstract

The present application provides a data compression and decompression device and method, which are used to compress and decompress data transmitted in a neural network. The data compression device includes a data bus and a memory, a data receiver, an operation processing unit and a data transmitter connected to the data bus, and the data transmitter includes a data compression module. The technical solution provided by the present application has the advantages of reducing the amount of data transmission, reducing the demand for transmission bandwidth, and improving transmission efficiency.
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 technology, and in particular to a device and method for data compression and decompression. Background Art

[0002] At present, artificial neural network is one of the most common computing models in all intelligent methods. In the process of computing each network layer of neural network and training neural network, a large amount of data is transmitted and exchanged. The larger the amount of data to be transmitted, the more communication time is often required.

[0003] However, there is no solution in the prior art to effectively reduce the amount of data transferred and the communication time. In order to improve performance, it is necessary to adopt various means to improve the data transmission process in the neural network. Summary of the invention

[0004] The embodiment of the present application provides a device for data compression and decompression, which reduces the amount of data transmitted, lowers the demand for transmission bandwidth, and improves transmission efficiency.

[0005] In a first aspect, a data compression device is provided, comprising a data bus and a memory connected to the data bus, a data receiver, an operation processing unit and a data transmitter, wherein the data transmitter comprises a data compression module, wherein the data compression module is configured to:

[0006] When the first data meets the data compression condition, compressing the first data to form second data;

[0007] Determine a first position index of the second data;

[0008] The second data and the first location index are sent.

[0009] In a second aspect, a data decompression device is provided, comprising a data bus and a memory, a data receiver, an operation processing unit and a data transmitter connected to the data bus, wherein the data receiver comprises a data decompression module, wherein the data decompression module is configured to:

[0010] receiving sixth data and a third position index; and

[0011] The data is restored according to the third position index according to a predetermined rule to form seventh data.

[0012] According to a third aspect, a data compression method is provided, comprising: compressing the first data to form second data when the first data meets a data compression condition; determining a first position index of the second data; and sending the second data and the first position index.

[0013] In a fourth aspect, a data decompression method is provided, comprising: receiving third data and a second position index; and restoring data according to the second position index according to a predetermined rule to form fourth data.

[0014] According to a fifth aspect, an electronic device is provided, wherein the electronic device comprises the data compression device according to the first aspect.

[0015] According to a sixth aspect, an electronic device is provided, wherein the electronic device comprises the data decompression device according to the second aspect.

[0016] In the process of transmitting data between chips or processors, the inter-chip bandwidth is smaller than the intra-chip bandwidth. In the scheme of the present application, compression and decompression modules are added to the transmitting end and the receiving end respectively. After compressing the data, the data transmission volume is reduced, the demand for transmission bandwidth is reduced, and then the data is transmitted, thereby improving the transmission efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0018] Figure 1 A schematic diagram of the structure of a neural network architecture.

[0019] Figure 2 A schematic diagram of a data compression and decompression device according to an embodiment of the present application is provided.

[0020] Figure 3 A schematic diagram of a data transmitter according to an embodiment of the present application is provided.

[0021] Figure 4 A schematic diagram of a data receiver according to an embodiment of the present application is provided.

[0022] Figure 5 A schematic diagram of a data compression method according to an embodiment of the present application is provided.

[0023] Figure 6 A schematic diagram of a data decompression method according to an embodiment of the present application is provided. DETAILED DESCRIPTION

[0024] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0025] It should be understood that the terms "first", "second", "third", and "fourth" in the claims, specifications, and drawings of the present disclosure are used to distinguish different objects rather than to describe a specific order. The terms "include" and "comprise" used in the specifications and claims of the present disclosure indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their collections.

[0026] It should also be understood that the terms used in this disclosure are only for the purpose of describing specific embodiments and are not intended to limit the disclosure. As used in this disclosure and claims, the singular forms of "a", "an", and "the" are intended to include the plural forms unless the context clearly indicates otherwise. It should also be further understood that the term "and / or" used in this disclosure and claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations.

[0027] As used in this specification and claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0028] See also Figure 1 , Figure 1 A neural network architecture diagram is provided, such as Figure 1 As shown, the neural network architecture may include a multi-layer structure, such as Figure 1As shown, it may include: input layer, convolution layer 1, batchnorm layer, convolution layer 2, intermediate layer (different intermediate layers may be provided according to different neural network architectures with different functions, and the intermediate layer may be at least one layer), convolution layer n, fully connected layer 1, activation (e.g., activation function: softmax) layer. For the neural network architecture, the layers with large computational load may be called computational layers, such as convolutional layers, fully connected layers, etc. Of course, in practical applications, the above computational layers may also include other types of layers. In addition, the present application provides Figure 1 The neural network architecture in the present application is only for illustration. Figure 1 The structure shown.

[0029] Figure 2 A schematic diagram of a data compression and decompression device according to an embodiment of the present application is provided. The data compression and decompression device may be an artificial intelligence chip or an artificial intelligence processor. The data compression and decompression device includes an operation processing unit, a memory, a data receiver, and a data transmitter, and the operation processing unit, the data receiver, and the data transmitter are connected to the memory via a ring-shaped data bus. It should be noted that the operation processing unit of the data compression and decompression device may be a computing core in an artificial intelligence chip or an artificial intelligence processor, including an artificial intelligence processing unit, a neural network processor, or a neural network processing unit, and the type of memory may be any type of memory, for example, a dynamic random access memory (DRAM), a static random access memory (SRAM), etc. The data bus includes a NOC.

[0030] It should be noted that Figure 2 The artificial intelligence chip shown includes a neural network chip, the artificial intelligence processor includes a neural network processor, and the operation processing unit includes an artificial intelligence processing unit or a neural network processing unit. The data receiver, the data transmitter and the operation processing unit transmit data to each other and access the memory through the data bus.

[0031] according to Figure 2 In the example shown, the artificial intelligence chip or artificial intelligence processor includes 2 operation processing units, 2 data transmitters, 2 data receivers and 1 memory. However, it is understandable that the artificial intelligence chip or artificial intelligence processor may include any number of operation processing units, data transmitters, data receivers and memories, which are all within the scope of this application. Moreover, the number of operation processing units, data transmitters and data receivers may or may not correspond one to one.

[0032] exist Figure 2 In the embodiment shown, the data transmitter and the data receiver respectively include a data compression module and a data decompression module for compressing and decompressing data. Figure 3 and Figure 4 The structure and function of the data transmitter and data receiver are described respectively.

[0033] Figure 3 A schematic diagram of a data transmitter according to an embodiment of the present application is provided. Figure 3 As shown, the data transmitter includes a transmit decoder, a data reordering buffer, a data compression module, an arithmetic logic unit, a transmit buffer and a serial interface.

[0034] like Figure 3 As shown, the sending decoder is used to send data read request information to the data reordering buffer according to the task information. In one embodiment, the task information can be a collaborative convolution operation, in which a computing node (for example, an artificial intelligence processor, an artificial intelligence chip, or an artificial intelligence chip computing core) transmits the calculated overlapping data blocks to the corresponding computing node.

[0035] The data reordering buffer is used to obtain and send data to the data compression module through the data bus according to the data read request information.

[0036] The data compression module compresses the received data and sends out the compressed data and a position index indicating the position of the compressed data.

[0037] exist Figure 3 In the illustrated embodiment, the data compression module sends the compressed data and the position index to the arithmetic logic unit, the arithmetic logic unit operates on the compressed data, forms a new position index based on the operated data, and sends the obtained operation result and the new position index to the sending buffer.

[0038] The sending buffer is configured to receive and buffer the operation result and the new position index from the arithmetic logic unit, and then send data based on the operation result and the new position index according to the format of the serial interface.

[0039] The serial interface is configured to receive and transmit the data.

[0040] In an optional embodiment, the arithmetic logic unit may also be located between the data reordering buffer and the data compression module. In this case, the data reordering buffer may send data to the arithmetic logic unit. After the arithmetic logic unit operates on the data output from the data reordering buffer, it sends the operation result to the data compression module, and the data compression module then compresses the operation result.

[0041] In another optional embodiment, the transmission decoder may not include an arithmetic logic unit. Then, the data compression module sends the compressed data and the position index to the transmission buffer. The transmission buffer receives and caches the compressed data and the position index, and then sends data based on the compressed data and the position index according to the format of the serial interface.

[0042] The serial interface is configured to receive and transmit the data.

[0043] Next, the functions of the data compression module are described in detail.

[0044] Before compressing data, it is necessary to determine whether the data meets the data compression condition. If the data meets the compression condition, the data is compressed into compressed data, and the index of the compressed data is determined.

[0045] In one embodiment, the data compression condition includes a group of data having a value equal to a setting. In a specific embodiment, the setting value can be set to 0. If there is data equal to 0 in a group of data, the data equal to 0 will not be sent.

[0046] In another implementation, the data compression condition includes a group of data having a value less than a set value. In a specific embodiment, the set value can be set to 0, and if there is data less than 0 in a group of data, the data less than 0 will not be sent.

[0047] In another implementation, the data compression condition includes a group of data having a value less than or equal to a set value. In a specific embodiment, the set value can be set to 0. If there is data less than or equal to 0 in a group of data, data less than 0 will not be sent.

[0048] It should be noted that the set value can be any number. According to actual needs and specific applications, those skilled in the art can use any appropriate number, which falls within the scope of this application. In addition, the data compression conditions are not limited to the above conditions. Other data compression conditions that those skilled in the art can think of under the inspiration of the above embodiments fall within the scope of this application.

[0049] The following example shows the data compression process. When the data compression condition is "a set of data exists that is less than or equal to 0", there is a set of data: 1, 2, 0, -0.2, 3, -0.1, -1, -0.5, 4, -0.3, 5, then the compressed data is 1, 2, 3, 4, 5.

[0050] In order to facilitate the decompression of compressed data, it is necessary to determine the position index for the compressed data. In one embodiment, the position index can be determined by a direct indexing method. For the above set of data, the direct indexing method is used, and the position index is 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, where "1" means valid and "0" means invalid; they can also be expressed interchangeably, that is, "0" means valid and "1" means invalid.

[0051] The position index can be in the form of a step index. For the above set of data, the step index is used, and the position index is: 1, 1, 3, 4, 2, where the first "1" indicates that the first number is valid, and the other numbers indicate the step between two valid numbers, for example, the step between the numbers "1" and "2" is 1, and the step between the numbers "2" and "3" is 3. In addition to the methods of determining the position index using the direct index method and the step index method, those skilled in the art may also use other methods of position indexing, such as compressed row method and compressed column method, and so on.

[0052] The above lists a method for compressing a set of data and a position index used for the compressed data. However, according to actual needs and specific applications, those skilled in the art may use any other available compression method and a position index matching the compression method, which all belong to the scope of this application.

[0053] In an optional embodiment, when a group of data does not meet the data compression condition, for example, the data compression condition is that a group of data has a number equal to 0, and any value in the group of data is not 0, then there is no need to compress the group of data, and no position index is generated. The data compression module directly sends the group of data.

[0054] After receiving the data compressed by the data compression module, the data receiver needs to decompress the compressed data. Figure 4 A schematic diagram of a data receiver according to an embodiment of the present application is provided. Figure 4 As shown, the data receiver includes a data buffer, a decoder, a data decompression module and a direct storage access unit.

[0055] exist Figure 4In the illustrated embodiment, the data buffer is configured to receive data, a location index, and packet information from outside the data receiver. The decoder is configured to receive and send the data and the location index to the data decompression module, receive the packet information, and parse the storage address from the packet information. The data decompression module decompresses the data according to the location index. The direct storage access unit is configured to receive the decompressed data from the data decompression module, and write the decompressed data to the corresponding area of ​​the memory through the data bus according to the storage address.

[0056] Next, the functions of the data decompression module are described in detail.

[0057] First, the data decompression module receives the data to be decompressed and a position index related to the data to be decompressed.

[0058] Next, the data decompression module restores the data according to the position index according to a predetermined rule to form decompressed data.

[0059] As described above, the position index is generated by the data compression module during the compression process. According to different compression methods, there are different ways to determine the position index, including any one of the direct index method, the step index method, the row compression method and the column compression method. It is understandable that according to actual needs and specific applications, those skilled in the art can adopt any other available compression method and the position index matching the compression method, which are all within the scope of this application.

[0060] According to one embodiment, the predetermined rule may be to fill the set value according to the position index. In a specific embodiment, the set value is 0. In the above compression embodiment, for the compressed data 1, 2, 3, 4, 5, 0 is filled according to the position index, and the decompressed data is 1, 2, 0, 0, 3, 0, 0, 0, 4, 0, 5. It can be understood that the set value can be any suitable value according to actual needs and specific applications.

[0061] According to another embodiment, the predetermined rule may be to fill in randomly generated values ​​according to the position index. In the above compression embodiment, for the compressed data 1, 2, 3, 4, 5, randomly generated values ​​0.1, -0.3; 0.5, -0.1, 1.2; -0.6 are filled in according to the position index, and the decompressed data are 1, 2, 0.1, -0.3, 3, 0.5, -0.1, 1.2, 4, -0.6, 5.

[0062] The specific implementation of the above predetermined rules is only for the convenience of explaining the technical solution of the present invention, and is not used to limit the predetermined rules. Other implementations that can be thought of by those skilled in the art under the inspiration of the above implementations are within the scope of this application.

[0063] In the above scheme of the present application, the transmitting end and the receiving end respectively add compression and decompression modules. After compressing the data, the data transmission amount is reduced, the demand for transmission bandwidth is reduced, and then the transmission is performed, thereby improving the transmission efficiency.

[0064] Based on the above embodiments, the present application provides a method for data compression. Figure 5 As shown, the method includes:

[0065] Step S501: When first data meets a data compression condition, compress the first data to form second data.

[0066] Before compressing data, it is necessary to determine whether the data meets the data compression condition. If the data meets the compression condition, the data is compressed into compressed data, and the index of the compressed data is determined.

[0067] In one embodiment, the data compression condition includes a group of data having a value equal to a setting. In a specific embodiment, the setting value can be set to 0. If there is data equal to 0 in a group of data, the data equal to 0 will not be sent.

[0068] In another implementation, the data compression condition includes a group of data having a value less than a set value. In a specific embodiment, the set value can be set to 0, and if there is data less than 0 in a group of data, the data less than 0 will not be sent.

[0069] In another implementation, the data compression condition includes a group of data having a value less than or equal to a set value. In a specific embodiment, the set value can be set to 0. If there is data less than or equal to 0 in a group of data, data less than 0 will not be sent.

[0070] It should be noted that the set value can be any number. According to actual needs and specific applications, those skilled in the art can use any appropriate number, which falls within the scope of this application. In addition, the data compression conditions are not limited to the above conditions. Other data compression conditions that those skilled in the art can think of under the inspiration of the above embodiments fall within the scope of this application.

[0071] Step S502, determining a first position index of the second data;

[0072] As described in the above embodiments, the determination method of the position index includes any one of a direct index method, a step index method, a row compression method, and a column compression method. However, it should be noted that, according to actual needs and specific applications, those skilled in the art may adopt any other available compression method and a position index matching the compression method, which all belong to the scope covered by this application.

[0073] Step S503: sending the second data and the first location index.

[0074] After the compressed data and the position index related to the compressed data are obtained, the compressed data and the position index are sent out.

[0075] Based on the above embodiments, the present application provides a method for data decompression. Figure 6 As shown, the method includes:

[0076] Step S601, receiving third data and a second position index.

[0077] The compressed data and the position index related to the compressed data are received at the data receiving end. The second position index is determined by any one of a direct indexing method, a step indexing method, a row compression method and a column compression method. However, it should be noted that, according to actual needs and specific applications, those skilled in the art may adopt any other available compression method and a position index matching the compression method, which are all within the scope of this application.

[0078] Step S602: restore data according to the location index according to a predetermined rule to form fourth data.

[0079] According to one embodiment, the predetermined rule may be to fill the set value according to the position index. In a specific embodiment, the set value is 0. In the above compression embodiment, for the compressed data 1, 2, 3, 4, 5, 0 is filled according to the position index, and the decompressed data is 1, 2, 0, 0, 3, 0, 0, 0, 4, 0, 5. It can be understood that the set value can be any suitable value according to actual needs and specific applications.

[0080] According to another embodiment, the predetermined rule may be to fill in randomly generated values ​​according to the position index. In the above compression embodiment, for the compressed data 1, 2, 3, 4, 5, randomly generated values ​​0.1, -0.3; 0.5, -0.1, 1.2; -0.6 are filled in according to the position index, and the decompressed data are 1, 2, 0.1, -0.3, 3, 0.5, -0.1, 1.2, 4, -0.6, 5.

[0081] The specific implementation of the above predetermined rules is only for the convenience of explaining the technical solution of the present invention, and is not used to limit the predetermined rules. Other implementations that can be thought of by those skilled in the art under the inspiration of the above implementations are within the scope of this application.

[0082] Through the above-mentioned compression method and decompression method of the present application, the data is compressed before being sent, which reduces the data transmission volume, reduces the demand for transmission bandwidth, and then transmits, thereby improving transmission efficiency.

[0083] According to another embodiment, the present application provides an electronic device, including Figure 2 The data compression device shown.

[0084] According to another embodiment, the present application provides an electronic device, including Figure 2 The data decompression device shown.

[0085] It should be understood that the above-mentioned device embodiments are only illustrative, and the device disclosed herein may also be implemented in other ways. For example, the division of units / modules described in the above-mentioned embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components may be combined, or may be integrated into another system, or some features may be ignored or not executed.

[0086] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present disclosure may be integrated into one unit / module, or each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.

[0087] If the integrated unit / module is implemented in the form of hardware, the hardware may be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. If not otherwise specified, the processor or chip may be any appropriate hardware processor, such as a CPU, a GPU, an FPGA, a DSP, an ASIC, etc. If not otherwise specified, the on-chip cache, the off-chip memory, and the memory may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc.

[0088] If the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution disclosed herein is essentially or partly contributed to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the disclosure. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0089] In the above embodiments, the description of each embodiment has its own emphasis. For the part not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0090] The foregoing content can be better understood in accordance with the following terms:

[0091] Clause 1, a data compression device, comprising a data bus and a memory, a data receiver, an operation processing unit and a data transmitter connected to the data bus, wherein the data transmitter comprises a data compression module, wherein the data compression module is configured to:

[0092] When the first data meets the data compression condition, compressing the first data to form second data;

[0093] Determine a first position index of the second data;

[0094] The second data and the first location index are sent.

[0095] Item 2, an apparatus as described in Item 1, wherein the data compression condition includes the presence of a value less than or equal to a set value in the first data.

[0096] Clause 3, an apparatus as described in Clause 1 or 2, wherein a method for determining the first position index comprises any one of a direct indexing method, a step indexing method, a row compression method, and a column compression method.

[0097] Clause 4, the apparatus of clause 1, wherein the data compression module is further configured to:

[0098] The first data is sent without compressing the first data.

[0099] Clause 5. The apparatus of any one of clauses 1 to 4, wherein the data transmitter further comprises a transmit decoder and a data reordering buffer, wherein:

[0100] The sending decoder is configured to send data read request information to the data reordering buffer according to the task information;

[0101] The data reordering buffer is configured to obtain and send the first data to the data compression module through the data bus according to the data read request information.

[0102] Clause 6. The apparatus of any one of clauses 1 to 4, wherein the data transmitter further comprises a transmit buffer and a serial interface, wherein:

[0103] The sending buffer is configured to receive and buffer the second data and the first position index, and then send third data based on the second data and the first position index according to the format of the serial interface;

[0104] The serial interface is configured to receive and transmit the third data.

[0105] Clause 7. The apparatus of any one of clauses 1 to 4, wherein the data transmitter further comprises an arithmetic logic unit, a transmit buffer, and a serial interface, wherein:

[0106] The arithmetic logic unit is configured to operate on at least part of the second data, and send the obtained operation result as fourth data and a second position index to the sending buffer;

[0107] The sending buffer is configured to receive and buffer the fourth data and the second position index from the arithmetic logic unit, and then send fifth data based on the fourth data and the position index according to the format of the serial interface;

[0108] The serial interface is configured to receive and transmit the fifth data.

[0109] Clause 8. The apparatus of any one of clauses 1 to 7, wherein the data bus comprises a NOC.

[0110] Clause 9. An apparatus as described in any one of Clauses 1 to 8, wherein the apparatus comprises an artificial intelligence chip or an artificial intelligence processor, and the operation processing unit comprises an artificial intelligence processing unit.

[0111] Item 10. An apparatus as described in any one of Items 1 to 9, wherein the data receiver, the data transmitter, and the operation processing unit transmit data to each other and access the memory through the data bus.

[0112] Clause 11, a data decompression device, comprising a data bus and a memory, a data receiver, a processing unit and a data transmitter connected to the data bus, wherein the data receiver comprises a data decompression module, wherein the data decompression module is configured to:

[0113] receiving sixth data and a third position index; and

[0114] The data is restored according to the third position index according to a predetermined rule to form seventh data.

[0115] Item 12, an apparatus as described in Item 11, wherein a method for determining the third position index comprises any one of a direct indexing method, a step indexing method, a row compression method, and a column compression method.

[0116] Clause 13, an apparatus as described in clause 11 or 12, wherein the predetermined rule includes filling a set value according to the third position index.

[0117] Clause 14, an apparatus as described in clause 11 or 12, wherein the predetermined rule includes filling in a randomly generated value according to the third position index.

[0118] Clause 15. The apparatus of clause 11 or 12, wherein the data receiver comprises:

[0119] a data buffer configured to receive the sixth data, the third location index, and packet information from outside the data receiver;

[0120] The decoder is configured to receive and send the sixth data and the third position index to the data decompression module, receive the packet information and parse the storage address from the packet information.

[0121] Clause 16. The apparatus of clause 11 or 12, wherein the data receiver comprises:

[0122] The direct storage access unit is configured to receive the seventh data from the data decompression module, and write the seventh data into a corresponding area of ​​the memory through the data bus according to the storage address.

[0123] Clause 17. The apparatus of any of clauses 11 to 16, wherein the data bus comprises a NOC.

[0124] Clause 18. An apparatus as described in any one of Clauses 11 to 17, wherein the apparatus comprises an artificial intelligence chip or an artificial intelligence processor, and the operation processing unit comprises an artificial intelligence processing unit.

[0125] Clause 19. An apparatus as described in any one of clauses 11 to 18, wherein the data receiver, the data transmitter, and the operation processing unit transmit data to each other and access the memory through the data bus.

[0126] Clause 20. A method of compressing data, comprising:

[0127] When the first data meets the data compression condition, compressing the first data to form second data;

[0128] Determine a first position index of the second data;

[0129] The second data and the first location index are sent.

[0130] Item 21. A method as described in Item 20, wherein the data compression condition includes the presence of a value less than or equal to a set value in the first data.

[0131] Clause 22, a method as described in Clause 20 or 21, wherein the method for determining the first position index includes any one of a direct indexing method, a step indexing method, a row compression method, and a column compression method.

[0132] Clause 23. A method for decompressing data, comprising:

[0133] receiving third data and a second location index; and

[0134] The data is restored according to the second position index according to a predetermined rule to form fourth data.

[0135] Clause 24, a method as described in Clause 23, wherein the method for determining the second position index includes any one of a direct indexing method, a step indexing method, a row compression method, and a column compression method.

[0136] Clause 25, a method as described in clause 23 or 24, wherein the predetermined rule includes filling a set value according to the second position index.

[0137] Clause 26, a method as described in clause 23 or 24, wherein the predetermined rule includes filling in a randomly generated value according to the second position index.

[0138] Clause 27. An electronic device comprising the data compression device according to any one of clauses 1 to 10.

[0139] Clause 28. An electronic device comprising the data decompression device according to any one of clauses 11 to 19.

[0140] The embodiments of the present disclosure are described in detail above. Specific examples are used herein to illustrate the principles and implementation methods of the present disclosure. The description of the above embodiments is only used to help understand the method and its core idea of ​​the present disclosure. At the same time, changes or deformations made by those skilled in the art based on the ideas of the present disclosure, the specific implementation methods and the scope of application of the present disclosure, all belong to the scope of protection of the present disclosure. In summary, the content of this specification should not be understood as a limitation on the present disclosure.

Claims

1. A data compression device, which is an artificial intelligence chip or an artificial intelligence processor, comprising a data bus and a memory connected to the data bus, a data receiver, an operation processing unit and a data transmitter, wherein the data transmitter comprises a data compression module, wherein: The data compression module is configured to: When the first data meets a data compression condition, compress the first data to form second data, wherein the first data includes multiple values, wherein the data compression condition includes that the first data includes a value that is less than or equal to a set value, and the second data includes only values ​​that are greater than the set value; Determine a first position index of the second data; the first position index is determined based on whether the value at each position in the first data meets the data compression condition, "1" indicates that the corresponding value meets the data compression condition, and "0" indicates that the corresponding value does not meet the data compression condition; or, "0" indicates that the corresponding value meets the data compression condition, and "1" indicates that the corresponding value does not meet the data compression condition; The second data and the first location index are sent.

2. The device according to claim 1, wherein: The data compression module is further configured to: The first data is sent without compressing the first data.

3. The apparatus according to any one of claims 1 to 2, wherein the data transmitter further comprises a transmit decoder and a data reordering buffer, wherein: The sending decoder is configured to send data read request information to the data reordering buffer according to the task information; The data reordering buffer is configured to obtain and send the first data to the data compression module through the data bus according to the data read request information.

4. The device according to any one of claims 1 to 2, wherein the data transmitter further comprises a transmission buffer and a serial interface, wherein: The sending buffer is configured to receive and buffer the second data and the first position index, and then send third data based on the second data and the first position index according to the format of the serial interface; The serial interface is configured to receive and transmit the third data.

5. The device according to any one of claims 1 to 2, wherein the data transmitter further comprises an arithmetic logic unit, a transmission buffer and a serial interface, wherein, The arithmetic logic unit is configured to operate on at least part of the second data, and send the obtained operation result as fourth data and a second position index to the sending buffer; The sending buffer is configured to receive and buffer the fourth data and the second position index from the arithmetic logic unit, and then send fifth data based on the fourth data and the second position index according to the format of the serial interface; The serial interface is configured to receive and transmit the fifth data.

6. The device according to any one of claims 1 to 2, wherein: The data bus includes a NOC.

7. The device according to any one of claims 1 to 2, wherein: The operation processing unit includes an artificial intelligence processing unit.

8. The device according to any one of claims 1 to 2, wherein: The data receiver, the data transmitter and the operation processing unit transmit data to each other and access the memory through the data bus.

9. A data decompression device, referring to the data compression device according to claim 5, wherein the data decompression device is an artificial intelligence chip or an artificial intelligence processor, comprising a data bus and a memory connected to the data bus, a data receiver, an operation processing unit and a data transmitter, wherein the data receiver comprises a data decompression module, wherein: The data decompression module is configured to: receiving the fifth data and the second location index; and The data is restored according to the second position index according to a predetermined rule to form seventh data, wherein the predetermined rule includes filling a set value or a randomly generated value according to the second position index.

10. The device of claim 9, wherein: The data receiver comprises: a data buffer configured to receive the fifth data, the second location index, and packet information from outside the data receiver; The decoder is configured to receive and send the fifth data and the second position index to the data decompression module, receive the packet information and parse the storage address from the packet information.

11. The device of claim 9, wherein: The data receiver comprises: The direct storage access unit is configured to receive the seventh data from the data decompression module, and write the seventh data into a corresponding area of ​​the memory through the data bus according to a storage address.

12. The device according to any one of claims 9 to 11, wherein The data bus includes a NOC.

13. The device according to any one of claims 9 to 11, wherein: The operation processing unit includes an artificial intelligence processing unit.

14. The device as claimed in any one of claims 9 to 11, wherein: The data receiver, the data transmitter and the operation processing unit transmit data to each other and access the memory through the data bus.

15. A data compression method, comprising: When the first data meets a data compression condition, compress the first data to form second data, wherein the first data includes multiple values, wherein the data compression condition includes that the first data includes a value that is less than or equal to a set value, and the second data includes only values ​​that are greater than the set value; Determine a first position index of the second data; the first position index is determined based on whether the value at each position in the first data meets the data compression condition, "1" indicates that the corresponding value meets the data compression condition, and "0" indicates that the corresponding value does not meet the data compression condition; or, "0" indicates that the corresponding value meets the data compression condition, and "1" indicates that the corresponding value does not meet the data compression condition; The second data and the first location index are sent.

16. The data compression method according to claim 15, wherein the data compression method is performed in a data compression module of a data transmitter, and the data transmitter further comprises an arithmetic logic unit, a transmission buffer and a serial interface, wherein: The arithmetic logic unit is configured to operate on at least part of the second data, and send the obtained operation result as fourth data and a second position index to the sending buffer; The sending buffer is configured to receive and buffer the fourth data and the second position index from the arithmetic logic unit, and then send fifth data based on the fourth data and the second position index according to the format of the serial interface; The serial interface is configured to receive and transmit the fifth data.

17. A data decompression method, referring to the data compression method according to claim 16, the data decompression method comprising: receiving the fifth data and the second position index; as well as The data is restored according to the second position index according to a predetermined rule to form sixth data, wherein the predetermined rule includes filling a set value or a randomly generated value according to the second position index.

18. An electronic device comprising the data compression device according to any one of claims 1 to 8.

19. An electronic device comprising the data decompression device according to any one of claims 9 to 14.