An efficient floating-point processing method for deep learning on FPGA

By building an operation module that supports multiple hash algorithms on FPGA and using the particle swarm optimization algorithm, the deficiencies in processing speed and resource usage efficiency of traditional floating-point number processing methods are solved, efficient floating-point number processing is achieved, and depth is improved. Performance of learning algorithms.

CN118626052BActive Publication Date: 2024-10-22SHANDONG XINAN HONGJIN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411110000.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-14
Publication Date
2024-10-22
Estimated Expiration
2044-08-14

AI Technical Summary

Technical Problem

On FPGAs, traditional floating-point number processing methods perform poorly in terms of processing speed, data throughput, and power consumption, especially in scenarios where deep learning algorithms require a large number of floating-point number operations.

Method used

By building an operation module that supports multiple hash algorithms, the particle swarm optimization algorithm is used to update the pipeline configuration, and the pipeline configuration is optimized using the fitness function to improve processing speed and resource usage efficiency.

Benefits of technology

It achieves efficient floating-point number processing on FPGA, improves the adaptability and efficiency of the system when processing different types of data, avoids local optimal solutions, and ensures the convergence and performance improvement of the optimization process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118626052B_ABST
    Figure CN118626052B_ABST
Patent Text Reader

Abstract

The present invention provides an efficient floating point number processing method for implementing deep learning on an FPGA, and relates to the technical field of data processing. The method comprises: initializing a particle group, each particle in the particle group represents a pipeline configuration, the pipeline configuration includes the number of pipeline stages and a hash algorithm selected from an operation module, and the initial position of each particle in the particle group is randomly set to represent different initial configuration parameters; defining a fitness function for evaluating the performance of each pipeline configuration; updating the speed and position of each particle according to the fitness function, and repeatedly calculating the fitness function and updating the particles until a preset number of iterations is reached to obtain a final pipeline configuration, the final pipeline configuration including the final number of pipeline stages and the selected hash algorithm. The present invention increases the adaptability and efficiency of the system when processing different types of data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to an efficient floating point number processing method for implementing deep learning on FPGA. Background Art

[0002] In existing FPGA (field programmable gate array) technology, floating-point processing is a crucial step in implementing deep learning algorithms. However, when using traditional floating-point processing methods on FPGAs, it is often found that its performance and resource utilization efficiency are not satisfactory. These problems become more obvious in scenarios where deep learning algorithms require a large number of floating-point operations.

[0003] Specifically, traditional floating-point processing methods may encounter some challenges in terms of processing speed, data throughput, and power consumption. This is mainly because the hardware architecture of FPGA is different from that of traditional processors. It does not have a powerful instruction set and cache mechanism like the CPU, so it may be unable to cope with complex floating-point operations. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide an efficient floating-point number processing method for implementing deep learning on FPGA, which increases the adaptability and efficiency of the system when processing different types of data.

[0005] In order to solve the above technical problems, the technical solution of the present invention is as follows:

[0006] In a first aspect, an efficient floating-point number processing method for implementing deep learning on an FPGA is provided, the method comprising:

[0007] Based on the key features, build a running module that supports multiple different hash algorithms;

[0008] Initialize a particle swarm, where each particle in the particle swarm represents a pipeline configuration. The pipeline configuration includes the number of pipeline stages and a hash algorithm selected from the running module. The initial position of each particle in the particle swarm is randomly set, representing different initial configuration parameters.

[0009] Define a fitness function for evaluating the performance of each pipeline configuration;

[0010] According to the fitness function, the speed and position of each particle are updated. The fitness function calculation and particle update are repeated until the preset number of iterations is reached to obtain the final pipeline configuration. The final pipeline configuration includes the final pipeline stage and the selected hash algorithm.

[0011] Furthermore, before building a runtime module that supports multiple different hash algorithms, it also includes:

[0012] Preprocessing the input floating point data to obtain preprocessed data;

[0013] Analyze the preprocessed data to extract the corresponding key features.

[0014] Further, the input floating point data is preprocessed to obtain preprocessed data, including:

