Data compression system based on shift processing

By adopting a data compression system based on shift processing on the GPU chip, the data to be compressed is shifted and compressed, and the problem of limited data compression effect in the prior art is solved, and a more efficient data compression effect is achieved.

CN119540024AActive Publication Date: 2025-02-28MUXI LINGZHI TECHNOLOGY (BEIJING) CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202411593010.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-21
Publication Date
2025-02-28
Estimated Expiration
2044-05-21

AI Technical Summary

Technical Problem

When the prior art is used on GPU chips for artificial intelligence model training and inference, the data compression effect is limited, especially when processing data generated in the middle of the model, it cannot be effectively compressed.

Method used

A data compression system based on shift processing is adopted, and the compressed data to be compressed is shifted and compressed through the compression unit in the GPU, forming a set of shift processing results, and determining whether to perform further compression based on the average of accuracy loss.

Benefits of technology

It improves the overall compression rate of the artificial intelligence model during training or inference, can effectively compress the intermediate data of the artificial intelligence model, and improves the storage capacity of GPU video memory.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119540024A_ABST
    Figure CN119540024A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data compression, in particular to a data compression system based on shift processing, the system comprises a GPU, a database, a processor and a memory in which a computer program is stored, the database comprises to-be-compressed data, the GPU comprises a plurality of compression units, the to-be-compressed data is compressed through the compression units contained in the GPU, and the to-be-compressed data is compressed through the processor. According to the method, compression operation can be executed on the GPU side, then the method can be applied to intermediate data of the artificial intelligence model, the overall compression rate of the artificial intelligence model during training or reasoning can be effectively increased, and the compression effect is poor due to the fact that a compression mode based on lossless compression is affected by data distribution of data to be compressed. The compression effect of data compression can be improved by using a shift processing mode.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of "A Data Compression System". The application date of the original application is May 21, 2024, and the application number is CN118212116A Technical Field

[0002] The present invention relates to the technical field of data compression, and in particular to a data compression system based on shift processing. Background Art

[0003] When GPU chips are used in artificial intelligence scenarios, the efficiency of artificial intelligence model training and reasoning is often limited by the memory bandwidth of the GPU chip rather than the computing power of the GPU chip. Therefore, using limited memory bandwidth to store more data has become a way to improve model training and reasoning efficiency.

[0004] In response to the above problems, the prior art proposes a method of using data compression for the model data to be stored in the GPU, thereby improving the storage capacity of the GPU video memory. However, in order to ensure the accuracy of the model, the model data needs to be losslessly compressed. The lossless compression method currently applied to GPU chips is usually a delta compression-based method, which has a very limited compression effect on the model data. Moreover, the existing compression method is usually applied on the CPU side, and the GPU chip only performs a decompression operation to obtain the data before compression. When faced with the data generated in the middle of the model, such as feature tensors, compression processing cannot be performed.

[0005] Therefore, how to improve the compression effect of data compression in GPU application scenarios has become an urgent problem to be solved. Summary of the invention

[0006] In view of the above technical problems, the technical solution adopted by the present invention is:

[0007] A data compression system based on shift processing, the system comprising: a GPU, a database, a processor and a memory storing a computer program, wherein the database comprises to-be-compressed data A and its bit width w(A), wherein A={a 1 , a 2 , …, a n , …, a N}, a n is the nth sub-data to be compressed, n is an integer in the range of [1, N], N is the number of sub-data to be compressed in A, the sub-data to be compressed is floating point data, and the GPU includes a compression unit set B = {b 1 , b 2 , …, b m , …, b M}, b mis a compression unit corresponding to the mth compression method, m is an integer in the range of [1, M], and M is the number of compression units included in the GPU. When the computer program is executed by a processor, the following steps are implemented:

[0008] S1011, according to a n The corresponding order exp n , determine the reference order E = max (exp n ).

[0009] S1012, according to E and exp n , for a n Perform shift processing to obtain the shift processing result g n .

