Method, apparatus, computer device and storage medium for performing DFT

By executing the sub-transformations of DFT in a preset order and storing the output data, it solves the inefficiency problem caused by the disorder of input and output data in DFT processing, achieves more efficient memory-to-cache data copying, and improves DFT processing efficiency.

CN114254252BActive Publication Date: 2024-10-29HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011024504.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-25
Publication Date
2024-10-29
Estimated Expiration
2040-09-25

AI Technical Summary

Technical Problem

When performing DFT in the prior art, the input data or output data at each level after decomposition is often arranged out of order, which results in inefficiency when the computer device copies data from memory to cache, increases the amount of copied data in the calculation process, and reduces the processing time. efficiency.

Method used

By obtaining the scale value of the initial input data to be performed DFT, multiple sub-transformations of the DFT formula are executed in a preset order, and the index identifier of the output data is determined when each execution is completed and stored in the corresponding storage address to ensure that each level The input data calling order is from small to large index identifiers, maximizing the read cache hit rate of the initial input data and reducing the amount of data copied from the memory to the cache.

Benefits of technology

It effectively reduces the number of times and the amount of data copied from memory to cache, improves the efficiency of DFT processing, makes input data calls and memory addresses continuous, and improves the processing performance of computer equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114254252B_ABST
    Figure CN114254252B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a method, device, computer equipment and storage medium for performing DFT, which belongs to the field of computer technology. The method includes: obtaining the scale value of the initial input data to be subjected to discrete Fourier transform DFT; based on the stored execution data corresponding to the scale value, executing multiple sub-transformations corresponding to the DFT formula of the scale value in a preset execution order, and when each sub-transformation formula is executed, determining the index identifier of the output data of the sub-transformation formula currently executed, and storing the output data in the storage address corresponding to the index identifier of the output data, wherein the storage addresses corresponding to any two index identifiers with adjacent values ​​are adjacent storage addresses, and in the execution data, for each level other than the first level, the execution order between the sub-transformations in the level corresponds to the input data call order of the index identifier of the input data from small to large. The present application can improve the efficiency of DFT processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, computer device and storage medium for performing DFT. Background Art

[0002] Discrete Fourier Transform (DFT) is a very common technology in the computer field, which is used to convert discrete time domain data and discrete frequency domain data. Generally, when performing DFT, Fast Fourier Transform (FFT) technology is used to improve processing efficiency.

[0003] The Cooley-Tukey algorithm is a very common FFT algorithm. The algorithm uses the divide-and-conquer strategy to decompose a larger DFT formula (generally including time domain decomposition or frequency domain decomposition) into multiple smaller DFT formulas and complex multiplications of rotation factors (called sub-transformation formulas). These sub-transformation formulas are divided into multiple levels, each level includes several sub-transformation formulas, each level is executed in sequence, and each sub-transformation formula within the level is also executed in sequence. Multiple output data of the previous level will be used as multiple input data of the next level. FFT can greatly simplify the computational complexity of DFT and improve the computational efficiency of DFT.

[0004] In the process of implementing this application, the inventor found that the prior art has at least the following problems:

[0005] Whether it is time domain decomposition or frequency domain decomposition, the input data or output data of each level after decomposition is often arranged in disorder, that is, the calling order of input data or the output order of output data is not in the order of index identifiers. For example, after the DFT with a scale value of 8 is decomposed in the time domain, the calling order of the second-level input data is a0, a2, a1, a3, a4, a6, a5, a7, where 0, 2, 1, 3, 4, 6, 5, 7 are index identifiers. Because when a computer device copies data from memory to cache, it copies it in cache blocks (cachelines) as the data volume unit. For example, cachelines are 64 bytes. So every time the computer copies data from memory to cache, even if only 8 bytes of data are needed, 64 bytes of continuous data will be copied. In this way, if the order in which the computer device calls the input data is disordered, the amount of data copied from memory to cache during the entire calculation process will increase, thereby resulting in a relatively low efficiency of DFT processing. Summary of the invention

[0006] The embodiments of the present application provide a method, apparatus, computer device and storage medium for performing DFT, which can solve the problem of low efficiency of DFT processing. The technical solution is as follows:

[0007] In a first aspect, a method for performing DFT is provided, the method comprising: obtaining a scale value of initial input data to be subjected to discrete Fourier transform DFT; based on stored execution data corresponding to the scale value, executing multiple sub-transformations corresponding to the DFT formula of the scale value in a preset execution order, and determining an index identifier of output data of the sub-transformation formula currently executed when each sub-transformation formula is executed, and storing the output data in a storage address corresponding to the index identifier of the output data, wherein the multiple sub-transformations are divided into multiple levels, and the storage addresses corresponding to any two index identifiers with adjacent values ​​are adjacent storage addresses, and in the execution data, for each level other than the first level, the execution order between the sub-transformations in the level corresponds to an input data calling order that is an ascending order of the index identifiers of the input data; and determining the output data of each sub-transformation formula in the last level as the result data of performing DFT on the initial input data.

[0008] The technicians may pre-perform time domain decomposition or frequency domain decomposition on DFT formulas of different scale values ​​to obtain multi-level sub-transformation formulas, and then adjust the execution order of the decomposed sub-transformation formulas, and perform mapping transformation on the intermediate variables, so that for each level except the first level, the execution order between the sub-transformation formulas within the level corresponds to the input data calling order which is the order of the index identifier of the input data from small to large, to obtain the final multi-level sub-transformation formula, and then determine the execution data corresponding to the scale value based on the multi-level sub-transformation formula.

[0009] When performing DFT, the technician can operate the computer equipment to input the initial input data x=x0,…,x N-1 Alternatively, the technician performs initial settings on the computer equipment to obtain the real-time collected data. Every time a certain cycle length is reached, the data obtained within the current cycle length is used as the initial input data. After obtaining the initial input data, the scale value of the initial input data can be obtained. The scale value can be obtained by analyzing the length of the initial input data, or it can be set in advance by the technician. Then, the execution data corresponding to the scale value of the initial input data can be found in the execution data corresponding to each stored scale value, and then the execution data is executed. After each sub-transformation is executed, the output data is stored at the storage address corresponding to the index identifier. The index identifiers corresponding to the continuously arranged storage addresses are arranged from small to large. In this way, it can be ensured that the intermediate data is called continuously according to the storage address when it is called as input data. The processing efficiency of DFT can be improved.