[0015] The floating point data is input through Filter to obtain filtered data, where is the data point after filtering; is the original data point; is half the size of the filter window; is the distance from the center point to the current point within the filter window, and its value range is [ , ]; is the standard deviation of the Gaussian function; is the normalization constant; is the index of the data point currently being processed; is the original data point The index of the current processing point of distance;

[0016] The filtered data is processed by Processing is performed to obtain preprocessed data, where is the normalized data point; It is The local mean within a data segment; It is The local standard deviation within a data segment; It is The local maximum value within a data segment; It is The local minimum value within a data segment; is the global maximum value of the entire data set; is the global minimum of the entire data set; Is the index of the data segment, indicating The data segment to which it belongs.

[0017] Furthermore, the preprocessed data is analyzed to extract the corresponding key features, including:

[0018] Divide the preprocessed data into multiple data segments, each data segment contains an appropriate number of data points;

[0019] For each divided data segment, calculate and extract the statistical characteristics of the data in the data segment, including mean, standard deviation, skewness and kurtosis;

[0020] Perform spectrum analysis on the data segment and extract frequency domain features by converting the data into frequency domain;

[0021] Extract key features based on statistical features and frequency domain features.

[0022] Furthermore, the calculation formula of the fitness function is:

[0023] ;

[0024] in, is the fitness value; , , and is the weight coefficient; is the processing speed of the pipeline configuration; is the expected maximum processing speed; is the resource consumption of pipeline configuration; is the maximum resource consumption allowed; It is the variance of the output of the pipeline configuration when processing different input data, which represents stability; is the maximum output variance allowed; is the performance of the pipeline configuration when processing new input data; is the performance of the pipeline configuration when processing the benchmark input data.

[0025] Furthermore, the resource consumption of the pipeline configuration is calculated as follows:

[0026] ,in, yes Processor usage, yes Memory usage, yes Storage utilization; , and is a pre-set weight coefficient.

[0027] Furthermore, the formula for calculating the variance of the output of the pipeline configuration when processing different input data is:

[0028] ,in, represents the number of samples; Indicates The value of the data point; represents the average of all data; Indicates The square of the difference between the data point and the mean; It represents the sum of the squares of the differences between all data points and the mean;

[0029] The performance of a pipeline configuration when processing new input data is calculated as:

[0030] ,in, The processing speed of new input data; is the maximum processing speed of new input data; is the accuracy of the new input data; is the weight coefficient;

[0031] The performance of the pipeline configuration when processing the benchmark input data is calculated as:

[0032] ,in, The processing speed of the benchmark input data, The accuracy of the input data for the benchmark; is the weight coefficient.

[0033] In a second aspect, an efficient floating point number processing system for implementing deep learning on an FPGA is applied in the method described, comprising:

[0034] The acquisition module is used to construct a running module that supports multiple different hash algorithms based on key features; initialize a particle swarm, each particle in the particle swarm represents a pipeline configuration, the pipeline configuration includes the number of pipeline stages and a hash algorithm selected from the running module, and the initial position of each particle in the particle swarm is randomly set to represent different initial configuration parameters;

[0035] The processing module is used to define a fitness function for evaluating the performance of each pipeline configuration; according to the fitness function, the speed and position of each particle are updated, and the final pipeline configuration is obtained by repeatedly calculating the fitness function and updating the particles until a preset number of iterations is reached. The final pipeline configuration includes the final pipeline stage and the selected hash algorithm.

[0036] According to a third aspect, a computing device includes:

[0037] one or more processors;

[0038] The storage device is used to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method described.

[0039] In a fourth aspect, a computer-readable storage medium stores a program, and when the program is executed by a processor, the method described is implemented.

[0040] The above scheme of the present invention includes at least the following beneficial effects.

