High-performance implementation method of FIR filter based on domestic many-core processor
By using parallel computing and data stream processing technology on domestic multi-core processors, the calculation process of FIR filters is optimized, and the calculation speed and performance are significantly improved.
Patent Information
- Application Number
- CN202111519880.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-13
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2041-12-13
AI Technical Summary
When domestic multi-core processors perform FIR filter calculations, the calculation speed is slow when the input data is large, and there is a performance bottleneck.
Using a high-performance FIR filter based on domestic multi-core processors, the analog signal is converted into analog-to-digital conversion, and data allocation and fast Fourier transformation are used to transmit to the computing core for parallel calculations, and single Instruction flow multi-data flow technology and flow scheduling design optimize data transmission and calculation process.
The calculation rate of large-point FIR filters on Shenweizhong core processors has been improved. Through the parallelism of parallel computing and data stream processing, the redundant calculation and data transmission overhead is reduced, and the algorithm execution speed is significantly improved.
Smart Images

Figure CN114237716B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of finite impulse response filters, and in particular to a high-performance implementation method of an FIR filter based on a domestic multi-core processor. Background Art
[0002] Digital filters are one of the most widely used algorithms in the field of digital signal processing. Due to their advantages such as strong stability, strict linear phase and easy hardware implementation, they have many applications in speech and image processing, multimedia applications, etc.
[0003] FIR filter calculation is the process of completing the convolution of the filter coefficient and the input signal. Since the input data length N is usually much larger than the filter coefficient length M, the overlap retention method can be used to solve the problem of waste of computing resources caused by direct convolution. According to the overlap retention method, the input data is divided into R blocks of size L. Each sub-block needs to add the last M-1 points of the previous sub-block, and perform a total of R single-block length F = L + M-1 FIR filter calculations (the first M-1 points of the first sub-block are all 0). According to the circular convolution theorem, the Fast Fourier Transform (FFT) of the circular convolution results of two sequences is equal to the product of the Fast Fourier Transform results of the two sequences. When the length of a single FIR filter is F, the conditions for the equivalence of linear convolution and circular convolution are met. Therefore, FFT calculation can be performed on the filter coefficients and each block of input data. The FFT results of the two sequences are then multiplied and the product is inversely discrete Fourier transformed to obtain the result of a single sub-block. Finally, the results of each sub-block are spliced together to obtain the complete output.
[0004] The Shenwei processor 26010 uses a 64-bit independent Shenwei instruction set, a full chip of 260 cores, a standard operating frequency of 1.5GHz, and a peak computing speed of 3.168TFLOPS. The Shenwei processor has four core groups, each with 1 control core and 64 computing cores. The storage space of a single core group is 8G bytes, and the local storage space of a single computing core is 16K bytes. Data can be transferred between core groups using the Message Passing Interface (MPI).
[0005] When performing FIR filter calculations, if the amount of input data is large, the calculation speed of the domestic Shenwei multi-core processor is slow, so a method is needed to solve the performance bottleneck of FIR filter calculations. Summary of the invention
[0006] The technical problem to be solved by the present invention is to provide a high-performance implementation method of FIR filter based on domestic multi-core processor, so as to solve the compatibility problem between digital signal processing function FIR filter and Shenwei multi-core processor, and improve the calculation rate of large-point FIR filter on Shenwei multi-core processor.
[0007] In order to solve the above technical problems, the present invention provides a high-performance implementation method of FIR filter based on a domestic many-core processor, wherein the domestic many-core processor includes four core groups, each core group has one control core and 64 computing cores, and includes the following steps:
[0008] S1, converting the analog signal into digital form to obtain input data, including filter coefficients h[M] of length M, where the input data length is N;
[0009] S2, using the control core to read the input data of step 1 and using the message passing interface MPI to distribute the input data to the four core groups, and adding M-1 zero values to the front end of the input data;
[0010] In the control core, the rotation factor W is calculated, the filter coefficient h[M] is padded to 128 points at the end, and then the fast Fourier transform FFT calculation is performed to obtain the result H. The rotation factor W and the fast Fourier transform FFT calculation result H are transmitted to all the computing cores using direct memory access DMA;
[0011] S3, in each core group, after dividing the input data of step S1 into R blocks of size L, add the last M-1 points of the previous sub-block, and then perform R times of FIR filter calculations with a single block length of F=L+M-1. The first M-1 points of the first sub-block are all 0, and the continuous 4*F point data are transmitted to each computing core in the input order; a total of M-1+4*L points of data are transmitted, including 4*L FIR filter calculation results of valid calculation input data; when all 64 computing cores in each core group successfully receive the data, the single round of data transmission is completed;
[0012] S4, after each computing core receives the single-round data transmitted in step 3, it starts to calculate the single-round FIR filter, and at the same time performs direct storage access DMA write-back of the previous round FIR filter result and direct storage access DMA read-in of the next round input data; after receiving the data, each computing core uses the single instruction stream multiple data stream SIMD technology to store the 4*F point data output in step 3 into the vector variable array, and then simultaneously performs 4 groups of fast Fourier transform FFT calculations, and then multiplies the input signal and the fast Fourier transform FFT result of the filter coefficient h[M], and then performs a discrete Fourier inverse transform to obtain the result of a single calculation; after the computing core in each core group completes the single-round FIR filter calculation, the first M-1 numbers of each sub-block of length F are discarded, and the output result y[4*L] is transmitted back to the control core using direct storage access DMA;
[0013] S5. Repeat the operations of step S3 and step S4 for the input data of step 1 until all the input data are processed. The calculation result y[4*L] of each round is stored in y[N] in the control core in sequence to obtain the final calculation result y[N] of the N-point filter.
[0014] As an improvement of the high performance implementation method of the FIR filter based on the domestic multi-core processor of the present invention:
[0015] The input data in step S3 is divided into R blocks of size L. In order to divide the FIR filter with a large number of points into multiple FIR filters with a small number of points of the same size, 256 computing cores are called to parallelly calculate the FIR filter with a small number of points. 128 points are selected as the length F of the small block FIR filter. The effective input data length processed by each FIR filter block with a length of F is L. The total number of blocks R for the input data division is determined by the amount of input data. The total number of rounds that the computing core needs to calculate is
[0016] As a further improvement of the high performance implementation method of the FIR filter based on the domestic multi-core processor of the present invention:
[0017] The four input data of length F in step S3 include 4*(M-1) data transmitted to avoid aliasing, and 4*L valid calculation input data FIR filter results.
[0018] As a further improvement of the high performance implementation method of the FIR filter based on the domestic multi-core processor of the present invention:
[0019] When each computing core in step S4 calculates a single round of FIR filter, it first stores data from a standard double-precision floating-point type array into the vector variable array, where the length of the vector variable array is 128. Numbers with the same relative position in four L-point data blocks are loaded into the same vector variable of the vector array, and four groups of 128-point mutually unrelated Fourier transform FFT calculations are performed simultaneously.
[0020] As a further improvement of the high performance implementation method of the FIR filter based on the domestic multi-core processor of the present invention:
[0021] The specific steps of the single instruction stream multiple data stream SIMD are as follows: after the computing core receives the data of M-1+4*L points from the control core, 4 blocks of data of M-1+L points that are continuous and contain M-1 points overlapping are stored in the vector type variable in order, wherein the real part and the imaginary part of the data need to be stored in the same order in two vector type variable arrays, namely: the imaginary part vector type variable array xvi[F] and the imaginary part vector type variable array xvr[F], and then the Fourier transform FFT calculation of point F is performed; the result of the Fourier transform FFT calculation is stored in the imaginary part vector type variable array xvi[F] and the imaginary part vector type variable array xvr[F], and is multiplied with the Fourier transform FFT calculation result H of the filter coefficient h[M] respectively, and the product is stored in the vector type arrays YI[F] and YR[F] respectively, and finally YI and YR are respectively subjected to inverse fast Fourier transform IFFT calculation to obtain the single round calculation result y[4*L] in the computing core;
[0022] When the amount of data for calculating the FIR filter by a single computing core is greater than M-1+L*64*4, multiple rounds of direct storage access DMA read and write operations are required. The pipeline scheduling method is used to hide the communication time with the computing time. Through the pipeline scheduling design, in addition to the first round of reading and the last round of writing back communication processes, when the computing core is performing the small block FIR filter calculation of the current round of data, it reads the data required for the next round of calculation and writes back the calculation results of the previous round, thereby hiding the intermediate data communication time.
[0023] As a further improvement of the high performance implementation method of the FIR filter based on the domestic multi-core processor of the present invention:
[0024] The calculation formula of the FIR digital filter is as follows:
[0025]
[0026] Where y(n) is the output signal; h is the filter coefficient, h(k) represents the kth value of the filter coefficient; x(n) is the input data, x(nk) is the nkth value of the input data, and M represents the total length of the filter coefficient h[M];
[0027] The essence of the Fast Fourier Transform FFT is the same as the Discrete Fourier Transform DFT, and the calculation formula of DFT is:
[0028]
[0029] Where W is the rotation factor, x(n) is the nth input data, X(k) is the kth output data value, and n is an integer in the range [0, N-1]. Indicates the rotation factor when the input data length is N, n and k are specific values:
[0030]
[0031] The beneficial effects of the present invention are mainly reflected in:
[0032] The present invention is based on the multi-core of the many-core processor, splits the large-point FIR filter into small-point FIR filters of the same size for parallel calculation, and improves the core parallelism;
[0033] The present invention utilizes the single instruction stream multiple data stream SIMD parallel instructions of the multi-core processor to parallelize the processing data and improve the parallelism of data stream processing;
[0034] The present invention adopts data rearrangement and pipeline scheduling to reduce redundant calculation and data transmission overhead of FIR algorithm and improve the execution speed of the algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The specific implementation modes of the present invention are further described in detail below with reference to the accompanying drawings.
[0036] Figure 1 It is a flow chart of the high performance implementation method of FIR filter based on domestic multi-core processor of the present invention;
[0037] Figure 2 It is a flow chart of SIMD operation in a single computing core;
[0038] Figure 3 Schematic diagram of the acceleration ratio results of the experiment in Example 1. DETAILED DESCRIPTION
[0039] The present invention is further described below in conjunction with specific embodiments, but the protection scope of the present invention is not limited thereto:
[0040] Embodiment 1: A high-performance implementation method of a FIR filter based on a domestic multi-core processor, such as Figure 1-2 As shown, this method can adapt the FIR filter algorithm to the architecture and characteristics of the Shenwei multi-core processor.
[0041] The high-performance implementation method of the FIR filter based on the domestic Shenwei processor 26010 includes the following steps:
[0042] (1) Input data
[0043] After analog signals such as speech signals and image signals are converted into analog-to-digital (AD), the input data for FIR filter calculation can be obtained. The input data for FIR filter calculation includes filter coefficient h[M]. The length of filter coefficient h[M] is M, and the length of input data is N. The precision of input data is 64-bit double-precision data, and the conversion type is complex to complex conversion, that is, both input and output data are complex numbers. The input data scale is 600,000 points and higher, and the data is double-precision complex data.
[0044] The filter types include high-pass filter, low-pass filter, band-pass filter and band-stop filter, and the filter coefficient length M supports a range from single digit to double digit.
[0045] (2) Use the message passing interface MPI to distribute data to each core group, calculate the FFT calculation result H of the rotation factor W and the filter coefficient h[M] and transmit it to the computing core:
[0046] The control core reads the input data of step 1 and distributes the input data to the four core groups using the message passing interface MPI, and adds M-1 zero values to the front end of the input data to avoid aliasing. In the control core, the rotation factor W required for the 128-point fast Fourier transform (FFT) is calculated according to formula (3), and the filter coefficient h[M] is padded with zeros at the end to 128 points and then the fast Fourier transform (FFT) is calculated to obtain the result H. The rotation factor W and the fast Fourier transform (FFT) result H are transmitted to all computing cores using direct memory access (DMA).
[0047] The calculation formula of FIR digital filter is as follows:
[0048]
[0049] Among them, y(n) is the output signal; h is the filter coefficient, h(k) represents the kth value of the filter coefficient; x(n) is the input data, x(nk) is the nkth value of the input data; N represents the length of the input data, and M represents the total length of the filter coefficient h[M].
[0050] FIR filter calculation can be regarded as the process of convolution of filter coefficients and input signals. Since the length N of input data is usually much larger than the total length M of filter coefficients h[M], the overlap-retention method can be used to solve the problem of waste of computational resources caused by direct convolution. According to the overlap-retention method, the input data is divided into R data sub-blocks of size L. Each data sub-block needs to add the last M-1 points of the previous sub-block, so that the large-point FIR filter with a length of N is decomposed into R single-block FIR filter calculations with a small-point FIR filter with a length of F=L+M-1 (the first M-1 points of the first sub-block are all 0).
[0051] According to the circular convolution theorem, the Fast Fourier Transform (FFT) of the circular convolution results of two sequences is equal to the product of the Fast Fourier Transform results of the two sequences. When the length of a single FIR filter is F, the conditions for the equivalence of linear convolution and circular convolution are met, so the filter coefficients can be padded with zeros to point F for Fast Fourier Transform (FFT), and each input data sub-block can be calculated for Fast Fourier Transform (FFT) of point F, and then the Fast Fourier Transform (FFT) results of the two sequences are multiplied and the product is subjected to inverse discrete Fourier transform to obtain the FIR filter result of a single sub-block, and finally the results of each sub-block are spliced to obtain the complete output.
[0052] The essence of Fast Fourier Transform (FFT) is the same as Discrete Fourier Transform (DFT). For input data with one-dimensional length N, the calculation formula of DFT is:
[0053]
[0054] Where W is the rotation factor, Indicates the rotation factor when the input data length is N, n and k are specific values:
[0055]
[0056] According to Euler's formula, we can get e ix =cos x+i sin x, is an imaginary unit with symmetry and periodicity. The algorithm complexity of DFT is O(N 2 ), usually x(n) and X(k) are complex numbers, x(n) and X(k) represent the nth input data and kth output data values respectively, and the range of n is an integer in the interval [0, N-1].
[0057] (2) Use the message passing interface MPI to distribute data to each core group, calculate the fast Fourier transform (FFT) result H of the rotation factor W and the filter coefficient h[M], and transmit it to the computing core
[0058] Use the control core to read the input data of step 1 and use the message passing interface MPI to distribute the input data to the four core groups, and add M-1 zero values to the front end of the input data to avoid aliasing;
[0059] The control core calculates the rotation factor W required for the 128-point fast Fourier transform (FFT), pads the filter coefficient h[M] with zeros to 128 points, and then performs the fast Fourier transform (FFT) calculation to obtain the result H. The direct memory access (DMA) is used to transfer the rotation factor W and the fast Fourier transform (FFT) result H to all computing cores;
[0060] (3) Direct memory access (DMA) transfers single-round data to the computing core
[0061] In each core group, the input data of step 1 is divided into R blocks of size L. In order to avoid aliasing, the last M-1 points of the previous sub-block are added, and then R single-block length F (F = L + M-1) FIR filter calculations are performed according to formula (1) (the first M-1 points of the first sub-block are all 0). Four consecutive input data blocks of length F (i.e., 4*F point data) are transmitted to each computing core in the input order, and a total of M-1+4*L points of data are transmitted, including 4*L valid calculation input data FIR filter results. When all 64 computing cores in each core group successfully receive the data, the single round of data transmission is completed.
[0062] The 4*F point data transmitted to a single computing core in a single round includes 4*(M-1) data transmitted to avoid aliasing, and 4*L valid calculation input data FIR filter results.
[0063] The input data is divided into R blocks of size L, that is, the FIR filter with a large number of points is divided into multiple FIR filters with small points of the same size. Combined with the parallel computing capability of the multi-core architecture of the Shenwei multi-core processor, 256 computing cores are called to parallelly calculate the small-point FIR filter. In order to avoid the problem of inaccurate data caused by aliasing, the effective input data length processed by each FIR filter block with a length of F is L, so it is necessary to select a suitable L value to ensure the speed of FIR filter calculation. The local storage space in the computing core of the Shenwei multi-core processor is limited. When the algorithm uses single instruction stream multiple data stream (SIMD) for calculation, the amount of input data processed by a single computing core in a single round is 4*F. Temporary variables will also be generated during the calculation process. Therefore, the upper limit of the length of L is limited. At the same time, since the number of points supported by the Cooley-Tukey fast Fourier transform in the circular convolution theorem is an integer power of 2, if the number of points F of the selected single-block FIR filter is 256 points, the local storage space of the computing core cannot accommodate the 4*F point calculation process using SIMD. Therefore, considering the above factors, 128 points are selected as the length F of the small block FIR filter. The total number of blocks R divided by the input data is determined by the amount of input data, and the total number of rounds that the computing core needs to calculate is
[0064] When the input data and the filter coefficient h[M] are subjected to a fast Fourier transform (FFT) using the circular convolution theorem, since the number of fast Fourier transform (FFT) points calculated by each computing core in each round is the same, and the value of the rotation factor W generated in the fast Fourier transform (FFT) calculation process with the same number of points is also the same, the value of the 128-point rotation factor W can be calculated in advance in the control core, and then the calculation result of the rotation factor W is transmitted to all computing cores at once using direct memory access (DMA). No matter how many rounds of FIR filters the computing core calculates, it only needs to spend the time overhead of receiving the calculated 128-point rotation factor W result by DMA once. Similarly, since the FIR filter with a large number of points is decomposed into multiple blocks with a small number of points, the FIR filter coefficients of each block are still the same, so the fast Fourier transform (FFT) result of the filter coefficient h[M] required by each computing core in each round of calculation is also the same. According to this feature, the fast Fourier transform (FFT) calculation result H of the filter coefficient h[M] can be directly transmitted to each computing core after the fast Fourier transform (FFT) calculation of the filter coefficient h[M] is performed in advance in the control core. Before performing the fast Fourier transform (FFT) calculation of the filter coefficient h[M], it is necessary to first perform the operation of padding the end with zeros to point F, and then perform multiple circular shifts and complex multiplication and addition operations; this optimization step reduces a large number of repeated calculations, thereby improving the overall calculation speed.
[0065] (4) The computing core calculates a single-pass FIR filter
[0066] After receiving the single-round data transmitted in step 3, each computing core starts to calculate the single-round FIR filter, and at the same time performs direct memory access (DMA) write-back of the results of the previous round of FIR filters and direct memory access (DMA) reading of the input data of the next round; after receiving the data, each computing core uses the single instruction stream multiple data stream (SIMD) technology to store the input signal (i.e., the 4*F point data output in step 3) into a vector variable array, and then simultaneously performs 4 sets of fast Fourier transform (FFT) calculations, and then multiplies the input signal and the fast Fourier transform (FFT) result of the filter coefficient h[M], and then performs a discrete Fourier inverse transform to obtain the result of a single calculation; after the computing core in each core group completes the single-round FIR filter calculation, the first M-1 numbers of each sub-block of length F are discarded, and the output result y[4*L] is transmitted back to the control core using direct memory access (DMA);
[0067] When the computing core receives data for a single round of FIR filter calculations, the data is first stored from the standard double-precision floating-point type array into the vector variable array. The Shenwei multi-core processor supports 256-bit single instruction stream multiple data stream (SIMD) vector variables, so four double-precision floating points can be calculated at one time while calculating a single vector variable. Since the four double-precision floating-point numbers loaded into the same vector variable cannot generate related calculations, an array of vector variables with a length of 128 is required to load the numbers with the same relative position in the four L-point data blocks into the same vector variable in the vector array, and perform 4 groups of 128-point independent Fourier transform FFT calculations at the same time.
[0068] The specific steps of SIMD in a single computing core are as follows: Figure 2As shown, after the operation core receives the data of M-1+4*L points from the control core, it stores 4 blocks of data of M-1+L points that are continuous and contain M-1 points overlapping in sequence into vector variables, wherein the real part and the imaginary part of the data need to be stored in the same order into two vector variable arrays: the imaginary part vector variable array xvi[F] and the imaginary part vector variable array xvr[F], and then perform Fourier transform (FFT) calculation of point F; the result of Fourier transform (FFT) calculation is also stored in the imaginary part vector variable array xvi[F] and the real part vector variable array xvr[F], and is multiplied with the Fourier transform FFT calculation result H of the filter coefficient h[M], and the product is stored in the vector arrays YI[F] and YR[F], respectively, and finally YI and YR are respectively subjected to inverse fast Fourier transform (IFFT) calculation to obtain the single-round operation result y[4*L] in the operation core.
[0069] When the amount of data for calculating the FIR filter by a single computing core is greater than M-1+L*64*4, multiple rounds of DMA read and write operations are required. By using the pipeline scheduling method, the communication time can be hidden by the computing time. Through the pipeline scheduling design, in addition to the first round of reading and the last round of writing back communication process, when the computing core is performing the small block FIR filter calculation of the current round of data, it can also perform the reading of the data required for the next round of calculation and the writing back of the calculation results of the previous round, thereby hiding the intermediate data communication time.
[0070] (5) Repeat the operations of step (3) and step (4) for the input data in step 1 until all the input data are processed. The calculation result y[4*L] of each round is stored in y[N] in the control core in sequence to obtain the final calculation result y[N] of the N-point filter.
[0071] Experiment 1:
[0072] Experimental environment: The experiment is based on a single-chip "Shenwei 26010" processor, which contains 4 control cores and 256 computing cores. The FIR filter algorithm is implemented using C language programming, and the compiler version used is SWCC Compilers: Version 5.421-sw-500.
[0073] Data source: In the host computer, after analog-to-digital conversion of voice signals, image signals and other signals, the input data for FIR filter calculation can be obtained, including the filter coefficient h[M] of length M. Since the bottleneck of the FIR filter algorithm occurs when the input signal volume is large, the experimental input data is selected in the range of 600,000 to 6 million points.
[0074] Experimental setup: Two sets of experimental contents:
[0075] The first group is the control group, which uses the 256 computing cores and 4 control cores of the Shenwei processor to perform multiple rounds of parallel FIR filter calculations. Each computing core calculates a small-point FIR filter obtained by splitting the large-point input data using the overlap-retention method.
[0076] The second group adopts the method of Example 1, and based on the use of the overlap-retention method to achieve parallel calculation of FIR filters by 256 computing cores, simultaneously implements optimization experiments of SIMD, data rearrangement and pipeline scheduling.
[0077] During the experiment, the input data and running environment used by the first and second groups were consistent. The beat counter function was used to calculate the difference between the beats at the end and the beginning of the program to count the number of running beats. The size of the input data and the number of beats required to run the program are shown in Table 1.
[0078] Table 1: The size of the input data and the number of cycles of the running program in the experiment
[0079] Input data volume The number of beats in the first group The number of beats in the second group Speedup 665663 58239938 1842384 31.61118312 998463 85867337 2597936 33.05214352 1331263 112582160 3357919 33.52735775 1664063 141503508.3 4127346 34.28438648 1996863 169485289.8 4894542 34.6274071 2329663 201013942.8 5650566 35.5741237 2662463 227322500.5 6423453 35.38945494 2995263 255556413.3 7191476 35.53601698 3328063 286874268.3 7956171 36.05682649 3660863 313502253.8 8709197 35.99668876 3993663 341866203.3 9476663 36.07453608 4326463 369981298.8 10234745 36.14953756 4659263 396691929.8 10997718 36.07038731 4992063 435803473 11763436 37.04729409 5324863 466555206.8 12517587 37.27197785 5657663 491176606.8 13285757 36.97016406 5990463 516828023.8 14047638 36.79109913
[0080] The speedup ratio in Table 1 is the ratio of the number of beats of the first group of 256 computing cores and 4 control cores of the Shenwei processor for multi-round parallel FIR filter algorithm program running to the number of beats of the second group of multi-core parallel FIR filter algorithm program running in Example 1. The speedup ratio is used as the ordinate and the input data volume is used as the abscissa. Figure 3 As shown, the higher the speedup ratio, the more performance improvement. It can be seen that when the input data volume is between 670,000 and 6 million, the average speedup ratio is 35, and the overall fluctuation is small; at the same time, as the data scale increases, the speedup ratio value also increases: the speedup ratio when the input data scale is 5.32*10^6 is 17.35% higher than the speedup ratio when the input data scale is 0.67*10^6, indicating that the algorithm of the present invention has better performance for larger-scale data. Therefore, the present invention utilizes the multi-core parallel structure of the Shenwei processor to perform a high-performance optimization algorithm for the FIR filter, which effectively improves the calculation speed of the large-point FIR filter.
[0081] Finally, it should be noted that the above examples are only some specific embodiments of the present invention. Obviously, the present invention is not limited to the above embodiments, and there are many variations. All variations that can be directly derived or associated with the content disclosed by a person skilled in the art should be considered as the protection scope of the present invention.
Claims
1. A high-performance implementation method of FIR filter based on a domestic many-core processor. The domestic many-core processor includes four core groups, each of which has 1 control core and 64 computing cores. The characteristics are : The following steps are involved: S1, converting the analog signal into digital form to obtain input data, including filter coefficients h[M] of length M, where the input data length is N; S2, using the control core to read the input data of step 1 and using the message passing interface MPI to distribute the input data to the four core groups, and adding M-1 zero values to the front end of the input data; In the control core, the rotation factor W is calculated, the filter coefficient h[M] is padded to 128 points at the end, and then the fast Fourier transform FFT calculation is performed to obtain the result H. The rotation factor W and the fast Fourier transform FFT calculation result H are transmitted to all the computing cores using direct memory access DMA; S3, in each core group, after dividing the input data of step S1 into R blocks of size L, add the last M-1 points of the previous sub-block, and then perform R times of FIR filter calculations with a single block length of F=L+M-1. The first M-1 points of the first sub-block are all 0, and the continuous 4*F point data are transmitted to each computing core in the input order; a total of M-1+4*L points of data are transmitted, including 4*L FIR filter calculation results of valid calculation input data; when all 64 computing cores in each core group successfully receive the data, the single round of data transmission is completed; S4, after each computing core receives the single-round data transmitted in step 3, it starts to calculate the single-round FIR filter, and at the same time performs direct storage access DMA write-back of the previous round FIR filter result and direct storage access DMA read-in of the next round input data; after receiving the data, each computing core uses the single instruction stream multiple data stream SIMD technology to store the 4*F point data output in step 3 into the vector variable array, and then simultaneously performs 4 groups of fast Fourier transform FFT calculations, and then multiplies the input signal and the fast Fourier transform FFT result of the filter coefficient h[M], and then performs a discrete Fourier inverse transform to obtain the result of a single calculation; after the computing core in each core group completes the single-round FIR filter calculation, the first M-1 numbers of each sub-block of length F are discarded, and the output result y[4*L] is transmitted back to the control core using direct storage access DMA; S5. Repeat the operations of step S3 and step S4 for the input data of step 1 until all the input data are processed. The calculation result y[4*L] of each round is stored in y[N] in the control core in sequence to obtain the final calculation result y[N] of the N-point filter.
2. The high-performance implementation method of FIR filter based on domestic multi-core processor according to claim 1 is characterized in that: The input data in step S3 is divided into R blocks of size L. In order to divide the FIR filter with a large number of points into multiple FIR filters with small numbers of points of the same size, 256 computing cores are called to parallelly calculate the FIR filters with small numbers of points. 128 points are selected as the length F of the small block FIR filter. The effective input data length processed by each FIR filter block with a length of F is L. The total number of blocks R for the input data division is determined by the amount of input data. The total number of rounds that the computing core needs to calculate is 3. The high-performance implementation method of FIR filter based on domestic multi-core processor according to claim 2 is characterized in that: The four input data of length F in step S3 include 4*(M-1) data transmitted to avoid aliasing, and 4*L valid calculation input data FIR filter results.
4. The high-performance implementation method of FIR filter based on domestic multi-core processor according to claim 3 is characterized in that: When each computing core in step S4 calculates a single round of FIR filter, it first stores data from a standard double-precision floating-point type array into the vector variable array, where the length of the vector variable array is 128. Numbers with the same relative position in four L-point data blocks are loaded into the same vector variable of the vector array, and four groups of 128-point mutually unrelated Fourier transform FFT calculations are performed simultaneously.
5. The high-performance implementation method of FIR filter based on domestic multi-core processor according to claim 4 is characterized in that: The specific steps of the single instruction stream multiple data stream SIMD are as follows: after the computing core receives the data of M-1+4*L points from the control core, 4 blocks of data of M-1+L points that are continuous and contain M-1 points overlapping are stored in the vector type variable in order, wherein the real part and the imaginary part of the data need to be stored in the same order in two vector type variable arrays, namely: the imaginary part vector type variable array xvi[F] and the imaginary part vector type variable array xvr[F], and then the Fourier transform FFT calculation of point F is performed; the result of the Fourier transform FFT calculation is stored in the imaginary part vector type variable array xvi[F] and the imaginary part vector type variable array xvr[F], and is multiplied with the Fourier transform FFT calculation result H of the filter coefficient h[M] respectively, and the product is stored in the vector type arrays YI[F] and YR[F] respectively, and finally YI and YR are respectively subjected to inverse fast Fourier transform IFFT calculation to obtain the single round calculation result y[4*L] in the computing core; When the amount of data for calculating the FIR filter by a single computing core is greater than M-1+L*64*4, multiple rounds of direct storage access DMA read and write operations are required. The pipeline scheduling method is used to hide the communication time with the computing time. Through the pipeline scheduling design, in addition to the first round of reading and the last round of writing back communication processes, when the computing core is performing the small block FIR filter calculation of the current round of data, it reads the data required for the next round of calculation and writes back the calculation results of the previous round, thereby hiding the intermediate data communication time.
6. The high-performance implementation method of FIR filter based on domestic multi-core processor according to claim 5 is characterized in that: The calculation formula of the FIR digital filter is as follows: Where y(n) is the output signal; h is the filter coefficient, h(k) represents the kth value of the filter coefficient; x(n) is the input data, x(nk) is the nkth value of the input data, and M represents the total length of the filter coefficient h[M]; The essence of the Fast Fourier Transform FFT is the same as the Discrete Fourier Transform DFT, and the calculation formula of DFT is: Where W is the rotation factor, x(n) is the nth input data, X(k) is the kth output data value, and n is an integer in the range [0, N-1]. Indicates the rotation factor when the input data length is N, n and k are specific values:
