A data compression system based on shift processing

Through a data compression system based on shift processing, the problem of limited model data compression effect on GPU chips is solved, lossless compression and efficient data storage are achieved, and the efficiency of model training and inference is improved.

CN119540024BActive Publication Date: 2025-10-03MUXI LINGZHI TECHNOLOGY (BEIJING) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing technologies have limited compression effects on artificial intelligence model data on GPU chips, especially when it comes to intermediate model data such as feature tensors. This results in the inability to effectively compress them, causing the graphics memory bandwidth to limit model training and inference efficiency.

Method used

A data compression system based on shift processing is adopted. By determining the order and precision loss of the data to be compressed, the appropriate compression unit is selected to perform lossless compression on the data, and the compression operation is performed on the GPU side.

Benefits of technology

It improves the overall compression rate of artificial intelligence models during training and inference, and enhances the data compression effect, especially when facing intermediate data of the model, it can achieve lossless compression.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119540024B_ABST
    Figure CN119540024B_ABST
Patent Text Reader

Abstract

The present application relates to the field of data compression technology, and in particular to a data compression system based on shift processing. The system includes: a GPU, a database, a processor and a memory storing a computer program. The database includes data to be compressed, and the GPU includes multiple compression units. The data to be compressed is compressed by the compression units 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 inference. 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.
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 GPU chip's memory bandwidth rather than the GPU chip's computing power. Therefore, using limited memory bandwidth to store more data has become a way to improve model training and reasoning efficiency.

[0004] To address the above issues, the existing technology proposes a data compression method for the model data to be stored by 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 extremely limited compression effect on model data. Moreover, the existing compression method is usually applied on the CPU side, and the GPU chip only performs decompression operations 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 data to be compressed A 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 the compression unit corresponding to the mth compression method, m is an integer in the range [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: Form a shift processing result set G from all shift processing results.

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

[0012] S1015, based on all the precision losses, calculate the precision loss mean μ=(∑ 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] The present invention has significant advantages over the prior art. By means of the above technical solution, the data compression system based on shift processing provided by the present invention can achieve considerable technological advancement and practicality, and has wide industrial application value. It has at least the following advantages:

[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 data to be compressed A and its bit width w(A), wherein A={a1, a2, ..., a n ,…,a N}, a nis 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 the 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 shift processing results, S1014, according to a n and g n , determine g n The corresponding accuracy loss l n , S1015, according to all the precision losses, calculate the precision loss mean μ=(∑ N n=1 (l n )) / N, 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, 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 inference. 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 The present invention provides a flowchart of a computer program executed by a processor in a data compression system based on shift processing according to an embodiment of the present invention. DETAILED DESCRIPTION

[0021] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. 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 shall fall within the scope of protection of the present invention.

[0022] This embodiment provides a data compression system, which includes: a GPU, a database, a processor, and a memory storing a computer program, wherein the database includes the data to be compressed A and its bit width w(A), and 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 [1, Q], Q is the total number of standard bit widths in P, and the GPU includes a compression unit set B = {b1, b2, ..., b m ,…,b M}, b m is the compression unit corresponding to the mth compression method, m is an integer in the range [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 m Compress A to obtain reference compressed data c m .

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

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

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

[0027] S105, according to w1(c k ), determine from P the value of 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.

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

[0029] The data A to be compressed may be of floating-point data type, w(A) is the bit width occupied by A, and the standard bit width may refer to the storage bit width supported by the GPU. Data compression is usually used for data storage, but due to hardware limitations, the GPU can only support a partial bit width when storing data, namely the standard bit width.

[0030] The compression unit can be used to compress the data to be compressed. Different compression units adopt different compression methods. In this embodiment, the compression unit can adopt entropy coding and Delta coding.

[0031] Specifically, each compression unit is used to compress A separately, 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. 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. It is necessary to obtain the bit width for each reference compressed data, and then calculate the reference compression rate corresponding to the reference compressed data according to the bit width of the reference compressed data and the original bit width w(A). 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 Afterwards, the corresponding reference compressed data is c k , at this time c kThe corresponding bit width w1(c k ) may be different from the standard bit width, so it is necessary to determine the bit width that is consistent with w1(c k ) is closest to and greater than or equal to w1(c k ) as the reference bit width w2(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 compression is maintained, maintaining the effect of lossless compression.

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

[0034] Optionally, the data to be compressed A={a1,a2,…,a n ,…,a N}, a n is the nth sub-data to be compressed, where n is an integer in the range [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 further includes the following steps:

[0036] S1011, according to a n The corresponding order exp n , 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 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 based on 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 the data be concentrated around 0 as much as possible, while the Delta coding method requires that the difference between the 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 l n ;

[0045] S1015, based on all the precision losses, calculate the precision loss mean μ=(∑ N n=1 (l n )) / N;

[0046] S1016, when μ meets the preset conditions, 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 gn The corresponding accuracy loss l n , and then calculate the mean of the precision loss corresponding to all the 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 scope of protection 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 based on 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, and b 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 and obtains d. The metadata in the memory page is updated with d, and b is also updated. 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 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 kDetermine a decompression method, and use the decompression method to decompress d to obtain A, completing the decompression process.

[0059] Optionally, Q is set to 4.

[0060] In this embodiment, Q can be set to 4, then P = {p1, p2, p3, p4}, p1 can be set to 0 bytes, p2 can be set to 64 bytes, p3 can be set to 96 bytes, and p4 can be set to 128 bytes. The implementer can adjust the standard bit width setting according to the actual hardware situation.

[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 may use b m Before compressing A, compare A with historical data. If A is the same as historical data, use the same encoding 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 inference. 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 understood 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 understood 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 includes: a GPU, a database, a processor and a memory storing a computer program, wherein the database includes the data to be compressed A and its bit width w(A), a standard bit width set P={p1, p2, ..., p q ,…,p Q }, where A={a1, a2, …, a n ,…,a N }, a n is the nth sub-data to be compressed, n is an integer in the range [1, N], N is the number of sub-data to be compressed in A, the sub-data to be compressed is floating point data, 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={b1, b2, ..., b m ,…,b M }, b m is the compression unit corresponding to the mth compression method, m is an integer in the range [1, M], M is the number of compression units included in the GPU, M is set to 5, and the five compression methods include Laplace coding, Gaussian coding, Delta coding, XOR coding, and identical coding. 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 shift processing results; S1014, according to a n and g n , determine g n The corresponding accuracy loss l n ; S1015, based on all the precision losses, calculate the mean precision loss μ=(∑ N n=1 (l n )) / N; 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; 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 ; 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 of 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 Perform size standardization to obtain the target compressed data d, where the bit width of d is w(d)=w2(c k ).

2. The data compression system based on shift processing according to claim 1, 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, and b k As a compression method identifier, it is stored in the memory page whose compression identifier is compressible.

3. The data compression system based on shift processing according to claim 2, 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.

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

Citation Information

Patent Citations

  • Neural network data processing method and apparatus

    CN112784956A

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

    CN115242883A