[0041] Supporting multiple hash algorithms enables the system to flexibly select the appropriate algorithm according to different needs and application scenarios, thereby optimizing performance. Providing a variety of hash algorithm options increases the adaptability and efficiency of the system when processing different types of data. Through the particle swarm optimization algorithm, the system can search in a wide range of configuration spaces to find the optimal pipeline configuration. Randomly setting the initial position of the particles helps to avoid falling into the local optimum and increase the possibility of finding the global optimal solution. Through the fitness function, the performance of each pipeline configuration can be quantitatively evaluated to provide clear goals and directions for optimization. Through repeated calculations and updates, the system can gradually approach the optimal pipeline configuration and achieve continuous performance improvement. The preset number of iterations ensures the convergence of the optimization process, allowing the system to achieve stable optimization results within a limited time. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 It is a flowchart of an efficient floating-point number processing method for implementing deep learning on an FPGA provided by an embodiment of the present invention.

[0043] Figure 2 This is a schematic diagram of an efficient floating-point number processing system for implementing deep learning on an FPGA provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0044] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0045] like Figure 1 As shown, an embodiment of the present invention provides an efficient floating point number processing method for implementing deep learning on an FPGA, the method comprising the following steps:

[0046] Step 11, based on the key features, build an operation module that supports multiple different hash algorithms;

[0047] Step 12, initialize a particle swarm, each particle in the particle swarm represents a pipeline configuration, the pipeline configuration includes the number of pipeline stages and a hash algorithm selected from the running module, and the initial position of each particle in the particle swarm is randomly set, representing different initial configuration parameters;

[0048] Step 13, defining a fitness function for evaluating the performance of each pipeline configuration;

[0049] Step 14, according to the fitness function, the speed and position of each particle are updated, and the calculation of the fitness function and the updating of the particles are repeated until a preset number of iterations is reached to obtain the final pipeline configuration, which includes the final pipeline stage and the selected hash algorithm.

[0050] In an embodiment of the present invention, step 11 supports multiple hash algorithms so that the system can flexibly select the appropriate algorithm according to different needs and application scenarios, thereby optimizing performance, providing multiple hash algorithm options, and increasing the adaptability and efficiency of the system when processing different types of data. Step 12, through the particle swarm optimization algorithm, the system can search in a wide configuration space to find the optimal pipeline configuration, and randomly set the initial position of the particles, which helps to avoid falling into the local optimum and increase the possibility of finding the global optimal solution. Step 13, through the fitness function, the performance of each pipeline configuration can be quantitatively evaluated to provide clear goals and directions for optimization. Step 14, through repeated calculations and updates, the system can gradually approach the optimal pipeline configuration and achieve continuous performance improvement. The preset number of iterations ensures the convergence of the optimization process, so that the system can achieve stable optimization results within a limited time.

[0051] In a preferred embodiment of the present invention, before constructing an operating module that supports a variety of different hash algorithms, it also includes:

[0052] Preprocessing the input floating point data to obtain preprocessed data;

[0053] Analyze the preprocessed data to extract the corresponding key features.

[0054] In an embodiment of the present invention, the preprocessing step helps to convert the original floating point data into a format that is more suitable for subsequent analysis and processing. Normalized data can improve the stability and accuracy of the algorithm. By analyzing the preprocessed data and extracting key features, the dimension and complexity of the data can be greatly reduced, while retaining information that is critical to subsequent hash processing, which not only reduces the complexity of the calculation, but also improves the efficiency of the hash algorithm. Optimizing the extracted key features can make the hash algorithm more focused on the core information of the data, thereby improving the speed and accuracy of the hash calculation. In addition, feature extraction also helps to reduce the impact of noise and redundant information on the hash result. Due to the introduction of the preprocessing and feature extraction steps, the constructed running module can more flexibly adapt to floating point data of different types and formats. This flexibility enables the module to easily cope with diverse data input requirements. Through preprocessing and feature analysis, it is easier to integrate new hash algorithms into existing modules because the modules are already designed to process optimized and refined feature sets instead of raw data. In-depth analysis and feature extraction of data before hashing helps to identify and eliminate potential malicious data or outliers, thereby enhancing the security of the entire system.

[0055] In a preferred embodiment of the present invention, the input floating point data is preprocessed to obtain preprocessed data, including:

[0056] The floating point data is input through Filter to obtain filtered data, where is the data point after filtering; is the original data point; is half the size of the filter window; is the distance from the center point to the current point within the filter window, and its value range is [ , ]; is the standard deviation of the Gaussian function; is the normalization constant; is the index of the data point currently being processed; is the original data point The index of the current processing point of distance;

[0057] The filtered data is processed by Processing is performed to obtain preprocessed data, where is the normalized data point; It is The local mean within a data segment; It is The local standard deviation within a data segment; It is The local maximum value within a data segment; It is The local minimum value within a data segment; is the global maximum value of the entire data set; is the global minimum of the entire data set; Is the index of the data segment, indicating The data segment to which it belongs.

[0058] In an embodiment of the present invention, by Gaussian filtering, the noise and outliers in the original floating point data can be effectively reduced. The Gaussian filter, with its bell-shaped curve characteristics, gives higher weights to data points close to the center point, and gives lower weights to data points far from the center point, thereby achieving data smoothing. By calculating the local mean, standard deviation, maximum and minimum values ​​in each data segment, the preprocessing step can highlight the local characteristics of the data. Through normalization, all data points are converted to the same scale, which helps to eliminate the deviations that may be caused by different dimensions or numerical ranges between different features. The preprocessing formula not only takes into account the local characteristics of the data (such as local mean, standard deviation, etc.), but also helps to capture the local and global changes of the data in subsequent analysis. After such preprocessing, the quality of the data is significantly improved.

[0059] In a preferred embodiment of the present invention, analyzing the preprocessed data to extract corresponding key features includes:

[0060] Divide the preprocessed data into multiple data segments, each data segment contains an appropriate number of data points;

[0061] For each divided data segment, calculate and extract the statistical characteristics of the data in the data segment, including mean, standard deviation, skewness and kurtosis;

[0062] Perform spectrum analysis on the data segment and extract frequency domain features by converting the data into frequency domain;

[0063] Extract key features based on statistical features and frequency domain features.

[0064] In an embodiment of the present invention, by extracting key features, the original high-dimensional data can be effectively compressed and represented, thereby simplifying the complexity of the data. This not only reduces the demand for storage and processing, but also makes subsequent data analysis more efficient. The extracted statistical features and frequency domain features can reflect the core information of the data in a concentrated manner. Statistical features such as mean, standard deviation, skewness and kurtosis reveal the distribution pattern and degree of discreteness of the data, while the frequency domain features show the periodic changes and frequency components of the data, which helps to understand the inherent laws of the data more deeply. By analyzing and interpreting the extracted key features, it is easier to understand the nature and influencing factors of the data. The analysis of statistical features and frequency domain features helps to identify and detect outliers and noise in the data.

[0065] When applied specifically, the following steps are included:

[0066] According to the sampling rate and periodicity of the data, the number of data points that each data segment should contain is determined; the preprocessed continuous data stream is divided into multiple independent data segments according to the determined size. If the total amount of data is not an integer multiple of the data segment size, the last data segment contains fewer data points.

[0067] The mean of each data segment is obtained by summing all the data points within the data segment and dividing by the number of data points. It reflects the average level of the data. The standard deviation is obtained by averaging the square of the difference between each data point and the mean and taking the square root of the square. The skewness measures the asymmetry of the data distribution and is calculated by averaging the cube of the difference between each data point and the mean and normalizing it. The kurtosis describes the sharpness of the data distribution and is obtained by averaging the fourth power of the difference between each data point and the mean and normalizing it.

[0068] Apply FFT (Fast Fourier Transform) to convert the time domain signal into the frequency domain signal. Through FFT, the periodic components and frequency characteristics in the data can be analyzed. In the frequency domain representation, the main frequency components and their amplitudes of the data can be observed, and these frequency components and amplitude values ​​can be extracted as features. According to the specific application scenario and objectives, evaluate which statistical features and frequency domain features are important for subsequent analysis, and extract selected statistical features and frequency domain features from each data segment to form a feature vector.