[0010] In a possible implementation, in the execution data, sub-transformations with the same rotation factors in each level are executed continuously.

[0011] In this way, when a sub-transformation is executed, its rotation factor is copied from the memory to the cache. When the next sub-transformation is executed, the rotation factor used is likely to be the same as the rotation factor of the previous sub-transformation. This means that the rotation factor can be read directly from the cache with a high probability, eliminating the need to re-copy the rotation factor from the memory to the cache, thereby improving processing efficiency.

[0012] In a possible implementation, in the execution data, for each level, the superscript of the rotation factor of the sub-transform formula in the previous execution order within the level is less than or equal to the superscript of the rotation factor of the sub-transform formula in the next execution order.

[0013] When storing the rotation factors, the rotation factors can be stored continuously in the memory in the order of the rotation factor superscripts from small to large. Moreover, based on the above-mentioned characteristics of the execution data, when each level executes each sub-transformation, the calling order of the rotation factors is in the order of the superscripts from small to large, so that when the previous rotation factor is copied from the memory to the cache when executing a sub-transformation, the next one or more rotation factors will be copied to the cache. In this way, when the next rotation factor is needed for the execution of the subsequent sub-transformation, it can be directly read in the cache without copying the rotation factor from the memory again, which can improve the processing efficiency.

[0014] In one possible implementation, in the execution data, for any input bit, the index identifier of the input data of the any input bit of the sub-transformation formula that is executed earlier in the first stage is smaller than the index identifier of the input data of the any input bit of the sub-transformation formula that is executed later in the first stage.

[0015] In a possible implementation, in the execution data, for any input bit, the index identifiers of two sub-transformations adjacent in the execution order within the first stage in the input data of the any input bit are numerically continuous.

[0016] After the scale value is determined, in the sub-transformation formula corresponding to the scale value, the offset values ​​between the index identifiers of the input data of different input bits in different sub-transformations of the first level are fixed. The above arrangement method can maximize the read cache hit rate of the initial input data and improve processing efficiency while maintaining this feature.

[0017] In one possible implementation, in the execution data, for any output bit, the index identifier of the output data of the any output bit of the sub-transformation formula that is executed earlier in the last level is smaller than the index identifier of the output data of the any output bit of the sub-transformation formula that is executed later in the last level.

[0018] In a possible implementation, in the execution data, for any output bit, the index identifiers of the output data of the any output bit of two sub-transformations adjacent in the execution order within the last level are numerically continuous.

[0019] After the scale value is determined, in the sub-transformation formula corresponding to the scale value, the offset values ​​between the index identifiers of the output data of different input bits in different sub-transformations of the last level are fixed. The above arrangement can maximize the processing efficiency while maintaining this feature.

[0020] In a possible implementation, obtaining the scale value of the initial input data to be subjected to discrete Fourier transform DFT includes: obtaining the scale value of the time domain audio data to be filtered; determining the output data of each sub-transformation formula in the last stage as the result data of performing DFT on the initial input data includes: determining the output data of each sub-transformation formula in the last stage as the frequency domain audio data corresponding to the time domain audio data; the method also includes: filtering the frequency domain audio data.

[0021] The time domain audio data is subjected to DFT according to the above processing method to obtain the frequency domain audio data, and then the frequency domain audio data is filtered. For example, the data in a preset high frequency band can be filtered out to achieve noise reduction, or the data in different frequency bands can be attenuated or enhanced in different proportions to achieve audio special effects processing, and so on.

[0022] In a second aspect, a device for performing DFT is provided, the device comprising at least one module, and the at least one module is used to implement the method for performing DFT provided in the first aspect.

[0023] According to a third aspect, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, and the instruction is loaded and executed by the processor to implement the method provided in the first aspect.

[0024] In a fourth aspect, a computer-readable storage medium is provided, comprising instructions, which, when the computer-readable storage medium is run on a destination server, enables the destination server to execute the method provided in the first aspect.

[0025] In a fifth aspect, a computer program product comprising instructions is provided. When the computer program product is run on a destination server, the destination server executes the method provided in the first aspect.

[0026] The beneficial effects of the technical solution provided by the embodiment of the present application are:

[0027] In the embodiment of the present application, the execution data is obtained based on the scale value of the initial input data, and the corresponding sub-transformation formula is executed based on the execution data. The storage addresses corresponding to any two index identifiers with adjacent values ​​are adjacent storage addresses. In the execution data, for each level other than the first level, the execution order between the sub-transformations in the level corresponds to the input data calling order which is the order of the index identifiers of the input data from small to large. In this way, when the output data is stored, the storage address is continuous according to the order of the index identifiers, and the calling order of the input data after the first level is also according to the order of the index identifiers. In this way, when each level after the first level executes the sub-transformation formula, the input data is called continuously according to the memory address, which can effectively reduce the number of times the data is copied from the memory to the cache, reduce the amount of copied data, and improve the efficiency of DFT processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 It is a schematic diagram of the structure of each processing layer inside a computer device provided in an embodiment of the present application;

[0029] Figure 2 It is a schematic diagram of the structure of internal components of a computer device provided in an embodiment of the present application;

[0030] Figure 3 This is a diagram of a butterfly network structure before adjustment provided in an embodiment of the present application;

[0031] Figure 4 It is a schematic diagram of a variable mapping relationship provided in an embodiment of the present application;

[0032] Figure 5 This is an adjusted butterfly network structure diagram provided in an embodiment of the present application;

[0033] Figure 6 is a flowchart of a method for performing DFT provided in an embodiment of the present application;

[0034] Figure 7 It is a structural diagram of a device for performing DFT provided in an embodiment of the present application. DETAILED DESCRIPTION

