Data processing method, data processing system, and storage medium

By performing two quantizations and bit transposition on the data, the problem of fixed quantization bits is solved, enabling flexible data quantization, saving storage resources and transmission bandwidth, and improving the accuracy and efficiency of data processing.

WO2026157241A1PCT designated stage Publication Date: 2026-07-30HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
HUAWEI TECH CO LTD
Filing Date
2025-09-03
Publication Date
2026-07-30

AI Technical Summary

Technical Problem

In existing technologies, the number of bits used for data quantization is fixed, which lacks flexibility and leads to a waste of storage resources and data transmission bandwidth.

Method used

The data is quantized twice by the first processing unit into a format supported by the second processing unit, and then restored to the original format at the second processing unit. This achieves flexible data quantization and improves the accuracy and flexibility of quantization by using standard values ​​and bit transposition techniques.

Benefits of technology

This achieves savings in storage space and data transmission bandwidth without changing the data format of the second processing unit, thereby improving system performance and the flexibility and accuracy of data processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025118730_30072026_PF_FP_ABST
    Figure CN2025118730_30072026_PF_FP_ABST
Patent Text Reader

Abstract

A first processing unit performs a first quantization operation on X pieces of first data to obtain X pieces of second data, wherein each piece of second data comprises M bits, and a second processing unit supports processing of data comprising M bits; the first processing unit performs a second quantization operation on X pieces of second data to obtain X pieces of third data, wherein each piece of third data comprises N bits, X is a positive integer greater than or equal to 2, M and N are any positive integers, and N is less than M; the first processing unit converts the X pieces of third data into N pieces of fourth data, wherein each piece of fourth data comprises X bits, and an i-th piece of fourth data among the N pieces of fourth data is composed of data comprising X i-th bits among the X pieces of third data; the second processing unit acquires the N pieces of fourth data, and restores the N pieces of fourth data into the X pieces of second data; and the second processing unit processes the X pieces of second data. The present invention can implement flexible data quantization, thereby saving data storage space and transmission bandwidth.
Need to check novelty before this filing date? Find Prior Art

Description

Data processing methods, data processing systems, and storage media

[0001] This application claims priority to Chinese Patent Application No. 202510113685.9, filed on January 23, 2025, entitled "Data Processing Method, Data Processing System and Storage Medium", the entire contents of which are incorporated herein by reference. Technical Field

[0002] This application relates to the field of computing, and in particular to data processing methods, data processing systems and storage media. Background Technology

[0003] In the field of computing, various data processing methods are involved, such as data quantization. Data quantization refers to representing data with fewer bits, thereby achieving data compression. In related technologies, due to the limitations of the processing unit's data processing capabilities, the number of bits in the quantized data is fixed, usually a multiple of the number of bits that the processing unit can process, thus lacking flexibility. Summary of the Invention

[0004] This application provides a data processing method, a data processing system, and a storage medium to achieve flexible data quantization, thereby saving data storage space and transmission bandwidth. The technical solution is as follows:

[0005] In a first aspect, a data processing method is provided, comprising: a first processing unit performing a first quantization operation on X first data to obtain X second data, each second data including M bits, wherein the second processing unit supports processing data with M bits; the first processing unit performing a second quantization operation on the X second data to obtain X third data, each third data including N bits, wherein X is a positive integer greater than or equal to 2, M and N are both arbitrary positive integers, and N is less than M; the first processing unit converting the X third data into N fourth data, each fourth data including X bits, wherein the i-th fourth data among the N fourth data is composed of the X i-th bits of the X third data; the second processing unit acquiring the N fourth data and restoring the N fourth data to X second data; and the second processing unit processing the X second data.

[0006] This application uses a first processing unit to quantize data into a format supported by a second processing unit through a first quantization operation. Then, it quantizes the data after the first quantization operation into data of any format through a second quantization operation. After the second processing unit obtains the data after the second quantization operation, it dequantizes the data of any format into a format supported by the second processing unit. In this way, the data can be further quantized into data with fewer bits after the first quantization, which not only saves memory space but also saves bandwidth for data transmission between the first and second processing units. When the second processing unit processes the data, it restores the data to a format supported by the second processing unit, thereby realizing the quantization of data of any format without changing the data format supported by the second processing unit, thus improving system performance.

[0007] The first data is quantized into a third data consisting of N bits. Since N is not constrained by the processing capability of the second processing unit, the quantization becomes more flexible. Furthermore, this application transforms the quantized third data by grouping together the data with the same bits from X different third data sets to obtain a fourth data set consisting of X bits. This allows the second processing unit to directly recover the second data based on the fourth data set. Since the second data set consists of M bits, and the second processing unit supports processing M bits of data, it can process the second data accurately and flexibly.

[0008] In one possible implementation, the first processing unit performs a second quantization operation on X second data points to obtain X third data points, including: determining a standard value corresponding to each bit in N bits; and determining each third data point in the X third data points based on the N standard values ​​and the value of each second data point in the X second data points. The N standard values ​​provide a stable quantization standard for the second quantization operation, improving the accuracy of quantization.

[0009] In one possible implementation, N standard values ​​correspond to N bits respectively. Each third data in X third data is determined based on the N standard values ​​and the value of each second data in X second data. This includes: decomposing the value of each second data in X second data into the sum of the standard values ​​corresponding to K bits in N bits, setting the value of the K bits in the third data to 1, and setting the value of the bits other than the K bits in the N bits in the third data to 0, where K is a positive integer greater than or equal to 0 and less than or equal to N.

[0010] For any second data point, it is decomposed into the sum of standard values ​​corresponding to K bits. This determines that the second data point is related to the standard values ​​corresponding to these K bits. Therefore, setting the values ​​of the K bits in the corresponding third data point to 1 accurately indicates that the second data point is related to the standard values ​​corresponding to these K bits. Bits in the third data point that are unrelated to the standard values ​​are set to 0, accurately indicating that these bits in the third data point are unrelated to the standard values, thus allowing for accurate reconstruction of the second data point.

[0011] In one possible implementation, restoring N fourth data points to X second data points includes: for the N j-th bit data points among the N fourth data points, obtaining the values ​​of the N j-th bit data points and the standard value corresponding to each of the N fourth data points, where the j-th standard value of each of the N fourth data points is the same as the standard value corresponding to each of the N j-th bit data points, and j ranges from 1 to X; and obtaining the j-th second data point among the X second data points based on the values ​​of the N j-th bit data points and the standard values ​​corresponding to each of the N fourth data points.

[0012] Since the fourth data is derived from the third data, and the third data is quantized based on the second data and the N standard values ​​corresponding to the second data, the second data can be accurately and efficiently recovered through the standard values ​​and the fourth data.

[0013] In one possible implementation, the j-th second data among X second data is obtained based on the values ​​of N j-th bit data and the standard value corresponding to each of the N fourth data. This includes: determining the values ​​corresponding to the N j-th bit data; when the value of any j-th bit data is 1, the value corresponding to any j-th bit data is the standard value corresponding to any j-th bit data; when the value of any j-th bit data is 0, the value corresponding to any j-th bit data is 0; and adding the values ​​corresponding to the N j-th bit data to obtain the j-th second data.

