Data processing method, device and system

文档序号:7790 发布日期:2021-09-17 浏览:43次 中文

1. A data processing method applied to a first processor comprises the following steps:

rewriting the first objective function by using the specified interval of the independent variable range as a rewriting target, and using the rewritten function as a second objective function, wherein the specified interval is [2 ]Q,2G]Or [2 ]Q,2G) Or (2)Q,2G) Or (2)Q,2G]Q and G are integers, and G is more than or equal to Q;

dividing the independent variable interval of the second objective function based on the power of 2 to obtain M sections, wherein M sectionsThe mth one of the block sections is [2 ]Q+(m-1),2Q+m),M=G-Q;

Dividing each of the M block sections in a uniform segmentation mode, wherein the number N of the block sections obtained by dividing the mth block section of the M block sectionsmSatisfies log2 (N)m) Is a positive integer;

and constructing a lookup table according to the final segmentation result of the independent variable interval so that the second processor determines a function value corresponding to the independent variable to be calculated of the first target function based on the lookup table.

2. The data processing method of claim 1, wherein the constructing a lookup table according to the final segmentation result of the argument interval comprises:

aiming at each obtained block section, carrying out Taylor coefficient expansion of a specified order on the second target function at the head of the block section to obtain a derivative coefficient corresponding to the block section;

and constructing a lookup table based on the derivative coefficients respectively corresponding to the sections.

3. The data processing method of claim 2, wherein the constructing the lookup table based on the derivative coefficients respectively corresponding to the segments comprises:

converting the derivative coefficients respectively corresponding to the sections into floating point coefficients to obtain the floating point coefficients respectively corresponding to the sections;

constructing the lookup table based on the floating point coefficients respectively corresponding to the sections;

and/or the presence of a gas in the gas,

for each obtained segment, converting the derivation coefficient corresponding to the segment into a fixed point coefficient with a set bit width according to a maximum fixed point scaling value which does not overflow in the derivation coefficient corresponding to the segment, so as to obtain a fixed point coefficient corresponding to the segment;

and constructing the lookup table based on the fixed point coefficient and the maximum fixed point scaling value respectively corresponding to each section.

4. A data processing method, applied to a second processor, comprising:

determining that an argument to be calculated of a first objective function corresponds to an argument in a second objective function, and using the determined argument as an objective argument, wherein the second objective function is obtained by rewriting the first objective function by using a first processor to define an argument range in a specified interval as a rewriting target, and the specified interval is [2 ]Q,2G]Or [2 ]Q,2G) Or (2)Q,2G) Or (2)Q,2G]Q and G are integers, and G is more than or equal to Q;

determining a segment head offset and a table entry address corresponding to the target independent variable, wherein the segment head offset is an offset of the target independent variable relative to a segment head of a segment section in which the target independent variable is located, the segment section is a segment section included in a final segmentation result of an independent variable interval of the second target function, the final segmentation result is a plurality of segment sections obtained by dividing the independent variable interval of the second target function by the first processor based on a power of 2 so as to obtain M segment sections, and then dividing each segment section of the M segment sections in a uniform segmentation manner, the table entry address is an address in a lookup table corresponding to the segment section in which the target independent variable is located, and the lookup table is a table constructed according to the final segmentation result of the independent variable interval;

and determining a function value corresponding to the argument to be calculated of the first target function based on the segment head offset, the table entry address and the lookup table.

5. The data processing method of claim 4, wherein determining the entry address comprises:

acquiring a binary bit stream corresponding to the target independent variable;

determining the interval number of the interval section where the target independent variable is located according to the binary bit stream and preset parameters;

and determining the table entry address according to the interval number of the section where the target independent variable is located.

6. The data processing method of claim 5, wherein determining a segment head offset corresponding to the target argument comprises:

and setting the preset bit number of the binary bit stream corresponding to the target independent variable to be 0 to obtain the segment head offset.

7. The data processing method according to claim 4, wherein the data processing method is processed using a floating point processing method and/or a fixed point processing method.

8. A data processing system comprising a first processor and a second processor;

the first processor is used for rewriting a first objective function by taking the independent variable range as a rewriting target in a specified interval as [2 ], and taking the rewritten function as a second objective functionQ,2G]Or [2 ]Q,2G) Or (2)Q,2G) Or (2)Q,2G]Q and G are integers, and G is more than or equal to Q; dividing the independent variable interval of the second objective function based on the power of 2 to obtain M sections, wherein the mth section in the M sections is [2 ]Q+(m-1),2Q+m) M ═ G-Q; dividing each of the M block sections in a uniform segmentation mode, wherein the number N of the block sections obtained by dividing the mth block section of the M block sectionsmSatisfies log2 (N)m) Is a positive integer; constructing a lookup table according to the final segmentation result of the independent variable interval;

the second processor is used for determining that the independent variable to be calculated of the first objective function corresponds to the independent variable in the second objective function, and taking the determined independent variable as the target independent variable; determining a segment head offset and an entry address corresponding to the target independent variable, wherein the segment head offset is the offset of the target independent variable relative to the segment head of the segment in which the target independent variable is located, and the entry address is the address in a lookup table corresponding to the segment in which the target independent variable is located; and determining a function value corresponding to the argument to be calculated of the first target function based on the segment head offset, the table entry address and the lookup table.

9. A data processing apparatus, applied to a first processor, comprising: the device comprises a function rewriting module, a first segmentation module, a second segmentation module and a lookup table construction module;

the function rewriting module is used for rewriting a first target function by taking the independent variable range as a rewriting target in a specified interval as a second target function, wherein the specified interval is [2 ]Q,2G]Or [2 ]Q,2G) Or (2)Q,2G) Or (2)Q,2G]Q and G are integers, and G is more than or equal to Q;

the first segmentation module is configured to divide the argument interval of the second objective function based on a power of 2 to obtain M segments, where an mth segment of the M segments is [2 ]Q+(m-1),2Q+m),M=G-Q;

The second segmentation module is configured to divide each of the M segments in a uniform segmentation manner, where the number N of segments obtained by dividing the mth segment of the M segments ismSatisfies log2 (N)m) Is a positive integer;

