Quantization data processing method, architecture, system and chip
By converting input variable values into relative quantum values within the target operation interval and querying them in the target function value set, the problem of increased data processing calculation time and energy consumption is solved, and efficient data processing is achieved.
Patent Information
- Application Number
- CN202411264406.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2024-10-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
With the widespread application of artificial intelligence and big data technology, the calculation time and energy consumption of data processing continue to increase, and it is difficult to effectively reduce it with existing technologies.
By converting the input variable value into a relative quantum value within the target operation interval, and obtaining the objective function value corresponding to the relative quantum value in the stored objective function value set, using discrete integer values for processing, avoiding real-time repeated calculations and reducing calculation time energy consumption.
It significantly reduces the calculation time and energy consumption of data processing, improves the efficiency of data processing, and quickly obtains the required results through the processing of discrete integer values and a pre-calculated set of objective function values.
Smart Images

Figure CN118798375A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of computer technology, and in particular to a quantized data processing method, architecture, system and chip. Background Art
[0002] As technologies such as artificial intelligence and big data are widely used in various fields, the calculations required for data processing are increasing, the time is getting longer and the energy consumption is getting higher.
[0003] Therefore, how to reduce the computation, time and energy consumption of data processing remains to be solved by those skilled in the art. Summary of the invention
[0004] In view of this, the embodiments of the present disclosure provide a quantized data processing method, architecture, system and chip, which can significantly reduce the calculation, time and energy consumption of data processing.
[0005] First, the present disclosure provides a quantized data processing method, including: Converting the input variable value into a relative quantum value within a target operation interval, wherein the relative quantum value is a discrete integer value; Obtaining and obtaining, according to the objective function of the input variable value, an objective function value corresponding to the relative quantum value in a stored objective function value set, wherein the stored objective function value set is a set of objective function values corresponding to each relative quantum value within the target operation interval; Based on the objective function value corresponding to the relative quantum value, the objective function value corresponding to the input variable value is obtained.
[0006] Optionally, converting the input variable value into a relative quantum value within a target operation interval includes: Acquire a mapping relationship between the input variable value and the relative quantum value; The input variable value is converted into a relative quantum value within a target operation interval based on the mapping relationship.
[0007] Optionally, the mapping relationship between the input variable value and the relative quantum value includes: The input variable value corresponds to the product of the first proportional quantum value and the relative quantum value.
[0008] Optionally, the mapping relationship between the input variable value and the relative quantum value includes: The input variable value corresponds to the product of the second proportional quantum value and the difference between the relative quantum value and the zero shift point.
[0009] Optionally, the first proportional quantum value includes at least one of the following: Exponential function value; Preset exponent value; Logarithmic function value.
[0010] Optionally, the second proportional quantum value includes at least one of the following: Exponential function value; Preset exponent value; Logarithmic function value.
[0011] Optionally, the target operation interval includes: an integer value operation interval; When the input variable value is converted into a relative quantum value within the target operation interval, the relative quantum value is determined by any of the following methods: Round up; Round down; Randomly choose to round up or round down.
[0012] Optionally, when the objective function has multiple input variable values, obtaining the objective function value corresponding to the input variable value based on the objective function value corresponding to the relative quantum value includes: Aligning the relative quantum values corresponding to the input variable values so that the relative quantum values corresponding to the input variable values have the same proportional quantum values; Based on the objective function values corresponding to the aligned plurality of relative quantum values, objective function values corresponding to the plurality of input variable values are obtained.
[0013] Optionally, the stored objective function value set includes at least one of the following: A set of objective function values directly corresponding to each relative quantum value in the target operation interval; The set of objective function values indirectly corresponding to the relative quantum values within the target operation interval.
[0014] Optionally, the objective function value indirectly corresponding to each relative quantum value refers to the objective function value after a preset process is performed on the objective function value directly corresponding to each relative quantum value.
[0015] Optionally, converting the input variable value into a relative quantum value within a target operation interval includes: grouping the input variable values based on characteristics of the input variable values; The input variable values of each group are converted into relative quantum values within the target operation interval corresponding to each group.
[0016] Optionally, the grouping of the input variable values based on the characteristics of the input variable values includes any one of the following: Grouping the input variable values based on the distribution range of the input variable values; The input variable values are grouped based on the distribution density of the input variable values.
[0017] The present disclosure also provides a quantized data processing architecture, including: A first data converter, adapted to convert an input variable value into a relative quantum value within a target operation interval, wherein the relative quantum value is a discrete integer value; A query device, adapted to obtain and obtain, according to the objective function of the input variable value, an objective function value corresponding to the relative quantum value from a stored objective function value set, wherein the stored objective function value set is a set of objective function values corresponding to each relative quantum value within the target operation interval; The second data converter is adapted to obtain the objective function value corresponding to the input variable value based on the objective function value corresponding to the relative quantum value.
[0018] Optionally, the first data converter is adapted to obtain a mapping relationship between the input variable value and the relative quantum value; and convert the input variable value into a relative quantum value within a target operation interval based on the mapping relationship.
[0019] Optionally, the first data converter is adapted to convert the input variable value into a relative quantum value within a target operation interval based on a mapping relationship between the input variable value and the product of the first proportional quantum value and the relative quantum value.
[0020] Optionally, the first data converter is adapted to convert the input variable value into a relative quantum value within a target operation interval based on a mapping relationship between the input variable value and the product of the second proportional quantum value and the difference between the relative quantum value and the zero shift point.
[0021] Optionally, the first proportional quantum value includes at least one of the following: Exponential function value; Preset exponent value; Logarithmic function value.
[0022] Optionally, the second proportional quantum value includes at least one of the following: Exponential function value; Preset exponent value; Logarithmic function value.
[0023] Optionally, the target operation interval includes: an integer value operation interval; The first data converter, when converting the input variable value into a relative quantum value within a target operation interval, is adapted to determine the relative quantum value in any of the following ways: Round up; Round down; Randomly choose to round up or round down.
[0024] Optionally, the architecture further comprises: an internal memory adapted to store the objective function value set, wherein the objective function value set comprises at least one of the following: A set of objective function values directly corresponding to each relative quantum value in the target operation interval; A set of objective function values indirectly corresponding to each relative quantum value within the target operation interval; The objective function value indirectly corresponding to each relative quantum value refers to the objective function value after a preset process is performed on the objective function value directly corresponding to each relative quantum value.
[0025] Optionally, the architecture further comprises: an external memory, adapted to store the objective function value set, wherein the objective function value set comprises at least one of the following: A set of objective function values directly corresponding to each relative quantum value in the target operation interval; A set of objective function values indirectly corresponding to each relative quantum value within the target operation interval; The objective function value indirectly corresponding to each relative quantum value refers to the objective function value after a preset process is performed on the objective function value directly corresponding to each relative quantum value.
[0026] Optionally, the query device includes: an instruction decoder adapted to decode the received query instruction to obtain data processing information; At least one address decoder is adapted to obtain, based on the data processing information decoded by the instruction decoder, an objective function value corresponding to the relative quantum value in a stored objective function value set.
[0027] Optionally, the at least one address decoder is a plurality of address decoders, adapted to respectively obtain objective function values corresponding to a plurality of relative quantum values in a stored objective function value set based on data processing information decoded by the instruction decoder.
[0028] Optionally, the query instruction includes the following information: Objective function label information; Enter variable value information; The storage address information of the objective function value corresponding to the input variable value.
[0029] Optionally, the query instruction includes the following information: Objective function label information; Enter variable address information; The storage address information of the objective function value corresponding to the input variable value.
[0030] Optionally, the query device further includes: The address converter is adapted to convert a multi-dimensional storage address into a one-dimensional storage address.
[0031] Optionally, the query device further includes: The data buffer is adapted to store the target function value corresponding to the relative quantum value obtained by the address decoder.
[0032] Optionally, the architecture further includes: The proportional aligner is adapted to align the relative quantum values corresponding to the input variable values so that the relative quantum values corresponding to the input variable values have the same proportional quantum values.
[0033] Optionally, the second data converter includes: A proportional regulator is adapted to adjust the output value ratio of the objective function value corresponding to the relative quantum value.
[0034] Optionally, the architecture further includes: A data updater, adapted to update a stored set of objective function values.
[0035] Optionally, the data updater is suitable for dynamically updating the stored objective function value set.
[0036] Optionally, the architecture further includes: The processor is adapted to obtain a set of objective function values corresponding to each relative quantum value within a target operation interval.
[0037] The present disclosure also provides a quantized data processing system, including: Interactive interface; a processor, coupled to the interactive interface; The quantized data processing architecture described in any of the above embodiments is coupled to the interactive interface and is communicatively coupled to the processor via the interactive interface; and is suitable for executing the quantized data processing method described in any of the above embodiments.
[0038] The present disclosure also provides a quantized data processing system, including: Interactive interface; A plurality of processors are respectively coupled to the interaction interfaces; Multiple quantized data processing architectures described in any of the above embodiments are respectively coupled to the interactive interface, and each quantized data processing architecture is communicatively coupled to the corresponding processor through the interactive interface; and are suitable for executing the quantized data processing method described in any of the above embodiments.
[0039] The present disclosure also provides a chip, including: The quantized data processing architecture described in any of the above embodiments.
[0040] By adopting the quantized data processing method provided by the embodiment of the present disclosure, by converting the input variable value into a relative quantum value within the target operation interval, and obtaining and obtaining the target function of the input variable value, the target function value corresponding to the relative quantum value is obtained in the stored target function value set, and then based on the target function value corresponding to the relative quantum value, the target function value corresponding to the input variable value can be quickly obtained. On the one hand, since the relative quantum value is a discrete integer value, it is very easy to process; on the other hand, since the target function value corresponding to each relative quantum value within the target operation interval has been stored, the target function value corresponding to the relative quantum value can be quickly obtained in the target function value set, so the time and energy consumption for obtaining the target function value corresponding to the input variable value can be significantly reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0042] Figure 1 A schematic diagram showing the steps of a quantized data processing method in some embodiments of the present disclosure is shown; Figure 2 A schematic diagram of a step of converting an input variable value into a relative quantum value within a target operation interval in some embodiments of the present disclosure is shown; Figure 3 A schematic diagram of a step of obtaining an objective function value corresponding to an input variable value in some embodiments of the present disclosure is shown; Figure 4 Another schematic diagram of converting input variable values into relative quantum values within a target operation interval in some embodiments of the present disclosure is shown; Figure 5 A schematic diagram of a relative quantum value superposition representation in some embodiments of the present disclosure is shown; Figure 6 Another schematic diagram of relative quantum value superposition in some embodiments of the present disclosure is shown; Figure 7 A schematic diagram of a logarithmic domain relative quantum value superposition representation in some embodiments of the present disclosure is shown; Figure 8 A schematic diagram of relative quantum value multiplication in some embodiments of the present disclosure is shown; Fig. 9Another schematic diagram of relative quantum value multiplication in some embodiments of the present disclosure is shown; Fig.10 Another schematic diagram of relative quantum value multiplication in some embodiments of the present disclosure is shown; Fig.11 A schematic diagram of a quantized data processing architecture in some embodiments of the present disclosure is shown; Fig.12 Another schematic diagram of quantized data processing architecture in some embodiments of the present disclosure is shown; Fig.13 A schematic diagram of a query instruction in some embodiments of the present disclosure is shown; Fig.14 Another query instruction schematic diagram in some embodiments of the present disclosure is shown; Fig.15 A specific structural schematic diagram of a quantized data processing architecture in some embodiments of the present disclosure is shown; Fig.16 A schematic diagram showing a specific structure of a query device in some embodiments of the present disclosure is shown; Fig.17 A schematic diagram of a query process of a query device in some embodiments of the present disclosure is shown; Fig.18 A schematic diagram showing the working process of a quantized data processing architecture in some embodiments of the present disclosure is shown; Fig.19 A schematic diagram of a quantized data processing system in some embodiments of the present disclosure is shown; Fig. 20 A schematic diagram of another quantized data processing system in some embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0043] As described in the background technology, as technologies such as artificial intelligence and big data are widely used in various fields, data processing time is getting longer and longer, and energy consumption is getting higher and higher.
[0044] In view of the above problems, some embodiments of the present disclosure provide a quantized data processing method, which converts the input variable value into a relative quantum value within a target operation interval, obtains and obtains the target function corresponding to the relative quantum value in a stored target function value set according to the target function of the input variable value, and then can quickly obtain the target function value corresponding to the input variable value based on the target function value corresponding to the relative quantum value. On the one hand, since the relative quantum value is a discrete integer value, it is very easy to process; on the other hand, since the target function value corresponding to each relative quantum value in the target operation interval has been stored, in other words, the target function value corresponding to each relative quantum value in the target operation interval has been pre-calculated, the target function value corresponding to the relative quantum value can be quickly obtained by querying the stored target function value set without real-time repeated calculation. Therefore, the above method can significantly reduce the calculation, time and energy consumption of obtaining the target function value.
[0045] In order to enable those skilled in the art to better understand and implement the embodiments of the present disclosure, the concepts, schemes, principles and advantages of the embodiments of the present disclosure are described in detail below with reference to the accompanying drawings and through specific application examples.
[0046] First, some embodiments of the present disclosure provide a quantized data processing method, referring to Figure 1 The schematic diagram of the steps of a quantized data processing method in some embodiments of the present disclosure is shown, and the quantized data processing method may include the following steps: Step A: converting the input variable value into a relative quantum value within a target operation interval, wherein the relative quantum value is a discrete integer value.
[0047] In a specific implementation, the target operation interval is a finite operation interval, because the relative quantum value in the target operation interval is very finite and discrete, so after the input variable value is converted into the relative quantum value in the target operation interval, the query operation can be very simple.
[0048] In some embodiments of the present disclosure, the input variable value may include a positive rational number, a negative rational number, and zero, and the relative quantum value may include a positive relative quantum value, a negative relative quantum value, and zero.
[0049] In some embodiments of the present disclosure, the input variable value may include an irrational number. Since a rational number can approximate any irrational number, the irrational number can also be converted into a relative quantum value within the target operation interval.
[0050] It is understandable that the embodiment of the present disclosure does not impose any specific limitation on the type of input variable value, which can be any real number.
[0051] Step B, obtaining and according to the objective function of the input variable value, obtaining the objective function value corresponding to the relative quantum value in the stored objective function value set, wherein the stored objective function value set is a set of objective function values corresponding to each relative quantum value in the target operation interval.
[0052] In a specific implementation, the objective function is used to define the operation performed on the input variable value.
[0053] In some embodiments of the present disclosure, the objective function may be used to define operations in a linear domain.
[0054] For example, the objective function may define an addition operation, a subtraction operation, a multiplication operation, a division operation, etc.
[0055] In some embodiments of the present disclosure, the objective function may be used to define operations in a nonlinear domain.
[0056] For example, the objective function may define a logarithmic operation, an exponential operation, etc.
[0057] It is understandable that the embodiment of the present disclosure does not impose any specific limitation on the objective function, which can be used to define any operation.
[0058] In some embodiments of the present disclosure, the objective function value set may be stored in an internal memory of a computer system.
[0059] For example, random access memory, synchronous dynamic random access memory, static memory, registers, etc.
[0060] In some embodiments of the present disclosure, the objective function value set may be stored in an external memory of the computer system.
[0061] For example, hard disk drives, solid state drives, etc.
[0062] In some embodiments of the present disclosure, the objective function value set may be stored in the form of a table.
[0063] For example, when the operation defined by the objective function includes a single input variable value, the objective function value can be stored in a one-dimensional table, and then the objective function value corresponding to the relative quantum value after the input variable value is converted into the relative quantum value can be obtained by querying the table.
[0064] For another example, when the operation defined by the objective function includes two input variable values, the objective function values may be stored in a two-dimensional table.
[0065] Step C, based on the objective function value corresponding to the relative quantum value, obtaining the objective function value corresponding to the input variable value.
[0066] According to the above embodiment, by converting the input variable value into a relative quantum value within the target operation interval, and obtaining and using the target function of the input variable value, the target function value corresponding to the relative quantum value is obtained in the stored target function value set, and then based on the target function value corresponding to the relative quantum value, the target function value corresponding to the input variable value can be quickly obtained. On the one hand, since the relative quantum value is a discrete integer value, it is very easy to process; on the other hand, since the target function value corresponding to each relative quantum value within the target operation interval has been stored, in other words, the target function value corresponding to each relative quantum value within the target operation interval has been pre-calculated, the target function value corresponding to the relative quantum value can be quickly obtained by querying the stored target function value set without real-time repeated calculation, and then based on the target function value corresponding to the relative quantum value, the target function value corresponding to the input variable value can be quickly obtained. Therefore, the above method can significantly reduce the calculation, time and energy consumption of obtaining the target function value.
[0067] In some embodiments of the present disclosure, reference Figure 2 A schematic diagram of steps for converting an input variable value into a relative quantum value within a target operation interval in some embodiments of the present disclosure is shown. For step A, the input variable value can be converted into a relative quantum value within the target operation interval by the following steps: Step A11, obtaining a mapping relationship between the input variable value and the relative quantum value.
[0068] In some embodiments of the present disclosure, the mapping relationship between the input variable value and the relative quantum value may include: the input variable value corresponds to the product of a first proportional quantum value and the relative quantum value, wherein the range of the relative quantum value is determined by the target operation interval, and the first proportional quantum value is determined by the relative quantum value, which is used to convert the input variable value into a relative quantum value within the target operation interval, so that related operations on the input variable value can be performed within the target operation interval.
[0069] For example, when the input variable value is a rational number r, the rational number r can be converted to quantized data q(r) = (x, s) through the conversion function q, and the quantized data (x, s) can be converted to a rational number through the inverse function of q(). q -1(x, s) = r, where x is the relative quantum value, limited to the target operation interval, s is the first scale quantum value, and the product of the relative quantum value x and the first scale quantum value s corresponds to the rational number r. The relative quantum value x of the quantized data q(r) can be recorded as q(r)[1] = x, and the first scale quantum value s can be recorded as q(r)[2]= s. When the relative quantum value x corresponding to the first scale quantum value s is 1, the relative quantum value x can be recorded as q(r)[1] = x=1; when the relative quantum value x corresponding to the first scale quantum value s is 2, the relative quantum value x can be recorded as q(r)[1] = x=2; and so on, when the relative quantum value x corresponding to the first scale quantum value s is c, the relative quantum value x can be recorded as q(r)[1]= x=c.
[0070] For example, when the input variable value is a rational number expressed in binary, that is, r = p n 2 n + p n-1 2 n-1 + …+ p1 2 1 + p0 2 0 + … + p -m 2 -m , where p n is non-zero. If p -m If m>0, then r is a fraction. If m=0, then r is an integer. 2 m is an integer.
[0071] When the input variable value r is not within the target operation interval, we can select an integer k so that r 2 -k In the target operation range, q(r) = (x, s) = (x, 2 k ), where x = floor(r 2 -k ), i.e. not more than r 2 -k The largest integer, where, since it is in the binary case, q(r) can also be simply written as q(r) = (x, k).
[0072] In some embodiments of the present disclosure, in order to reduce the precision loss when converting the input variable value into a relative quantum value within a target operation interval, the mapping relationship between the input variable value and the relative quantum value may include: the product of the second proportional quantum value corresponding to the input variable value and the difference between the relative quantum value and the zero shift point.
[0073] For example, in [ , ] interval to process a set of rational numbers, if the target operation interval is [ , ], then the mapping relationship between the rational number r belonging to the above interval and the relative quantum value q corresponding to the rational number r can be expressed by the following formula: (1) Where d is the second proportional quantum value and z is the zero shift point. From formula (1), we can know that: (2) From formula (2), we can know that: (3) In some embodiments of the present disclosure, the zero shift point may be stored separately, and then when obtaining the objective function value corresponding to the input variable value based on the objective function value corresponding to the relative quantum value, the zero shift point may be added.
[0074] Step A12: converting the input variable value into a relative quantum value within a target operation interval based on the mapping relationship.
[0075] By adopting the above embodiment, by obtaining the mapping relationship between the input variable value and the relative quantum value, the input variable value can be quickly and accurately converted into the relative quantum value within the target operation interval based on the mapping relationship.
[0076] In some embodiments of the present disclosure, the first proportional quantum value may include an exponential function value.
[0077] In some embodiments of the present disclosure, the proportional quantum value may include a preset base exponent value.
[0078] For example, the first proportional quantum value may include a binary exponent value, an octal exponent value, or the like.
[0079] In some embodiments of the present disclosure, the first proportional quantum value may include a logarithmic function value.
[0080] It is understandable that the embodiment of the present disclosure does not impose any specific restrictions on the first proportional quantum value. In addition, the embodiment of the present disclosure does not impose any specific restrictions on the preset base exponent value, and the binary exponent value and the octal exponent value are only used as exemplary illustrations.
[0081] In some embodiments of the present disclosure, the second proportional quantum value may include an exponential function value.
[0082] In some embodiments of the present disclosure, the two-ratio quantum value may include a preset base exponent value.
[0083] For example, the second proportional quantum value may include a binary exponent value, an octal exponent value, etc.
[0084] In some embodiments of the present disclosure, the second proportional quantum value may include a logarithmic function value.
[0085] It is understandable that the embodiment of the present disclosure does not impose any specific restrictions on the second proportional quantum value. In addition, the embodiment of the present disclosure does not impose any specific restrictions on the preset base exponent value, and the binary exponent value and the octal exponent value are only used as exemplary illustrations.
[0086] In some embodiments of the present disclosure, the target operation interval includes: an integer value operation interval.
[0087] For example, the 4-bit integer INT4 can be used to represent 2 4 = 16 consecutive but different integers, we can define a target operation interval that includes 16 values, namely [1,16].
[0088] For another example, a 4-bit integer INT4 can be used to define a target operation range [0,15] including 16 values.
[0089] It is understandable that the target operation interval is not specifically limited in the embodiment of the present disclosure. In a specific implementation, the target operation interval is determined according to the data actually processed.
[0090] In some embodiments of the present disclosure, in order to reduce the error when converting the input variable value into the relative quantum value within the target operation interval, rounding up may be performed during the conversion.
[0091] In the specific implementation, when the target operation interval is small, r' = q -1 (q(r)), there will be a certain error between r' and r.
[0092] In some embodiments of the present disclosure, in order to reduce the error between r' and r, rounding up may be performed during conversion.
[0093] In some embodiments of the present disclosure, in order to reduce the error between r' and r, rounding down may be performed during conversion.
[0094] In some embodiments of the present disclosure, in order to reduce the error between r' and r, rounding up or rounding down may be performed randomly during conversion.
[0095] In some embodiments of the present disclosure, when the objective function has multiple input variable values, refer to Figure 3The schematic diagram of the steps for obtaining the objective function value corresponding to the input variable value in some embodiments of the present disclosure is shown. For step C, the objective function value corresponding to the input variable value can be obtained by the following steps: Step C11, aligning the relative quantum values corresponding to the input variable values so that the relative quantum values corresponding to the input variable values have the same proportional quantum values.
[0096] For example, the objective function includes two input variable values r1 and r2. Taking the mapping relationship between the input variable value and the product of the first proportional quantum value and the relative quantum value as an example, the input variable values r1 and r2 are converted into relative quantum values within the target operation interval to obtain r1= (x1, s1) and r2= (x2, s2), s1≥ s2, and the relative quantum value x1 and the relative quantum value x2 are both within the target operation interval. Before performing the operation, the proportional quantum values of r1 and r2 can be aligned first, that is, the first proportional quantum value s1 and the first proportional quantum value s2 are the same.
[0097] In some embodiments of the present disclosure, the first scale quantum value s1 and the second scale quantum value s2 may be aligned by using an alignment scale adjustment function dt(s2, s1).
[0098] For example, when performing addition, we first define the addition operation as the target function qad(r1, r2). If the alignment is to r1, then qad(r1, r2) = qad((x1, s1), (x2 dt(s2, s1), s1)).
[0099] For example, when performing a subtraction operation, we first define the subtraction operation as the target function qsb(r1, r2). If the alignment is to r1, then qsb(r1, r2) = qsb((x1, s1), (x2 dt(s2, s1), s1)).
[0100] In some embodiments of the present disclosure, the alignment ratio adjustment function dt(s2, s1) may be specifically defined as dt(s2, s1) = s2 / s1.
[0101] It should be noted that the embodiments of the present disclosure do not specifically limit the alignment method of the proportional quantum values. For example, in some embodiments of the present disclosure, the first proportional quantum value s1 may be aligned to the first proportional quantum value s2; in other embodiments of the present disclosure, the first proportional quantum value s2 may be aligned to the first proportional quantum value s1.
[0102] Step C12, based on the objective function values corresponding to the aligned plurality of relative quantum values, obtaining the objective function values corresponding to the plurality of input variable values.
[0103] In some embodiments of the present disclosure, the stored objective function value set may include a set of objective function values directly corresponding to each relative quantum value within the target operation interval.
[0104] For example, when the objective function is a single-independent variable function, that is, when the operation defined by the objective function includes a single input variable value, the relative quantum value in the target operation interval can be directly queried to obtain the objective function value corresponding to the relative quantum value in the target operation interval and store it.
[0105] For example, when the objective function is a logarithmic function, assuming that the input variable value is x ∈ [ x min , x max ], the corresponding objective function value y = log ( x )∈[ y min , y max ].Will x and y Converted into the corresponding quantized data q i ( x )and q o (y). Under the same proportional quantum value, that is, q i ( x min )[2] = q i ( x max )[2], x min , x max ]Convert to the target operation range[ q i ( x min )[1], q i ( x max )[1]], can be a linear mapping. x ∈ [ x min , x max ], and obtain each quantized data within the target operation interval q i ( x ). Similarly,y min , y max ] corresponds to the same proportion of quantum values (i.e. q o ( y min )[2] = q o ( y max )[2])The target operation interval is [ q o ( y min )[1], q o ( y max )[1]]. Similarly, y = log ( x )∈[ y min , y max ] Repeating the above corresponding transformations can obtain the set of objective function values directly corresponding to each relative quantum value in the target operation interval q o ( y ) = q o ( log ( q i ( x ))). The above objective function value set can then be stored in the form of a table, and the established table is a single-dimensional discrete table within the target operation interval.
[0106] In some embodiments of the present disclosure, q i () can be used with q o ()same.
[0107] For another example, when the objective function is an exponential function, since the exponential function and the logarithmic function are inverse functions of each other, the inverse correspondence of the logarithmic function can be used to implement it, that is, a reverse lookup table.
[0108] In some embodiments of the present disclosure, the stored objective function value set may include a set of objective function values indirectly corresponding to each relative quantum value within the target operation interval.
[0109] In some embodiments of the present disclosure, the objective function value indirectly corresponding to each relative quantum value refers to the objective function value after a preset process is performed on the objective function value directly corresponding to each relative quantum value.
[0110] For example, the set of objective function values may be objective function values obtained after multiplication of the relative quantum values and scaling by a preset scaling ratio.
[0111] In some embodiments of the present disclosure, reference Figure 4 Another schematic diagram of steps for converting input variable values into relative quantum values within a target operation interval is shown. For step A, the input variable value can be converted into a relative quantum value within a target operation interval by the following steps: Step A21: grouping the input variable values based on the characteristics of the input variable values.
[0112] In a specific implementation, when the distribution range of values in a given set of rational arrays is very large, or forms several obvious separated value regions, the input variable values can be grouped based on the characteristics of the input variable values.
[0113] In some embodiments of the present disclosure, the input variable values may be grouped based on the distribution range of the input variable values.
[0114] For example, the input variable values are grouped according to their sizes, and data with larger values and data with smaller values are divided into different groups.
[0115] In some embodiments of the present disclosure, the input variable values may be grouped based on the distribution density of the input variable values.
[0116] For example, you can group input variable values that are concentrated within a certain range.
[0117] In some embodiments of the present disclosure, for example, in the field of machine learning, each channel or tensor may be grouped.
[0118] Step A22, converting the input variable values of each group into relative quantum values within the target operation interval corresponding to each group.
[0119] In a specific implementation, after the input variable values are grouped, target operation intervals corresponding to each group are established respectively, and then each group of input variable values is converted into relative quantum values within the target operation interval corresponding to each group, which can improve the accuracy of numerical conversion.
[0120] In a specific implementation, the method of converting the input variable value into a relative quantum value within the target operation interval described in any of the aforementioned embodiments can be used to convert the input variable value of each group into a relative quantum value within the target operation interval corresponding to each group, which will not be repeated here.
[0121] In order to enable those skilled in the art to better understand and implement the embodiments of the present disclosure, the following describes how the quantized data processing method described in the above embodiments specifically implements quantized data processing through specific examples.
[0122] This embodiment is explained by taking the objective function including two input variable values as an example. It can be understood that the embodiment of the present disclosure does not impose any specific limitation on the number of input variable values.
[0123] In some embodiments of the present disclosure, a 4-bit integer INT4 may be used to represent 2 4 = 16 consecutive but different integers, we can define a target operation interval that includes 16 values, namely [1,16].
[0124] In some embodiments of the present disclosure, a 4-bit integer INT4 may be used to define a target operation interval [0, 15] including 16 values.
[0125] In some embodiments of the present disclosure, the objective function may define an addition operation of two input variable values, and then the objective function value corresponding to the addition operation of two relative quantum values within the target operation interval [1, 16] may be obtained in advance, and a relative quantum value superposition table may be established to store the pre-obtained objective function value. Figure 5 A schematic diagram of a relative quantum value superposition representation is shown, in which, within the target operation interval [1,16], after two relative quantum values are operated, a resolution of up to 16x16=256 values can be obtained.
[0126] In some embodiments of the present disclosure, Figure 5 The relative quantum superposition table shown is further processed, for example, by linearly regressing it to two relative quantum value superposition tables of 16 magnitudes through the proportional quantum adjustment number s=2, referring to Figure 6 Another schematic representation of the relative quantum value superposition is shown.
[0127] In some embodiments of the present disclosure, for example, when performing an addition operation on the rational number 6 and the rational number 18, the conversion function q Convert 6 and 18 into quantized data: q (6) = (6, 0), q (18) = (9, 1); align again q (6) and q The proportional quantum value of (18) is q (6) To q (18) As an example, we get: q (6)=(3, 1); then add the two quantized data to get: qad( q (6), q(18)) = qad((3, 1), (9, 1)) = qad(3+9, 1) = (12, 1), verification result: the quantized data of 6+18 = 24 is q (24) = (12, 1).
[0128] In some embodiments of the present disclosure, for example, when performing an addition operation on rational numbers 7 and 18, 7 and 18 are first converted into quantized data using a conversion function q: q (7) = (7 0), q (18) = (9, 1); align again q (7) and q The proportional quantum value of (18) is q (7) To q (18) As an example, we get: q (7) = (4, 1); then add the two quantized data to get: qad( q (7), q (18)) = qad((4, 1), (9, 1)) = qad(4+9, 1) = (13, 1), verification result: the quantized data of 7+18 = 25 is q (25) = (13, 1).
[0129] In some embodiments of the present disclosure, the objective function may define the addition operation of two input variable values in the logarithmic domain, and then the objective function value corresponding to the addition operation of two relative quantum values in the logarithmic domain within the target operation interval [1,16] may be obtained in advance, that is, log2(x1+x2), the proportional quantum adjustment number is s=-2, and a relative quantum value superposition table is established to store the pre-obtained objective function value. Figure 7 A schematic representation of a superposition of relative quantum values in the logarithmic domain is shown.
[0130] In some embodiments of the present disclosure, the objective function may define a multiplication operation of two input variable values, and then the objective function value corresponding to the multiplication operation of two relative quantum values within the target operation interval [1,16] may be obtained in advance, and a relative quantum value multiplication table may be established to store the pre-obtained objective function value. Figure 8 A schematic diagram of a relative quantum value multiplication is shown.
[0131] In the specific implementation, when the target operation interval is small, r' = q -1 ( q (r)), there will be a certain error between r' and r.
[0132] In some embodiments of the present disclosure, in order to reduce the error between r' and r, rounding up may be performed during conversion.
[0133] For example, the proportional quantum adjustment number s = 2 -4 right Figure 8 The relative quantum value multiplication table shown in the figure is subjected to linear regression and rounded up to obtain the relative quantum value multiplication table after 16 orders of magnitude. Fig. 9 Another schematic representation of relative quantum value multiplication is shown.
[0134] In some embodiments of the present disclosure, in order to reduce the error between r' and r, rounding down may be performed during conversion.
[0135] For example, the proportional quantum adjustment number s = 2 -4 right Figure 8 The relative quantum value multiplication table shown in the figure is subjected to linear regression and rounded down to obtain the relative quantum value multiplication table after 16 orders of magnitude. Fig.10 Another schematic diagram of relative quantum value multiplication is shown.
[0136] from Fig. 9 and Fig.10 As can be seen in , in some operations, when the input variable value is converted into a relative quantum value within the target operation range, the precision of the decimal value will be affected to a certain extent. Fig. 9 In qml((4,0),(5,0))=(2,2 4 ),and Fig.10 In the example, qml((4,0),(5,0))=(1,2 4 ), where qml(r1, r2) is the objective function that defines the multiplication operation. This effect can be reduced by adding a random selection of round-up or round-down strategies. In addition, selecting other proportional quantum values and zero shift points will also improve accuracy.
[0137] For ease of implementation, the present disclosure also provides a quantized data processing architecture. Fig.11 A schematic diagram of a quantized data processing architecture is shown, and the quantized data processing architecture T includes: The first data converter T1 is adapted to convert the input variable value into a relative quantum value within a target operation interval, wherein the relative quantum value is a discrete integer value.
[0138] In a specific implementation, the target operation interval is a finite operation interval. Since the relative quantum value within the target operation interval is very finite and discrete, the operation can be very simple after the input variable value is converted into the relative quantum value within the target operation interval by the first data converter.
[0139] In some embodiments of the present disclosure, the input variable value may include a positive rational number, a negative rational number, and zero, and the relative quantum value may include a positive relative quantum value, a negative relative quantum value, and zero.
[0140] In some embodiments of the present disclosure, the input variable value may include an irrational number. Since a rational number can approximate any irrational number, the irrational number can also be converted into a relative quantum value within the target operation interval.
[0141] It is understandable that the embodiment of the present disclosure does not impose any specific limitation on the type of input variable value, which can be any real number.
[0142] In some embodiments of the present disclosure, the first data converter may include a central processing unit (CPU).
[0143] The query device T2 is adapted to obtain and obtain the objective function value corresponding to the relative quantum value from the stored objective function value set according to the objective function of the input variable value, wherein the stored objective function value set is a set of objective function values corresponding to each relative quantum value in the target operation interval.
[0144] In a specific implementation, the objective function is used to define the operation performed on the input variable value.
[0145] In some embodiments of the present disclosure, the objective function may be used to define operations in a linear domain.
[0146] For example, the objective function may define an addition operation, a subtraction operation, a multiplication operation, a division operation, etc.
[0147] In some embodiments of the present disclosure, the objective function may be used to define operations in a nonlinear domain.
[0148] For example, the objective function may define a logarithmic operation, an exponential operation, etc.
[0149] It is understandable that the embodiment of the present disclosure does not impose any specific limitation on the objective function, which can be used to define any operation.
[0150] The second data converter T3 is adapted to obtain the objective function value corresponding to the input variable value based on the objective function value corresponding to the relative quantum value.
[0151] In some embodiments of the present disclosure, the second data converter may include a central processing unit (CPU).
[0152] According to the above embodiment, the input variable value is converted into a relative quantum value within the target operation interval by the first data converter, and the target function corresponding to the relative quantum value is obtained from the stored target function value set according to the target function of the input variable value by the query device, and then the target function value corresponding to the input variable value can be quickly obtained based on the target function value corresponding to the relative quantum value by the second data converter. On the one hand, since the relative quantum value is a discrete integer value, it is very easy to process; on the other hand, since the target function value corresponding to each relative quantum value within the target operation interval has been stored, in other words, the target function value corresponding to each relative quantum value within the target operation interval has been pre-calculated, the target function value corresponding to the relative quantum value can be quickly obtained by querying the stored target function value set without real-time repeated calculation, so the calculation, time and energy consumption of the quantized data processing architecture to obtain the target function value corresponding to the input variable value can be significantly reduced.
[0153] In some embodiments of the present disclosure, the first data converter may obtain a mapping relationship between the input variable value and the relative quantum value, and convert the input variable value into a relative quantum value within a target operation interval based on the mapping relationship.
[0154] By adopting the above embodiment, the first data converter can obtain the mapping relationship between the input variable value and the relative quantum value, so as to quickly and accurately convert the input variable value into the relative quantum value within the target operation interval based on the mapping relationship.
[0155] In some embodiments of the present disclosure, the first data converter may convert the input variable value into a relative quantum value within a target operation interval based on a mapping relationship between the input variable value and the product of the first proportional quantum value and the relative quantum value.
[0156] The range of the relative quantum value is determined by the target operation interval, and the first proportional quantum value is determined by the relative quantum value, which is used to convert the input variable value into a relative quantum value within the target operation interval, so that related operations on the input variable value can be performed within the target operation interval.
[0157] In some embodiments of the present disclosure, in order to reduce the precision loss when converting the input variable value into the relative quantum value within the target operation interval, the first data converter can convert the input variable value into the relative quantum value within the target operation interval based on the mapping relationship between the second proportional quantum value corresponding to the input variable value and the product of the difference between the relative quantum value and the zero shift point.
[0158] In some embodiments of the present disclosure, the first proportional quantum value may include an exponential function value.
[0159] In some embodiments of the present disclosure, the first proportional quantum value may include a preset base exponent value.
[0160] For example, the first proportional quantum value may include a binary exponent value, an octal exponent value, or the like.
[0161] In some embodiments of the present disclosure, the first proportional quantum value may include a logarithmic function value.
[0162] It is understandable that the embodiment of the present disclosure does not impose any specific restrictions on the first proportional quantum value. In addition, the embodiment of the present disclosure does not impose any specific restrictions on the preset base exponent value, and the binary exponent value and the octal exponent value are only used as exemplary illustrations.
[0163] In some embodiments of the present disclosure, the second proportional quantum value may include an exponential function value.
[0164] In some embodiments of the present disclosure, the two-ratio quantum value may include a preset base exponent value.
[0165] For example, the second proportional quantum value may include a binary exponent value, an octal exponent value, etc.
[0166] In some embodiments of the present disclosure, the second proportional quantum value may include a logarithmic function value.
[0167] It is understandable that the embodiment of the present disclosure does not impose any specific restrictions on the second proportional quantum value. In addition, the embodiment of the present disclosure does not impose any specific restrictions on the preset base exponent value, and the binary exponent value and the octal exponent value are only used as exemplary illustrations.
[0168] In some embodiments of the present disclosure, the target operation interval includes: an integer value operation interval.
[0169] For example, the 4-bit integer INT4 can be used to represent 2 4 = 16 consecutive but different integers, we can define a target operation interval that includes 16 values, namely [1,16].
[0170] For another example, a 4-bit integer INT4 can be used to define a target operation range [0,15] including 16 values.
[0171] It is understandable that the target operation interval is not specifically limited in the embodiment of the present disclosure. In a specific implementation, the target operation interval is determined according to the actual processed data.
[0172] In some embodiments of the present disclosure, in order to reduce the error when converting the input variable value into the relative quantum value within the target operation interval, rounding up may be performed during the conversion.
[0173] In the specific implementation, when the target operation interval is small, r' = q -1 ( q (r)), there will be a certain error between r' and r.
[0174] In some embodiments of the present disclosure, in order to reduce the error between r' and r, rounding up may be performed during conversion.
[0175] In some embodiments of the present disclosure, in order to reduce the error between r' and r, rounding down may be performed during conversion.
[0176] In some embodiments of the present disclosure, in order to reduce the error between r' and r, rounding up or rounding down may be performed randomly during conversion.
[0177] In some embodiments of the present disclosure, reference Fig.12 As shown in another schematic diagram of quantized data processing architecture, the quantized data processing architecture T may further include: an internal memory T4, suitable for storing the objective function value set.
[0178] In some embodiments of the present disclosure, continue to refer to Fig.12 , the quantized data processing architecture T may further include: an external memory T5, suitable for storing the objective function value set.
[0179] In some embodiments of the present disclosure, the stored objective function value set may include a set of objective function values directly corresponding to each relative quantum value within the target operation interval.
[0180] For example, when the objective function is a single-independent variable function, that is, when the operation defined by the objective function includes a single input variable value, the relative quantum value in the target operation interval can be directly calculated, and the objective function value corresponding to the relative quantum value in the target operation interval can be obtained and stored.
[0181] In some embodiments of the present disclosure, the stored objective function value set may include a set of objective function values indirectly corresponding to each relative quantum value within the target operation interval.
[0182] In some embodiments of the present disclosure, the objective function value indirectly corresponding to each relative quantum value refers to the objective function value after a preset process is performed on the objective function value directly corresponding to each relative quantum value.
[0183] For example, the set of objective function values may be objective function values obtained after multiplication of the relative quantum values and scaling by a preset scaling ratio.
[0184] In some embodiments of the present disclosure, the query unit T2 may include: The instruction decoder is adapted to decode the received query instruction to obtain data processing information.
[0185] In some embodiments of the present disclosure, the query instruction may include information such as target function label information, input variable value information, and storage address information of the target function value corresponding to the input variable value.
[0186] For example, refer to Fig.13 A schematic diagram of a query instruction is shown, wherein the query instruction includes a target function label Fid, a first input variable value In1, a second input variable value In2, and a storage address Outadd of a target function value corresponding to the input variable value.
[0187] In some embodiments of the present disclosure, the query instruction may include information such as target function label information, input variable address information, and storage address information of the target function value corresponding to the input variable value.
[0188] For example, refer to Fig.14 Another query instruction schematic diagram is shown, the query instruction includes the target function label Fid, the input address Inadd1 of the first input variable, the input address Inadd2 of the second input variable and the storage address Outadd of the target function value corresponding to the input variable value.
[0189] At least one address decoder is adapted to obtain, based on the data processing information decoded by the instruction decoder, an objective function value corresponding to the relative quantum value in a stored objective function value set.
[0190] In some embodiments of the present disclosure, the query device may include multiple address decoders, which are suitable for respectively obtaining target function values corresponding to multiple relative quantum values in the stored target function value set based on the data processing information decoded by the instruction decoder.
[0191] In some embodiments of the present disclosure, the query device may further include an address converter adapted to convert a multi-dimensional storage address into a one-dimensional storage address.
[0192] In the specific implementation, the traditional two-dimensional array data search is to obtain the value stored at the corresponding address in the memory given an address. This requires linearizing the two-dimensional array and searching. Therefore, if the input of the objective function is more than two input variable values, the multidimensional array needs to be linearized.
[0193] For example, suppose f(x1, x2, x3) is the target function with three input variable values, and the set of target function values directly corresponding to the relative quantum values in the target operation interval is stored as a quantum function table, N is the maximum relative quantum value, and fadd is the starting address of the quantum function table of the f function. Assuming that each output value occupies an address unit, the output value of f(x1, x2, x3) can be placed at the following address: fadd + x1 + x2 N + x3 N 2 .
[0194] It is to be understood that the embodiment of the present disclosure does not impose any specific restrictions on the storage method of the set of objective function values. The above storage as a quantum function table is only used as an exemplary description. In some embodiments of the present disclosure, the set of objective function values can also be stored as an array. In addition, the embodiment of the present disclosure does not impose any specific restrictions on the dimension of the quantum function table.
[0195] In some embodiments of the present disclosure, the query device may further include a data buffer, adapted to store the target function value corresponding to the relative quantum value acquired by the address decoder.
[0196] In some embodiments of the present disclosure, the quantized data processing architecture may further include a proportional aligner adapted to align the relative quantum values corresponding to the input variable values so that the relative quantum values corresponding to the input variable values have the same proportional quantum values.
[0197] In some embodiments of the present disclosure, the second data converter may include a ratio regulator adapted to adjust the output value ratio of the objective function value corresponding to the relative quantum value.
[0198] In some embodiments of the present disclosure, the quantized data processing architecture may further include a data updater adapted to update a stored set of objective function values.
[0199] In a specific implementation, the set of objective function values stored in the designated storage area may be updated according to the actually processed data.
[0200] In some embodiments of the present disclosure, the data updater is suitable for dynamically updating the stored objective function value set.
[0201] In a specific implementation, the data updater can dynamically transfer different objective function value sets to a designated storage area, such as an internal memory of a computing system or an external memory of a computing system, to achieve dynamic update of the objective function value set in the storage area.
[0202] In some embodiments of the present disclosure, the quantized data processing architecture may further include a processor adapted to obtain a set of objective function values corresponding to each relative quantum value within a target operation interval.
[0203] It should be noted that the quantized data processing architecture described in the embodiments of the present disclosure can execute the quantized data processing method described in any of the above embodiments.
[0204] In order to enable those skilled in the art to better understand and implement the embodiments of the present disclosure, the following describes how the quantized data processing architecture described in the above embodiments specifically implements quantized data processing through specific examples.
[0205] Reference Fig.15 The specific structural diagram of a quantum data processing architecture shown includes a control unit CU, multiple quantum function tables QNP_1, QNP_2, ..., QNP_m, a query unit T2, a data updater UD, a multi-level memory MH, a fast query read bus Bus1, a memory bus Bus2, and a central processing unit interface bus Bus3.
[0206] In some embodiments of the present disclosure, a plurality of quantum function tables QNP_1, QNP_2, ..., QNP_m may be pre-calculated and stored in a memory.
[0207] In some embodiments of the present disclosure, multiple quantum function tables QNP_1, QNP_2, ..., QNP_m can be updated by a data updater UD.
[0208] In some embodiments of the present disclosure, a plurality of quantum function tables QNP_1, QNP_2, ..., QNP_m may be calculated by an external traditional computing structure and then updated by a data updater UD.
[0209] In some embodiments of the present disclosure, the program and data may be placed in a memory. Each instruction in the program is driven by a control unit CU. The query instruction to be executed may be placed in a fast query cache. The query result may be first stored in the fast query cache.
[0210] In some embodiments of the present disclosure, the query result may be immediately used as an input value for the next one or more query instructions.
[0211] In some embodiments of the present disclosure, continue to refer to Fig.13 The query instruction may include the target function label Fid, the first input variable value In1, the second input variable value In2, and the storage address Outadd of the target function value corresponding to the input variable value. The output value obtained by the query device T2 from the corresponding quantum function table is placed in the output value storage address Outadd.
[0212] For example, the output value storage address Outadd can be a relative address in the fast query cache. At this time, the output value can be used as the input of the next query for the next query; or, the output value can be stored in the corresponding memory address through a correspondence table from this relative address to the memory address.
[0213] For another example, the output value storage address Outadd may be an absolute address in the memory.
[0214] In some embodiments of the present disclosure, continue to refer to Fig.14 The query instruction includes the target function label Fid, the input address Inadd1 of the first input variable, the input address Inadd2 of the second input variable, and the storage address Outadd of the target function value corresponding to the input variable value.
[0215] In some embodiments of the present disclosure, reference Fig.16 As shown in the specific structural diagram of a query device, the query device T2 may include: an instruction decoder T21, an address decoder T22, a data buffer T23, and an output value storage address module T24.
[0216] When the query device T2 receives the program instruction Ins, it transmits the program instruction Ins to the instruction decoder T21.
[0217] In some embodiments of the present disclosure, the instruction decoder T21 parses the function label Fid and the input variable value or the input variable value vector from the program instruction Ins and transmits them to the address decoder T22. When the input of the program instruction Ins is an address, the instruction decoder T21 obtains the relative quantum value of the input variable value according to the input address. The instruction decoder T21 can also separate the output value storage address. The output value storage address can be an address in the memory or an address in the data buffer T23. After receiving the function label Fid and the input variable value or the input variable value vector, the address decoder T22 parses the address of the target function value corresponding to the input variable value, and obtains the output value from the quantum function table.
[0218] In some embodiments of the present disclosure, the output value may be sent to the memory as specified by the address.
[0219] In some embodiments of the present disclosure, the output value may be stored in the data buffer T23 for the next calculation according to the address specified.
[0220] In some embodiments of the present disclosure, querying the quantum function table is a key operation in the fast query process. In order to speed up the query of the operation table, the hardware needs to be enhanced accordingly. Specifically, the traditional two-dimensional array data query is to obtain the value stored at the corresponding address in the memory given an address. This requires multiple steps to linearize and search the two-dimensional array.
[0221] For example, refer to Fig.17 The query process diagram of a query device is shown in FIG. 1 . In this embodiment, taking the objective function having two input variable values as an example, the input data includes a first input variable value In1 and a second input variable value In2. The objective function values corresponding to the two input variable values can be obtained by adding the function label to the respective input values. This is because a function label can correspond to an address stored in a quantum function table, and the corresponding address in the storage interval can be uniquely determined by adding the input variable value, thereby obtaining the objective function values corresponding to the two input variable values. The conversion operation from the input variable value to the input variable value address can be performed by Fig.17 The first address decoder AD1 and the second address decoder AD2 shown in the figure are used to implement the above. In this way, the corresponding value can be obtained in one clock cycle. In addition, before querying, the function value of the pre-calculated quantum function table is added to the memory according to the corresponding address.
[0222] In some embodiments of the present disclosure, different quantum function tables can share an address decoder in a query device, thereby simplifying and saving design logic.
[0223] In some embodiments of the present disclosure, continue to refer to Fig.17 , Fig.17 It also shows the connection of the function value in the quantum function table to the corresponding address. According to the address corresponding to the given input variable value, the target function value set is pre-calculated. In this embodiment, the target function value set is stored in the form of a quantum function table QNP. Each target function value in the quantum function table QNP is sent to the corresponding storage address for later query. The function value of the quantum function table can be dynamically updated during the program running process using program instructions to increase flexibility. The set of currently supported quantum function tables can also be flexibly replaced.
[0224] In some embodiments of the present disclosure, if the input variable values of the target function are more than two, the query function value can be realized by the same method. That is, the target function values corresponding to the relative quantum values in the target operation interval are first calculated in advance, and then stored in the memory in the form of a quantum function table. Finally, during the operation, the value can be quickly found by hardware method or address conversion method.
[0225] For example, hardware can be designed to support multi-dimensional address queries, and a target function including three input variable values can be stored in a three-dimensional stack.
[0226] For another example, a multi-dimensional address can be converted into a one-dimensional address by performing address conversion. Assuming that f(x1, x2, x3) is a target function with three input variable values, the set of target function values directly corresponding to the relative quantum values in the target operation interval is stored as a quantum function table. N is the maximum relative quantum value, and fadd is the starting address of the quantum function table of the f function. Assuming that each output value occupies one address unit, the output value of f(x1, x2, x3) can be placed at the following address: fadd + x1 + x2 N + x3 N 2 .
[0227] Reference Fig.18 A schematic diagram of the working process of a quantized data processing architecture is shown. First, the first data converter T1 converts the input variable value In1 and the input variable value In2 of the target function Fid into relative quantum values within the target operation interval, wherein the input variable value In1 and the input variable value In2 may include rational numbers r1 and r2, and the rational numbers r1 and r2 are converted into quantized data r1= (x1, s1) and r2=(x2, s2), respectively.
[0228] In some embodiments of the present disclosure, the first data converter T1 may include a central processing unit CPU.
[0229] In some embodiments of the present disclosure, when s1 and s2 are different, the proportional aligner Tx can be used to make s1 and s2 the same, thereby obtaining new quantized data r1= (x'1, s'1) and r2=(x'2, s'2).
[0230] In some embodiments of the present disclosure, when the objective function includes only one input variable value, the input variable value, after passing through the first data converter T1, does not need to pass through the scale aligner Tx, and can be directly transmitted to the query unit T2 to obtain a corresponding output result.
[0231] The aligned quantized data r1= (x'1, s'1) and r2=(x'2, s'2) are transmitted to the query device T2. The query device T2 obtains the corresponding target function value by querying the quantum function table stored in the memory. The target function value is also represented by quantized data, that is, (y, s).
[0232] In some embodiments of the present disclosure, according to the needs of the objective function Fid, the output value ratio of the objective function value (y, s) can be adjusted by the proportional regulator Ty to obtain a new quantized data representation of the output result, namely (y', s').
[0233] For example, if the stored objective function value set is the result after adjustment by the proportional quantum adjustment number, it is necessary to adjust the output value ratio of the objective function value (y, s) to restore it to the result without adjustment by the proportional quantum adjustment number.
[0234] After obtaining the objective function value (y', s'), the objective function value (y', s') may be converted into a rational number through a second data converter.
[0235] In some embodiments of the present disclosure, the second data converter may include a central processing unit (CPU).
[0236] In some embodiments of the present disclosure, if the stored objective function value set has not been adjusted by the proportional quantum adjustment number, the query result does not need to be adjusted by the proportional regulator.
[0237] In some embodiments of the present disclosure, since the quantum function table can be dynamically replaced by the data updater, the ratio regulator can also dynamically adjust the output value ratio of the objective function value.
[0238] In some embodiments of the present disclosure, since the target operation interval occupies a limited amount of memory and has the same structure, multiple target functions can be batch processed in parallel.
[0239] Specifically, for example, for quantized data calculations comparable to INT4 precision, excluding the fixed lengths of proportional quantum values and two addresses, the memory space required to support 16 quantized data operations is a 16x16=256-unit table, where each unit requires half a byte. If quantized data calculations comparable to INT8 are used, the memory space required to support 256 quantized data operations is 256x256 = 2 16 Cell table, where each cell requires one byte. Thus, a table only requires 16KB of memory. Only one table is needed for one objective function operation. This table can be pre-calculated and stored in the corresponding QNP_m fast storage through the data updater.
[0240] It should be noted that the operation of the quantum function table can be defined dynamically, and for any target function in QNP_m, it only takes one clock cycle to look up the value of the quantum function table in real time. Therefore, the quantum data processing architecture provides great flexibility and universality.
[0241] The present disclosure also provides a quantized data processing system, referring to Fig.19 A schematic diagram of a quantized data processing system is shown, and the quantized data processing system SX includes: Interaction interface SX1.
[0242] The processor SX2 is coupled to the interaction interface.
[0243] In some embodiments of the present disclosure, the processor may include a central processing unit (CPU).
[0244] It is understandable that the embodiments of the present disclosure do not impose any specific restrictions on the processor as long as it has a data processing function. For example, the processor may also include other computing processors such as a microprocessor and a neural network processor.
[0245] In some embodiments of the present disclosure, data may be acquired and output by a CPU, as well as used for pre-calculation of a quantum function table.
[0246] The quantized data processing architecture SX3 described in any of the aforementioned embodiments is coupled to the interaction interface SX1 and is communicatively coupled to the processor SX2 via the interaction interface SX1; and is suitable for executing the quantized data processing method described in any of the aforementioned embodiments.
[0247] In some embodiments of the present disclosure, the quantized data processing architecture may be integrated into a quantized data processing chip.
[0248] By adopting the above-mentioned embodiment, the processor and the quantized data processing architecture are communicatively coupled via an interactive interface, and then cooperate with each other to perform data processing, which can significantly reduce the time and energy consumption of data processing.
[0249] The present disclosure also provides a quantized data processing system, referring to Fig. 20 Another schematic diagram of a quantized data processing system is shown, the quantized data processing system SY includes: Interaction interface SY1.
[0250] A plurality of processors SY21 - SY2n are respectively coupled to the interaction interface SY1 .
[0251] In some embodiments of the present disclosure, the processor may include a central processing unit (CPU).
[0252] It is understandable that the embodiments of the present disclosure do not impose any specific restrictions on the processor as long as it has a data processing function. For example, the processor may also include other computing processors such as a microprocessor and a neural network processor.
[0253] In some embodiments of the present disclosure, data may be acquired and output by a CPU, as well as used for pre-calculation of a quantum function table.
[0254] Multiple quantized data processing architectures SY31~SY3n described in any of the aforementioned embodiments are respectively coupled to the interactive interface SY1, and each quantized data processing architecture is communicatively coupled with the corresponding processor through the interactive interface SY1; and are suitable for executing the quantized data processing method described in any of the aforementioned embodiments.
[0255] In some embodiments of the present disclosure, the quantized data processing architecture may be integrated into a quantized data processing chip.
[0256] By adopting the above-mentioned embodiment, multiple processors and multiple quantized data processing architectures are communicatively coupled through an interactive interface, and then cooperate with each other to perform data processing, which can not only significantly reduce the time and energy consumption of data processing, but also realize the parallel operation of multiple quantized data processing architectures, thereby further improving the speed of data processing.
[0257] In some embodiments of the present disclosure, different instructions and related data are assigned to a specified quantized data processing architecture according to the arrangement of the program, and the corresponding quantized data processing architecture is triggered to execute a query operation to perform corresponding operations on the data, thereby realizing the parallel operation of multiple quantized data processing architectures.
[0258] In some embodiments of the present disclosure, the number of processors and the number of quantized data processing architectures may be the same.
[0259] In some embodiments of the present disclosure, the number of processors and quantized data processing architectures may be different.
[0260] It should be understood that the above examples are merely illustrative and do not constitute any limitation to the embodiments of the present disclosure.
[0261] The disclosed embodiment also provides a chip, comprising the quantized data processing architecture described in any of the aforementioned embodiments.
[0262] The chip described in the above embodiment can be easily integrated into various computing systems and cooperate with other processors to reduce the calculation, time and energy consumption of data processing. It has flexible design and strong scalability.
[0263] Although the embodiments of the present disclosure are disclosed as above, the present invention is not limited thereto. Any person skilled in the art may make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the scope defined by the claims.
Claims
1. A quantized data processing method, characterized in that: include: Converting the input variable value into a relative quantum value within a target operation interval, wherein the relative quantum value is a discrete integer value; Obtaining and obtaining, according to the objective function of the input variable value, an objective function value corresponding to the relative quantum value in a stored objective function value set, wherein the stored objective function value set is a set of objective function values corresponding to each relative quantum value within the target operation interval; Based on the objective function value corresponding to the relative quantum value, the objective function value corresponding to the input variable value is obtained.
2. The method according to claim 1, characterized in that The step of converting the input variable value into a relative quantum value within a target operation interval includes: Acquire a mapping relationship between the input variable value and the relative quantum value; The input variable value is converted into a relative quantum value within a target operation interval based on the mapping relationship.
3. The method according to claim 2, characterized in that The mapping relationship between the input variable value and the relative quantum value includes: The input variable value corresponds to the product of the first proportional quantum value and the relative quantum value.
4. The method according to claim 2, characterized in that The mapping relationship between the input variable value and the relative quantum value includes: The input variable value corresponds to the product of the second proportional quantum value and the difference between the relative quantum value and the zero shift point.
5. The method according to claim 3, characterized in that: The first ratio quantum value includes at least one of the following: Exponential function value; Preset exponent value; Logarithmic function value.
6. The method according to claim 4, characterized in that The second ratio quantum value includes at least one of the following: Exponential function value; Preset exponent value; Logarithmic function value.
7. The method according to claim 1, characterized in that The target operation interval includes: an integer value operation interval; When the input variable value is converted into a relative quantum value within the target operation interval, the relative quantum value is determined by any of the following methods: Round up; Round down; Randomly choose to round up or round down.
8. The method according to claim 3 or 4, characterized in that: When the objective function has multiple input variable values, obtaining the objective function value corresponding to the input variable value based on the objective function value corresponding to the relative quantum value includes: Aligning the relative quantum values corresponding to the input variable values so that the relative quantum values corresponding to the input variable values have the same proportional quantum values; Based on the objective function values corresponding to the aligned plurality of relative quantum values, objective function values corresponding to the plurality of input variable values are obtained.
9. The method according to claim 8, characterized in that The stored objective function value set includes at least one of the following: A set of objective function values directly corresponding to each relative quantum value in the target operation interval; The set of objective function values indirectly corresponding to the relative quantum values within the target operation interval.
10. The method according to claim 9, characterized in that The objective function value indirectly corresponding to each relative quantum value refers to the objective function value after a preset process is performed on the objective function value directly corresponding to each relative quantum value.
11. The method according to claim 1, characterized in that: The step of converting the input variable value into a relative quantum value within a target operation interval includes: grouping the input variable values based on characteristics of the input variable values; The input variable values of each group are converted into relative quantum values within the target operation interval corresponding to each group.
12. The method according to claim 11, characterized in that The grouping of the input variable values based on the characteristics of the input variable values includes any one of the following: Grouping the input variable values based on the distribution range of the input variable values; The input variable values are grouped based on the distribution density of the input variable values.
13. A quantized data processing architecture, characterized in that: include: A first data converter, adapted to convert an input variable value into a relative quantum value within a target operation interval, wherein the relative quantum value is a discrete integer value; A query device, adapted to obtain and obtain, according to the objective function of the input variable value, an objective function value corresponding to the relative quantum value from a stored objective function value set, wherein the stored objective function value set is a set of objective function values corresponding to each relative quantum value within the target operation interval; The second data converter is adapted to obtain the objective function value corresponding to the input variable value based on the objective function value corresponding to the relative quantum value.
14. The architecture according to claim 13, characterized in that The first data converter is adapted to obtain a mapping relationship between the input variable value and the relative quantum value; and convert the input variable value into a relative quantum value within a target operation interval based on the mapping relationship.
15. The architecture according to claim 14, characterized in that The first data converter is adapted to convert the input variable value into a relative quantum value within a target operation interval based on a mapping relationship between the input variable value and a product of a first proportional quantum value and the relative quantum value.
16. The architecture according to claim 14, characterized in that The first data converter is adapted to convert the input variable value into a relative quantum value within a target operation interval based on a mapping relationship between the input variable value and the second proportional quantum value and the product of the difference between the relative quantum value and the zero shift point.
17. The architecture according to claim 15, characterized in that The first ratio quantum value includes at least one of the following: Exponential function value; Preset exponent value; Logarithmic function value.
18. The architecture according to claim 16, characterized in that The second ratio quantum value includes at least one of the following: Exponential function value; Preset exponent value; Logarithmic function value.
19. The architecture according to claim 13, characterized in that The target operation interval includes: an integer value operation interval; The first data converter, when converting the input variable value into a relative quantum value within a target operation interval, is adapted to determine the relative quantum value in any of the following ways: Round up; Round down; Randomly choose to round up or round down.
20. The architecture of claim 13, wherein: Also includes: An internal memory, adapted to store the objective function value set, the objective function value set comprising at least one of the following: A set of objective function values directly corresponding to each relative quantum value in the target operation interval; A set of objective function values indirectly corresponding to each relative quantum value within the target operation interval; The objective function value indirectly corresponding to each relative quantum value refers to the objective function value after a preset process is performed on the objective function value directly corresponding to each relative quantum value.
21. The architecture of claim 13, wherein: Also includes: An external memory is adapted to store the objective function value set, wherein the objective function value set includes at least one of the following: A set of objective function values directly corresponding to each relative quantum value in the target operation interval; A set of objective function values indirectly corresponding to each relative quantum value within the target operation interval; The objective function value indirectly corresponding to each relative quantum value refers to the objective function value after a preset process is performed on the objective function value directly corresponding to each relative quantum value.
22. The architecture of claim 13, wherein: The query device comprises: an instruction decoder adapted to decode the received query instruction to obtain data processing information; At least one address decoder is adapted to obtain, based on the data processing information decoded by the instruction decoder, an objective function value corresponding to the relative quantum value in a stored objective function value set.
23. The architecture according to claim 22, characterized in that The at least one address decoder is a plurality of address decoders, adapted to respectively obtain objective function values corresponding to a plurality of relative quantum values in a stored objective function value set based on the data processing information decoded by the instruction decoder.
24. The architecture according to claim 23, characterized in that The query instruction includes the following information: Objective function label information; Enter variable value information; The storage address information of the objective function value corresponding to the input variable value.
25. The architecture of claim 23, wherein: The query instruction includes the following information: Objective function label information; Enter variable address information; The storage address information of the objective function value corresponding to the input variable value.
26. The architecture of claim 13, wherein: The query device also includes: The address converter is adapted to convert a multi-dimensional storage address into a one-dimensional storage address.
27. The architecture of claim 22, wherein: The query device also includes: The data buffer is adapted to store the target function value corresponding to the relative quantum value obtained by the address decoder.
28. The architecture according to claim 15 or 16, characterized in that Also includes: The proportional aligner is adapted to align the relative quantum values corresponding to the input variable values so that the relative quantum values corresponding to the input variable values have the same proportional quantum values.
29. The architecture of claim 14, wherein: The second data converter comprises: A proportional regulator is adapted to adjust the output value ratio of the objective function value corresponding to the relative quantum value.
30. The architecture of claim 13, wherein: Also includes: A data updater, adapted to update a stored set of objective function values.
31. The architecture according to claim 30, characterized in that The data updater is suitable for dynamically updating the stored objective function value set.
32. The architecture of claim 13, wherein: Also includes: The processor is adapted to obtain a set of objective function values corresponding to each relative quantum value within a target operation interval.
33. A quantized data processing system, characterized in that: include: Interactive interface; a processor, coupled to the interactive interface; The quantized data processing architecture described in any one of claims 13-32 is coupled to the interactive interface and is communicatively coupled to the processor through the interactive interface; and is suitable for executing the quantized data processing method described in any one of claims 1-12.
34. A quantized data processing system, characterized in that: include: Interactive interface; A plurality of processors are respectively coupled to the interaction interfaces; Multiple quantized data processing architectures described in any one of claims 13-32 are respectively coupled to the interactive interface, and each quantized data processing architecture is communicatively coupled to the corresponding processor through the interactive interface; and are suitable for executing the quantized data processing method described in any one of claims 1-12.
35. A chip, characterized in that: include: The quantized data processing architecture described in any one of claims 13 to 32.