[0014] When any bit in the fourth data has a value of 1, it means that the value of that bit is related to the corresponding standard value, so the value corresponding to that bit is determined to be 1; when any bit in the fourth data has a value of 0, it means that the value of that bit is not related to the corresponding standard value, so the value corresponding to that bit can be directly determined to be 0, thus achieving accurate and efficient restoration of the fourth data.

[0015] In one possible implementation, converting X third data points into N fourth data points involves transposing the X third data points to obtain N fourth data points. This transposition allows the data points with identical bits among the X third data points to be arranged in a concentrated manner, resulting in accurate and efficient acquisition of the fourth data points.

[0016] In one possible implementation, determining the standard value corresponding to each of the N bits includes: determining the standard value based on the values ​​of X second data. The standard value is determined based on the values ​​of the X second data, ensuring that the standard value conforms to the data characteristics of the X second data, thus enabling accurate quantization of the second data based on the standard value.

[0017] Secondly, a data processing system is provided, comprising a first processing unit and a second processing unit; the first processing unit is configured to perform a first quantization operation on X first data to obtain X second data, each second data including M bits, wherein the second processing unit supports processing M bits of data; the first processing unit is further configured to perform a second quantization operation on the X second data to obtain X third data, each third data including N bits, wherein X is a positive integer greater than or equal to 2, M and N are both arbitrary positive integers, and N is less than M; the first processing unit is further configured to convert the X third data into N fourth data, each fourth data including X bits, wherein the i-th fourth data in the N fourth data is composed of the X i-th bits of the X third data; the second processing unit is configured to acquire the N fourth data and restore the N fourth data to X second data; the second processing unit processes the X second data.

[0018] In one possible implementation, the first processing unit is used to determine the standard value corresponding to each of the N bits; and to determine each of the X third data based on the N standard values ​​and the value of each of the X second data.

[0019] In one possible implementation, N standard values ​​correspond to N bits respectively. The first processing unit is used to decompose the value of each of the X second data into the sum of the standard values ​​corresponding to K bits in the N bits, and set the value of the K bits in the third data to 1, and set the value of the bits other than K bits in the N bits in the third data to 0, where K is a positive integer greater than or equal to 0 and less than or equal to N.

[0020] In one possible implementation, the second processing unit is used to obtain, for N j-th bit data among N fourth data data, the value of the N j-th bit data and the standard value corresponding to each of the N fourth data data, wherein the j-th standard value of each of the N fourth data data is the same as the standard value corresponding to each of the N j-th bit data, and j ranges from 1 to X; and based on the value of the N j-th bit data and the standard value corresponding to each of the N fourth data data, obtain the j-th second data among X second data.

[0021] In one possible implementation, the second processing unit is used to determine the values ​​corresponding to the N j-th bits. When the value of any j-th bit is 1, the value corresponding to any j-th bit is the standard value corresponding to any j-th bit. When the value of any j-th bit is 0, the value corresponding to any j-th bit is 0. The values ​​corresponding to the N j-th bits are added together to obtain the j-th second data.

[0022] In one possible implementation, the second processing unit is used to transpose X third data to obtain N fourth data.

[0023] In one possible implementation, the first processing unit is used to determine a standard value based on the values ​​of X second data.

[0024] Thirdly, a data processing device is provided, which includes the data processing system described in the second aspect and any possible implementation thereof.

[0025] Fourthly, a storage medium is provided, which stores at least one instruction, which is loaded and executed by a data processing system to implement the method in any possible implementation of the first aspect above.

[0026] Fifthly, a program product is provided, comprising a program / instruction, which is executed by a data processing system to enable the data processing system to implement the method in any possible implementation of the first aspect above.

[0027] In a sixth aspect, a chip is provided, including a first processing unit or a second processing unit, for calling and executing instructions stored in a memory, causing a data processing system on which the chip is mounted to execute the method in any possible implementation of the first aspect described above.

[0028] In a seventh aspect, another chip is provided, including: an input interface, an output interface, and a memory, and further including a first processing unit or a second processing unit, the first processing unit or the second processing unit being used to execute code in the memory, and when the code is executed, the data processing system with the chip installed executes the method in any possible implementation of the first aspect above.

[0029] It should be understood that the beneficial effects of the technical solutions and corresponding possible implementations of the second to seventh aspects of this application can be found in the above description of the technical effects of the first aspect and its corresponding possible implementations, and will not be repeated here. Attached Figure Description

[0030] Figure 1 is a schematic diagram of an implementation scenario provided by an embodiment of this application;

[0031] Figure 2 is a flowchart illustrating a data processing method provided in an embodiment of this application;

[0032] Figure 3 is a comparative diagram of an encoding result provided in an embodiment of this application;

[0033] Figure 4 is a schematic diagram of a data recovery process provided in an embodiment of this application;

[0034] Figure 5 is a schematic diagram of a data recovery process provided in an embodiment of this application;

[0035] Figure 6 is a schematic diagram of a data processing process provided in an embodiment of this application;

[0036] Figure 7 is a schematic diagram of another data processing procedure provided in an embodiment of this application;

[0037] Figure 8 is a schematic diagram of the structure of a data processing system provided in an embodiment of this application;

[0038] Figure 9 is a schematic diagram of another data processing system provided in an embodiment of this application. Detailed Implementation

[0039] The terminology used in the implementation section of this application is for the purpose of explaining specific embodiments of this application only, and is not intended to limit this application.

[0040] With the rapid development of big data and artificial intelligence, computing technology has become an important tool in scenarios such as information retrieval, recommendation systems, and question-answering systems. For example, in information retrieval scenarios, when searching for data, the similarity between the data stored in the database and the data being queried can be calculated, allowing for quick and accurate retrieval of the requested data based on the similarity score. In the development of large language models and generative artificial intelligence, data retrieval also plays a crucial role through efficient data processing and information extraction.

[0041] Computing technology requires massive amounts of data as its foundation for rapid development. With the explosive growth of data volume during the development of computing technology, the amount of stored data is increasing. Retrieving data from such vast amounts of data is becoming increasingly difficult. Therefore, in the technical field, it is common practice to quantify the data being queried and the data stored in the database, and then perform retrieval based on the quantified data to improve retrieval efficiency.

[0042] Data quantization refers to representing multi-bit data with fewer bits. The concept of data quantization can be traced back to the 1950s. With the development of computer technology, data quantization has gradually become an important data processing method. As the scale and dimensions of data increase, data quantization has begun to be widely used to improve the efficiency of data storage and retrieval.

[0043] Different types of data occupy different numbers of bits and represent different value ranges. Therefore, during data quantization, the raw data to be stored can be quantized into different types of data with different numbers of bits according to actual business needs. The commonly used quantization bit depth in industry is 8 bits, meaning that multi-bit data of different types is typically quantized into 8-bit data. For example, 32-bit floating-point data can be quantized into 8-bit integer data. Quantization with fewer than 8 bits is called low-bit quantization.

[0044] Data quantization is typically performed by processors, such as graphics processing units (GPUs), neural processing units (NPUs), data processing units (DPUs), or central processing units (CPUs). Among these, the NPU, as a processor specifically designed to accelerate neural network computations, can efficiently perform tensor calculations and matrix operations. Meanwhile, quantization techniques for tensor or vector data types are constantly evolving. By combining quantization with advanced technologies such as graph neural networks, the accuracy and speed of NPU data computation are continuously improving.

[0045] Since most processors are equipped with basic instruction sets that can perform calculations on 4-bit integer data (or int4 type data) or 8-bit integer data (or int8 type data), int4 or int8 type data can be directly calculated on the computing cores of most processors. Therefore, related technologies typically perform int8 quantization or int4 quantization on the data to be stored, and store the int4 or int8 type data in the processor so that the processor can directly perform calculations on the stored quantized data on the computing core, improving computational efficiency. Specifically, int8 quantization refers to converting multiple bits (greater than 8 bits) of data into 8-bit integer data, while int4 quantization refers to converting multiple bits (greater than 4 bits) of data into 4-bit integer data.

[0046] However, int8 or int4 quantization of data is relatively fixed in its degree of quantization and lacks flexibility. For example, certain specific data can be expressed with fewer bits to represent their characteristics. For such specific data, lower bit quantization can be used. Lower bit quantization not only maintains sufficient expressive power of data features even with high data redundancy, but also significantly reduces storage consumption. For instance, a 16-bit data can be expressed with only 2 bits, but related technologies quantize this 16-bit data into 8-bit or 4-bit data, resulting in wasted storage resources when storing the quantized data.

[0047] Therefore, this application provides a data processing method capable of adaptively adjusting the number of quantization bits, which can quantize data of multiple bits into a small number of bits, improving the flexibility of quantization. It can also efficiently restore the quantized data. The data processing method provided by this application can be applied to various scenarios requiring data quantization encoding, such as database scenarios, cloud service scenarios, or large model development scenarios. Referring to Figure 1, a schematic diagram of an implementation scenario provided by this application is shown. This implementation scenario includes a first processing unit 11 and a second processing unit 12, which are connected. The first processing unit 11 and the second processing unit 12 can be any type of processor, a chip core on a processor, or a chip with an integrated processor. The types of the first processing unit 11 and the second processing unit 12 can be the same or different; for example, the first processing unit 11 can be a CPU, and the second processing unit 12 can be an NPU. The first processing unit 11 and the second processing unit 12 can be integrated into a server, which can be an artificial intelligence (AI) server. This server can belong to an AI cluster, which includes multiple servers as shown in Figure 1. The AI ​​cluster can belong to a database scenario, a cloud service scenario, or a large model development scenario. The first processing unit 11 is connected to a first memory, which is used to store the data processed by the first processing unit 11. The second processing unit 12 is connected to a second memory, which is used to store the data processed by the second processing unit 12.

[0048] Referring to Figure 2, a flowchart illustrating a data processing method provided in an embodiment of this application is shown. This method can be executed by various processors in various scenarios requiring data quantization, encoding, and reconstruction. As shown in Figure 2, this data processing method includes, but is not limited to, S101 to S105 as follows.

[0049] S101, the first processing unit performs a first quantization operation on X first data to obtain X second data, each second data including M bits, wherein the second processing unit supports the processing of M bits of data.

[0050] The first data can be data generated during business execution or user input. The first data can be data in structures such as scalars, vectors, or tensors, or a portion of such data. For example, vector data includes multiple elements; in other words, a vector can be viewed as a one-dimensional array containing multiple elements, each of which can be considered a first data element. For instance, a vector V represented as an array is V = [v1, v2, v3], where v1, v2, and v3 are the three elements of vector V, or the three data elements. A first data element can be any one of v1, v2, or v3.

[0051] Optionally, the X first data points can belong to one or more vectors. For example, X = 4, vector K1 = [k11, k12], vector K2 = [k21, k22], and vector K3 = [k31, k32, k33, k34]. If the four first data points are k11, k12, k21, and k22, then the four first data points belong to the vectors K1 and K2. If the four first data points are k31, k32, k33, and k34, then the four first data points belong to the same vector K3. Correspondingly, the X first data points can belong to one or more tensors.

[0052] The first data can be of various types. For example, the first data can be floating-point (FP) data or integer (int) data. Floating-point data can refer to single-precision floating-point data or double-precision floating-point data. The first data includes M bits, where M can be any positive integer, such as 8, 16, 32, or 64. X is a positive integer greater than or equal to 2.

[0053] In this embodiment, the value of the quantized second data belongs to a first value range, which includes H values, where H is 2 to the power of N, and N is the number of bits included in a third data, i.e., the quantization gradient. Taking N=3 bits included in the third data as an example, the value range corresponding to the second data is the decimal [0,7], with a total of 8 values. The method to make the value of the second data belong to the first value range is mapping. Optionally, the first processing unit can first perform a first quantization on the first data and then map the quantized data to obtain the second data, thereby making the value of the second data belong to the first value range.

[0054] For example, in the scenario shown in Figure 1, the first data can be stored in the first memory. This application embodiment does not limit the method by which the first processing unit performs the first quantization on the first data. For example, the quantization of the first data can be achieved using a weighted average method. Taking the first data as an unsigned integer consisting of 16 bits, and M being 8, different weights are assigned to the high 8 bits and low 8 bits of the first data, and then a weighted average is calculated to obtain the quantization result of the first data. For example, if the first data is 1100101001101101, the weight of the high 8 bits is 0.6 and the weight of the low 8 bits is 0.4. Converting the high 8 bits 11001010 to decimal gives 202, and converting the low 8 bits 01101101 to decimal gives 109. The weighted average is calculated as 202*0.6 + 109*0.4, which gives 164.8. Rounding 164.8 to 165 and then converting 165 to an 8-bit binary number gives 10100101, this completes the first quantization of the first data.

[0055] After obtaining the quantization result of the first data, the quantization result of the first data is mapped to obtain the second data. Optionally, the mapping rule includes any of the following: linear function mapping rule; nonlinear function mapping rule; lookup table mapping rule; principal component analysis mapping rule. In the embodiments of this application, the mapping of the fifth data can be achieved through multiple mapping rules, making the mapping more flexible and applicable to various scenarios.

[0056] Taking the mapping rule as a linear function mapping rule as an example, mapping rule B N =f(A N ) can be q = ap + c, where q and B N The mapped data, also known as the second data, consists of p and A. N The first data is the data before mapping, i.e., the quantization result of the first data. 'a' is the mapping coefficient, and 'c' is a constant. The value of 'a' is determined based on the required range of values ​​for the second data (i.e., the first range) and the range of values ​​for the quantization result of the first data.

[0057] For example, if the quantization result of the first data has a value range of [0, 255] and the first value range is [0, 7], then a can be set to 32 and c to 0. If the quantization result of the first data is 165, substituting p = 165 and a = 32 into the mapping rule, the result q is 5.15625. Rounding q, the result is 5, which means the value of the second data corresponding to the first data is 5. Converting 5 to binary representation, we get the second data 00000101, which includes 8 bits.

[0058] The second data obtained by quantizing the first data includes M bits, where M is any positive integer and the second processing unit supports the processing of M bits of data. Therefore, quantizing the first data into the second data facilitates the processing of the second data by the second processing unit.

[0059] S102, the first processing unit performs a second quantization operation on X second data to obtain X third data, each third data including N bits, where X is a positive integer greater than or equal to 2, M and N are both arbitrary positive integers, and N is less than M.