[0035] An embodiment of the present application provides a method for performing DFT, which can be implemented by a computer device, and the computer device can be a hardware platform including a general-purpose processor, such as an embedded device, a general-purpose computer, or a server. The server mentioned here can be a single server or a server group composed of multiple servers. Computer devices can be used to perform high-performance computing (HPC). In the HPC field, there are a large number of DFT operations, and the specific fields involved may be quantum physics, spectral analysis, oil exploration, earthquake prediction, weather forecast, medical fault diagnosis, etc. In addition, FFT is also used as one of the seven benchmarks in the HPC Challenge Benchmark (HPCC) to detect the HPC performance of the device. Figure 1 As shown, the functions involved in the DFT operation are stored in the math library under the acceleration library used by the compiler, which is located between the underlying hardware platforms and the upper layer application. The embodiment of the present application implements the DFT operation process through an improved FFT.

[0036] The computer device may include a processor 210 and a memory 220, wherein the processor 210 and the memory 220 are connected. Figure 2 As shown. The processor 210 is used to obtain the scale value of the initial input data to be subjected to discrete Fourier transform DFT; based on the execution data corresponding to the scale value stored in the memory 220, execute multiple sub-transformations corresponding to the DFT formula of the scale value in a preset execution order, and when each sub-transformation formula is executed, determine the index identifier of the output data of the sub-transformation formula currently executed, and store the output data to the storage address corresponding to the index identifier of the output data, wherein the multiple sub-transformations are divided into multiple levels, and the storage addresses corresponding to any two index identifiers with adjacent values ​​are adjacent storage addresses. In the execution data, for each level other than the first level, the execution order between the sub-transformations in the level corresponds to the input data calling order of the index identifier of the input data from small to large; determine the output data of each sub-transformation in the last level as the result data of performing DFT on the initial input data. The memory 220 can be used to store the execution data corresponding to different scale values, store the output data of each sub-transformation in each level as the input data of each sub-transformation in the next level, and the output data of the last level as the final result data of DFT. The processor 210 may be a central processing unit (CPU). The memory may include a memory, a cache or a hard disk.

[0037] The DFT processing process in the embodiment of the present application is described in detail below in conjunction with the specific implementation method. First, the execution principle of the embodiment of the present application is described, and the preparatory work before executing DFT is introduced.

[0038] According to the definition of discrete Fourier transform, for a complex sequence x of length N, where x = x0, ..., x N-1 , after DFT, we get a complex sequence X of length N, where X = X0,…,X N-1 , this length is the scale value, and the calculation formula is:

[0039]

[0040] When the scale value of the input data is an integer power of 2, the above operation can be decomposed into a combination of a series of DFT operations with an input data scale value of 2 according to the Cooley-Tukey algorithm.

[0041] To facilitate understanding, here we take the DFT operation with an input data scale value of 8 as an example to explain in detail how to improve the Cooley-Tukey algorithm.

[0042] First, we expand the DFT formula with a scale value of 8 into:

[0043]

[0044]

[0045]

[0046]

[0047]

[0048]

[0049]

[0050]

[0051] For the DFT formula with a scale value of 2, the formula is expanded as follows:

[0052]

[0053]

[0054] Time domain extraction and frequency domain extraction are general ways to decompose the DFT formula in the Cooley-Tukey algorithm. The embodiment of the present application uses time domain extraction as an example for explanation. The case of frequency domain extraction is similar and will not be repeated here. Through the Cooley-Tukey algorithm, the DFT formula with a scale value of 8 is extracted in the time domain and decomposed step by step to obtain a series of sub-transformation formulas. Each sub-transformation formula is a complex multiplication of a DFT formula with a scale value of 2 and a rotation factor. We represent the input data as x0-x7, the output data as X0-X7, the temporary variables of the middle two levels as a0-a7, b0-b7, and the entire calculation process is represented by a butterfly network, as shown in Figure 3 As shown in the figure, each dotted box represents a section, each level is called a stage, and a section contains multiple butterflies. For example, in the first stage, there are 4 sections, each with a butterfly, and in the second stage, there are 2 sections, each with 2 butterflies. The distribution of butterflies between different sections in the same stage is completely symmetrical, and the rotation factors of butterflies in the same position are also exactly the same. Figure 3 It can be seen that the calculation process after decomposition is:

[0055] First level:

[0056]

[0057]

[0058]

[0059]

[0060] Level 2:

[0061]

[0062]

[0063]

[0064]

[0065] Level 3:

[0066]

[0067]

[0068]

[0069]

[0070] It can be seen that the original Cooley-Tukey algorithm does not match the order of input data calls at each level with the order of data storage in the memory (that is, the input data needs to be accessed discretely), because when the computer copies data from the memory to the cache, it copies it in cacheline units. For example, if the cacheline is 64 bytes, then each time the computer copies data from the memory to the cache, even if only 8 bytes of data are needed, 64 bytes of data will be copied continuously. In this way, if the order of input data calls of the computer device does not match the order of data storage in the memory, each time data is copied from the memory to the cache, a lot of data will be copied and cannot be used, which will increase the amount of data copied from the memory to the cache during the entire calculation process, thereby resulting in a relatively low efficiency of DFT processing. If the order of input data calls of the computer device matches the order of data storage in the memory, then all data copied from the memory to the cache each time will not be used, which can effectively reduce the number of data copies.

[0071] For example, the order in which data is stored in memory is a0, a1, a2, a3, a4, a5, a6, a7, and the order in which input data is called is a0, a4, ..., and the size of cacheline is 4 times that of a single data. When a0 is called, data is copied from memory to cache, and a0, a1, a2, a3 are copied. Then a4 will be called, and a4, a5, a6, a7 are copied. Obviously, a1, a2, a3 copied for the first time are not used. If the order in which input data is called is a0, a1, ..., then when a0 is called, data is copied from memory to cache, and a0, a1, a2, a3 are copied. Then a1 will be called. At this time, a1 is already in the cache, so there is no need to copy data from memory. In this way, the amount of copied data can be greatly reduced, and processing efficiency can be improved.

[0072] Computer memory access is divided into read operations and write operations. Read operations are blocking, while write operations are usually non-blocking, which means that they will not affect the normal pipeline operation of other subsequent computing operations.