and the lookup table construction module is used for constructing a lookup table according to the final segmentation result of the independent variable interval so that the second processor can determine the function value corresponding to the independent variable to be calculated of the first target function based on the lookup table.

10. A data processing apparatus, for application to a second processor, comprising: the system comprises a target independent variable determining module, an information determining module and a function value determining module;

the target independent variable determining moduleThe method comprises the steps of determining that an argument to be calculated of a first objective function corresponds to an argument in a second objective function, and using the determined argument as a target argument, wherein the second objective function is obtained by rewriting the first objective function by using a first processor and limiting an argument range to a specified interval as a rewriting target, and the specified interval is [2 ]Q,2G]Or [2 ]Q,2G) Or (2)Q,2G) Or (2)Q,2G]Q and G are integers, and G is more than or equal to Q;

the information determining module is configured to determine a segment head offset and a table entry address corresponding to the target argument, where the segment head offset is an offset of the target argument with respect to a segment head of a segment in which the target argument is located, the segment is a segment included in a final segmentation result of an argument interval of the second target function, the final segmentation result is a plurality of segments obtained by dividing the argument interval of the second target function by the first processor based on a power of 2 to obtain M segments, and each of the M segments is divided in a uniform segmentation manner, and the table entry address is an address in a lookup table corresponding to the segment in which the target argument is located, and the lookup table is a table constructed according to the final segmentation result of the argument interval;

and the function value determining module is used for determining a function value corresponding to the argument to be calculated of the first target function based on the segment head offset, the table entry address and the lookup table.

Background

In various engineering data processing technology fields, such as molecular dynamics, digital signal processing, convolutional neural networks, there are a large number of complex nonlinear mathematical calculations. These complex mathematical calculations are typically implemented by software programming using a general purpose microprocessor CPU, which consumes long time and consumes large amounts of power. At present, a special processor is selected in each field to carry out acceleration operation, namely, basic addition, multiplication and table look-up operation part functions in the special processor are used for carrying out acceleration operation.

For example, in Molecular Dynamics (MD) simulation, a system to be tested is placed in a physical space cube, and particles in the system move according to the stress. The particles have various classical mechanical interactions such as long-range interaction, short-range interaction, bonding interaction and the like, the interactions relate to high-order power functions, trigonometric functions, e-exponential functions, integral functions and the like, even in a combined form of the functions, the calculation complexity is high, the calculation amount is huge, and the requirement on data precision is high. To speed up the computation, a special processor needs to be used.

Currently, in engineering implementation, a table lookup method is usually used to implement a nonlinear mathematical operation. The conventional table lookup method is implemented as follows: firstly, constructing a lookup table, segmenting an independent variable interval (usually uniform segmentation or increasing the number of segments for partial intervals of function characteristics) which can be taken by a function aiming at a specific calculation function, solving a dependent variable value and a first-order and second-order derivative coefficient (also can be deformed) at the first segment of each segment, and storing the dependent variable value and the first-order and second-order derivative coefficients into the lookup table; during calculation, the value of the independent variable is taken, the table entry address is calculated according to the segmentation mode during the construction of the lookup table, and the function value is calculated through fitting operation after the table entry of the table entry address is taken.

Because the function forms have diversity, the independent variable value ranges of different functions are different, and the change speed of the same function in different subintervals is also different, but the current table lookup method can only make a segmentation mode aiming at a specific function and adopts a calculation mode matched with the made segmentation mode to calculate the table entry address, the universality is poor, and the calculation efficiency is low.

Disclosure of Invention

In view of this, the present application provides a data processing method, device and system, so as to solve the problems of poor generality and low computation efficiency caused by the fact that a unified table lookup method cannot be adopted to compute a function value in the prior art, and the technical scheme is as follows:

a data processing method is applied to a first processor and comprises the following steps:

rewriting the first objective function with the argument range limited to a specified interval as a rewrite target, and using the rewritten function as a second objective function, wherein the specified interval is [2 ]Q,2G]Or [2 ]Q,2G) Or (2)Q,2G) Or (2)Q,2G]Q and G are integers, and G is more than or equal to Q;

dividing the independent variable interval of the second objective function based on the power of 2 to obtain M sections, wherein the mth section in the M sections is [2 ]Q+(m-1),2Q+m),M=G-Q;

Dividing each of the M block sections in a uniform segmentation mode, wherein the number N of the block sections obtained by dividing the mth block section of the M block sectionsmSatisfies log2 (N)m) Is a positive integer;

and constructing a lookup table according to the final segmentation result of the independent variable interval so that the second processor determines a function value corresponding to the independent variable to be calculated of the first target function based on the lookup table.

Optionally, constructing a lookup table according to the final segmentation result of the argument interval, including:

aiming at each obtained block section, carrying out Taylor coefficient expansion of a specified order on a second target function at the head of the block section to obtain a derivative coefficient corresponding to the block section;

and constructing a lookup table based on the derivative coefficients respectively corresponding to the sections.

Optionally, constructing a lookup table based on the derivation coefficients corresponding to the respective time intervals includes:

converting the derivative coefficients respectively corresponding to the sections into floating point coefficients to obtain the floating point coefficients respectively corresponding to the sections;

constructing a lookup table based on the floating point coefficients respectively corresponding to the sections;

and/or the presence of a gas in the gas,

for each obtained segment, converting the derivation coefficient corresponding to the segment into a fixed point coefficient with a set bit width according to a maximum fixed point scaling value which does not overflow in the derivation coefficient corresponding to the segment, so as to obtain a fixed point coefficient corresponding to the segment;

and constructing a lookup table based on the fixed point coefficient and the maximum fixed point scaling value respectively corresponding to each interval.

A data processing method is applied to a second processor and comprises the following steps:

determining that an independent variable to be calculated of a first target function corresponds to an independent variable in a second target function, and using the determined independent variable as a target independent variable, wherein the second target function is obtained by rewriting the first target function by using a first processor to limit the range of the independent variable to a specified interval as a rewriting target, and the specified interval is [2 ]Q,2G]Or [2 ]Q,2G) Or (2)Q,2G) Or (2)Q,2G]Q and G are integers, and G is more than or equal to Q;