[0060] The number of N can be determined based on the data characteristics of the first data, or it can be defined by the user, or it can be set based on experience. For example, the first processing unit performs a second quantization operation on X second data to obtain X third data, including: determining the standard value corresponding to each bit in the N bits; and determining each third data in the X third data according to the N standard values ​​and the value of each second data in the X second data.

[0061] Optionally, determining the standard value corresponding to each of the N bits includes: determining the standard value based on the values ​​of the X second data. For example, if N = 3, and the values ​​of the X second data are distributed in the range [-3, 3], any value in the range [-3, 3] can be obtained by adding the three values ​​-3, 1, and 2. Therefore, the three standard values ​​can be determined as -3, 1, and 2.

[0062] After determining N standard values, X third data can be determined based on the N standard values ​​and the value of each of the X second data. For example, the N standard values ​​correspond to N bits respectively. For instance, if N = 3, the three standard values ​​are -3, 1, and 2. These three standard values ​​correspond to three bits in the third data to be generated. That is, the first standard value -3 corresponds to the first bit in the third data, the second standard value 1 corresponds to the second bit in the third data, and the third standard value 2 corresponds to the third bit in the third data.

[0063] In this case, each of the X third data is determined based on the N standard values ​​and the value of each of the X second data. This includes: decomposing the value of each of the X second data into the sum of the standard values ​​corresponding to K bits out of N bits, setting the value of the K bits in the third data to 1, and setting the value of the bits other than the K bits out of the N bits in the third data to 0, where K is a positive integer greater than or equal to 0 and less than or equal to N.

[0064] For example, if the value corresponding to any second data is the same as the t-th standard value among N standard values, that is, if K is 1, the value of the t-th bit in the third data corresponding to any second data is determined to be 1, and the values ​​of the other bits in the third data corresponding to any second data except the t-th bit are determined to be 0, where t is greater than or equal to 0 and less than N.

[0065] For example, the value corresponding to the second data is 2, which is the same as the third standard value of 2 defined above. At this time, K=1, t=3, the value of the third bit in the third data corresponding to the second data is determined to be 1, and the values ​​of the first bit and the second bit are determined to be 0. Then the third data is 001.

[0066] Alternatively, if the value corresponding to any second data is the same as the sum of multiple standard values ​​among the N standard values, that is, if K is greater than 1, then the value of the K bits corresponding to the K standard values ​​in the third data corresponding to any second data is determined to be 1, and the value of the other bits in the third data corresponding to any second data except for the bits corresponding to the K standard values ​​is determined to be 0.

[0067] For example, the value corresponding to the second data is -2, which is the sum of the first standard value -3 and the second standard value 1 among the three standard values ​​defined earlier. Then K = 2. The first standard value corresponds to the first bit in the third data, and the second standard value corresponds to the second bit in the third data. So the K bits are the first and second bits in the third data, that is, t = 1, 2. Therefore, the value of the first bit in the third data corresponding to the second data is determined to be 1, the value of the second bit is determined to be 1, and the value of the third bit is determined to be 0. Then the third data is 110.

[0068] Alternatively, if the value corresponding to any second data is 0, that is, if K = 0, then the value of each bit in the third data corresponding to any second data is determined to be 0.

[0069] For example, if the value corresponding to the second data is 0, which is different from any standard value, then the value of each bit in the third data can be determined as 0, and the resulting third data is 000.

[0070] The N standard values ​​provide a stable quantization standard for the second quantization operation, improving the accuracy of quantization. Furthermore, for any second data, it is decomposed into the sum of the standard values ​​corresponding to K bits. This determines that the second data is related to the standard values ​​corresponding to these K bits. Therefore, setting the values ​​of the K bits in the corresponding third data to 1 accurately indicates that the second data is related to the standard values ​​corresponding to these K bits. Bits in the third data that are unrelated to the standard values ​​are set to 0, accurately indicating that these bits in the third data are unrelated to the standard values, thus ensuring accurate reconstruction of the second data.

[0071] S103, the first processing unit converts X third data into N fourth data, each fourth data including X bits, and the i-th fourth data in the N fourth data is composed of X i-th bits of the X third data.

[0072] The process of converting X third data into N fourth data can also be called encoding. During the encoding process, the corresponding bits of each third data are arranged in a set. This encoding method can be regarded as a transpose with bit-level granularity. That is, transposing X third data yields N fourth data.

[0073] The first processing unit aggregates the corresponding bit values ​​of the X third data pieces together, rather than transposing the entire third data structure. Here, the corresponding bits of the X third data pieces refer to the bits with the same order in the X third data pieces. The order of a bit can be its sequence among multiple bits in its corresponding third data piece; this sequence can be from high bit to low bit, or from low bit to high bit. For example, if the sequence is from high bit to the first bit, then the highest bit in the third data piece is the first bit, and the second highest bit adjacent to the highest bit is the second bit.

[0074] The first bit of each of the X third data is a corresponding bit of the X third data, the second bit of each of the X third data is also a corresponding bit of the X third data, and so on.

[0075] The first bit of each of the X third data sets is arranged in a set to obtain the first fourth data set, which includes the first bit of each of the X third data sets. The second bit of each of the X third data sets is arranged in a set to obtain the second fourth data set, which includes the second bit of each of the X third data sets. This process is repeated until the Nth bit of each of the X third data sets is arranged in a set to obtain the Nth fourth data set. By transforming the third data according to the method provided in this application embodiment, an independent bit sequence corresponding to each bit is formed, making information extraction more efficient.

[0076] Referring to Figure 3, a comparative schematic diagram of an encoding result provided by an embodiment of this application is shown. In Figure 3, A1 to AX represent X first data. After performing a first quantization operation on the X first data, X second data are obtained, which are second data B1 to second data BX. Performing a second quantization operation on the second data B1 to second data BX yields third data B1' to third data BX', for a total of X third data. A third data includes N bits, for example, third data B1' includes N bits such as B1'[1], B1'[2], ..., B1'[N], third data B2' includes N bits such as B2'[1], B2'[2], ..., B2'[N], and so on.

[0077] If we follow the traditional encoding method, for any third data, the N bits of the third data are stored in an adjacent order. That is, for the i-th third data, the encoded format is Bi'[1]Bi'[2]…Bi'[N]. However, according to the encoding method provided in the embodiments of this application, the corresponding bits of X third data are arranged in a centralized manner. For example, the first bit B1'[1] of the third data B1', the first bit B2'[1] of the third data B2', …, the first bit BX'[1] of the third data BX' are arranged in a centralized manner to obtain the first fourth data. The format of the first fourth data is B1'[1]B2'[1]…BX'[1]. The first fourth data includes X bits, and the data of the X bits comes from the first bit of the X third data respectively.

[0078] For example, X is 4, and the four third data are third data 1, third data 2, third data 3, and third data 4. N is 3, third data 1 is 111, third data 2 is 001, third data 3 is 010, and third data 4 is 011. Encoding these four third data yields N = 3 fourth data, namely fourth data 1, fourth data 2, and fourth data 3. Fourth data 1 is the first obtained fourth data, comprising the first bit of each of the four third data, and is 1000. Fourth data 2 is the second obtained fourth data, comprising the second bit of each of the four third data, and is 1011. Fourth data 3 is the third obtained fourth data, comprising the third bit of each of the four third data, and is 1101.