[0010] S1013, forming a shift processing result set G from all the shift processing results.

[0011] S1014, according to a n and g n , determine g n The corresponding accuracy loss is l n .

[0012] S1015, according to all the precision losses, the mean precision loss μ is calculated as follows: N n=1 (l n )) / N.

[0013] S1016, when μ meets the preset condition, execute step S1018, otherwise execute step S1017, the preset condition is: μ≥L, where L is the preset accuracy threshold.

[0014] S1017, use b m Compress A to obtain reference compressed data c m .

[0015] S1018, use b m Compress G to obtain reference compressed data c m .

[0016] Compared with the prior art, the present invention has obvious beneficial effects. By means of the above technical solution, a data compression system based on shift processing provided by the present invention can achieve considerable technical advancement and practicality, and has wide industrial utilization value, and has at least the following beneficial effects:

[0017] The present invention provides a data compression system based on shift processing, the system comprising: a GPU, a database, a processor and a memory storing a computer program, wherein the database comprises to-be-compressed data A and its bit width w(A), wherein A={a 1 , a 2 , …, a n , …, a N}, a n is the nth sub-data to be compressed, n is an integer in the range of [1, N], N is the number of sub-data to be compressed in A, the sub-data to be compressed is floating point data, and the GPU includes a compression unit set B = {b 1 , b 2 , …, b m , …, b M}, b m is a compression unit corresponding to the mth compression method, m is an integer in the range of [1, M], and M is the number of compression units included in the GPU. When the computer program is executed by the processor, the following steps are implemented: S1011, according to a n The corresponding order exp n , determine the reference order E = max (exp n ), S1012, according to E and exp n , for a n Perform shift processing to obtain the shift processing result g n , S1013, form a shift processing result set G from all the shift processing results, S1014, according to a n and g n , determine g n The corresponding accuracy loss is l n , S1015, according to all the precision losses, calculate the mean precision loss μ=(∑ N n=1 (l n )) / N, S1016, when μ satisfies the preset condition, execute step S1018, otherwise execute step S1017, the preset condition is: μ≥L, where L is the preset accuracy threshold, S1017, use b m Compress A to obtain reference compressed data c m S1018, use b m Compress G to obtain reference compressed data c m .

[0018] It can be seen that the data to be compressed is compressed by the compression unit contained in the GPU, so that the compression operation can be performed by the GPU side, and then can be applied to the intermediate data of the artificial intelligence model, which can effectively improve the overall compression rate of the artificial intelligence model during training or reasoning. Moreover, the compression method based on lossless compression will be affected by the data distribution of the data to be compressed, resulting in poor compression effect. The use of shift processing can improve the compression effect of data compression. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0020] Figure 1 A flowchart of a computer program executed by a processor in a data compression system based on shift processing provided by an embodiment of the present invention. DETAILED DESCRIPTION

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

[0022] This embodiment provides a data compression system, the system comprising: a GPU, a database, a processor, and a memory storing a computer program, wherein the database comprises to-be-compressed data A and its bit width w(A), and a standard bit width set P={p 1 , p 2 ,…,p q ,…,p Q}, p q is the qth standard bit width, q is an integer in the range [1, Q], Q is the total number of standard bit widths in P, and the GPU includes a compression unit set B = {b 1 , b 2 , …, b m , …, b M}, b m is a compression unit corresponding to the mth compression method, m is an integer in the range of [1, M], and M is the number of compression units included in the GPU. When the computer program is executed by a processor, the following steps are implemented:

[0023] S101, use b mCompress A to obtain reference compressed data c m .

[0024] S102, obtain c m The corresponding bit width w 1 (c m ).

[0025] S103, calculate c m The corresponding reference compression rate α m =w 1 (c m ) / w(A).

[0026] S104, determine min(α m ) The corresponding compression unit is the target compression unit b k .