determining a segment head offset and a table entry address corresponding to a target independent variable, wherein the segment head offset is the offset of the target independent variable relative to a segment head of a segment zone in which the target independent variable is located, the segment zone is a segment zone contained in a final segmentation result of an independent variable zone of a second target function, the final segmentation result is a plurality of segment zones obtained by dividing the independent variable zone of the second target function by a first processor based on a power of 2 so as to obtain M segment zones, each segment zone of the M segment zones is divided in a uniform segmentation mode, the table entry address is an address in a lookup table corresponding to the segment zone in which the target independent variable is located, and the lookup table is a table constructed according to the final segmentation result of the independent variable zone;

and determining a function value corresponding to the argument to be calculated of the first target function based on the segment head offset, the table entry address and the lookup table.

Optionally, determining the table entry address includes:

acquiring a binary bit stream corresponding to a target independent variable;

determining the interval number of the interval section where the target independent variable is located according to the binary bit stream and preset parameters;

and determining the address of the table entry according to the interval number of the section where the target independent variable is located.

Optionally, determining a segment head offset corresponding to the target argument includes:

and setting the preset bit number of the binary bit stream corresponding to the target independent variable to be 0 to obtain the segment head offset.

Optionally, the data processing method is processed by a floating point processing method and/or a fixed point processing method.

A data processing system comprising a first processor and a second processor;

a first processor for rewriting a first objective function with a rewrite target of limiting the argument range to a specified section [2 ], the rewritten function serving as a second objective functionQ,2G]Or [2 ]Q,2G) Or (2)Q,2G) Or (2)Q,2G]Q and G are integers, and G is more than or equal to Q; dividing the independent variable interval of the second objective function based on the power of 2 to obtain M sections, wherein the mth section in the M sections is [2 ]Q+(m-1),2Q+m) M ═ G-Q; dividing each of the M block sections in a uniform segmentation mode, wherein the number N of the block sections obtained by dividing the mth block section of the M block sectionsmSatisfies log2 (N)m) Is a positive integer; constructing a lookup table according to the final segmentation result of the independent variable interval;

the second processor is used for determining that the independent variable to be calculated of the first objective function corresponds to the independent variable in the second objective function, and taking the determined independent variable as the target independent variable; determining a segment head offset and an item address corresponding to the target independent variable, wherein the segment head offset is the offset of the target independent variable relative to the segment head of the segment in which the target independent variable is located, and the item address is the address in the lookup table corresponding to the segment in which the target independent variable is located; and determining a function value corresponding to the argument to be calculated of the first target function based on the segment head offset, the table entry address and the lookup table.

A data processing device applied to a first processor comprises: the device comprises a function rewriting module, a first segmentation module, a second segmentation module and a lookup table construction module;

a function rewriting module for rewriting the first objective function and the rewritten function as the second objective function with the independent variable range limited in the designated interval [2 ]Q,2G]Or [2 ]Q,2G) Or (2)Q,2G) Or (2)Q,2G]Q and G are integers, and G is more than or equal to Q;

a first segmentation module, configured to divide an argument interval of the second objective function based on a power of 2 to obtain M segments, where an mth segment of the M segments is [2 ]Q+(m-1),2Q+m),M=G-Q;

A second segmentation module for dividing each of the M segments in a uniform segmentation manner, wherein the number N of the M-th segment is obtained by dividing the M-th segmentmSatisfies log2 (N)m) Is a positive integer;

and the lookup table construction module is used for constructing a lookup table according to the final segmentation result of the independent variable interval so that the second processor can determine a function value corresponding to the independent variable to be calculated of the first target function based on the lookup table.

A data processing device applied to a second processor comprises: the system comprises a target independent variable determining module, an information determining module and a function value determining module;

object self-changingThe quantity determining module is used for determining that the independent variable to be calculated of the first objective function corresponds to the independent variable in the second objective function, and taking the determined independent variable as the target independent variable, wherein the second objective function is obtained by rewriting the first objective function by limiting the range of the independent variable to a specified interval [2 ] as a rewriting target for the first processorQ,2G]Or [2 ]Q,2G) Or (2)Q,2G) Or (2)Q,2G]Q and G are integers, and G is more than or equal to Q;

the information determining module is used for determining a segment head offset and a table entry address corresponding to the target independent variable, wherein the segment head offset is the offset of the target independent variable relative to a segment head of a segment section in which the target independent variable is located, the segment section is a segment section contained in a final segmentation result of an independent variable section of a second target function, the final segmentation result is a plurality of segment sections obtained by dividing the independent variable section of the second target function by a first processor based on a power of 2 so as to obtain M segment sections, each segment section in the M segment sections is divided in a uniform segmentation mode, the table entry address is an address in a lookup table corresponding to the segment section in which the target independent variable is located, and the lookup table is a table constructed according to the final segmentation result of the independent variable section;

and the function value determining module is used for determining a function value corresponding to the argument to be calculated of the first target function based on the segment head offset, the table entry address and the lookup table.

As can be seen from the above technical solutions, in the data processing method provided by the present application, the first processor rewrites the argument range to be limited to the designated section, rewriting the first objective function to obtain a second objective function, dividing the independent variable interval of the second objective function based on the power of 2, obtaining M sections, dividing each section in the M sections in a uniform segmentation mode, then constructing a lookup table according to the final segmentation result of the independent variable section, firstly determining that the independent variable to be calculated of the first objective function corresponds to the independent variable in the second objective function by the second processor, taking the determined independent variable as the objective independent variable, and finally, determining a function value corresponding to the argument to be calculated of the first target function according to the segment head offset, the table item address and the lookup table. According to the function calculation method, the independent variable intervals of the second target functions in various forms can be segmented in a unified segmentation mode, the table entry address, the segment head offset and the function value can be determined in a unified calculation mode, the universality is higher, and the calculation efficiency is higher.

Drawings

In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.

Fig. 1 is a schematic flowchart of a data processing method according to an embodiment of the present application;

fig. 2 is a schematic diagram of a second block section including M block sections according to an embodiment of the present disclosure;