[0079] Since the fourth data is derived from the third data, and the third data is quantized based on the second data and the N standard values ​​corresponding to the second data, the second data can be accurately and efficiently recovered through the standard values ​​and the fourth data.

[0080] After encoding X third data points to obtain N fourth data points, these N fourth data points can be stored for subsequent data retrieval, decompression, and other processing. For example, the N fourth data points can be stored according to the bit order of the third data points. The storage order of the i-th fourth data point is 'i'.

[0081] For example, the first fourth data in N fourth data items comprises bits that are the first bits of X third data items, so its storage order is 1. Similarly, the second fourth data item comprises bits that are the second bits of X third data items, so its storage order is 2. Therefore, following the bit order of the third data items, the first fourth data item can be stored first, then the second, with the second data item stored adjacent to the first. Next, the third fourth data item is stored, with the third data item stored adjacent to the second. This process continues until all N fourth data items are stored.

[0082] Storing N fourth data points according to the bit order of the third data points makes the storage of the fourth data points more regular, which facilitates subsequent reading or other processing of the N fourth data points in sequence, thereby improving the processing efficiency of the N fourth data points.

[0083] Alternatively, the N fourth data points can be stored in a different order than the bits in the third data point. For example, the third fourth data point can be stored first, followed by the first, with the first and third data points stored adjacent to each other. Then the fourth data point can be stored next to the first, and so on.

[0084] In this embodiment of the application, the first processing unit may also send the encoded fourth data to other processors. For example, the first processing unit may send N pieces of fourth data to the second processing unit.

[0085] By sending the fourth data to the second processing unit, the second processing unit can efficiently obtain the fourth data without having to process the first data again, thus reducing the consumption of computing and storage resources of the second processing unit.

[0086] The data processing method provided in this application not only enables quantization at any scale—that is, quantizing the first data into a third data of size N bits, achieving intN quantization and making quantization more flexible—but also performs bitwise encoding on the quantized third data, encoding the values ​​of the same bits in different third data together to obtain the fourth data, making the encoding method more flexible.

[0087] S104, the second processing unit acquires N fourth data and restores the N fourth data to X second data.

[0088] The N fourth data points can be generated by the second processing unit, uploaded by the user via an interface, or sent by the first processing unit. Before the second processing unit restores the N fourth data points into X second data points, the N fourth data points can be stored in the memory corresponding to the second processing unit. For example, in the scenario shown in Figure 1, the N fourth data points can be stored in the second memory connected to the second processing unit. The second processing unit restores the N fourth data points into X second data points by: for the N j-th bit data points in the N fourth data points, obtaining the value of the N j-th bit data points and the standard value corresponding to each fourth data point in the N fourth data points, where the j-th standard value of each fourth data point in the N fourth data points is the same as the standard value corresponding to each j-th bit in the N j-th bit data points, and j ranges from 1 to X; and obtaining the j-th second data point in the X second data points based on the value of the N j-th bit data points and the standard value corresponding to each fourth data point in the N fourth data points.

[0089] The following steps 11 to 12 will explain the process of restoring N fourth data points to X second data points.

[0090] Step 11: Determine the values ​​corresponding to the j-th bits of the N bits.

[0091] The value of any bit in any fourth data element can be either 1 or 0. The method for determining the value of any j-th bit differs depending on the two cases. For example, cases 111 and 112 can be used to determine the value of any j-th bit.

[0092] Case 111: When the value of any j-th bit is 1, the value corresponding to any j-th bit is the standard value corresponding to any j-th bit.

[0093] If the value of the j-th bit of any fourth data is 1, then the standard value corresponding to the j-th bit of that fourth data can be selected from among the standard values ​​corresponding to the j-th bit of the N fourth data. For example, if the j-th bit of the N fourth data corresponds to N standard values, the standard value corresponding to the j-th bit of the first fourth data is the first standard value among the N standard values ​​corresponding to the j-th bit of the N fourth data.

[0094] For example, if N is 3, and the three fourth data are fourth data 1, fourth data 2, and fourth data 3, and the three standard values ​​corresponding to the first bit of each of the three fourth data are standard value 11, standard value 12, and standard value 13, respectively, then the standard value corresponding to the first bit of fourth data 1 is standard value 11, the standard value corresponding to the first bit of fourth data 2 is standard value 21, and the standard value corresponding to the first bit of fourth data 3 is standard value 31. Therefore, the standard value obtained for the first bit of fourth data 2 is standard value 21.

[0095] Optionally, the X standard values ​​corresponding to the X bits of a fourth data point can be stored in a reference vector, where each element of the reference vector is a standard value corresponding to a bit of the fourth data point. For example, if X is 4 and N is 3, then 3 fourth data points correspond to 3 reference vectors. The first fourth data point corresponds to the first reference vector, which includes X = 4 standard values. The first standard value in the first reference vector is the standard value corresponding to the first bit of the first fourth data point; the second standard value in the first reference vector is the standard value corresponding to the second bit of the first fourth data point; the third standard value in the first reference vector is the standard value corresponding to the third bit of the first fourth data point; and the fourth standard value in the first reference vector is the standard value corresponding to the fourth bit of the first fourth data point.

[0096] If the value of the first bit of the fourth data 2 is 1, then in the reference vector 2 corresponding to the fourth data 2, the first standard value in the reference vector 2 corresponding to the first bit of the fourth data 2 is determined, and the first standard value in the reference vector 2 is taken as the value corresponding to the first bit of the fourth data 2.

[0097] Case 112: If the value of any j-th bit is 0, then the value corresponding to any j-th bit is 0.

[0098] If the value of any j-th bit is 0, it means that there is no reference standard value when quantizing the data of that bit, so the value of the j-th bit can be directly determined as 0.

[0099] Assumptions: The number of N is 3, and the three fourth data are fourth data 1, fourth data 2 and fourth data 3 respectively. The number of X is 4, that is, one fourth data includes 4 bits. See Figure 4, which shows a schematic diagram of a data recovery process provided by an embodiment of this application. As shown in Figure 4, during the recovery process for the first fourth data, the value of the first bit B1'[1] of the first fourth data is 0, so the value corresponding to the first bit of the first fourth data is 0. The value of the second bit B2'[1] of the first fourth data is 0, so the value corresponding to the second bit of the first fourth data is 0. The value of the third bit B3'[1] of the first fourth data is 1, and the value corresponding to the third bit of the first fourth data is the standard value 3 in the first reference vector. The value of the fourth bit B4'[1] of the first fourth data is 1, and the value corresponding to the fourth bit of the first fourth data is the standard value 4.

[0100] Step 12: Add the values ​​corresponding to the j-th bits of the N data to obtain the j-th second data.

[0101] For example, if j = 1, add the values ​​corresponding to the first bit of N fourth data to get the first second data. For example, if N is 3, add the values ​​corresponding to the first bit of the first fourth data, the first bit of the second fourth data, and the first bit of the third fourth data to get the first second data.