[0073] So, let's take an example: in the scenario where multiple data are added by one and written back to the memory, in the case of a read miss cache and a write hit cache, the add-one operation will delay the subsequent write operation because the data cannot be copied from the memory to the cache in time. To explain the read miss cache, when the processor needs A, it will first read A from the cache. If not, it needs to copy A in the memory to the cache, which is a read miss. If A is in the cache, this is a read hit. To explain the write hit, after the processor calculates the new value of A, it will search for A in the cache. If A is in the cache, the value of A in the cache will be updated to the new value, which is a write hit. If A is not in the cache, the new value of A will be sent to the memory for update. Let's look at this example step by step. In the first step, reading A does not hit the cache. At this time, it is necessary to request the value of A from the memory. In the second step, the process of adding 1 to A requires waiting for the memory to return the value of A. It can be seen that there is a delay in this step. In the third step, the new value of A is written and hits the cache. In the fourth step, reading B does not hit the cache. At this time, it is necessary to request the value of A from the memory. In the fifth step, the process of adding 1 to B requires waiting for the memory to return the value of B. It can be seen that there is a delay in this step. In the sixth step, the new value of B is written and hits the cache.

[0074] In this example, steps 2 and 5 are obviously delayed because the read operations miss the cache.

[0075] Let's take another example: in the scenario where multiple data are incremented by one and written back to the memory, if the read hits the cache and the write misses the cache, the write operation cannot be completed in time but will not block subsequent read operations. Let's look at this example step by step. The first step is to read A and hit the cache. The second step is to add 1 to A. The third step is to write A and miss the cache. The fourth step is to read B and hit the cache. Because writing a new value of A to the memory does not affect the subsequent reading of B, the reading of B will not be delayed. The fifth step is to add 1 to B. The third step is to write B and miss the cache. Because writing a new value of B to the memory does not affect the subsequent reading of other data, the reading of other subsequent data will not be delayed.

[0076] In order to solve the problem of low DFT execution efficiency caused by discrete data access, we will make certain adjustments to the execution order of each level of neutron transformation and the location of data storage, so that each intermediate level can access the input data as continuously as possible when reading it, that is, the input data call order matches the data storage order in the memory.

[0077] First, we make some adjustments to the execution order so that the sub-transformations with the same rotation factors are executed in adjacent order, such as Figure 3As shown, the adjustment method can be: first calculate the sub-transformation formula corresponding to the butterfly at the same position in different sections, and then traverse according to the internal order of the section. Figure 3 For the second level in the , first execute the sub-transformation formula corresponding to the butterfly at the first position of section1, then execute the sub-transformation formula corresponding to the butterfly at the first position of section2, then execute the sub-transformation formula corresponding to the butterfly at the second position of section1, and finally execute the sub-transformation formula corresponding to the butterfly at the second position of section2. Because the distribution of butterflies in each section within the level is symmetrical, the first position of section1 and the first position of section2 can be considered to be the same position, and their rotation factors are the same. Optionally, the traversal order within the section can be in the order of the rotation factor superscript from small to large. In addition, for a level with multiple sections, when sorting the sub-transformations corresponding to the butterflies at the same position in multiple sections, they can be arranged in ascending order according to the index identifier of the input data of the corresponding input bit.

[0078] The adjusted execution order is as follows:

[0079] First level:

[0080]

[0081]

[0082]

[0083]

[0084] Level 2:

[0085]

[0086]

[0087]

[0088]

[0089] Level 3:

[0090]

[0091]

[0092]

[0093]

[0094] Next, we can consider making some adjustments so that during the execution of each sub-transformation formula at each level except the first level, the order of input data calls is in the order of the index identifiers of the input data. In this way, as long as we store the output data of the previous level in the order of the index identifiers when storing the output data segment of the previous level, the input data call order can match the storage order of the output data of the previous level. According to the execution order of the above sub-transformations, it can be seen that the input data of the second level is called in the order of [a0, a2], [a4, a6], [a1, a3], [a5, a7]. To ensure the continuity of the calculation, we remap a0-a7 to c0-c7 to ensure that it is finally called in the order of [c0, c1], [c2, c3], [c4, c5], [c6, c7]. Similarly, the input of the third level also remaps b0-b7 to d0-d7. The corresponding mapping relationship is as follows: Figure 4 shown.

[0095] The final sub-transformations and their corresponding execution order after mapping adjustment are as follows:

[0096] First level:

[0097]

[0098]

[0099]

[0100]

[0101] Level 2:

[0102]

[0103]

[0104]

[0105]

[0106] Level 3:

[0107]

[0108]

[0109]

[0110]

[0111] The final adjusted butterfly network structure is as follows Figure 5shown.

[0112] Based on the sub-transformation formulas and execution order of each level, we can establish the execution data of each level, and form the execution data of the entire DFT processing in the order of the levels. This execution data is stored in correspondence with the scale value of the DFT input data. In this way, when performing DFT processing of a certain scale value, the corresponding execution data can be called to perform DFT processing. The execution data here has many possible forms, and some possible forms are listed below:

[0113] In form one, the execution data is the execution program code, which is executed in a loop. Each loop executes a sub-transformation formula. In the next loop, the index value of the input data, the index value of the output data, the superscript of the rotation factor and other parameters are offset and adjusted to obtain the next sub-transformation formula and execute it.

[0114] In the second form, the execution data is the execution program code, which includes the execution code of each sub-transformation executed sequentially.

[0115] Form three, the execution data includes execution parameter information and an execution code framework. The execution parameter information includes the index value of the input data, the index value of the output data, the superscript of the rotation factor, etc. of each sub-transformation formula. During execution, the sub-transformation formulas can be executed in the execution order. When a sub-transformation formula does not need to be executed, the index value of the input data, the index value of the output data, the superscript of the rotation factor and other parameters corresponding to the sub-transformation formula are obtained from the execution parameter information, added to the position corresponding to each parameter specified in the execution code framework, the execution code of the sub-transformation formula is obtained, and the execution code is executed.