[0027] S105, according to w 1 (c k ), determine from P the value of 1 (c k ) is closest to and greater than or equal to w 1 (c k ) as the reference bit width w 2 (c k ), where c k The target compression unit b k The corresponding reference compressed data, w 1 (c k ) is the target compression unit b k The bit width of the corresponding reference compressed data.

[0028] S106, b k Output reference compressed data c k Perform size standardization to obtain the target compressed data d, where the bit width of d is w(d) = w 2 (c k ).

[0029] Among them, the data A to be compressed can be a floating point data type, w(A) is the bit width occupied by A, the standard bit width can refer to the storage bit width supported by the GPU, and data compression is usually used for data storage. Due to hardware limitations, the GPU can only support a partial bit width when storing data, that is, the standard bit width.

[0030] The compression unit may be used to compress the data to be compressed. Different compression units may use different compression methods. In this embodiment, the compression unit may use an entropy coding method and a Delta coding method.

[0031] Specifically, each compression unit is used to compress A respectively, and the reference compressed data output by each compression unit can be obtained. In the artificial intelligence application scenario, A is usually data such as model weights and feature tensor parameters. In order to ensure the accuracy of model training or inference process, the compression for A should be lossless compression, and the compression rate of lossless compression will be affected by the data distribution of A. Therefore, the bit width of the reference compressed data is uncertain, and the bit width needs to be obtained for each reference compressed data. Then, according to the bit width of the reference compressed data and the original bit width w(A), the reference compression rate corresponding to the reference compressed data is calculated. Obviously, the smaller the reference compression rate, the better the compression effect. Therefore, min(α m ) is used as the target compression unit.

[0032] In determining the target compression unit b k After that, the corresponding reference compressed data is c k , at this time c k The corresponding bit width w 1 (c k ) may not be the same as the standard bit width, so it is necessary to determine the bit width that is consistent with w from the standard bit width set P. 1 (c k ) is closest to and greater than or equal to w 1 (c k ) as the reference bit width w 2 (c k ), in such a way that c k Under the premise of being able to store, there is no loss of c k The accuracy of the image is maintained, maintaining the effect of lossless compression.

[0033] Size standardization can be achieved by zero padding, that is, k Padded with several zeros to make the data after zero padding consistent with w 2 (c k ) is the same as that of the first embodiment, and the data after zero padding is used as the target compressed data d.

[0034] Optionally, the data to be compressed A={a 1 , a 2 , …, a n , …, a N}, a n is the nth sub-data to be compressed, n is an integer in the range of [1, N], N is the number of sub-data to be compressed in A, and the sub-data to be compressed is floating-point data;

[0035] Step S101 also includes the following steps:

[0036] S1011, according to a n The corresponding order expn , determine the reference order E = max(exp n );

[0037] S1012, according to E and exp n , for a n Perform shift processing to obtain the shift processing result g n ;

[0038] S1013, forming a shift processing result set G from all the shift processing results;

[0039] S1018, use b m Compress G to obtain reference compressed data c m .

[0040] Among them, A contains N sub-data to be compressed, and lossless compression can be performed according to the data distribution of the N sub-data to be compressed. Accordingly, since the data distribution of the N sub-data to be compressed in each data to be compressed is different, the compression results using different compression units are also different. In this embodiment, the sub-data to be compressed can be a half-precision floating-point data type, and the bit width of a single sub-data to be compressed is 16 bits, that is, 2 bytes. N can be set to 64, and the corresponding bit width of A is 128 bytes.

[0041] Specifically, the entropy coding method requires that data be concentrated near 0 as much as possible, while the Delta coding method requires that the difference between data be as small as possible. However, when the sub-data to be compressed is floating-point data, there may still be large differences between the floating-point data corresponding to the sub-data to be compressed with similar values. For example, the difference in floating-point representation between 1.999 and 2 is larger than the difference in floating-point representation between 1.998 and 1.999.