[0102] Referring to Figure 5, a schematic diagram of a data recovery process provided by an embodiment of this application is shown. The process shown in Figure 5 involves data recovery of N fourth data points. Each fourth data point includes X bits. For example, the first fourth data point includes B1'[1], B2'[1], ..., BN'[1]. In Figure 5, Bj'[i] represents the j-th bit of the i-th fourth data point.

[0103] By selecting the values ​​corresponding to each bit in the first fourth data, we obtain the values ​​corresponding to each bit in the first fourth data as values ​​B1”[1], B2”[1], ..., BX”[1]. In Figure 5, B”j[i] represents the value corresponding to the j-th bit of the i-th fourth data. In a similar manner, we select the values ​​corresponding to each bit in the remaining fourth data to obtain N*X values.

[0104] In N*X values, the values ​​corresponding to the j-th bit of each fourth data are added together to obtain the j-th second data Bj. In Figure 5, the values ​​corresponding to the first bit of the first fourth data B1”[1], the values ​​corresponding to the first bit of the second fourth data B1”[2], ..., the values ​​corresponding to the first bit of the Nth fourth data B1”[N] are added together to obtain the second data B1. Based on a similar process, the second data B2 to the second data BX are obtained by adding together, thus completing the recovery of X second data.

[0105] In this embodiment, the first data corresponding to the X restored second data can belong to one or more vectors, or the first data corresponding to the X second data can also belong to one or more tensors. Taking the first data corresponding to the X second data as belonging to a tensor as an example, the pseudocode executed by the second processing unit during the data recovery process is as follows:

[0106] S105, the second processing unit processes X second data.

[0107] Since the second data is obtained by performing the first quantization operation on the first data, after recovering X second data based on N fourth data, it is also necessary to restore the X second data to X first data.

[0108] For example, if the second data is obtained by mapping the quantization result of the first data, then the second data can be demapped to restore the quantization result of the first data, and then the quantization result of the first data can be dequantized to obtain the first data. For example, if the range of the second data is [0,7], and the second data is obtained by mapping the quantization result of the first data through a linear function mapping rule, the second data includes 8 bits. The quantization result of the first data has the same number of bits as the second data, so the range of the quantization result of the first data is 0 to 2^8, that is, [0,255]. Then, a linear function for inverse mapping can be constructed, p = bq + d, where p is the quantization result of the first data, q is the second data, b is the inverse mapping coefficient, and d is a constant. The inverse mapping coefficient b is the reciprocal of the mapping coefficient a mentioned above. For example, if a is 32, then b is 1 / 32. The constant d is the opposite of the constant c. For example, if the constant c is 1, then the constant d is -1. Then, the second processing unit can dequantize the quantization result of the first data back into the first data by performing the inverse operation of the first quantization operation.

[0109] Referring to Figure 6, a schematic diagram of a data processing procedure provided in an embodiment of this application is shown. As shown in Figure 6, the first processing unit performs a first quantization operation on the input first data A1 to first data AX to obtain second data B1 to second data BX. After obtaining X second data, a second quantization operation is performed on the X second data to obtain X third data, and the X third data are converted according to the conversion method in S103 above to obtain N fourth data.

[0110] The first processing unit sends N fourth data points to the second processing unit. The second processing unit decodes the N fourth data points according to the method in S104 to obtain X second data points. Then, the second processing unit dequantizes the second data points B1 to BX to obtain first data points A1 to AX. After obtaining the first data points, the second processing unit can perform subsequent calculations, such as distance calculations, to determine data similar to the user's query based on the calculated distances, thus achieving data retrieval.

[0111] Referring to Figure 7, a schematic diagram of a data processing procedure provided in an embodiment of this application is shown. The user inputs X = 4 first data values ​​to the first processing unit, namely A1 = -13.9, A2 = 1.0, A3 = 0.0, and A4 = 4.9. The values ​​of the first data A1 to A4 are their decimal representations. In fact, the first data A1 to A4 are floating-point data comprising 32 bits. For example, the binary representation of the first data A1 is 110000010101111001100110011001100110.

[0112] The first processing unit performs a first quantization operation on the four first data points to obtain four second data points: second data B1 = -3, second data B2 = 1, second data B3 = 0, and second data B4 = 2. The values ​​of second data B1 to second data B4 are their decimal representations. In fact, second data B1 to second data B4 are integer data consisting of 8 bits. For example, the binary representation of second data B1 is 11111101.

[0113] The four second data points are quantized and encoded, which means performing a second quantization operation and a conversion operation on the four second data points to obtain N=3 fourth data points. For example, the first fourth data point includes B1'[1]=1, B2'[1]=0, B3'[1]=0 and B4'[1]=0. The second fourth data point includes B1'[2]=0, B2'[2]=1, B3'[2]=0 and B4'[2]=0. The third fourth data point includes B1'[3]=0, B2'[3]=0, B3'[3]=0 and B4'[3]=1.

[0114] In the process of data recovery for the fourth data, a reference vector is used, consisting of X = 4 standard values. Each of the 4 standard values ​​in the reference vector corresponds to one of the 4 bits in the fourth data. The 4 standard values ​​in the first reference vector are all integers with 8 bits, corresponding to the decimal number -3, and are respectively associated with the 4 bits in the first fourth data. The 4 standard values ​​in the second reference vector are all integers with 8 bits, corresponding to the decimal number 1, and are respectively associated with the 4 bits in the second fourth data. The 4 standard values ​​in the third reference vector are all integers with 8 bits, corresponding to the decimal number 2, and are respectively associated with the 4 bits in the third fourth data.

[0115] Taking the data recovery of the first fourth data as an example, if the value of the first bit of the first fourth data is 1, then the first standard value in the first reference vector is determined as the value corresponding to the first bit of the first fourth data, that is, B1”[1]=-3. If the value of the second bit of the first fourth data is 0, then the value corresponding to the second bit of the first fourth data is determined as 0, that is, B2”[1]=0. If the value of the third bit of the first fourth data is 0, then the value corresponding to the third bit of the first fourth data is determined as 0, that is, B3”[1]=0. If the value of the fourth bit of the first fourth data is 0, then the value corresponding to the fourth bit of the first fourth data is determined as 0, that is, B4”[1]=0.

[0116] Following a similar method, the decoding of the three fourth data points is completed, resulting in 3*4=12 values. Then, based on these values, the various second data points are restored. Taking the restored first second data point as an example, the value B1”[1] corresponding to the first bit of the first fourth data point is -3, the value B1”[2] corresponding to the first bit of the second fourth data point is 0, and the value B1”[3] corresponding to the first bit of the third fourth data point is 0. Adding these three values ​​together, we get the second data point B1=-3.

[0117] See Table 1 below, which shows the mapping relationship between the values ​​of each bit of the fourth data and the values ​​of the restored second data.

[0118] Table 1

[0119] In Table 1, the first row (-3, 1, 2) represents the standard values ​​corresponding to the three bits of any fourth data. The first column (-3, -2, -1, 0, 1, 2, 3) represents the value of the second data obtained by restoring the values ​​of the bits in the fourth data in the corresponding row. For example, in Table 1, the value in the second row and second column is the value of the first bit of the first fourth data (1), which corresponds to the value of -3. The value in the second row and third column is the value of the first bit of the second fourth data (0), which corresponds to the value of 0. The value in the second row and fourth column is the value of the first bit of the third fourth data (0), which corresponds to the value of 0. Adding these three values ​​together gives the second data -3 represented in the second row and first column.