[0116] If we use binary to represent the index of input and output data at each level, the above sub-transformations can be expressed as:

[0117] First level:

[0118]

[0119]

[0120]

[0121]

[0122] Level 2:

[0123]

[0124]

[0125]

[0126]

[0127] Level 3:

[0128]

[0129]

[0130]

[0131]

[0132] We represent the index identifier of the initial input data in binary as [N2, N1, N0] (N0 is the lowest bit, N2 is the highest bit). It can be seen that in each sub-transformation of the first level, the index identifier of the output data exchanges the lowest bit and the middle bit relative to the index identifier of the input data at the corresponding position, that is, it can be expressed as [N2, N0, N1]. For example, the index identifier of the first input data of the second sub-transformation of the first level is 001, and the index identifier of the first output data is 010. Obviously, the latter is obtained by exchanging the lowest bit and the middle bit of the former. Similarly, the index identifier of the output data of the second level is cyclically right-shifted by one bit relative to the index identifier of the input data of this level, that is, [N2, N0, N1] is cyclically right-shifted by one bit, which can be expressed as [N1, N2, N0]. The index identifier of the third-level output data is also cyclically shifted right by one bit relative to the index identifier of the input data of this level, that is, [N1, N2, N0] is cyclically shifted right by one bit, which can be expressed as [N0, N1, N2], which is exactly the bit flip order relative to the index identifier of the initial input data. Based on the above analysis, when the execution data is in the above-mentioned form 1, when establishing the execution data, the index identifier of the output data can be transformed by the index identifier of the input data.

[0133] For input data of arbitrary scale value, the multi-level sub-transformation formula obtained by decomposing the Cooley-Tukey algorithm can also be adjusted in a similar manner as described above. In this case, the size of the butterfly basis obtained by decomposition (i.e., the scale value of the butterfly input data) can be of arbitrary size.

[0134] Generally speaking, for an FFT operation with an input data size of N, it is decomposed into n factors f0~f n-1 , so that f0*f1*f2*…*f n-1 =N, which corresponds to the calculation of the n-level butterfly network.

[0135] Based on the time domain extraction, a mixed-basis butterfly network is obtained (the basis size of the basis butterfly is not fixed). We use sn to represent the number of sections at the xth level, bn to represent the number of butterflies in a single section at the xth level, and fx represents the size of the butterfly at the xth level (x ranges from 0 to n-1, x=0 corresponds to the first level), then:

[0136] sn=f0*f1*f2*…*f x-1

[0137] bn=f x+1 *f x+2 *f x+3 *…*f n-1

[0138] The final data size is sn*bn*f x =N, which is the scale value of the input data.

[0139] Thus, according to the above method, the DFT expression of any scale value is first decomposed in the time domain or frequency domain, and then the sub-transform expressions are rearranged according to the principles described in the above embodiment. The principle of rearrangement is: first calculate the sub-transform expressions corresponding to the butterflies at the same position of different sections, and then traverse them in the order within the section. The C code can be roughly expressed as follows (where bufferfly(fx) is a single butterfly operation):

[0140]

[0141] The subsequent process of adjusting the sub-transformation formula by means of variable mapping is similar to the above and will not be repeated here.

[0142] For DFT of arbitrary scale value, the following is a way to represent index identifier:

[0143] We denote the index of input data or output data as [a n-1 , a n-2 , …, a1, a0], which is equivalent to an n-dimensional matrix, a0 is the lowest dimension, a n-1 is the highest dimension, and data is stored continuously from low dimension to high dimension. For any dimension a j , a j The value range of satisfies the condition 0<=a j <f j For example, for N=4*5*6=120, the index mark of the input data can be expressed as [a2, a1, a0], where the value of the index mark of any input data must satisfy 0<=a2<4, 0<=a1<5, 0<=a0<6.

[0144] For the above example, the entire butterfly network with input data size N = 120 is decomposed into 3 levels. Since there is more than one specific decomposition method, assume that the first level has sn = 4 * 5 = 20 sections, bn = 1, fx =6; the second level has sn = 4 sections, bn = 6, f x =5; the third level has sn = 1 section, bn = 6*5 = 30, f x =4. So we can:

[0145] The index identifier of the first-level input data is represented as [bi, si, fi], where 0 <= bi <bn=1,0<=si<sn=20,0<=fi<f x =6;

[0146] The index identifier of the second-level input data is represented as [bi, si, fi], where 0 <= bi <bn=6,0<=si<sn=4,0<=fi<f x =5;

[0147] The index identifier of the third-level input data is represented as [bi, si, fi], where 0 <= bi <bn=30,0<=si<sn=1,0<=fi<f x =4.

[0148] When data is stored according to the index identifiers defined in the above manner, taking the second level as an example, the order of the index identifiers of each data stored in the consecutive storage addresses can be: [b0, s0, f1], [b0, s0, f2], …, [b0, s0, f5], [b0, s1, f0], [b0, s1, f1], …, [b0, s1, f5], …, [b0, s3, f5], [b1, s0, f0], …, [b4, s3, f5].

[0149] After storing the input data at each level, when calculating at each level, since fi is always in the lowest bit, the f of each butterfly is read when reading the input data. x The input data are stored continuously, and the calling order of the input data is also carried out according to the above index identification order, which can just ensure that the data can be accessed completely continuously from front to back.

[0150] The above content has elaborated on the decomposition of DFT formula, the adjustment of sub-transform formula and the determination of execution data. The following will describe the process of performing DFT processing based on the execution data corresponding to the stored different scale values. The corresponding processing can be as follows Figure 6 As shown, the following steps are included:

[0151] Step 601: Obtain the scale value of the initial input data to be subjected to DFT.

[0152] In implementation, the technician can operate the computer device to input the initial input data x=x0,…,x N-1Alternatively, the technician performs initial settings on the computer equipment to obtain real-time collected data, and when a certain cycle time is reached, the data obtained within the current cycle time is used as initial input data.

[0153] For example, when conducting oil exploration, a detection wave can be emitted below the stratum in the area to be surveyed, and an echo can be received. The echo is time domain data, and the time domain data can be the initial input data. For another example, when performing audio filtering, the time domain data of the audio detected by the microphone can be obtained as the initial input data. For another example, when performing image filtering, the time domain data of the image can be obtained as the initial input data.