[0069] For example, suppose there is a set of floating point data that is collected from a sensor with a sampling rate of 100 times per second. First, preprocess the data. Apply a Gaussian filter to reduce the noise in the data. Choose an appropriate filter window size (e.g., 5 data points) and the standard deviation of the Gaussian function (e.g., 1). Through Gaussian filtering, the smoothed data is obtained. Next, the filtered data is divided into several data segments (e.g., each data segment contains 1000 data points). For each data segment, calculate the local mean, local standard deviation, local maximum and local minimum, and use these values ​​and the global maximum and minimum of the entire data set to normalize the data. Based on the sampling rate and periodicity of the data, it is determined that each data segment contains 1000 data points. Then, the preprocessed data is divided into this size.

[0070] For each data segment, the average value of all data points in it is calculated, which reflects the average level of the data in that period of time. The standard deviation is obtained by calculating the square root of the average of the squares of the difference between each data point and the mean, which indicates the degree of dispersion of the data. The skewness is obtained by calculating the average of the cube of the difference between each data point and the mean and normalizing it, which measures the asymmetry of the data distribution. The kurtosis is obtained by calculating the average of the fourth power of the difference between each data point and the mean and normalizing it, which describes the sharpness of the data distribution. Each data segment is converted from the time domain to the frequency domain using FFT (Fast Fourier Transform). In the frequency domain, the main frequency components and amplitudes of the data are observed and analyzed. These frequency components and amplitude values ​​are extracted as features.

[0071] Based on the application scenario and goal (e.g., equipment failure prediction), evaluate which statistical features and frequency domain features are important for subsequent analysis. Finally, these selected features are extracted from each data segment to form a feature vector.

[0072] In another preferred embodiment of the present invention, step 11, based on the key features, constructing an operation module that supports a variety of different hash algorithms, including:

[0073] First, analyze the key features extracted from the floating-point data in detail. These features may include statistical properties of the data (such as mean, standard deviation, skewness, kurtosis, etc.) and frequency domain characteristics (such as major frequency components and their amplitudes). Based on the analysis of key features, select a series of suitable hash algorithms. These algorithms may include, but are not limited to, traditional hash algorithms such as MD5, SHA-1, SHA-256, and may also include more advanced hash functions specific to application scenarios. When selecting, consider the security and performance of the algorithms and their sensitivity to specific features. Design a flexible module architecture so that different hash algorithms can be easily integrated and switched. This architecture should allow hash algorithms to be loaded and unloaded dynamically to accommodate different data processing requirements. Implement a unified interface for each selected hash algorithm. This interface should define the necessary methods and properties to ensure that all algorithms can be called and managed in a consistent manner. The interface includes initialization methods, data input methods, hash value calculation methods, and result output methods.

[0074] Integrate the implemented hash algorithms into the runtime module. Ensure that each algorithm can be called correctly through a unified interface and can process key features extracted from floating-point data. Perform comprehensive testing and verification on the built runtime module. This includes unit testing, integration testing, and system testing to ensure that each hash algorithm works correctly and the overall performance of the module meets expectations. Based on the test results, optimize and adjust the runtime module. This may include improving the performance of the algorithm, optimizing memory usage, reducing calculation time, etc. Ensure that the module can achieve optimal performance and efficiency in actual applications.

[0075] In a preferred embodiment of the present invention, the calculation formula of the fitness function is:

[0076] ;

[0077] in, is the fitness value; , , and is the weight coefficient; is the processing speed of the pipeline configuration; is the expected maximum processing speed; is the resource consumption of pipeline configuration; is the maximum resource consumption allowed; It is the variance of the output of the pipeline configuration when processing different input data, which represents stability; is the maximum output variance allowed; is the performance of the pipeline configuration when processing new input data; is the performance of the pipeline configuration when processing the benchmark input data.