[0120] After obtaining each second data point, data recovery is performed on the second data points to obtain the first data points. For example, data recovery is performed on the second data point B1 in Figure 7 to obtain the corresponding first data point A1 = -13.9; data recovery is performed on the second data point B2 to obtain the corresponding first data point A2 = 1.0; data recovery is performed on the second data point B3 to obtain the corresponding first data point A3 = 0.0; and data recovery is performed on the second data point B4 to obtain the corresponding first data point A4 = 4.9.

[0121] In summary, in this embodiment, the first processing unit quantizes the data into a format supported by the second processing unit through a first quantization operation, and then quantizes the data after the first quantization operation into data of any format through a second quantization operation. After the second processing unit obtains the data after the second quantization operation, it dequantizes the data of any format into a format supported by the second processing unit. In this way, the data can be further quantized into data with fewer bits after the first quantization, which not only saves memory space but also saves bandwidth for data transmission between the first and second processing units. When the second processing unit processes the data, it restores the data to a format supported by the second processing unit, thereby realizing the quantization of data of any format without changing the data format supported by the second processing unit, thus improving system performance.

[0122] In an exemplary embodiment, a data processing system is provided, as shown in FIG1. ​​The data processing system includes a first processing unit 11 and a second processing unit 12.

[0123] The first processing unit 11 is used to perform a first quantization operation on X first data to obtain X second data, each second data including M bits, wherein the second processing unit 12 supports the processing of M bits of data;

[0124] The first processing unit 11 is also used to perform a second quantization operation on X second data to obtain X third data, each third data including N bits, where X is a positive integer greater than or equal to 2, M and N are both arbitrary positive integers, and N is less than M;

[0125] The first processing unit 11 is also used to convert X third data into N fourth data, each fourth data including X bits, and the i-th fourth data in the N fourth data is composed of X i-th bits of the X third data;

[0126] The second processing unit 12 is used to acquire N fourth data and restore the N fourth data to X second data.

[0127] The second processing unit 12 processes the X second data.

[0128] In one possible implementation, the first processing unit 11 is used to determine the standard value corresponding to each bit in the N bits; and to determine each third data in the X third data based on the N standard values ​​and the value of each second data in the X second data.

[0129] In one possible implementation, N standard values ​​correspond to N bits respectively. The first processing unit 11 is used to decompose the value of each of the X second data into the sum of the standard values ​​corresponding to K bits in the N bits, set the value of the K bits in the third data to 1, and set the value of the bits other than the K bits in the N bits in the third data to 0, where K is a positive integer greater than or equal to 0 and less than or equal to N.

[0130] In one possible implementation, the second processing unit 12 is used to obtain the value of the N j-th bit of the N fourth data and the standard value corresponding to each of the N fourth data, where the j-th standard value of each of the N fourth data is the same as the standard value corresponding to each of the N j-th bits, and j ranges from 1 to X; and to obtain the j-th second data among the X second data based on the value of the N j-th bit and the standard value corresponding to each of the N fourth data.

[0131] In one possible implementation, the second processing unit 12 is used to determine the values ​​corresponding to the N j-th bits. When the value of any j-th bit is 1, the value corresponding to any j-th bit is the standard value corresponding to any j-th bit. When the value of any j-th bit is 0, the value corresponding to any j-th bit is 0. The values ​​corresponding to the N j-th bits are added together to obtain the j-th second data.

[0132] In one possible implementation, the second processing unit 12 is used to transpose X third data to obtain N fourth data.

[0133] In one possible implementation, the first processing unit 11 is used to determine a standard value based on the values ​​of X second data.

[0134] It should be understood that the beneficial effects of the first processing unit 11 provided in Figure 1 when implementing its function are the same as those of the data processing method provided in Figure 2. The first processing unit 11 and the first processing unit in the data processing method embodiment belong to the same concept, and their specific implementation process is detailed in the method embodiment, which will not be repeated here. Correspondingly, the beneficial effects of the second processing unit 12 provided in Figure 1 when implementing its function are the same as those of the data processing method provided in Figure 2. The second processing unit 12 and the second processing unit in the data processing method embodiment belong to the same concept, and their specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0135] Referring to Figure 8, a schematic diagram of a data processing system provided in an embodiment of this application is shown. The first processing unit in the data processing system is a host-side processing unit, such as a CPU. The first processing unit stores high-order data, i.e., first data, in the host-side memory. The second processing unit is, for example, an NPU. The NPU stores fourth data in its memory and can move the fourth data into the AI ​​Core, allowing the matrix (Cube) calculation unit or vector calculation unit in the AI ​​Core to perform data recovery on the fourth data. During the data recovery process, the Select and Add interfaces are used to reverse-convert the low-order data into floating-point numbers or integers for subsequent operations such as distance calculation.

[0136] Referring to Figure 9, a schematic diagram of another data processing system provided in an embodiment of this application is shown. The first processing unit is the CPU on the host side, and the second processing unit is the NPU on the device side. The global memory in the second processing unit refers to the external storage accessible to the AI ​​Core, and the data processed is a global tensor. The NPU local memory refers to the internal storage where calculations are directly performed within the AI ​​Core, and the data processed is a local tensor. The Cube calculation unit is used for matrix calculations, and the Vector calculation unit is used for vector calculations.

[0137] On the host side, the first processing unit quantizes and transforms the base vector (i.e., the first data) according to business requirements using the method provided earlier, obtaining the fourth data, and then moves the fourth data into the Global Memory of the second processing unit. The second processing unit then moves the fourth data from the Global Memory into its Local Memory. Since the space in the Local Memory directly used for computation in the second processing unit is limited, the fourth data needs to be moved from the Global Memory to the Local Memory in multiple batches. Using the Vector computation unit in AI Core, the Select and Add interfaces are used to recover the fourth data, obtaining floating-point or integer data that the second processing unit can process subsequently, i.e., the first data. The Cube computation unit in AI Core is then used for subsequent processing (e.g., distance calculation), and the distance result is moved to the first processing unit on the host side. The above steps are repeated until all batches of data in the Global Memory have been moved and the computation is complete.

[0138] In dedicated hardware such as NPUs, direct computation of int4 and lower-dimensional data is not yet effectively supported. Most NPU designs in related technologies are mainly designed for int8 and higher-bit data processing, and cannot perform low-bit computations. This makes it very challenging to apply variable-bit quantization (such as int3 / int2) to practical vector computing systems on NPUs. The embodiments of this application realize variable-bit quantization through specific encoding and decoding methods, enabling lower-bit data processing and improving the flexibility of quantization.

[0139] In an exemplary embodiment, a program (product) is provided, the program (product) including: program code, which, when run by a data processing system, causes the data processing system to perform the method in FIG2.

[0140] In an exemplary embodiment, a storage medium is provided that stores a program or instruction, which, when executed on a data processing system, causes a computer to perform the method described in FIG2.

[0141] In an exemplary embodiment, a chip is provided, including a first processing unit or a second processing unit, for calling and executing instructions stored in a memory, causing a data processing system on which the chip is mounted to perform the method in FIG2.