fig. 3 is a bit-taking diagram of a binary bitstream in a fixed-point format according to an embodiment of the present application;

fig. 4 is a schematic structural diagram of a data processing apparatus applied to a first processor according to an embodiment of the present disclosure;

fig. 5 is a schematic structural diagram of a data processing apparatus applied to a second processor according to an embodiment of the present application;

fig. 6 is a block diagram of a hardware structure of a data processing apparatus applied to a first processor according to an embodiment of the present application;

fig. 7 is a block diagram of a hardware structure of a data processing apparatus applied to a second processor according to an embodiment of the present application.

Detailed Description

The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.

The existing data processing method can adopt a table look-up method when determining the function value of the nonlinear complex function with the independent variable having a limited range, but the segmentation mode required when constructing the look-up table needs to customize each function, which means that the calculation mode matched with the segmentation mode is also needed when calculating the table look-up address, so that the function value can not be calculated by adopting a unified table look-up method, the universality is not strong, and the realization efficiency is low.

In view of the problems in the prior art, the present inventors have conducted extensive studies, and finally have proposed a data processing method, which can convert a first objective function having an argument with a limited range into a second objective function having an argument section as a designated section, and when constructing a lookup table, can use binary data to represent characteristics, segment the argument section of the second objective function in a set of fixed pattern segmentation manner, and when calculating a function value, use a calculation manner matched with the fixed pattern segmentation manner, thereby completing the calculation with high efficiency and high accuracy, and having a stronger versatility. The following embodiments are provided to describe the data processing method in detail.

Referring to fig. 1, a schematic flow chart of a data processing method provided in an embodiment of the present application is shown, where the data processing method may include:

in step S101, the first processor rewrites the first objective function with the argument range limited to the designated section as a rewrite target, and the rewritten function is regarded as a second objective function.

For ease of description, the first objective function is hereinafter denoted by Fori (xori), where xori is an argument of the first objective function that satisfies xori ∈ [ R ∈ [ ]1,R2],R1∈N,R2∈N,R2>R1(optionally, the argument interval of the first objective function may also beFor the fully open interval or the half open and half closed interval), the second objective function is represented by f (x).

In this embodiment, the first processor may be a general-purpose central processing unit CPU, and the first objective function is a non-linear complex function, such as a van der waals action potential function, a van der waals action force function, a short-range electrostatic action potential function, a short-range electrostatic action force function, and the like, involved in molecular dynamics simulation.

The independent variable range of the first target function is limited in the designated interval, namely the first target function is rewritten into a second target function with the independent variable interval as the designated interval, so that the rewritten independent variable interval of the second target function can be conveniently segmented in a uniform segmentation mode.

Wherein, the specified interval is [2 ] according to the opening and closing condition of the independent variable interval of the first objective functionQ,2G]Or [2 ]Q,2G) Or (2)Q,2G) Or (2)Q,2G]Here, G ∈ Z, Q ∈ Z, and G ≧ Q. For example, if the argument interval of the first objective function is [ R ]1,R2]Then the interval is designated as [2 ]Q,2G]If the argument interval of the first objective function is [ R ]1,R2) Then the interval is designated as [2 ]Q,2G) If the argument interval of the second objective function is (R)1,R2) Then, the interval is designated as (2)Q,2G) If the argument interval of the second objective function is (R)1,R2]Then, the interval is designated as (2)Q,2G]。

Limiting the argument range of the first objective function to a specified interval [2 ]Q,2G]Or [2 ]Q,2G) Or (2)Q,2G) Or (2)Q,2G]For the purpose of the present invention, the following mapping function may be adopted to perform translation, normalization, and translation processing on the argument interval of the first objective function, so as to obtain the second objective function.

Here, the mapping function is:

the following steps S102 to S103 are processes of segmenting the argument interval of the second objective function by using a uniform segmentation method, and the steps S102 to S103 are segmentation methods obtained by considering binary data representation characteristics corresponding to arguments, and the segmentation methods are used to facilitate subsequent determination of the table entry address.

Step S102, the first processor divides the independent variable interval of the second objective function based on the power of 2 to obtain M intervals.

Wherein M ═ G-Q.

Referring to fig. 2, after the second segment is segmented, the mth segment of the M segments is [2 ]Q+(m-1),2Q +m) And M is 1,2,3, …, M, namely the length of the section after the segmentation is 2 times of the length of the section before the segmentation.

It should be noted that, in this step, after the segmentation, the sum of the M sections is not necessarily equal to the argument interval of the second objective function, for example, the argument interval of the second objective function is [2 ]Q,2G]When the sum of the M block sections is actually [2 ]Q,2G)。

This step is based on a power of 2 segmentation method, so that in the binary data representation, the corresponding next segment is shifted to the left by one bit from the previous segment, which is a characteristic convenient for determining the table entry address subsequently.

Step S103, the first processor divides each of the M sections in a uniform section mode.

This step may be performed to uniformly segment each of the M segments shown in fig. 2 again, wherein the number N of segments obtained by dividing the mth segment of the M segmentsmSatisfies log2 (N)m) Is a positive integer, M is 1,2,3, …, M, and the number of segments NmThe variation speed of the second objective function in the mth section and the calculation accuracy requirement can be determined by an implementer through algorithm design and simulation.

The step of uniformly segmenting and the mth segment pair in the M segmentsNumber of segments NmSo that, in the binary data representation, some truncated log2 (N) of the argument is takenm) After the bit, the corresponding decimal may be used to determine the bin number of the argument in this mth bin.

After segmenting the independent variable interval of the second objective function through the steps S102 to S103, the total number of the obtained segment intervals is:

and step S104, the first processor constructs a lookup table according to the final segmentation result of the independent variable interval.

Optionally, the process of "constructing the lookup table according to the final segmentation result of the independent variable interval" in this step may specifically include the following steps S1041 to S1042:

step S1041, performing taylor coefficient expansion of a specified order on the second objective function at the segment head of each obtained segment to obtain a derivative coefficient corresponding to the segment.