[0154] After the initial input data is obtained, a scale value of the initial input data may be obtained. The scale value may be obtained by analyzing the length of the initial input data, or may be set in advance by a technician.

[0155] Step 602, based on the stored execution data corresponding to the scale value, execute multiple sub-transformations corresponding to the DFT formula of the scale value in a preset execution order, and when each sub-transformation is completed, determine the index identifier of the output data of the sub-transformation formula currently executed, and store the output data to the storage address corresponding to the index identifier of the output data.

[0156] Wherein, the plurality of sub-transformations are divided into multiple levels. The storage addresses corresponding to any two index identifiers with adjacent values ​​are adjacent storage addresses, and it can be set that, among the two index identifiers with adjacent values, the index identifier with a smaller value corresponds to the previous storage address, and the index identifier with a larger value corresponds to the later storage address. In the execution data, for each level except the first level, the execution order between the sub-transformations in the level corresponds to the input data calling order of the index identifiers of the input data from small to large.

[0157] In implementation, the computer device may initially input the execution data corresponding to the scale value of the data among the execution data corresponding to each scale value stored, and then execute the execution data. Different execution methods may be adopted for execution data in different forms. The execution methods corresponding to form one, form two, and form three have been respectively introduced in the above embodiments. Please refer to the relevant content above.

[0158] Here, it is explained that before executing DFT, the capacity of the memory required for each level of operation can be determined based on the scale value of the initial input data and the data volume of a single data, and a memory space of the corresponding capacity can be applied. After obtaining the output data, the output data can be stored in the storage address corresponding to its index identifier in this memory space. In this storage space, the index identifiers of the output data corresponding to multiple storage addresses from front to back are arranged from small to large. For example, the output data includes c0, c4, c2, c6, c1, c5, c3, and c7, which need to be stored in 8 storage locations in the storage space. The storage address corresponding to c0 is the storage address of the first storage location, the storage address corresponding to c4 is the storage address of the fifth storage location, and the storage address corresponding to c2 is the storage address of the third storage location, and so on. The implementation method of this storage method can be to set a certain offset for the storage address in the program code. For example, the storage address of c4 can be obtained by offsetting 4 unit capacities backward on the storage address of c0, and one unit capacity is the capacity for storing one output data.

[0159] Based on the above storage method, the output data of each level are arranged in the order of index identifiers from small to large when stored. Moreover, based on the process of determining each sub-transformation formula introduced in the above embodiment, it can be known that for each level other than the first level, the execution order between each sub-transformation formula in the level corresponds to the input data calling order which is the order of the index identifiers of the input data from small to large. It can be seen that for each level other than the first level, when calling the input data, the stored input data is called continuously according to the storage address, which can greatly reduce the amount of invalid data copied from the memory to the cache and improve the processing efficiency.

[0160] Optionally, in the execution data, sub-transformations with the same rotation factors in each level are executed consecutively.

[0161] The previous embodiment has been described accordingly. When determining the execution order of each sub-transformation formula, the sub-transformation formulas with the same rotation factor in each level are executed continuously. Please refer to the corresponding formula in the previous content. In this way, when executing a sub-transformation formula, its rotation factor is copied from the memory to the cache. When executing the next sub-transformation formula, the rotation factor used is likely to be the same as the previous sub-transformation formula. This is a high probability that the rotation factor can be read directly from the cache, so there is no need to re-copy the rotation factor from the memory to the cache, which can improve processing efficiency.

[0162] Optionally, in the execution data, for each level, the superscript of the rotation factor of the sub-transform formula in the previous execution order within the level is less than or equal to the superscript of the rotation factor of the sub-transform formula in the next execution order.

[0163] When storing the rotation factors, the rotation factors can be stored continuously in the memory in the order of the rotation factor superscripts from small to large. Moreover, based on the above-mentioned characteristics of the execution data, when each level executes each sub-transformation, the calling order of the rotation factors is in the order of the superscripts from small to large, so that when the previous rotation factor is copied from the memory to the cache when executing a sub-transformation, the next one or more rotation factors will be copied to the cache. In this way, when the next rotation factor is needed for the execution of the subsequent sub-transformation, it can be directly read in the cache without copying the rotation factor from the memory again, which can improve the processing efficiency.

[0164] Optionally, in the execution data, for any input bit, the index identifier of the input data of the sub-transformation formula that is in the previous execution order in the first level is smaller than the index identifier of the input data of the sub-transformation formula that is in the next execution order. Optionally, for any input bit, the index identifiers of the input data of the sub-transformation formula that is adjacent in the execution order in the first level are numerically continuous.

[0165] We can look at the final sub-transformations in the above embodiment. The input data of the first input bit in the sub-transformations of the first level are arranged in the order of execution as x0, x1, x2, x3, and the input data of the second input bit are arranged in the order of execution as x4, x5, x6, x7. Because the initial input data has the following characteristics, x0 and x4 must be in one sub-transformation, x1 and x5 must be in one sub-transformation, x1 and x5 must be in one sub-transformation, x2 and x6 must be in one sub-transformation, and x3 and x7 must be in one sub-transformation. Therefore, the above arrangement can maximize the read cache hit rate of the initial input data and improve processing efficiency while maintaining this characteristic.

[0166] Optionally, in the execution data, for any output bit, the index identifier of the output data of the output bit of the sub-transformation formula that is in the previous execution order in the last level is smaller than the index identifier of the output data of the output bit of the sub-transformation formula that is in the next execution order. Optionally, for any output bit, the index identifiers of the output data of the output bit of two sub-transformations that are adjacent in execution order in the last level are numerically continuous.

[0167] It can be seen from the final sub-transformations in the above embodiment that the output data of the first output bit in the sub-transformations of the last level are arranged in the order of execution as X0, X1, X2, and X3, and the output data of the second output bit are arranged in the order of execution as X4, X5, X6, and X7. Because the initial output data has the following characteristics, X0 and X4 must be in one sub-transformation, X1 and X5 must be in one sub-transformation, X1 and X5 must be in one sub-transformation, X2 and X6 must be in one sub-transformation, and X3 and X7 must be in one sub-transformation. Therefore, the above arrangement can maximize the processing efficiency while maintaining this characteristic.