[0142] In an exemplary embodiment, another chip is provided, including an input interface, an output interface, and a memory. The chip also includes a first processing unit or a second processing unit. The input interface, the output interface, the first processing unit, or the second processing unit is used to execute code in the memory. When the code is executed, the data processing system with the chip installed performs the method in FIG2.

[0143] In this application, the terms "first," "second," etc., are used to distinguish identical or similar items with substantially the same function. It should be understood that there is no logical or temporal dependency between "first," "second," and "nth," nor does it limit the quantity or order of execution. It should also be understood that although the following description uses the terms "first," "second," etc., to describe various elements, these elements should not be limited by the terms. These terms are merely used to distinguish one element from another.

[0144] It should also be understood that, in the various embodiments of this application, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0145] In this application, the term "at least one" means one or more, and the term "multiple" means two or more. For example, multiple second devices means two or more second devices. The terms "system" and "network" are often used interchangeably herein.

[0146] It should be understood that the terminology used in the description of the various examples herein is for the purpose of describing particular examples only and is not intended to be limiting. As used in the description of the various examples and the appended claims, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise.

[0147] It should also be understood that the term "and / or" as used herein refers to and covers any and all possible combinations of one or more of the associated listed items. The term "and / or" describes an association between related objects, indicating that three relationships can exist; for example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / " in this application generally indicates that the preceding and following related objects are in an "or" relationship.

[0148] It should also be understood that the terms “if” and “if” can be interpreted as meaning “when” or “upon”, or “in response to determination” or “in response to detection”. Similarly, depending on the context, the phrases “if determination…” or “if detection [the stated condition or event]” can be interpreted as meaning “when determination…”, or “in response to determination…”, or “when detection [the stated condition or event]” or “in response to detection [the stated condition or event]”.

[0149] The above description is merely an embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.

Claims

1. A data processing method, characterized in that, The method includes: The first processing unit performs a first quantization operation on X first data to obtain X second data, each second data including M bits, wherein the second processing unit supports the processing of M bits of data; The first processing unit performs a second quantization operation on the X second data to obtain X third data, each third data including N bits, wherein X is a positive integer greater than or equal to 2, M and N are both arbitrary positive integers, and N is less than M; The first processing unit converts the X third data into N fourth data, each fourth data including X bits, and the i-th fourth data in the N fourth data is composed of the X i-th bits of the X third data; The second processing unit acquires the N fourth data points and restores the N fourth data points to the X second data points; The second processing unit processes the X second data.

2. The method according to claim 1, characterized in that, The first processing unit performs a second quantization operation on the X second data to obtain X third data, including: Determine the standard value corresponding to each of the N bits; Each of the X third data is determined based on the N standard values ​​and the value of each of the X second data.

3. The method according to claim 2, characterized in that, The N standard values ​​correspond to the N bits respectively. Determining each of the X third data based on the N standard values ​​and the value of each of the X second data includes: The value of each of the X second data is decomposed into the sum of the standard values ​​corresponding to K bits in the N bits, and the values ​​of the K bits in the third data are set to 1, and the values ​​of the bits other than the K bits in the N bits of the third data are set to 0, where K is a positive integer greater than or equal to 0 and less than or equal to N.

4. The method according to claim 2 or 3, characterized in that, The step of restoring the N fourth data points to the X second data points includes: For the N j-th bit data in the N fourth data, obtain the value of the N j-th bit data and the standard value corresponding to each fourth data in the N fourth data. The j-th standard value of each fourth data in the N fourth data is the same as the standard value corresponding to each j-th bit in the N j-th bit, where j ranges from 1 to X. Based on the values ​​of the N j-th bits and the standard values ​​corresponding to each of the N fourth data, the j-th second data is obtained from the X second data.

5. The method according to claim 4, characterized in that, The step of obtaining the j-th second data among the X second data based on the values ​​of the N j-th bits and the standard value corresponding to each of the N fourth data includes: Determine the value corresponding to the N j-th bit. When the value of any j-th bit is 1, the value corresponding to any j-th bit is the standard value corresponding to any j-th bit. When the value of any j-th bit is 0, the value corresponding to any j-th bit is 0. The values ​​corresponding to the j-th bits of the N bits are added together to obtain the j-th second data.

6. The method according to any one of claims 2 to 5, characterized in that, Determining the standard value corresponding to each of the N bits includes: The standard value is determined based on the values ​​of the X second data.

7. The method according to any one of claims 1 to 6, characterized in that, The process of converting the X third data points into N fourth data points includes: The X third data are transposed to obtain the N fourth data.

8. A data processing system, characterized in that, The system includes a first processing unit and a second processing unit; The first processing unit is used to perform a first quantization operation on X first data to obtain X second data, each second data including M bits, wherein the second processing unit supports the processing of M bit data; The first processing unit is further configured to perform a second quantization operation on the X second data to obtain X third data, each third data including N bits, wherein X is a positive integer greater than or equal to 2, M and N are both arbitrary positive integers, and N is less than M; The first processing unit is further configured to convert the X third data into N fourth data, each fourth data including X bits, wherein the i-th fourth data in the N fourth data is composed of the X i-th bits of the X third data; The second processing unit is used to acquire the N fourth data and restore the N fourth data to the X second data; The second processing unit processes the X second data.

9. The data processing system according to claim 8, characterized in that, The first processing unit is configured to determine the standard value corresponding to each of the N bits; and to determine each of the X third data based on the N standard values ​​and the value of each of the X second data.

10. The data processing system according to claim 9, characterized in that, The N standard values ​​correspond to the N bits respectively. The first processing unit is used to decompose the value of each of the X second data into the sum of the standard values ​​corresponding to K bits in the N bits, set the value of the K bits in the third data to 1, and set the value of the bits other than the K bits in the N bits in the third data to 0, where K is a positive integer greater than or equal to 0 and less than or equal to N.

11. The data processing system according to claim 9 or 10, characterized in that, The second processing unit is configured to, for the N j-th bit data among the N fourth data data, obtain the value of the N j-th bit data and the standard value corresponding to each of the N fourth data data, wherein the j-th standard value of each of the N fourth data data is the same as the standard value corresponding to each of the N j-th bit data, where j ranges from 1 to X; and obtain the j-th second data among the X second data based on the value of the N j-th bit data and the standard value corresponding to each of the N fourth data data.

12. The data processing system according to claim 11, characterized in that, The second processing unit is used to determine the value corresponding to the N j-th bits. When the value of any j-th bit is 1, the value corresponding to any j-th bit is the standard value corresponding to any j-th bit. When the value of any j-th bit is 0, the value corresponding to any j-th bit is 0. The values ​​corresponding to the N j-th bits are added together to obtain the j-th second data.

13. The data processing system according to any one of claims 9 to 12, characterized in that, The first processing unit is used to determine the standard value based on the values ​​of the X second data.

14. The data processing system according to any one of claims 8 to 13, characterized in that, The second processing unit is used to transpose the X third data to obtain the N fourth data.

15. A storage medium, characterized in that, The storage medium stores at least one instruction, which is loaded and executed by the data processing system to implement the data processing method as described in any one of claims 1-7.

16. A program product, characterized in that, The program product includes a program / instruction that is executed by a data processing system to implement the data processing method according to any one of claims 1-7.