[0078] In the embodiment of the present invention, the fitness function realizes multi-objective optimization of pipeline configuration by introducing multiple performance indicators (processing speed, resource consumption, stability and adaptability). This helps to find a pipeline configuration that performs well in all aspects, rather than just optimizing a single performance indicator. , , and ), which can flexibly adjust the importance of each performance indicator in the optimization process. This flexibility allows the fitness function to be customized according to different application scenarios and requirements to better meet specific optimization goals. The fitness function provides a quantitative performance evaluation value (fitness value) for each pipeline configuration. F ), which makes the performance comparison between different configurations objective and intuitive. By comparing the fitness values, it is easy to identify the pipeline configuration with better performance. By introducing the resource consumption term, the fitness function can take into account the impact of actual resource limitations on the pipeline configuration. By introducing the stability term The fitness function emphasizes the stability of the pipeline configuration when processing different inputs, which helps to improve the reliability and robustness of the pipeline in practical applications. , the fitness function can evaluate the adaptability of the configuration to future unknown inputs.

[0079] In a preferred embodiment of the present invention, the calculation formula for resource consumption of pipeline configuration is:

[0080] ,in, is the processor utilization, is the memory usage, is the storage utilization rate; , and is a pre-set weight coefficient;

[0081] The formula for calculating the variance of the output of the pipeline configuration when processing different input data is:

[0082] ,in, represents the number of samples; Indicates The value of the data point; represents the average of all data; Indicates The square of the difference between the data point and the mean; It represents the sum of the squares of the differences between all data points and the mean;

[0083] The performance of a pipeline configuration when processing new input data is calculated as:

[0084] ,in, The processing speed of new input data; is the maximum processing speed of new input data; is the accuracy of the new input data; is the weight coefficient;

[0085] The performance of the pipeline configuration when processing the benchmark input data is calculated as:

[0086] ,in, The processing speed of the benchmark input data, The accuracy of the input data for the benchmark; is the weight coefficient.

[0087] In the embodiment of the present invention, by comprehensively considering the processor usage , memory usage and storage usage The resource consumption calculation formula can comprehensively evaluate the consumption of various resources in the pipeline configuration. Pre-set weight coefficients , and The importance of various resource consumption in the overall evaluation can be adjusted according to actual conditions, which increases the flexibility and accuracy of the evaluation. The formula for calculating the output variance quantifies the degree of output variation of the pipeline configuration when processing different inputs. By comparing the variance values ​​of different pipeline configurations, a configuration that performs more stably when processing various inputs can be selected. and The calculation formula considers the processing speed and accuracy of new input data and benchmark input data respectively, providing a comprehensive indicator for evaluating the performance of pipeline configuration on different types of data. and ) allows the relative importance of processing speed and accuracy in performance evaluation to be adjusted to suit different application scenarios and requirements. These formulated evaluation methods ensure the objectivity and repeatability of the evaluation process and help reduce the impact of subjective judgment on pipeline configuration selection.

[0088] In a preferred embodiment of the present invention, when updating the speed and position of each particle, the speed update formula is:

[0089] ;

[0090] in, It is a particle In Dimension Last time speed; It is a particle In Dimension Last time speed; is the initial maximum inertia weight; is the final minimum inertia weight; is the current iteration number; is the maximum number of iterations; and is the acceleration factor; and is a random number in the range [0, 1]; It is a particle In Dimension The optimal position of an individual on ; is the entire particle group in dimension The global optimal position on ; It is a particle In Dimension Last time location;

[0091] When updating the velocity and position of each particle, the update formula for the position is:

[0092] ;

[0093] in, It is a particle In Dimension Last time location.

[0094] In the embodiment of the present invention, by adjusting the inertia weight , so that the algorithm has greater global search capabilities in the early stage and greater local search capabilities in the later stage, thereby improving the search accuracy and speed of the algorithm. and , can balance the global search ability and local search ability of the algorithm and avoid the algorithm falling into the local optimal solution. and , which increases the randomness of the algorithm, enables the algorithm to jump out of the local optimal solution during the search process, and increases the global search capability of the algorithm.

[0095] When applied specifically, the following steps are included:

[0096] The data processing pipeline is optimized to improve data processing efficiency and accuracy. The configuration of the pipeline includes determining the number of pipeline stages (i.e., the number of data processing stages) and the hashing algorithm used in each stage. Due to the large number of possible configuration combinations, the particle swarm optimization (PSO) algorithm is used to find the optimal pipeline configuration.

[0097] Step 12, assuming that the particle swarm contains 10 particles, each particle represents a pipeline configuration, and the position of each particle consists of two parts: the number of pipeline stages (an integer) and the hash algorithm selected for each stage (an integer encoding, corresponding to different hash algorithms). For example, the initial position of particle 1 may be (3, [2, 5, 1]), indicating that the pipeline has 3 stages, using hash algorithms numbered 2, 5, and 1 respectively. Step 13, the fitness function is used to evaluate the performance of each pipeline configuration. In this case, the performance evaluation is based on processing speed, accuracy, and resource consumption. Step 14, the PSO algorithm is used to update the speed and position of each particle to search for a better pipeline configuration. In each iteration, the performance of each particle is evaluated according to the fitness function, and the individual optimal and global optimal positions are updated. The speed and position of the particle are updated according to the formula until the preset number of iterations (for example, 100 times) is reached.

[0098] In the initial state, evaluate the fitness of all particles, update the individual optimal and global optimal positions, adjust the configuration of each particle according to the speed and position update formula, re-evaluate the fitness of all particles, and repeat the steps until 100 iterations are reached. After 100 iterations, the algorithm converges to an optimal pipeline configuration, such as (5, [3, 1, 4, 6, 2]). This configuration indicates that the optimal pipeline has 5 levels, using hash algorithms numbered 3, 1, 4, 6, and 2 respectively. The data processing pipeline can be adjusted according to this optimal configuration to improve efficiency and accuracy.

[0099] like Figure 2 As shown, an embodiment of the present invention further provides an efficient floating point number processing system 20 for implementing deep learning on an FPGA, which is applied in the method described, and includes:

[0100] The acquisition module 21 is used to construct an operation module that supports multiple different hash algorithms; initialize a particle swarm, each particle in the particle swarm represents a pipeline configuration, the pipeline configuration includes the number of pipeline stages and a hash algorithm selected from the operation module, and the initial position of each particle in the particle swarm is randomly set to represent different initial configuration parameters;

[0101] The processing module 22 is used to define a fitness function for evaluating the performance of each pipeline configuration; according to the fitness function, the speed and position of each particle are updated, and the final pipeline configuration is obtained by repeatedly calculating the fitness function and updating the particles until a preset number of iterations is reached. The final pipeline configuration includes the final pipeline stage and the selected hash algorithm.

[0102] It should be noted that the system is a system corresponding to the above method, and all implementation methods in the above method embodiment are applicable to this embodiment and can achieve the same technical effect.

[0103] The embodiment of the present invention further provides a computing device, comprising: a processor, a memory storing a computer program, wherein when the computer program is executed by the processor, the method described above is executed. All implementations in the above method embodiment are applicable to this embodiment and can achieve the same technical effect.

[0104] The embodiment of the present invention also provides a computer-readable storage medium storing instructions, which, when executed on a computer, enable the computer to execute the method described above. All implementations in the above method embodiment are applicable to this embodiment and can achieve the same technical effect.