[0168] Step 603: determine the output data of each sub-transformation in the last stage as the result data of performing DFT on the initial input data.

[0169] For example, when conducting oil exploration, the time domain data of the above echo is the initial input data, and the result data obtained by performing the above process processing on the time domain data is the frequency domain data of the echo, and then the frequency domain data can be input into the oil burial analysis model to obtain oil burial related data, such as depth, reserves, location, etc. For another example, when performing audio filtering processing, the time domain data of the above audio is the initial input data, and the result data obtained by performing the above process processing on the time domain data is the frequency domain data of the audio, and then the frequency domain data can be filtered, such as filtering out noise data in a preset high frequency band. For another example, when performing image filtering processing, the time domain data of the above image is the initial input data, and the result data obtained by performing the above process processing on the time domain data is the frequency domain data of the image, and then the frequency domain data can be filtered, such as filtering out the data in the preset high frequency band to blur the image, and strengthening the data in the preset high frequency band to sharpen the image.

[0170] In the embodiment of the present application, the execution data is obtained based on the scale value of the initial input data, and the corresponding sub-transformation formula is executed based on the execution data. The storage addresses corresponding to any two index identifiers with adjacent values ​​are adjacent storage addresses. In the execution data, for each level other than the first level, the execution order between the sub-transformations in the level corresponds to the input data calling order which is the order of the index identifiers of the input data from small to large. In this way, when the output data is stored, the storage address is continuous according to the order of the index identifiers, and the calling order of the input data after the first level is also according to the order of the index identifiers. In this way, when each level after the first level executes the sub-transformation formula, the input data is called continuously according to the memory address, which can effectively reduce the number of times the data is copied from the memory to the cache, reduce the amount of copied data, and improve the efficiency of DFT processing.

[0171] Based on the same technical concept, the embodiment of the present application also provides a device for performing DFT, which can be applied to the computer device provided in the above embodiment, such as Figure 7 As shown, the device comprises:

[0172] The acquisition module 710 is used to acquire the scale value of the initial input data to be subjected to discrete Fourier transform DFT; specifically, it can implement the acquisition function mentioned above, as well as other implicit steps.

[0173] The execution module 720 is used to execute multiple sub-transformations corresponding to the DFT formula of the scale value in a preset execution order based on the stored execution data corresponding to the scale value, and determine the index identifier of the output data of the sub-transformation formula currently executed when each sub-transformation formula is executed, and store the output data to the storage address corresponding to the index identifier of the output data, wherein the multiple sub-transformations are divided into multiple levels, and the storage addresses corresponding to any two index identifiers with adjacent values ​​are adjacent storage addresses. In the execution data, for each level other than the first level, the execution order between the sub-transformations in the level corresponds to the input data calling order of the index identifiers of the input data from small to large; specifically, the above-mentioned execution function and other implicit steps can be realized.

[0174] The determination module 730 is used to determine the output data of each sub-transformation in the last stage as the result data of performing DFT on the initial input data; specifically, it can implement the determination function mentioned above and other implicit steps.

[0175] Optionally, in the execution data, sub-transformations with the same rotation factors in each level are executed continuously.

[0176] Optionally, in the execution data, for each level, the superscript of the rotation factor of the sub-transform formula in the previous execution order within the level is less than or equal to the superscript of the rotation factor of the sub-transform formula in the next execution order.

[0177] Optionally, in the execution data, for any input bit, the index identifier of the input data of the any input bit of the sub-transformation formula that is executed earlier in the first level is smaller than the index identifier of the input data of the any input bit of the sub-transformation formula that is executed later in the first level.

[0178] Optionally, in the execution data, for any input bit, the index identifiers of two sub-transformations adjacent in the execution order within the first stage in the input data of the any input bit are numerically continuous.

[0179] Optionally, in the execution data, for any output bit, the index identifier of the output data of the any output bit of the sub-transformation formula that is executed earlier in the last level is smaller than the index identifier of the output data of the any output bit of the sub-transformation formula that is executed later in the last level.

[0180] Optionally, in the execution data, for any output bit, the index identifiers of the output data of the any output bit of two sub-transformations adjacent in the execution order within the last level are numerically continuous.

[0181] Optionally, the acquisition module is used to:

[0182] Obtaining the scale value of the time-domain audio data to be filtered;

[0183] The determining module is used to:

[0184] Determine the output data of each sub-transformation formula in the last stage as the frequency domain audio data corresponding to the time domain audio data;

[0185] The device also includes a filtering module, which is used to:

[0186] The frequency domain audio data is filtered.

[0187] It should be noted that the acquisition module 710, the execution module 720 and the determination module 730 may be implemented by a processor, or by a processor in conjunction with a memory.

[0188] In the embodiment of the present application, the execution data is obtained based on the scale value of the initial input data, and the corresponding sub-transformation formula is executed based on the execution data. The storage addresses corresponding to any two index identifiers with adjacent values ​​are adjacent storage addresses. In the execution data, for each level other than the first level, the execution order between the sub-transformations in the level corresponds to the input data calling order which is the order of the index identifiers of the input data from small to large. In this way, when the output data is stored, the storage address is continuous according to the order of the index identifiers, and the calling order of the input data after the first level is also according to the order of the index identifiers. In this way, when each level after the first level executes the sub-transformation formula, the input data is called continuously according to the memory address, which can effectively reduce the number of times the data is copied from the memory to the cache, reduce the amount of copied data, and improve the efficiency of DFT processing.

