Algorithm configuration method, device, equipment and storage medium of FPGA device
By screening and combining the algorithms to be configured in FPGA devices, a new algorithm to be configured is formed, and configured based on the resources of the FPGA device. This solves the problems of low multi-algorithm configuration efficiency and low resource utilization of FPGA devices in the existing technology, and achieves Efficient resource management and performance improvement.
Patent Information
- Application Number
- CN202210451775.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-27
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-04-27
Smart Images

Figure CN114741202B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to an algorithm configuration method, device, equipment and storage medium for FPGA equipment. Background Art
[0002] At present, FPGA (Field Programmable Gate Array) devices are introduced into data centers as hardware accelerators for applications due to their low energy consumption, low latency and configurable excellent characteristics. At first, the functions of FPGA hardware accelerators were fixed, and they only accelerated specific applications. Considering that the number and types of running applications change dynamically with demand, if the number of applications decreases over a period of time, the FPGA hardware accelerators corresponding to such applications will be idle. At the same time, in order to accelerate other applications, additional FPGA accelerator devices corresponding to other applications must be added. In the prior art, in order to cope with the dynamic nature of demand and improve the utilization rate of FPGA resources, combined with the configurable characteristics of FPGA, it is proposed that different algorithms can be dynamically configured to FPGA devices according to demand to accelerate the design of different applications. However, currently, when performing the configuration operation, only one algorithm corresponding to an application is configured to the FPGA device at a time, and the configuration of multiple algorithms needs to be performed multiple times, and it cannot be ensured that multiple algorithms are adapted to the current FPGA device resources after configuration. Therefore, how to improve the efficiency of FPGA device algorithm configuration is a problem that needs to be solved urgently. Summary of the invention
[0003] In view of this, the purpose of the present invention is to provide an algorithm configuration method, apparatus, device and medium for FPGA devices, which can improve the efficiency of algorithm configuration of FPGA devices. The specific scheme is as follows:
[0004] In a first aspect, the present application discloses an algorithm configuration method for an FPGA device, comprising:
[0005] Acquire multiple algorithms to be configured, and randomly and non-repeatedly select one of the algorithms to be configured in sequence as a target algorithm to be configured;
[0006] Screening out algorithms that meet the requirements for algorithm combination with the target algorithm to be configured from all the algorithms to be configured, so as to obtain a plurality of algorithm combinations corresponding to the target algorithm to be configured; the combination condition of the algorithm combination is that the resource holding amount of the target FPGA device is greater than the resource demand amount of the algorithm included in the algorithm combination;
[0007] Selecting a target algorithm combination from the algorithm combinations and using the target algorithm combination as a new algorithm to be configured;
[0008] The target FPGA device is configured with an algorithm based on the new algorithm to be configured.
[0009] Optionally, the performing algorithm configuration on the target FPGA device based on the new algorithm to be configured includes:
[0010] According to the combination condition of the algorithm combination, determining whether the new algorithm to be configured can continue to be combined with the algorithm to be configured;
[0011] If not, the target FPGA device is configured with the new algorithm to be configured.
[0012] Optionally, after judging, according to the combination condition of the algorithm combination, whether the new algorithm to be configured can continue to be combined with the algorithm to be configured, the method further includes:
[0013] If yes, the new algorithm to be configured is used as the target algorithm to be configured, and the step of screening out algorithms that meet the requirements for algorithm combination with the target algorithm to be configured from all the algorithms to be configured is performed to obtain multiple algorithm combinations corresponding to the target algorithm to be configured.
[0014] Optionally, the filtering out a target algorithm combination from the algorithm combinations includes:
[0015] According to the priorities corresponding to the algorithms in all the algorithm combinations, the algorithm combination including the algorithm with the highest priority is used as the target algorithm combination.
[0016] Optionally, the filtering out a target algorithm combination from the algorithm combinations includes:
[0017] Obtaining a sum of resource requirements corresponding to each algorithm combination according to the resource requirements respectively corresponding to the target algorithm to be configured and an algorithm to be configured contained in each algorithm combination;
[0018] The algorithm combinations are sorted according to the resource requirement sum, and the algorithm combination with the largest resource requirement sum is used as the target algorithm combination.
[0019] Optionally, the step of selecting an algorithm that is suitable for algorithm combination with the target algorithm to be configured from all the algorithms to be configured includes:
[0020] Obtaining a single resource requirement of each target resource type for all the algorithms to be configured;
[0021] According to the single resource demand, the sum of the single resource demand of the target algorithm to be configured and each of the algorithms to be configured for each target resource type is calculated, and the target algorithm to be configured and any one of the algorithms to be configured are used as a group of algorithm pairs to obtain the sum of the single resource demand of each algorithm pair for different target resource types;
[0022] Calculate a resource ratio of the sum of the single resource requirements of the algorithm pair to the single resource holding situation of the corresponding target resource type according to the sum of the single resource requirements and the single resource holding situation of the target FPGA device for each target resource type;
[0023] According to the preset ratio threshold and the numerical value of the resource ratio, an algorithm that can be combined with the target algorithm to be configured is screened out from all the algorithms to be configured.
[0024] Optionally, the target resource types include trigger resources, lookup table resources, on-chip storage resources and digital signal processing resources.
[0025] Optionally, obtaining the sum of resource requirements corresponding to each algorithm combination according to the resource requirements respectively corresponding to the target algorithm to be configured and an algorithm to be configured contained in each algorithm combination includes:
[0026] The sum of the resource ratios of the resource ratios of each target resource type corresponding to the target algorithm to be configured and one algorithm to be configured in the algorithm combination is calculated based on the sum of the single resource requirements of each target resource type corresponding to the target algorithm to be configured and the resource ratio of the single resource holding situation of the corresponding target resource type;
[0027] The sum of the resource ratios is taken as the sum of the resource requirements to obtain the sum of the resource requirements corresponding to each of the algorithm combinations.
[0028] In a second aspect, the present application discloses an algorithm configuration device for an FPGA device, comprising:
[0029] An algorithm acquisition module, used to acquire multiple algorithms to be configured, and randomly and non-repeatedly select one of the algorithms to be configured as a target algorithm to be configured;
[0030] An algorithm combination determination module, used to screen out algorithms that meet the algorithm combination requirements with the target algorithm to be configured from all the algorithms to be configured, so as to obtain a plurality of algorithm combinations corresponding to the target algorithm to be configured; the combination condition of the algorithm combination is that the resource holding amount of the target FPGA device is greater than the resource demand amount of the algorithm included in the algorithm combination;
[0031] A target algorithm combination determination module is used to screen out a target algorithm combination from the algorithm combinations and use the target algorithm combination as a new algorithm to be configured;
[0032] The algorithm configuration module is used to perform algorithm configuration on the target FPGA device based on the new algorithm to be configured.
[0033] In a third aspect, the present application discloses an electronic device, comprising:
[0034] Memory, used to store computer programs;
[0035] The processor is used to execute the computer program to implement the algorithm configuration method of the FPGA device mentioned above.
[0036] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the aforementioned algorithm configuration method for the FPGA device.
[0037] In the present application, a plurality of algorithms to be configured are obtained, and one of the algorithms to be configured is randomly and non-repeatedly selected in sequence as a target algorithm to be configured; algorithms that meet the requirements for algorithm combination with the target algorithm to be configured are screened out from all the algorithms to be configured to obtain a plurality of algorithm combinations corresponding to the target algorithm to be configured; a combination condition of the algorithm combination is that the resource holding amount of the target FPGA device is greater than the resource demand amount of the algorithms included in the algorithm combination; a target algorithm combination is screened out from the algorithm combination, and the target algorithm combination is used as a new algorithm to be configured; and algorithm configuration is performed on the target FPGA device based on the new algorithm to be configured. It can be seen that by combining the algorithms to be configured as a new algorithm to be configured, and then configuring the target FPGA device based on the new algorithm to be configured, since the new algorithm to be configured actually contains multiple algorithms, the configuration of multiple algorithms can be achieved through one configuration, which improves the efficiency of FPGA algorithm configuration. In addition, according to the resource requirements of the algorithms to be configured and the resource holdings of the target FPGA device, multiple algorithm combinations are determined according to the algorithm combination conditions, and then the target algorithm combination is selected as the new algorithm to be configured. The combination of algorithms takes into account the resource requirements of the algorithms and the resource holdings of the FPGA device, and can achieve effective combination of multiple algorithms to avoid unsatisfactory performance of the final algorithm combination due to excessive resource requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0039] Figure 1 A flowchart of an algorithm configuration method for an FPGA device provided in this application;
[0040] Figure 2 A schematic diagram of the algorithm configuration device structure of an FPGA device provided in this application;
[0041] Figure 3 A structural diagram of an electronic device provided for this application. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0043] In the prior art, only one algorithm corresponding to an application is configured to the FPGA device at a time during the configuration operation, and the configuration of multiple algorithms needs to be performed multiple times, and it cannot be ensured that the multiple algorithms are adapted to the current FPGA device resources after configuration. In order to overcome the above technical problems, this application proposes an algorithm configuration method for FPGA devices, which can improve the efficiency of algorithm configuration of FPGA devices.
[0044] The present application embodiment discloses an algorithm configuration method for an FPGA device, see Figure 1 As shown, the method may include the following steps:
[0045] Step S11: obtaining multiple algorithms to be configured, and randomly selecting one of the algorithms to be configured in sequence without duplication as a target algorithm to be configured.
[0046] In this embodiment, a plurality of algorithms to be configured that need to be configured in the FPGA device are first obtained, and then one algorithm is randomly selected from all the algorithms to be configured without duplication as a target algorithm to be configured.
[0047] Step S12: Filter out algorithms that are suitable for algorithm combination with the target algorithm to be configured from all the algorithms to be configured, so as to obtain multiple algorithm combinations corresponding to the target algorithm to be configured; the combination condition of the algorithm combination is that the resource holding amount of the target FPGA device is greater than the resource demand amount of the algorithm included in the algorithm combination.
[0048] In this embodiment, after the target algorithm to be configured is selected, the algorithms that can be combined with the target algorithm to be configured are screened out from all the algorithms to be configured according to the resource requirements of all the algorithms to be configured and the resource holdings of the target FPGA device, according to the combination conditions of the algorithm combination, and each algorithm to be configured that meets the conditions forms an algorithm combination with the above-mentioned target algorithm to be configured, so as to obtain multiple algorithm combinations corresponding to the target algorithm to be configured; wherein, the combination condition of the algorithm combination is that the resource holdings of the target FPGA device are greater than the resource requirements of the algorithms included in the algorithm combination, the purpose is to screen out algorithms that can be combined with each other, and the rule is constructed based on the criterion that the resources of the FPGA device can support the algorithm combination obtained by the combination, thereby screening out effective algorithm combination methods.
[0049] In this embodiment, the algorithm that is selected from all the algorithms to be configured that is suitable for algorithm combination with the target algorithm to be configured may include: obtaining the single resource requirements of all the algorithms to be configured for each target resource type; according to the single resource requirements, calculating the sum of the single resource requirements of the target algorithm to be configured and each algorithm to be configured for each target resource type, and taking the target algorithm to be configured and any one of the algorithms to be configured as a group of algorithm pairs to obtain the sum of the single resource requirements of each algorithm pair for different target resource types; according to the sum of the single resource requirements and the single resource holding of the target FPGA device for each target resource type, calculating the resource ratio of the sum of the single resource requirements of the algorithm pair and the single resource holding of the corresponding target resource type; according to the preset ratio threshold and the numerical value of the resource ratio, selecting the algorithm that can be combined with the target algorithm to be configured from all the algorithms to be configured. In this embodiment, the target resource types may include trigger resources, lookup table resources, on-chip storage resources, and digital signal processing resources.
[0050] It can be understood that FPGA device resources usually include four categories of resources, namely flip-flop FF resources, look-up table LUT resources, on-chip RAM (Random Access Memory) resources and digital signal processing DSP (Digital Signal Process) resources; in this embodiment, for an algorithm A, it is tested whether it is suitable to be combined with another algorithm (the other algorithm here can also be algorithm A). If it is suitable, the combination of the two algorithms is a valid combination, otherwise the other algorithm should be filtered out and is not in the combinable set of algorithm A. To determine whether the combination of the two algorithms is suitable, the resource ratio of the sum of the single resource requirements of each target resource type of the different algorithms to be configured and the single resource holding situation of the corresponding target resource type is calculated, that is, the sum of the resources of each type of the two algorithms divided by the ratio of the corresponding type of resources of the FPGA device is calculated and recorded respectively. If the resource ratio of any type of resource is greater than or equal to the preset ratio threshold, the two algorithms should not be combined. In this embodiment, the ratio threshold can be set to 0.9. It is understandable that if the ratio is greater than 1, it means that the sum of the demand for a certain type of resource caused by the combination of the two algorithms exceeds the total content of the corresponding type of resources of the FPGA device, and the combination will definitely fail; at the same time, due to the characteristics of the FPGA device, if a certain type of resource used by the algorithm accounts for too high a proportion of the total resources of the FPGA device, such as 90%, then in the layout and routing stage of the algorithm generation process, it may be necessary to connect the resources located at the edge of the device due to the lack of resources in the adjacent area, resulting in too long lines and large delays, resulting in low operating frequency and performance degradation of the final algorithm. Therefore, if the ratio is less than 1 and greater than or equal to 0.9, the performance of the final algorithm will also be reduced due to resource shortage. In addition, in this embodiment, the comparison is made by resource ratios instead of simply adding up the number of resources, which can eliminate the influence of different resource types.
[0051] Step S13: Filter out a target algorithm combination from the algorithm combinations, and use the target algorithm combination as a new algorithm to be configured.
[0052] In this embodiment, the step of selecting the target algorithm combination from the algorithm combination may include: according to the priorities of the algorithms in all the algorithm combinations, taking the algorithm combination containing the algorithm with the highest priority as the target algorithm combination. That is, according to the urgency of the user's needs, the corresponding priority may be added to the algorithm, and during configuration, the algorithm combination containing the algorithm with the highest priority may be first selected as the new algorithm to be configured.
[0053] In this embodiment, the target algorithm combination is selected from the algorithm combination, which may include: obtaining the sum of resource requirements corresponding to each algorithm combination according to the resource requirements corresponding to the target algorithm to be configured and one algorithm to be configured contained in each algorithm combination; sorting the algorithm combinations according to the sum of resource requirements, and taking the algorithm combination with the largest sum of resource requirements as the target algorithm combination. That is, if the number of algorithm combinations is greater than 1, the algorithm combination with the highest resource occupancy rate combined with A should be selected from them. That is, the selected algorithm combinations are all algorithm combinations that can be supported by the target FPGA device, but in order to achieve the maximum utilization of FPGA resources, in this embodiment, the target algorithm combination whose resource requirements are closest to the resource holdings of the FPGA device is selected from the algorithm combination by a combination screening method. Thus, according to the sum of resources corresponding to each algorithm combination, the target algorithm combination with the largest sum of resource requirements is selected as a new algorithm to be configured to maximize the utilization of FPGA device resources.
[0054] In this embodiment, the resource requirements corresponding to each algorithm combination are obtained according to the resource requirements corresponding to the target algorithm to be configured and the algorithm to be configured respectively contained in each algorithm combination, which may include: calculating the resource ratio sum of the resource ratios of various target resource types corresponding to the algorithm combination according to the sum of the single resource requirements of each target resource type corresponding to the target algorithm to be configured and the algorithm to be configured in the algorithm combination, and the resource ratio of the single resource holding situation of the corresponding target resource type; taking the sum of the resource ratios as the sum of resource requirements to obtain the sum of resource requirements corresponding to each algorithm combination. That is, according to the sum of the single resource requirements calculated above, the sum of the resources of each type of the two algorithms and the resource ratio of the corresponding type of resources of the FPGA device, the resource ratios of each type of resources are accumulated and summed, and the higher the accumulated value, the higher the resource occupancy rate, and the algorithm should be selected. If there is an equal accumulated value, random selection is performed. Of course, it is also possible to sort from large to small according to the total resource requirements, and the algorithm combinations with the first two positions in the sorting are all used as the target algorithm combinations.
[0055] Step S14: performing algorithm configuration on the target FPGA device based on the new algorithm to be configured.
[0056] In this embodiment, the algorithm configuration of the target FPGA device based on the new algorithm to be configured may include: judging whether the new algorithm to be configured can continue to be combined with the algorithm to be configured according to the combination condition of the algorithm combination; if not, performing algorithm configuration on the target FPGA device based on the new algorithm to be configured.
[0057] In this embodiment, after judging whether the new algorithm to be configured can be combined with the algorithm to be configured according to the combination condition of the algorithm combination, it can also include: if so, taking the new algorithm to be configured as the target algorithm to be configured, and performing the step of selecting the algorithm that meets the algorithm combination with the target algorithm to be configured from all the algorithms to be configured to obtain multiple algorithm combinations corresponding to the target algorithm to be configured. That is, in this embodiment, by continuously looping the algorithm combination step, until a new algorithm to be configured cannot be combined, the new algorithm to be configured is configured to the FPGA device, and at this time, the new algorithm to be configured actually contains multiple algorithms, thereby realizing the configuration operation of multiple algorithms at one time.
[0058] For example, the algorithms to be configured include Algorithm A, Algorithm B, and Algorithm C. Algorithm A is selected as the target algorithm to be configured. According to the resource conditions of the FPGA device and different types of resources of each algorithm, the following table is shown:
[0059] Resource Type FF LUT RAM DSP FPGA Devices 500 400 200 100 Algorithm A 300 200 100 20 Algorithm B 100 100 50 10 Algorithm C 120 80 60 50
[0060] For Algorithm A, first determine the algorithm combination of Algorithm A. After Algorithm A is combined with other algorithms, the resource ratio of the sum of each type of resources and the corresponding type of resources of the FPGA device is calculated, as shown in the following table:
[0061] FF LUT RAM DSP A+A 1.2 1 1 0.4 A+B 0.8 0.75 0.75 0.3 A+C 0.84 0.7 0.8 0.7
[0062] According to the criteria for determining whether they are combinable, if the resource ratio of any type of resource is greater than or equal to 0.9, it is determined to be uncombinable. Therefore, the algorithms that can be combined with algorithm A include algorithm B and algorithm C, while algorithm A cannot be combined with algorithm A.
[0063] Subsequently, the optimal target algorithm combination is selected, and the ratio of each type of resource is accumulated. The larger the accumulated sum, the corresponding algorithm is selected. The sum of the resource ratios of A+B is (0.8+0.75+0.75+0.3)=2.6, and the sum of the resource ratios of A+C is (0.84+0.7+0.8+0.7)=3.04, so the target algorithm combination of algorithm A is a combination with algorithm C. After obtaining the target algorithm combination A+C, the algorithm after combining A+C can be used as a new algorithm to re-execute the algorithm combination determination and the optimal target algorithm combination selection to see if there is a possibility of further combination, until there is no possibility of new combination, then for the A algorithm, the effective combination is determined. Subsequently, for other algorithms B and C, the determination is made according to the same process. Since the number of FPGA resources occupied by an algorithm usually occupies a low proportion of the total resources of the FPGA device, in order to further improve the resource utilization of the FPGA device in this embodiment, the FPGA algorithm resource management is performed by realizing the effective combination between multiple algorithms, and multiple different algorithms can be configured to the FPGA device at one time.
[0064] As can be seen from the above, in this embodiment, multiple algorithms to be configured are obtained, and one of the algorithms to be configured is selected in turn as the target algorithm to be configured; according to the resource requirements of all the algorithms to be configured and the resource holdings of the target FPGA device, the algorithms that meet the algorithm combination requirements with the target algorithm to be configured are screened out from all the algorithms to be configured according to the algorithm combination rules, so as to obtain multiple algorithm combinations corresponding to the target algorithm to be configured; according to the sum of the resource requirements corresponding to each algorithm combination, the target algorithm combination is screened out from the algorithm combination according to the combination screening method, and the target algorithm combination is used as a new algorithm to be configured; and the target FPGA device is algorithmically configured based on the new algorithm to be configured. It can be seen that by combining the algorithms to be configured as a new algorithm to be configured, and then configuring the target FPGA device based on the new algorithm to be configured, since the new algorithm to be configured actually contains multiple algorithms, the configuration of multiple algorithms can be achieved through one configuration, which improves the efficiency of FPGA algorithm configuration. In addition, according to the resource requirements of the algorithms to be configured and the resource holdings of the target FPGA device, multiple algorithm combinations are determined according to the algorithm combination conditions, and then the target algorithm combination is selected as the new algorithm to be configured. The combination of algorithms takes into account the resource requirements of the algorithms and the resource holdings of the FPGA device, and can achieve effective combination of multiple algorithms to avoid unsatisfactory performance of the final algorithm combination due to excessive resource requirements.
[0065] Correspondingly, the present application embodiment also discloses an algorithm configuration device for an FPGA device, see Figure 2 As shown, the device comprises:
[0066] The algorithm acquisition module 11 is used to acquire multiple algorithms to be configured, and randomly and non-repeatedly select one of the algorithms to be configured as a target algorithm to be configured;
[0067] The algorithm combination determination module 12 is used to select algorithms that meet the algorithm combination requirements with the target algorithm to be configured from all the algorithms to be configured, so as to obtain multiple algorithm combinations corresponding to the target algorithm to be configured; the combination condition of the algorithm combination is that the resource holding amount of the target FPGA device is greater than the resource demand amount of the algorithm included in the algorithm combination;
[0068] A target algorithm combination determination module 13 is used to select a target algorithm combination from the algorithm combinations and use the target algorithm combination as a new algorithm to be configured;
[0069] The algorithm configuration module 14 is used to perform algorithm configuration on the target FPGA device based on the new algorithm to be configured.
[0070] As can be seen from the above, in this embodiment, multiple algorithms to be configured are obtained, and one of the algorithms to be configured is selected in turn as the target algorithm to be configured; according to the resource requirements of all the algorithms to be configured and the resource holdings of the target FPGA device, the algorithms that meet the algorithm combination requirements with the target algorithm to be configured are screened out from all the algorithms to be configured according to the algorithm combination rules, so as to obtain multiple algorithm combinations corresponding to the target algorithm to be configured; according to the sum of the resource requirements corresponding to each algorithm combination, the target algorithm combination is screened out from the algorithm combination according to the combination screening method, and the target algorithm combination is used as a new algorithm to be configured; and the target FPGA device is algorithmically configured based on the new algorithm to be configured. It can be seen that by combining the algorithms to be configured as a new algorithm to be configured, and then configuring the target FPGA device based on the new algorithm to be configured, since the new algorithm to be configured actually contains multiple algorithms, the configuration of multiple algorithms can be achieved through one configuration, which improves the efficiency of FPGA algorithm configuration. In addition, according to the resource requirements of the algorithms to be configured and the resource holdings of the target FPGA device, multiple algorithm combinations are determined according to the algorithm combination conditions, and then the target algorithm combination is selected as the new algorithm to be configured. The combination of algorithms takes into account the resource requirements of the algorithms and the resource holdings of the FPGA device, and can achieve effective combination of multiple algorithms to avoid unsatisfactory performance of the final algorithm combination due to excessive resource requirements.
[0071] In some specific embodiments, the algorithm configuration module 14 may specifically include:
[0072] A judging unit, configured to judge whether the new algorithm to be configured can continue to be combined with the algorithm to be configured according to the combination condition of the algorithm combination;
[0073] A configuration execution unit is used to perform algorithm configuration on the target FPGA device based on the new algorithm to be configured if the judgment result of the judgment unit is no.
[0074] In some specific embodiments, the algorithm configuration device may specifically include:
[0075] The algorithm combination determination execution unit is used to, if the judgment result of the judgment unit is yes, use the new algorithm to be configured as the target algorithm to be configured, and execute the step of screening out algorithms that meet the algorithm combination requirements with the target algorithm to be configured from all the algorithms to be configured to obtain multiple algorithm combinations corresponding to the target algorithm to be configured.
[0076] In some specific embodiments, the target algorithm combination determination module 13 may specifically include:
[0077] The first target algorithm determination unit is used to select the algorithm combination including the algorithm with the highest priority as the target algorithm combination according to the priorities corresponding to the algorithms in all the algorithm combinations.
[0078] In some specific embodiments, the target algorithm combination determination module 13 may specifically include:
[0079] A resource requirement sum determination unit, configured to obtain a resource requirement sum corresponding to each algorithm combination according to the resource requirements respectively corresponding to the target algorithm to be configured and an algorithm to be configured contained in each algorithm combination;
[0080] The second target algorithm determination unit is used to sort the algorithm combinations according to the total resource requirements, and use the algorithm combination with the largest total resource requirement value as the target algorithm combination.
[0081] In some specific embodiments, the algorithm combination determination module 12 may specifically include:
[0082] A single resource requirement determination unit, used to obtain the single resource requirement of all the algorithms to be configured for each target resource type;
[0083] a single resource requirement summing calculation unit, configured to calculate the sum of the single resource requirements of the target algorithm to be configured and each of the algorithms to be configured for each target resource type according to the single resource requirement, and to take the target algorithm to be configured and any one of the algorithms to be configured as a group of algorithm pairs to obtain the sum of the single resource requirements of each algorithm pair for different target resource types;
[0084] A resource ratio calculation unit, configured to calculate a resource ratio of the sum of the single resource requirements of the algorithm pair to the single resource holding situation of the corresponding target resource type according to the sum of the single resource requirements and the single resource holding situation of the target FPGA device for each target resource type;
[0085] The algorithm combination determination unit is used to screen out an algorithm that can be combined with the target algorithm to be configured from all the algorithms to be configured according to a preset ratio threshold and the numerical value of the resource ratio.
[0086] In some specific embodiments, the target resource types may specifically include trigger resources, lookup table resources, on-chip storage resources, and digital signal processing resources.
[0087] In some specific embodiments, the resource requirement sum determination unit may specifically include:
[0088] a resource ratio sum determination unit, configured to calculate the resource ratio sum of the resource ratios of various target resource types corresponding to the algorithm combination according to the sum of the single resource requirements of each target resource type corresponding to the target algorithm to be configured and one algorithm to be configured in the algorithm combination, and the resource ratio of the single resource holding situation of the corresponding target resource type;
[0089] The resource requirement sum determination unit is used to use the resource ratio sum as the resource requirement sum to obtain the resource requirement sum corresponding to each algorithm combination.
[0090] Furthermore, the present application also discloses an electronic device, see Figure 3 As shown, the contents in the drawings should not be considered as any limitation on the scope of use of the present application.
[0091] Figure 3 The present invention provides a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the algorithm configuration method of the FPGA device disclosed in any of the aforementioned embodiments.
[0092] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0093] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon include an operating system 221, a computer program 222, and data 223 including algorithms to be configured, etc. The storage method can be temporary storage or permanent storage.
[0094] The operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device 20, so as to realize the operation and processing of the massive data 223 in the memory 22 by the processor 21, and it can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the algorithm configuration method of the FPGA device executed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0095] Furthermore, an embodiment of the present application also discloses a computer storage medium, in which computer executable instructions are stored. When the computer executable instructions are loaded and executed by a processor, the algorithm configuration method steps of the FPGA device disclosed in any of the aforementioned embodiments are implemented.
[0096] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0097] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0098] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0099] The above is a detailed introduction to the algorithm configuration method, apparatus, device and medium of an FPGA device provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. An algorithm configuration method for an FPGA device, characterized in that: include: Acquire multiple algorithms to be configured, and randomly and non-repeatedly select one of the algorithms to be configured in sequence as a target algorithm to be configured; Screening out algorithms that meet the requirements for algorithm combination with the target algorithm to be configured from all the algorithms to be configured, so as to obtain a plurality of algorithm combinations corresponding to the target algorithm to be configured; the combination condition of the algorithm combination is that the resource holding amount of the target FPGA device is greater than the resource demand amount of the algorithm included in the algorithm combination; Selecting a target algorithm combination from the algorithm combinations and using the target algorithm combination as a new algorithm to be configured; Performing algorithm configuration on the target FPGA device based on the new algorithm to be configured; The step of configuring the target FPGA device based on the new algorithm to be configured includes: According to the combination condition of the algorithm combination, determining whether the new algorithm to be configured can continue to be combined with the algorithm to be configured; If not, performing algorithm configuration on the target FPGA device based on the new algorithm to be configured; After judging whether the new algorithm to be configured can be further combined with the algorithm to be configured according to the combination condition of the algorithm combination, the method further includes: If yes, the new algorithm to be configured is used as the target algorithm to be configured, and the step of screening out algorithms that meet the requirements for algorithm combination with the target algorithm to be configured from all the algorithms to be configured is performed to obtain multiple algorithm combinations corresponding to the target algorithm to be configured.
2. The algorithm configuration method of the FPGA device according to claim 1, characterized in that: The step of selecting a target algorithm combination from the algorithm combination includes: According to the priorities corresponding to the algorithms in all the algorithm combinations, the algorithm combination including the algorithm with the highest priority is used as the target algorithm combination.
3. The algorithm configuration method of the FPGA device according to claim 1, characterized in that: The step of selecting a target algorithm combination from the algorithm combination includes: Obtaining a sum of resource requirements corresponding to each algorithm combination according to the resource requirements respectively corresponding to the target algorithm to be configured and an algorithm to be configured contained in each algorithm combination; The algorithm combinations are sorted according to the resource requirement sum, and the algorithm combination with the largest resource requirement sum is used as the target algorithm combination.
4. The algorithm configuration method of the FPGA device according to claim 3, characterized in that: The step of selecting an algorithm that is suitable for algorithm combination with the target algorithm to be configured from all the algorithms to be configured includes: Obtaining a single resource requirement of each target resource type for all the algorithms to be configured; According to the single resource demand, the sum of the single resource demand of the target algorithm to be configured and each of the algorithms to be configured for each target resource type is calculated, and the target algorithm to be configured and any one of the algorithms to be configured are used as a group of algorithm pairs to obtain the sum of the single resource demand of each algorithm pair for different target resource types; Calculate a resource ratio of the sum of the single resource requirements of the algorithm pair to the single resource holding situation of the corresponding target resource type according to the sum of the single resource requirements and the single resource holding situation of the target FPGA device for each target resource type; According to the preset ratio threshold and the numerical value of the resource ratio, an algorithm that can be combined with the target algorithm to be configured is screened out from all the algorithms to be configured.
5. The algorithm configuration method of the FPGA device according to claim 4, characterized in that: The target resource types include trigger resources, lookup table resources, on-chip storage resources and digital signal processing resources.
6. The algorithm configuration method of the FPGA device according to claim 4, characterized in that: The obtaining the sum of resource requirements corresponding to each algorithm combination according to the resource requirements respectively corresponding to the target algorithm to be configured and an algorithm to be configured contained in each algorithm combination comprises: The sum of the resource ratios of the resource ratios of each target resource type corresponding to the target algorithm to be configured and one algorithm to be configured in the algorithm combination is calculated based on the sum of the single resource requirements of each target resource type corresponding to the target algorithm to be configured and the resource ratio of the single resource holding situation of the corresponding target resource type; The sum of the resource ratios is taken as the sum of the resource requirements to obtain the sum of the resource requirements corresponding to each of the algorithm combinations.
7. An algorithm configuration device for an FPGA device, characterized in that: include: An algorithm acquisition module, used to acquire multiple algorithms to be configured, and randomly and non-repeatedly select one of the algorithms to be configured as a target algorithm to be configured; An algorithm combination determination module, used to screen out algorithms that meet the algorithm combination requirements with the target algorithm to be configured from all the algorithms to be configured, so as to obtain a plurality of algorithm combinations corresponding to the target algorithm to be configured; the combination condition of the algorithm combination is that the resource holding amount of the target FPGA device is greater than the resource demand amount of the algorithm included in the algorithm combination; A target algorithm combination determination module is used to screen out a target algorithm combination from the algorithm combinations and use the target algorithm combination as a new algorithm to be configured; An algorithm configuration module, used to perform algorithm configuration on the target FPGA device based on the new algorithm to be configured; The algorithm configuration module is further used to determine whether the new algorithm to be configured can continue to be combined with the algorithm to be configured according to the combination condition of the algorithm combination; If not, performing algorithm configuration on the target FPGA device based on the new algorithm to be configured; Among them, the algorithm configuration device is also used to determine whether the new algorithm to be configured can continue to be combined with the algorithm to be configured according to the combination conditions of the algorithm combination. If so, the new algorithm to be configured is used as the target algorithm to be configured, and the step of screening out algorithms that meet the requirements for algorithm combination with the target algorithm to be configured from all the algorithms to be configured is performed to obtain multiple algorithm combinations corresponding to the target algorithm to be configured.
8. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the algorithm configuration method for the FPGA device according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein when the computer programs are executed by a processor, the algorithm configuration method of the FPGA device as described in any one of claims 1 to 6 is implemented.