The segment head of a segment refers to the independent variable at the head position of the segment, and the taylor coefficient expansion of the specified order can be carried out on the second target function at the segment head of the segment in the step, so as to obtain the derivative coefficient corresponding to the segment. If it is subsequently required to determine the function value of each independent variable in the block section corresponding to the second objective function, the function value may be determined based on the derivation coefficient corresponding to the block section.

For example, if a block is [0.1,0.15 ], the second objective function is F (x), and the order is assigned to be Γ order, then F (0.1) may be subjected to Γ order taylor coefficient expansion at the first 0.1 of the block to obtain Γ derivation coefficients corresponding to the block. For each argument within the interval, e.g. 0.13, a specific value of F (0.13) may then be determined based on the resulting Γ derivative coefficients.

Step S1042, constructing a lookup table based on the derivation coefficients respectively corresponding to the sections.

In this step, the derivation coefficients corresponding to the respective block segments may be stored in a lookup table, where the derivation coefficient corresponding to one block segment is used as a row of the lookup table, and after the construction is completed, the total row number of the lookup table is S (i.e., the total number of block segments obtained in steps S102 to S103).

Step S105, the second processor determines that the argument to be calculated of the first objective function corresponds to the argument in the second objective function, and takes the determined argument as the target argument.

In this embodiment, the second processor is a processor including basic arithmetic unit functions including addition, multiplication, and table lookup.

In this embodiment, the process of the subsequent fitting calculation is actually a process of determining a function value of the second objective function, and determining the function value of the second objective function requires an argument to be calculated corresponding to the second objective function, so in this step, after obtaining the argument to be calculated of the first objective function, the argument to be calculated of the first objective function may be first converted into an argument corresponding to the second objective function.

In this step, when determining the target independent variable of the second target function based on the to-be-calculated independent variable of the first target function, the mapping function shown in step S101 may be adopted, that is, the to-be-calculated independent variable of the first target function is used as xori in the mapping function, and the obtained x is the target independent variable.

And step S106, the second processor determines the segment head offset and the table entry address corresponding to the target independent variable.

In this step, the offset of the segment head is the offset of the target independent variable relative to the segment head of the segment in which the target independent variable is located, and the table entry address is the address in the lookup table corresponding to the segment in which the target independent variable is located, which can be used to indicate the position of the derivation coefficient corresponding to the segment in which the target independent variable is located in the lookup table.

Therefore, both the table entry address and the segment head offset are related to the segment in which the target independent variable is located, and optionally, this step may first determine the segment in which the target independent variable is located, and then determine the table entry address and the segment head offset based on the segment in which the target independent variable is located.

And S107, the second processor determines a function value corresponding to the argument to be calculated of the first target function based on the segment head offset, the table entry address and the lookup table.

After the second objective function f (x) is expanded by the set taylor deformation formula by taylor coefficients of a specified order, the second objective function becomes a function related to only the segment start offset and the derivative coefficient, see the set taylor deformation formula below.

Setting a Taylor deformation formula: f (x) ═ kΓΔx+kΓ-1)Δx...+k2)Δx+k1Wherein k isΓ、kΓ-1、…、k1And obtaining a derivative coefficient corresponding to the section where the target independent variable is located, wherein delta x is the offset of the section head.

Therefore, in this step, a derivative coefficient corresponding to the segment where the target independent variable is located may be determined based on the table entry address and the lookup table, and then a function value corresponding to the to-be-calculated independent variable of the first target function may be determined based on the determined derivative coefficient and the segment head offset.

The data processing method provided by the application can segment the independent variable intervals of the second objective functions in various forms by adopting the uniform segmentation mode shown in the steps S102 to S103, the segmentation mode has flexibility, and the number M and the number N of the segments can be adjustedmThe method and the device are suitable for second target functions in different forms, and the table entry address, the segment head offset and the function value can be determined in a unified calculation mode shown in the steps S106 to S107, so that the universality is higher, and the calculation efficiency is higher. In addition, the data processing method provided by the application has high calculation precision.

Those skilled in the art will appreciate that there are two storage formats for data in a processor: the present embodiment may employ a floating point processing method and/or a fixed point processing method to process the data processing method described above.

Here, through a good fixed-point design, a system including multi-step mathematical operations can obtain the same system performance as that under high-data-bit-width floating-point processing when fixed-point processing of low data bit width is used, but realization of fixed-point processing has extremely high requirements on system data characteristics and algorithm workers, and therefore, in realizing the present application, processing is balanced when floating-point and fixed-point processing modes are selected.

Specifically, if the data processing method described above is processed by a floating point processing method in this embodiment, the process of "step S1042 and constructing the lookup table based on the derivative coefficients corresponding to the respective segments" may include steps S10421a to S10422 a:

step S10421a, converting the derivative coefficients corresponding to each of the sections into floating point coefficients, so as to obtain the floating point coefficients corresponding to each of the sections.

If a floating point processing mode is adopted, the table entry in the lookup table needs to be in a floating point format, so that before the lookup table is constructed based on the derivative coefficients respectively corresponding to each segment, the derivative coefficients respectively corresponding to each segment need to be converted into floating point coefficients.

Step S10422a, constructing a lookup table based on the floating point coefficients corresponding to each segment.

In this step, Γ derivation coefficients corresponding to the S-th segment included in the argument section of the second objective function may be stored in columns 1 to Γ of the S-th row of the lookup table, where S is 1,2,3, …, S is the total number of segments obtained in steps S102 to S103, and Γ is a specified order, that is, the dimension of the constructed lookup table is: s rows × Γ columns.

Correspondingly, the process of determining the function value corresponding to the argument to be calculated of the primitive function by the second processor based on the offset to be fitted, the table entry address and the lookup table in step S107 may include steps S1071a to S1073 a:

step S1071a, according to the table entry address, obtaining the floating point coefficient corresponding to the section where the target independent variable is located from the lookup table.

Step S1072a, fitting and calculating the second objective function according to the floating point coefficient and the segment head offset corresponding to the segment where the target independent variable is located, so as to obtain a function value corresponding to the target independent variable.

In the step, a floating point operation part is needed for multiplication and addition in fitting calculation, and the function value corresponding to the obtained target independent variable is in a floating point format.