[0189] It should be noted that: the device for performing DFT provided in the above embodiment only uses the division of the above functional modules as an example when performing DFT. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device for performing DFT is divided into different functional modules to complete all or part of the functions described above. In addition, the device for performing DFT provided in the above embodiment and the method embodiment for performing DFT belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0190] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the device, the process or function described in the embodiment of the present application is generated in whole or in part. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by the device or a data storage device such as a server or data center that includes one or more available media integration. The available medium can be a magnetic medium (such as a floppy disk, a hard disk and a tape, etc.), or an optical medium (such as a digital video disk (Digital Video Disk, DVD), etc.), or a semiconductor medium (such as a solid-state hard disk, etc.).

[0191] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

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

Claims

1. A method for performing DFT, characterized in that The method comprises: Obtaining the scale value of the initial input data to be subjected to discrete Fourier transform DFT; Based on the stored execution data corresponding to the scale value, multiple sub-transformations corresponding to the DFT formula of the scale value are executed in a preset execution order, and when each sub-transformation is completed, the index identifier of the output data of the sub-transformation currently executed is determined, and the output data is stored in a storage address corresponding to the index identifier of the output data, wherein the multiple sub-transformations are divided into multiple levels, and the storage addresses corresponding to any two index identifiers with adjacent values ​​are adjacent storage addresses. In the execution data, for each level other than the first level, the execution order between the sub-transformations in the level corresponds to the input data calling order of the index identifiers of the input data from small to large; The output data of each sub-transformation formula in the last stage is determined as the result data of performing DFT on the initial input data.

2. The method according to claim 1, characterized in that In the execution data, sub-transformations with the same rotation factors in each level are executed consecutively.

3. The method according to claim 1, characterized in that In the execution data, for each level, the superscript of the rotation factor of the sub-transform equation in the previous execution order within the level is less than or equal to the superscript of the rotation factor of the sub-transform equation in the next execution order.

4. The method according to claim 1, characterized in that: In the execution data, for any input bit, the index identifier of the input data of the sub-transformation formula that is executed earlier in the first stage is smaller than the index identifier of the input data of the sub-transformation formula that is executed later in the first stage.

5. The method according to claim 4, characterized in that In the execution data, for any input bit, the index identifiers of two sub-transformations adjacent in the execution order within the first stage in the input data of the any input bit are numerically continuous.

6. The method according to claim 1, characterized in that In the execution data, for any output bit, the index identifier of the output data of the sub-transformation formula in the previous execution order in the last level in the output data of the output bit is smaller than the index identifier of the output data of the sub-transformation formula in the next execution order in the output data of the output bit.

7. The method according to claim 6, characterized in that In the execution data, for any output bit, the index identifiers of the output data of the any output bit of two sub-transformations adjacent in the execution order within the last level are numerically continuous.

8. The method according to any one of claims 1 to 7, characterized in that: The step of obtaining the scale value of the initial input data to be subjected to discrete Fourier transform DFT comprises: Obtaining the scale value of the time-domain audio data to be filtered; The step of determining the output data of each sub-transformation in the last stage as the result data of performing DFT on the initial input data comprises: Determine the output data of each sub-transformation formula in the last stage as the frequency domain audio data corresponding to the time domain audio data; The method further comprises: The frequency domain audio data is filtered.

9. An apparatus for performing DFT, characterized in that The device comprises: An acquisition module, used for acquiring a scale value of initial input data to be subjected to a discrete Fourier transform DFT; an execution module, configured to execute, based on the stored execution data corresponding to the scale value, a plurality of sub-transformations corresponding to the DFT formula of the scale value in a preset execution order, and determine the index identifier of the output data of the sub-transformation formula currently executed when each sub-transformation formula is executed, and store the output data in a storage address corresponding to the index identifier of the output data, wherein the plurality of sub-transformations are divided into multiple levels, and the storage addresses corresponding to any two index identifiers with adjacent values ​​are adjacent storage addresses, and in the execution data, for each level other than the first level, the execution order between the sub-transformations in the level corresponds to the input data calling order of the index identifiers of the input data from small to large; The determination module is used to determine the output data of each sub-transformation formula in the last stage as the result data of performing DFT on the initial input data.

10. The device according to claim 9, characterized in that In the execution data, sub-transformations with the same rotation factors in each level are executed consecutively.

11. The device according to claim 9, characterized in that In the execution data, for each level, the superscript of the rotation factor of the sub-transform equation in the previous execution order within the level is less than or equal to the superscript of the rotation factor of the sub-transform equation in the next execution order.

12. The device according to claim 9, characterized in that In the execution data, for any input bit, the index identifier of the input data of the sub-transformation formula that is executed earlier in the first stage is smaller than the index identifier of the input data of the sub-transformation formula that is executed later in the first stage.

13. The device according to claim 12, characterized in that In the execution data, for any input bit, the index identifiers of two sub-transformations adjacent in the execution order within the first stage in the input data of the any input bit are numerically continuous.

14. The device according to claim 9, characterized in that In the execution data, for any output bit, the index identifier of the output data of the sub-transformation formula in the previous execution order in the last level in the output data of the output bit is smaller than the index identifier of the output data of the sub-transformation formula in the next execution order in the output data of the output bit.

15. The device according to claim 14, characterized in that In the execution data, for any output bit, the index identifiers of the output data of the any output bit of two sub-transformations adjacent in the execution order within the last level are numerically continuous.

16. The device according to any one of claims 9 to 15, characterized in that: The acquisition module is used to: Obtaining the scale value of the time-domain audio data to be filtered; The determining module is used to: Determine the output data of each sub-transformation formula in the last stage as the frequency domain audio data corresponding to the time domain audio data; The device also includes a filtering module, which is used to: The frequency domain audio data is filtered.

17. A computer device, characterized in that: The computer device includes a processor and a memory, wherein at least one instruction is stored in the memory, and the instruction is loaded and executed by the processor to implement the operation performed by the method according to any one of claims 1 to 8.

18. A computer-readable storage medium, characterized in that: The computer-readable storage medium comprises instructions, which, when executed on a destination server, cause the destination server to execute the method of any one of claims 1 to 8.

Citation Information

Patent Citations

  • Data processing method and device based on DFT ( Discrete Fourier Transform)

    CN101794274A

  • Scientific computation-oriented high performance DMA (Direct Memory Access) part in GPDSP (General-Purpose Digital Signal Processor)

    CN105389277A