[0105] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. An efficient floating point number processing method for deep learning on FPGA, characterized in that: The method comprises: Based on the key features, build a running module that supports multiple different hash algorithms; Initialize a particle swarm, where each particle in the particle swarm represents a pipeline configuration. The pipeline configuration includes the number of pipeline stages and a hash algorithm selected from the running module. The initial position of each particle in the particle swarm is randomly set, representing different initial configuration parameters. Define a fitness function for evaluating the performance of each pipeline configuration; According to the fitness function, the speed and position of each particle are updated, and the fitness function calculation and particle update are repeated until a preset number of iterations is reached to obtain the final pipeline configuration, which includes the final pipeline stage and the selected hash algorithm; Before building a runtime module that supports a variety of different hashing algorithms, also include: Preprocessing the input floating point data to obtain preprocessed data; Analyze the preprocessed data to extract the corresponding key features; Preprocess the input floating point data to obtain preprocessed data, including: The floating point data is input through Filter to obtain filtered data, where is the data point after filtering; is the original data point; is half the size of the filter window; is the distance from the center point to the current point in the filter window, and its value range is ; is the standard deviation of the Gaussian function; is the normalization constant; is the index of the data point currently being processed; is the original data point The index of the current processing point of Distance; the filtered data is passed through Processing is performed to obtain preprocessed data, where is the normalized data point; It is The local mean within a data segment; It is The local standard deviation within a data segment; It is The local maximum value within a data segment; It is The local minimum value within a data segment; is the global maximum value of the entire data set; is the global minimum of the entire data set; Is the index of the data segment, indicating The data segment to which it belongs; Analyze the preprocessed data to extract the corresponding key features, including: Dividing the preprocessed data into multiple data segments, each data segment contains an appropriate number of data points, specifically including: determining the number of data points that each data segment should contain according to the sampling rate and periodicity of the data; dividing the preprocessed continuous data stream into multiple independent data segments according to the determined size; For each divided data segment, calculate and extract the statistical characteristics of the data in the data segment, including mean, standard deviation, skewness and kurtosis; Perform spectrum analysis on the data segment and extract frequency domain features by converting the data into frequency domain; Extract key features based on statistical features and frequency domain features, specifically including: applying fast Fourier transform to convert time domain signals into frequency domain signals, and analyzing the periodic components and frequency characteristics in the data through fast Fourier transform; in the frequency domain representation, observe the frequency components and amplitudes of the data, and the frequency components and amplitude values ​​are extracted as features; according to the specific application scenario and objectives, extract selected statistical features and frequency domain features from each data segment to form a feature vector; The calculation formula of the fitness function is: ; in, is the fitness value; is the weight coefficient; is the processing speed of the pipeline configuration; is the expected maximum processing speed; is the resource consumption of pipeline configuration; is the maximum resource consumption allowed; It is the variance of the output of the pipeline configuration when processing different input data, which represents stability; is the maximum output variance allowed; is the performance of the pipeline configuration when processing new input data; is the performance of the pipeline configuration when processing benchmark input data; The resource consumption of pipeline configuration is calculated as: ,in, is the processor utilization, is the memory usage, is the storage utilization rate; is a pre-set weight coefficient; The formula for calculating the variance of the output of the pipeline configuration when processing different input data is: ,in, represents the number of samples; Indicates The value of the data point; represents the average of all data; Indicates The square of the difference between the data points and the mean; It represents the sum of the squares of the differences between all data points and the mean; The performance of a pipeline configuration when processing new input data is calculated as: ,in, The processing speed of new input data; is the maximum processing speed of new input data; is the accuracy of the new input data; Weight coefficient; The performance of the pipeline configuration when processing the benchmark input data is calculated as: ,in, The processing speed of the benchmark input data, The accuracy of the input data for the benchmark; is the weight coefficient.

2. An efficient floating point number processing system for deep learning on FPGA, characterized in that: Applied in the method as claimed in claim 1, comprising: The acquisition module is used to construct a running module that supports multiple different hash algorithms based on key features; initialize a particle swarm, each particle in the particle swarm represents a pipeline configuration, the pipeline configuration includes the number of pipeline stages and a hash algorithm selected from the running module, and the initial position of each particle in the particle swarm is randomly set to represent different initial configuration parameters; The processing module is used to define a fitness function for evaluating the performance of each pipeline configuration; according to the fitness function, the speed and position of each particle are updated, and the final pipeline configuration is obtained by repeatedly calculating the fitness function and updating the particles until a preset number of iterations is reached. The final pipeline configuration includes the final pipeline stage and the selected hash algorithm.

3. A computing device, characterized in that: include: one or more processors; A storage device, used for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method as claimed in claim 1.

4. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program, which implements the method according to claim 1 when executed by a processor.