Step S1073a, the function value corresponding to the target argument is used as the function value corresponding to the argument to be calculated of the first target function.

Similar to the floating point processing method, if the fixed point processing method is adopted, the process of "step S1042 and constructing the lookup table based on the derivative coefficients corresponding to the respective segments" may include steps S10421b to S10422 b:

step S10421b, for each obtained segment, according to a maximum fixed-point scaling value that does not overflow in the derivation coefficients corresponding to the segment, converting the derivation coefficients corresponding to the segment into fixed-point coefficients with a set bit width, so as to obtain the fixed-point coefficients corresponding to the segment.

If a fixed-point processing mode is adopted, the table entry in the lookup table needs to be in a fixed-point format, so before the lookup table is constructed based on the derivative coefficients corresponding to each segment, the derivative coefficients corresponding to each segment need to be converted into fixed-point coefficients.

Step S10422b, constructing a lookup table based on the fixed point coefficients and the maximum fixed point scaling values respectively corresponding to the respective block sections.

Unlike the floating point processing method, the fixed point processing method is to construct a lookup table based on the fixed point coefficients and the maximum fixed point scaling values corresponding to the respective sections, and specifically, to store Γ derivation coefficients corresponding to the S-th section included in the argument section of the second objective function into columns 1 to Γ of the S-th row of the lookup table, and store the maximum fixed point scaling value corresponding to the S-th section into column (Γ +1) of the lookup table, where S ═ 1,2,3, …, S is the total number of sections obtained in steps S102 to S103, and Γ is a specified order, that is, the dimensionality of the constructed lookup table is: s row x (Γ +1) column.

Correspondingly, the process of determining the function value corresponding to the argument to be calculated of the primitive function by the second processor based on the offset to be fitted, the table entry address and the lookup table in step S107 may include steps S1071b to S1073 b:

step S1071b, according to the table entry address, obtain the fixed point derivation coefficient and the maximum fixed point scaling value corresponding to the block section in which the target argument is located from the lookup table.

Step S1072b, performing fitting calculation on the second objective function according to the fixed point coefficient, the maximum fixed point calibration value, and the segment head offset corresponding to the segment in which the target independent variable is located, to obtain a function value corresponding to the target independent variable.

In the multiplication and addition in the fitting operation in this step, a fixed point operation unit is required to be used, the obtained function value corresponding to the target independent variable is in a fixed point format, and the scalar value of the function value in the fixed point format is the maximum fixed point scalar value obtained in step S1071 b.

It should be noted that, in the fitting operation process in this step, the fixed-point multiplication operation maintains the same bit width before and after each operation.

Step S1073b, based on the maximum fixed-point scaling value, converts the function value corresponding to the target argument into a floating-point format, and takes the function value in the floating-point format as the function value corresponding to the argument to be calculated of the first target function.

The data processing method provided by the embodiment supports a floating point processing mode and a fixed point processing mode, and a proper processing mode can be selected according to actual needs, so that the method is more flexible, and the calculation precision during fitting calculation is higher.

The following describes "step S106, the second processor determines the segment head offset and the entry address corresponding to the target argument" in the above embodiment.

In an alternative embodiment, regarding the floating point processing mode and the fixed point processing mode, the determination modes adopted when the "step S106 and the second processor determine the segment head offset and the entry address corresponding to the target argument" are different, and the step S106 will be described in detail below based on the two processing modes, respectively.

And step S1061, acquiring a binary bit stream corresponding to the target argument.

Specifically, if a floating point processing mode is adopted, the step may obtain the binary bit stream in the floating point format corresponding to the target argument according to an agreed floating point data storage mode, where the binary bit stream in the floating point format is a general floating point binary representation method combining a 1-bit sign bit, a P-bit order code, and a T-bit mantissa, and for example, the binary bit stream in the IEEE754 double-precision floating point format is composed of a 1-bit sign bit, an 11-bit order code, and a 52-bit mantissa.

If a fixed-point processing mode is adopted, a fixed-point format binary bit stream corresponding to the target independent variable is obtained, the fixed-point format binary bit stream is the binary bit stream corresponding to the target independent variable in the fixed-point format, and the target independent variable in the fixed-point format is obtained by converting the target independent variable into the fixed-point format according to a preset standard value.

Step S1062, determining the interval number of the interval where the target independent variable is located according to the binary bit stream and the preset parameter.

Specifically, if the floating point processing mode is adopted, the binary bit stream according to the floating point format and the preset parameters Q, NmDetermining the interval number of the interval in which the target independent variable is located, wherein the specific determination process may include: firstly, acquiring a P-level code in a binary bit stream in a floating-point format, marking a decimal number corresponding to the P-level code as E, and converting the decimal number into E- (2) through a formula mP-1-1) - (Q-1) determining that the target independent variable falls in the mth block section among M block sections included in the independent variable section, and then calculating a ═ log2 (N)m) Intercepting (P +1) +1 to (P +1) + a bits in the binary bit stream in the floating-point format, and recording a decimal value corresponding to the intercepted a bits as s, so that the target argument falls in the (s +1) th block section included in the mth block section, and then the block number of the block section in which the target argument is located is:

if the fixed-point processing mode is adopted, the binary bit stream according to the fixed-point format and the preset parameters M, Nm(different preset parameters for floating point processing mode and fixed point processing mode), determining target independent variableIn the interval number of the interval, the specific determination process may include: looking up the first 1 in the binary bit stream in the fixed-point format from the highest bit, as shown in fig. 3, if the found first 1 is the bit B except the sign bit, determining that the target argument falls in the M-th section of the M sections included in the argument section according to the formula M-B +1, and then taking the log2 (N) from the found first 1 to the back (see fig. 3)m) Bits, denoted b (1: log2 (N)m) Log2 (N)m) Bit-corresponding decimal value bin2dec (b (1: log2 (N)m) ) is recorded as s, the target argument falls within the (s +1) th block included in the m-th block, and the block number of the block in which the target argument is located is:here, bin2dec () represents binary to decimal.

It should be noted that the interval number determined in this step is counted from 1, that is, the interval number of the first interval included in the argument interval is 1, the interval number of the second interval is 2, and so on.