[0042] At the same time, combined with the prior information that the numerical differences between the sub-data to be compressed in A are not large, this embodiment aligns the orders of the 64 floating-point data in A, that is, determines the orders corresponding to the N sub-data to be compressed, takes the maximum order as the reference order, and shifts the N sub-data to be compressed according to the reference order, so that the orders of the N sub-data to be compressed are consistent with the reference order, and obtains the shift processing result set G after A is shifted, and then compresses G.

[0043] Optionally, step S101 further includes the following steps:

[0044] S1014, according to a n and g n , determine g n The corresponding accuracy loss is l n ;

[0045] S1015, according to all the precision losses, the mean precision loss μ is calculated as follows: N n=1 (l n )) / N;

[0046] S1016, when μ meets the preset condition, execute step S1018, otherwise execute step S1017;

[0047] S1017, use b m Compress A to obtain reference compressed data c m .

[0048] Among them, since the shift processing will cause the precision loss of floating-point data, according to a n and g n , calculate g n The corresponding accuracy loss is l n , and then calculate the mean precision loss corresponding to all shift processing results. It should be noted that the implementer should be aware that using any method such as median, mode, maximum value, etc. to measure the precision loss and then judge whether to perform the shift processing is within the protection scope of the present invention.

[0049] When μ satisfies the preset conditions, b is used m Compress the shift processing result set G. When μ does not meet the preset conditions, use b m A is compressed, that is, whether to perform shift processing is determined according to whether μ meets the preset conditions.

[0050] Optionally, the preset condition is: μ≥L, where L is a preset accuracy threshold.

[0051] The accuracy threshold can be set to 0.1, and the implementer can adjust the accuracy threshold according to actual conditions.

[0052] See also Figure 1 , which is a flowchart of a computer program executed by a processor in a data compression system based on shift processing provided by an embodiment of the present invention.

[0053] Optionally, the GPU includes a memory, the memory includes a plurality of memory pages, and the memory page includes a compression identifier, metadata, and a compression mode identifier;

[0054] When the computer program is executed by a processor, the following steps are also implemented:

[0055] S107, using the target compressed data d as metadata, k As a compression method identifier, it is stored in the memory page whose compression identifier is compressible.

[0056] In this embodiment, the data compression process is performed by the cache in the GPU. The compression flags include compressible and incompressible. When the GPU writes the data to be compressed to the memory page with the compression flag as compressible, the cache compresses the data to be compressed to obtain d, and updates the metadata in the memory page with d, and at the same time changes b k It is stored as a compression mode identifier to facilitate subsequent decompression of d.

[0057] Optionally, when the GPU reads the memory page storing d, it can read the memory page storing d according to b. k Determine a decompression method, and use the decompression method to decompress d to obtain A.

[0058] Among them, the cache is based on b k Determine a decompression method, and use the decompression method to decompress d to obtain A, thereby completing the decompression process.

[0059] Optionally, Q is set to 4.

[0060] In this embodiment, Q can be set to 4, then P = {p 1 , p 2 , p 3 , p 4}, p 1 Can be set to 0 bytes, p 2 Can be set to 64 bytes, p 3 Can be set to 96 bytes, p 4 It can be set to 128 bytes, and implementers can adjust the standard bit width setting according to actual hardware conditions.

[0061] Optionally, M is set to 5.

[0062] In this embodiment, the GPU may include five compression units, and the corresponding compression methods may be Laplace coding, Gaussian coding, Delta coding, XOR coding and identical coding.

[0063] In one embodiment, the implementer can use b m Before compressing A, compare A with historical data. If A is the same as historical data, the same encoding is used directly. Otherwise, use b m A is compressed. At this time, there are 4 compression units for compressing A. The compression methods used can be Laplace coding, Gaussian coding, Delta coding and XOR coding, so that the situation of using the same coding can be judged in advance, thereby improving the efficiency of data compression.

[0064] In this embodiment, the data to be compressed is compressed by the compression unit included in the GPU, so that the compression operation can be performed by the GPU side, and then can be applied to the intermediate data of the artificial intelligence model, which can effectively improve the overall compression rate of the artificial intelligence model during training or reasoning. Moreover, the compression method based on lossless compression will be affected by the data distribution of the data to be compressed, resulting in poor compression effect. The use of shift processing can improve the compression effect of data compression.