Step S1063, determining the table entry address according to the interval number of the interval in which the target argument is located.

The interval number of the section in which the target argument is located is related to the table entry address, and optionally, this step may use the interval number of the section in which the target argument is located as the table entry address, where the table entry address is counted from 1.

And step S1064, setting the preset bit number of the binary bit stream corresponding to the target argument to 0 to obtain the segment head offset.

Specifically, if the floating-point processing method is adopted, the first (P +1) + a bit of the binary bitstream in the floating-point format is set to 0, so as to obtain the segment header offset.

If the fixed-point processing mode is adopted, the first (B +1) + log2 (N) of the binary bit stream of the fixed-point format is processedm) And a bit of 0 is set to obtain the offset of the segment head.

In this embodiment, the table entry address can be determined by using the unified addressing manner as shown in step S1062 and step S1063, which means that the second processor accelerated operation unit only needs to design one set of circuit, and only one set of code is needed for implementing the algorithm. In addition, the segment head offset can be determined in a unified manner as shown in step S1064, so that the scheme has more universality and better implementation effect.

The data processing apparatus applied to the first processor provided by the embodiment of the present application is described below, and the data processing apparatus applied to the first processor described below and the data processing method applied to the first processor described above may be referred to correspondingly.

Referring to fig. 4, a schematic structural diagram of a data processing apparatus applied to a first processor according to an embodiment of the present application is shown, and as shown in fig. 4, the data processing apparatus applied to the first processor may include: a function rewriting module 401, a first segmentation module 402, a second segmentation module 403, and a look-up table construction 404.

A function rewriting module 401 for rewriting a first objective function with a rewrite target of limiting the argument range to a specified section [2 ], and using the rewritten function as a second objective functionQ,2G]Or [2 ]Q,2G) Or (2)Q,2G) Or (2)Q,2G]Q and G are integers, and G is more than or equal to Q.

A first segmentation module 402, configured to segment the argument interval of the second objective function based on a power of 2 to obtain M segments, where an mth segment of the M segments is [2 ]Q+(m-1),2Q+m),M=G-Q。

A second segmentation module 403, configured to divide each of the M segments in a uniform segmentation manner, where the number N of segments obtained by dividing the mth segment of the M segments is NmSatisfies log2 (N)m) Is a positive integer.

And a lookup table constructing module 404, configured to construct a lookup table according to the final segmentation result of the argument interval, so that the second processor determines, based on the lookup table, a function value corresponding to the argument to be calculated of the first target function.

In a possible implementation manner, the lookup table constructing module 404 may include: a derivation coefficient determining submodule and a lookup table constructing submodule;

and the derivation coefficient determining submodule is used for performing Taylor coefficient expansion of a specified order on the second target function at the segment head of each obtained segment so as to obtain a derivation coefficient corresponding to the segment.

And the lookup table construction submodule is used for constructing a lookup table based on the derivative coefficients respectively corresponding to the sections.

In a possible implementation manner, the lookup table construction sub-module is specifically configured to convert the derivative coefficients corresponding to the respective blocks into floating point coefficients to obtain the floating point coefficients corresponding to the respective blocks, and construct the lookup table based on the floating point coefficients corresponding to the respective blocks.

In a possible implementation manner, the lookup table constructing sub-module is specifically configured to, for each obtained segment, convert the derivation coefficient corresponding to the segment into a fixed point coefficient with a set bit width according to a maximum fixed point scaling value that does not overflow in the derivation coefficient corresponding to the segment, so as to obtain a fixed point coefficient corresponding to the segment, and construct the lookup table based on the fixed point coefficient and the maximum fixed point scaling value respectively corresponding to each segment.

The data processing device applied to the second processor provided by the embodiment of the present application is described below, and the data processing device applied to the second processor described below and the data processing method described above may be referred to correspondingly.

Referring to fig. 5, a schematic structural diagram of a data processing apparatus applied to a second processor according to an embodiment of the present application is shown, and as shown in fig. 5, the data processing apparatus applied to the second processor may include: a target independent variable determination module 501, an information determination module 502, and a function value determination module 503.

Target independent variable determination module 501 for determiningThe argument to be calculated of the first objective function corresponds to the argument in the second objective function, and the determined argument is used as the objective argument, wherein the second objective function is obtained by rewriting the first objective function by limiting the argument range to a specified interval [2 ] as a rewriting target for the first processorQ,2G]Or [2 ]Q,2G) Or (2)Q,2G) Or (2)Q,2G]Q and G are integers, and G is more than or equal to Q.

The information determining module 502 is configured to determine a segment first offset and a table entry address corresponding to the target argument, where the segment first offset is an offset of the target argument with respect to a segment first of a segment in which the target argument is located, a segment is a segment included in a final segmentation result of an argument interval of the second target function, the final segmentation result is a plurality of segments obtained by dividing, by the first processor, the argument interval of the second target function by a power of 2 to obtain M segments, and after the M segments are obtained, each segment in the M segments is divided by using a uniform segmentation manner, and the table entry address is an address in a lookup table corresponding to the segment in which the target argument is located, and the lookup table is a table constructed according to the final segmentation result of the argument interval.

The function value determining module 503 is configured to determine a function value corresponding to the argument to be calculated of the first target function based on the segment header offset, the table entry address, and the lookup table.

In a possible implementation manner, the process of determining the table entry address by the information determining module 502 may include: a binary bit stream obtaining submodule, an interval number determining submodule and a table entry address determining submodule.

And the binary bit stream acquisition submodule is used for acquiring the binary bit stream corresponding to the target independent variable.

And the interval number determining submodule is used for determining the interval number of the interval in which the target independent variable is positioned according to the binary bit stream and the preset parameter.

And the table entry address determining submodule is used for determining the table entry address according to the interval number of the section in which the target independent variable is positioned.

In a possible implementation manner, the process of determining the segment header offset corresponding to the target argument by the information determining module 502 may include: a segment start offset determination submodule.

And the segment head offset determining submodule is used for setting the preset bit number of the binary bit stream corresponding to the target independent variable to 0 to obtain the segment head offset.

An embodiment of the application provides a data processing system, which comprises a first processor and a second processor.