[0065] Although some specific embodiments of the present invention have been described in detail by way of example, it will be appreciated by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present invention. It will also be appreciated by those skilled in the art that various modifications may be made to the embodiments without departing from the scope and spirit of the present invention. The scope of the present invention is defined by the appended claims.

Claims

1. A data compression system based on shift processing, characterized in that: The system comprises: a GPU, a database, a processor and a memory storing a computer program, wherein the database comprises data A to be compressed and its bit width w(A), wherein A={a1, a2, ..., a n , …, a N }, a n is the nth sub-data to be compressed, n is an integer in the range of [1, N], N is the number of sub-data to be compressed in A, the sub-data to be compressed is floating-point data, and the GPU includes a compression unit set B = {b1, b2, ..., b m , …, b M }, b m is a compression unit corresponding to the mth compression method, m is an integer in the range of [1, M], and M is the number of compression units included in the GPU. When the computer program is executed by a processor, the following steps are implemented: S1011, according to a n The corresponding order exp n , determine the reference order E = max (exp n ); S1012, according to E and exp n , for a n Perform shift processing to obtain the shift processing result g n ; S1013, forming a shift processing result set G from all the shift processing results; S1014, according to a n and g n , determine g n The corresponding accuracy loss is l n ; S1015, according to all the precision losses, the mean precision loss μ is calculated as follows: N n=1 (l n )) / N; S1016, when μ satisfies a preset condition, execute step S1018, otherwise execute step S1017, wherein the preset condition is: μ ≥ L, where L is a preset accuracy threshold; S1017, use b m Compress A to obtain reference compressed data c m ; S1018, use b m Compress G to obtain reference compressed data c m .

2. The data compression system based on shift processing according to claim 1, characterized in that: The database also includes a standard bit width set P = {p1, p2, ..., p q ,…,p Q }, p q is the qth standard bit width, q is an integer in the range of [1, Q], Q is the total number of standard bit widths in P, and when the computer program is executed by a processor, the following steps are also implemented: S102, obtain c m The corresponding bit width w1(c m ); S103, calculate c m The corresponding reference compression rate α m =w1(c m ) / w(A); S104, determine min(α m ) The corresponding compression unit is the target compression unit b k ; S105, according to w1(c k ), determine from P the value that matches w1(c k ) is closest to and greater than or equal to w1(c k ) as the reference bit width w2(c k ), where c k The target compression unit b k The corresponding reference compressed data, w1(c k ) is the target compression unit b k The bit width of the corresponding reference compressed data; S106, b k Output reference compressed data c k The size is normalized to obtain the target compressed data d, where the bit width of d is w(d)=w2(c k ).

3. The data compression system based on shift processing according to claim 2, characterized in that: The GPU includes a memory, the memory includes a plurality of memory pages, and the memory page includes a compression identifier, metadata, and a compression mode identifier; When the computer program is executed by a processor, the following steps are also implemented: S107, using the target compressed data d as metadata, k As a compression method identifier, it is stored in the memory page whose compression identifier is compressible.

4. The data compression system based on shift processing according to claim 3, characterized in that: When the GPU reads the memory page storing d, according to b k Determine a decompression method, and use the decompression method to decompress d to obtain A.

5. The data compression system based on shift processing according to claim 2, characterized in that: Q is set to 4.

6. The data compression system based on shift processing according to claim 1, characterized in that: M is set to 5.

Citation Information

Patent Citations

  • Scientific calculation-orientated floating-point data parallel lossless compression method

    CN105022631A

  • Neural network data compression and related calculation method and device

    CN110490310A

  • Data compression using integer neural networks

    CN112771541A

  • Neural network data processing method and apparatus

    CN112784956A

  • Data compression method applied to channel estimation, related device and storage medium

    CN115242883A