Wherein the first processor is used for rewriting the first objective function by using the specified section of the independent variable range as the rewriting target, and the rewritten function is used as the second objective function, wherein the specified section is [2 ]Q,2G]Or [2 ]Q,2G) Or (2)Q,2G) Or (2)Q,2G]Q and G are integers, and G is more than or equal to Q; dividing the independent variable interval of the second objective function based on the power of 2 to obtain M sections, wherein the mth section in the M sections is [2 ]Q+(m-1),2Q+m) M ═ G-Q; dividing each of the M block sections in a uniform segmentation mode, wherein the number N of the block sections obtained by dividing the mth block section of the M block sectionsmSatisfies log2 (N)m) Is a positive integer; and constructing a lookup table according to the final segmentation result of the independent variable interval.

The second processor is used for determining that the independent variable to be calculated of the first objective function corresponds to the independent variable in the second objective function, and taking the determined independent variable as the target independent variable; determining a segment head offset and an item address corresponding to the target independent variable, wherein the segment head offset is the offset of the target independent variable relative to the segment head of the segment in which the target independent variable is located, and the item address is the address in the lookup table corresponding to the segment in which the target independent variable is located; and determining a function value corresponding to the argument to be calculated of the first target function based on the segment head offset, the table entry address and the lookup table.

It should be noted that, the data processing system provided in the embodiment of the present application, the data processing method, the data processing apparatus applied to the first processor, and the data processing apparatus applied to the second processor described above may be referred to correspondingly, and refer to the foregoing embodiments in detail, and are not repeated herein.

The embodiment of the application also provides data processing equipment applied to the first processor. Alternatively, fig. 6 is a block diagram showing a hardware structure of a data processing apparatus applied to the first processor, and referring to fig. 6, the hardware structure of the data processing apparatus applied to the first processor may include: at least one processor 601, at least one communication interface 602, at least one memory 603, and at least one communication bus 604;

in the embodiment of the present application, the number of the processor 601, the communication interface 602, the memory 603, and the communication bus 604 is at least one, and the processor 601, the communication interface 602, and the memory 603 complete communication with each other through the communication bus 604;

the processor 601 may be a central processing unit CPU, or an application Specific Integrated circuit asic, or one or more Integrated circuits configured to implement embodiments of the present invention, or the like;

the memory 603 may include a high-speed RAM memory, and may further include a non-volatile memory (non-volatile memory), etc., such as at least one disk memory;

wherein the memory 603 stores a program, and the processor 601 may call the program stored in the memory 603 for:

rewriting the first objective function with the argument range limited to a specified interval as a rewrite target, and using the rewritten function as a second objective function, wherein the specified interval is [2 ]Q,2G]Or [2 ]Q,2G) Or (2)Q,2G) Or (2)Q,2G]Q and G are integers, and G is more than or equal to Q;

dividing the second block section based on the power of 2 to obtain M block sections, wherein the mth block section in the M block sections is [2 ]Q+(m-1),2Q+m),M=G-Q;

By usingDividing each of the M blocks in a uniform segmentation mode, wherein the number N of the blocks obtained by dividing the mth block of the M blocksmSatisfies log2 (N)m) Is a positive integer;

and constructing a lookup table according to the final segmentation result of the independent variable interval so that the second processor determines a function value corresponding to the independent variable to be calculated of the first target function based on the lookup table.

Alternatively, the detailed function and the extended function of the program may be as described above.

The embodiment of the application also provides data processing equipment applied to the second processor. Alternatively, fig. 7 is a block diagram showing a hardware structure of a data processing apparatus applied to the second processor, and referring to fig. 7, the hardware structure of the data processing apparatus applied to the second processor may include: at least one processor 701, at least one communication interface 702, at least one memory 703 and at least one communication bus 704;

in the embodiment of the present application, the number of the processor 701, the communication interface 702, the memory 703 and the communication bus 704 is at least one, and the processor 701, the communication interface 702 and the memory 703 complete mutual communication through the communication bus 704;

the processor 701 may be a central processing unit CPU, or an application Specific Integrated circuit (asic), or one or more Integrated circuits configured to implement embodiments of the present invention, or the like;

the memory 703 may include a high-speed RAM memory, and may further include a non-volatile memory (non-volatile memory) or the like, such as at least one disk memory;

wherein the memory 703 stores a program, and the processor 701 may call the program stored in the memory 703, the program being configured to:

determining that the independent variable to be calculated of the first objective function corresponds to the independent variable in the second objective function, taking the determined independent variable as the target independent variable, wherein the second objective function is the first processor, limiting the range of the independent variable in a specified interval as a rewriting target, and performing the rewriting on the first objective functionRewriting the target function to obtain a specified interval of [2 ]Q,2G]Or [2 ]Q,2G) Or (2)Q,2G) Or (2)Q,2G]Q and G are integers, and G is more than or equal to Q;

determining a segment head offset and a table entry address corresponding to a target independent variable, wherein the segment head offset is the offset of the target independent variable relative to a segment head of a segment section in which the target independent variable is located, the segment section is a segment section contained in a final segmentation result of an independent variable section of a second target function, the final segmentation result is a plurality of segment sections obtained by dividing the second segment section by a first processor based on a power of 2 so as to obtain M segment sections, and dividing each segment section in the M segment sections in a uniform segmentation mode, wherein the table entry address is an address in a lookup table corresponding to the segment section in which the target independent variable is located, and the lookup table is a table constructed according to the final segmentation result of the independent variable section;

and determining a function value corresponding to the argument to be calculated of the first target function based on the segment head offset, the table entry address and the lookup table.

Alternatively, the detailed function and the extended function of the program may be as described above.

Embodiments of the present application further provide a readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the data processing method applied to the first processor is implemented as described above.

Alternatively, the detailed function and the extended function of the program may be as described above.

Embodiments of the present application also provide a readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the data processing method applied to the second processor is implemented as described above.

Alternatively, the detailed function and the extended function of the program may be as described above.

Finally, it is further noted that, herein, relational terms such as, for example, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.

The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:一种停电窗口期编排方法、系统、设备及介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!