Distributed compiling tuning method and device based on random forest model

By applying the random forest model and SHAP interpreter in compilation tuning, the problem of difficulty in mining deep dependencies of compilation options in the existing technology is solved, and more efficient compilation tuning is achieved.

CN119556934APending Publication Date: 2025-03-04CHINESE PEOPLES LIBERATION ARMY UNIT 32051
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411703105.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-26
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

Existing compilation tuning methods are difficult to fully tap deep dependencies between compilation options, resulting in missing potential optimization opportunities.

Method used

A distributed compilation tuning method based on a random forest model is adopted, and a compilation option combination is generated through preset distributed metasearch strategy, and a pre-trained random forest model is used to predict performance, a SHAP interpreter is established to analyze Shapley values ​​and interaction values, and filter and update the compilation option set.

Benefits of technology

Through the performance prediction of the random forest model and the analysis of the SHAP interpreter, the actual number of executions and time are reduced, energy consumption is reduced, and the deep dependence relationship between compilation options is fully explored, which is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119556934A_ABST
    Figure CN119556934A_ABST
Patent Text Reader

Abstract

The invention discloses a distributed compiling tuning method and device based on a random forest model. The method comprises the following steps: searching in a current compilation option set based on a preset distributed meta-search strategy to generate a plurality of compilation option combinations; performing performance prediction on the compilation option combination based on a pre-trained random forest model to obtain performance data corresponding to the compilation option combination; establishing an analysis sample set based on the compilation option combination and the performance data; establishing an SHAP interpreter based on a random forest model, and analyzing the analysis sample set based on the SHAP interpreter to obtain a Shapley value of each compiling option and a Shapley interaction value of each compiling option pair; screening the current compiling option set based on the Shapley value of each compiling option and the Shapley interaction value of each compiling option pair, and updating the current compiling option set; and under the condition that a preset condition is met, determining the current option set as a target option set. According to the method, the search efficiency can be improved while the search space dimension is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a distributed compilation tuning method and device based on a random forest model. Background Art

[0002] Compiler automatic tuning is a hot topic in current research, which focuses on three aspects: optimizing the search space, adjusting the evaluation model, and improving the search strategy. The optimization of the search space is to reduce the number of compilation option combinations that need to be considered to improve the tuning efficiency. An effective evaluation model can accurately predict the impact of different compilation option combinations on program performance. The search strategy determines how to select the next configuration based on the performance of the current configuration after each iteration.

[0003] At present, the research on compilation tuning has the following problems: the current search space optimization methods mainly rely on traditional statistical methods, which make it difficult to fully explore the deep dependencies between compilation options, thus missing potential optimization opportunities. Summary of the invention

[0004] The present invention provides a distributed compilation tuning method and device based on a random forest model to solve the problem that the existing search space optimization method is difficult to fully explore the deep dependencies between compilation options, thereby missing potential optimization opportunities.

[0005] According to one aspect of the present invention, a distributed compilation tuning method based on a random forest model is provided, comprising:

[0006] Searching in the current compilation option set based on a preset distributed meta-search strategy to generate multiple compilation option combinations; performing performance prediction on the compilation option combinations based on a pre-trained random forest model to obtain performance data corresponding to the compilation option combinations;

[0007] Establishing an analysis sample set based on the compilation option combination and the performance data corresponding to the compilation option combination;

[0008] Establishing a SHAP interpreter based on the random forest model, analyzing the analysis sample set based on the SHAP interpreter to obtain a Shapley value of each compilation option in the analysis sample set and a Shapley interaction value of each compilation option pair; the compilation option pair is determined by any two compilation options in the analysis sample set;

[0009] Filtering the current compilation option set based on the Shapley value of each compilation option and the Shapley interaction value of each compilation option pair, and updating the current compilation option set;

[0010] When the preset conditions are met, the current option set is determined as the target option set.

[0011] According to another aspect of the present invention, a distributed compilation and tuning device based on a random forest model is provided, comprising:

[0012] A compilation option combination search and performance prediction module, used to search in the current compilation option set based on a preset distributed meta-search strategy to generate multiple compilation option combinations; perform performance prediction on the compilation option combination based on a pre-trained random forest model to obtain performance data corresponding to the compilation option combination;

[0013] An analysis sample set establishing module, used to establish an analysis sample set based on the compilation option combination and the performance data corresponding to the compilation option combination;

[0014] A compilation option analysis module, used for establishing a SHAP interpreter based on the random forest model, analyzing the analysis sample set based on the SHAP interpreter, and obtaining a Shapley value of each compilation option in the analysis sample set and a Shapley interaction value of each compilation option pair; the compilation option pair is determined by any two compilation options in the analysis sample set;

[0015] a current compiling option set updating module, configured to filter the current compiling option set based on the Shapley value of each compiling option and the Shapley interaction value of each compiling option pair, and update the current compiling option set;

[0016] The target option set determination module is used to determine the current option set as the target option set when a preset condition is met.

[0017] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0018] at least one processor; and

[0019] a memory communicatively connected to the at least one processor; wherein,

[0020] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the distributed compilation tuning method based on the random forest model described in any embodiment of the present invention.

[0021] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the distributed compilation and tuning method based on the random forest model described in any embodiment of the present invention when executed.

[0022] The technical solution of the embodiment of the present invention generates multiple compilation option combinations by searching in the current compilation option set based on a preset distributed meta-search strategy; predicting the performance of the compilation option combination based on a pre-trained random forest model to obtain performance data corresponding to the compilation option combination; establishing an analysis sample set based on the compilation option combination and the performance data corresponding to the compilation option combination; establishing a SHAP interpreter based on the random forest model, analyzing the analysis sample set based on the SHAP interpreter to obtain the Shapley value of each compilation option in the analysis sample set and the Shapley interaction value of each compilation option pair; the compilation option pair is determined by any two compilation options in the analysis sample set; filtering the current compilation option set based on the Shapley value of each compilation option and the Shapley interaction value of each compilation option pair, and updating the current compilation option set; and determining the current option set as the target option set when the preset conditions are met. The performance of the compilation option combinations obtained by search is predicted through the random forest model, which reduces the actual execution times and time and reduces energy consumption. At the same time, by building a SHAP interpreter, the current compilation option set is screened using Shapley values ​​and Shapley interaction values ​​to update the current compilation option combination. This solves the problem that the existing search space optimization methods are difficult to fully explore the deep dependencies between compilation options, thereby missing potential optimization opportunities. This improves search efficiency while reducing the dimension of the search space.

[0023] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0025] Figure 1 It is a flow chart of a distributed compilation tuning method based on a random forest model provided in the first embodiment of the present invention;

[0026] Figure 2It is a structural schematic diagram of a distributed compilation and tuning device based on a random forest model provided in Embodiment 2 of the present invention;

[0027] Figure 3 It is a structural schematic diagram of an electronic device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0028] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme 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 should fall within the scope of protection of the present invention.

[0029] It should be noted that the terms "first compilation option set", "second compilation option set", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0030] Embodiment 1

[0031] Figure 1 This is a flow chart of a distributed compilation tuning method based on a random forest model provided in the first embodiment of the present invention. This embodiment is applicable to the case where a compilation option set is optimized to achieve compilation tuning. The method can be executed by a distributed compilation tuning device based on a random forest model. The distributed compilation tuning device based on a random forest model can be implemented in the form of hardware and / or software. The distributed compilation tuning device based on a random forest model can be configured in electronic devices such as computers and servers. Figure 1 As shown, the method includes:

[0032] S110, searching in the current compilation option set based on a preset distributed meta-search strategy to generate multiple compilation option combinations; performing performance prediction on the compilation option combinations based on a pre-trained random forest model to obtain performance data corresponding to the compilation option combinations.

[0033] Among them, the current compilation option set refers to the compilation option set of the current iterative execution round. It can be understood that the current compilation option set of the initial iterative round is the tuned compilation option set. In this embodiment, a search is performed in the current compilation option set based on a preset distributed meta-search strategy to generate multiple compilation option combinations; wherein the compilation option combination is composed of multiple compilation option combinations searched in the current compilation option set by the search technology. Further, the compilation option combination is input into the pre-trained random forest model for performance prediction, and the performance data corresponding to the compilation option combination is obtained, and the compilation option combination and the performance data corresponding to the compilation option combination are associated and stored in the search result database.

[0034] On the basis of the above embodiment, optionally, the method comprises: searching in the current compilation option set based on a preset distributed meta-search strategy to generate multiple compilation option combinations; performing performance prediction on the compilation option combination based on a pre-trained random forest model to obtain performance data corresponding to the compilation option combination, including: in each search round, determining a target search technology from the multiple search technologies based on the credit values ​​of the multiple search technologies; the higher the credit value of the search technology, the greater the probability of being selected; performing multiple searches in the current compilation option set based on the target search technology to obtain a batch of compilation option combinations; performing performance prediction on the compilation option combination based on a pre-trained random forest model to obtain performance data corresponding to the compilation option combination; determining a first credit item and a second credit item of the target search technology based on the performance data respectively corresponding to the batch of compilation option combinations; and updating the credit value of the target search technology based on the first credit item and the second credit item.

[0035] The search technology refers to the search technology that executes the distributed meta-search strategy. Specifically, the search technology includes but is not limited to the greedy mutation, differential evolution, random simplex method and other search technologies, which are not limited here. Each search round selects a search technology to search in the current option set. It is understandable that if you rely too much on a certain search strategy, you may fall into the local optimal value and miss new opportunities to improve program performance. Therefore, this embodiment selects the search technology for searching by the credit value of each search technology.

[0036] In an embodiment of the present invention, in each search round, a target search technology is selected from multiple search technologies based on the credit values ​​of multiple search technologies; it should be noted that the higher the credit value of a search technology, the greater the probability of being selected, but the search technology with the highest credit value may not necessarily be selected. Further, multiple searches are performed in the current compilation option set based on the target search technology to obtain a batch of compilation option combinations; performance predictions are performed on each compilation option combination based on a pre-trained random forest model to obtain performance data corresponding to each compilation option combination; the first credit item and the second credit item of the target search technology are determined based on the performance data corresponding to each compilation option combination; wherein the first credit item is used to ensure that excellent search technologies get more testing opportunities. Specifically, the calculation formula for the first credit item is as follows:

[0037]

[0038] Among them, AUC t Indicates the first credit item, V t is an array of type Bool, whose elements V t [i] indicates whether the global optimal result is obtained when the search technique t is used for the i-th time (if yes, it is 1, otherwise it is 0). Indicates V t The weighted sum of the elements in .

[0039] The second credit term is used to ensure that even poorly performing search techniques have a chance to be tried again to avoid falling into a local optimum. Specifically, the calculation formula for the second credit term is as follows:

[0040]

[0041] Among them, EXP t represents the second credit term, C and H are constants that control exploration and equilibrium.

[0042] Further, a new credit value of the target search technology is determined based on the first credit item and the second credit item, and the credit value of the target search technology is updated based on the new credit value. Specifically, the calculation formula of the new credit value is as follows:

[0043] Score t =AUC t +EXP t ;

[0044] Among them, Score t Indicates the calculated new credit value.

[0045] This embodiment achieves efficient parallelization of the search process by dynamically allocating credits to multiple search techniques.

[0046] Based on the above embodiment, optionally, the credit values ​​based on multiple search technologies determine the target search technology among the multiple search technologies, including: when the search round is an initial round, initializing the credit values ​​of the multiple search technologies, and randomly selecting a search technology from the multiple search technologies as the target search technology; wherein the credit values ​​of each of the search technologies after initialization are the same.

[0047] In an embodiment of the present invention, when the search round is an initial round, since the credit value of the search technology has not been updated, the credit values ​​of multiple search technologies are initialized, the same credit value is assigned to the multiple search technologies, and one search technology is randomly selected from the multiple search technologies as the target search technology.

[0048] In some embodiments, optionally, after performing performance prediction on the compilation option combination based on the pre-trained random forest model and obtaining performance data corresponding to the compilation option combination, the method further includes: comparing the performance data corresponding to the compilation option combination with a performance threshold; if the performance data corresponding to the compilation option combination is less than or equal to the performance threshold, submitting the compilation option combination to a computing node for distributed compilation and running, and obtaining measured performance data corresponding to the compilation option combination.

[0049] In an embodiment of the present invention, in order to ensure the accuracy of the performance data of the compilation option combination predicted by the random forest model, the performance data corresponding to the compilation option combination is compared with the performance threshold. If the performance data corresponding to the compilation option combination is less than or equal to the performance threshold, it indicates that the performance data of the compilation option combination predicted by the random forest model is abnormal. The compilation option combination is submitted to the computing node for distributed compilation and operation to perform actual execution verification, thereby obtaining the measured performance data corresponding to the compilation option combination. The measured performance data refers to the performance data obtained by actually compiling and running the compilation option combination.

[0050] Based on the above embodiments, optionally, the training method of the random forest model includes: establishing a sample set, the sample set including a training sample set and a verification sample set, each sample in the sample set including a compilation option combination and measured performance data corresponding to the compilation option combination; training the random forest model based on the training sample set, and verifying the random forest model based on the verification sample set to obtain the pre-trained random forest model.

[0051] In an embodiment of the present invention, a method for establishing a sample set is as follows: in each search round, a target search technology is selected from multiple search technologies based on the credit values ​​of multiple search technologies; multiple searches are performed in the current compilation option set based on the target search technology to obtain a batch of compilation option combinations, and the batch of compilation option combinations are submitted to the computing nodes for parallel distributed compilation and operation to obtain measured performance data corresponding to each compilation option combination; a first credit item and a second credit item of the target search technology are determined based on the measured performance data corresponding to the batch of compilation option combinations; the credit value of the target search technology is updated based on the first credit item and the second credit item. Through multiple search rounds of search and compilation operation, a large number of compilation option combinations and measured performance data corresponding to the compilation option combinations are obtained, and the compilation option combinations and the measured performance data corresponding to the compilation option combinations are associated and stored in a search result database. The compilation option combinations and the measured performance data corresponding to the compilation option combinations are extracted from the search result database to establish a sample set.

[0052] In an embodiment of the present invention, a random forest model is trained based on a training sample set, and the random forest model is verified based on a verification sample set to obtain a random forest model.

[0053] Based on the above embodiments, optionally, the method for determining the performance threshold includes: determining the performance threshold based on the compilation option combinations in the training sample set and the verification sample set and the measured performance data corresponding to the compilation option combinations, the number of elements in the training sample set, the number of elements in the verification sample set, and the determination coefficient of the pre-trained random forest model.

[0054] In the embodiment of the present invention, the performance threshold is calculated as follows:

[0055]

[0056] Among them, ET represents the performance threshold, S t represents the training sample set, S v represents the validation sample set, x i represents the i-th compilation option combination, t i represents the measured performance data corresponding to the i-th compilation option combination, W t Represents the number of elements in the training sample set, W v Represents the number of elements in the validation sample set, R 2 represents the coefficient of determination of the random forest model.

[0057] S120: Establish an analysis sample set based on the compilation option combination and performance data corresponding to the compilation option combination.

[0058] In the embodiment of the present invention, the compilation option combinations and the performance data corresponding to the compilation option combinations are extracted from the search result database to construct an analysis sample set.

[0059] S130. Establish a SHAP interpreter based on the random forest model, analyze the analysis sample set based on the SHAP interpreter, and obtain the Shapley value of each compilation option in the analysis sample set and the Shapley interaction value of each compilation option pair; the compilation option pair is determined by any two compilation options in the analysis sample set.

[0060] Among them, the SHAP interpreter is used to evaluate the importance of each compilation option in the analysis sample set and their interactions. In an embodiment of the present invention, the TreeExplainer function in the SHAP library is used, and the trained random forest model is used as an input parameter to construct a SHAP interpreter of the tree model; further, the analysis sample set is analyzed based on the SHAP interpreter, and the Shapley value of each compilation option in the analysis sample set and the Shapley interaction value of each compilation option pair are calculated. Among them, the Shapley value is used to evaluate the importance of each compilation option, and the Shapley interaction value is used to evaluate the interaction between any two compilation options in the analysis sample set; specifically, the calculation method of the Shapley value and the Shapley interaction value is:

[0061] shap_values=explainer.shap_values(states_val_array);

[0062] shap_interaction_values=explainer.shap_interaction_values(states_val_array);

[0063] Among them, shap_values ​​represents Shapley value, shap_interation_values ​​represents Shapley interaction value, and states_val_array represents the analysis sample set.

[0064] S140: Filter the current compilation option set based on the Shapley value of each compilation option and the Shapley interaction value of each compilation option pair, and update the current compilation option set.

[0065] In an embodiment of the present invention, the current compilation option set is screened based on the Shapley value and the Shapley interaction value, and the compilation options and compilation option pairs that have a significant positive impact on the performance are selected, and the compilation options with less impact are excluded to update the current compilation option set. It should be noted that the updated current compilation option set cannot be empty.

[0066] Based on the above embodiment, optionally, the filtering the current compilation option set based on the Shapley value of each compilation option and the Shapley interaction value of each compilation option pair, and updating the current compilation option set, includes: sorting the compilation options based on the Shapley value to obtain a first sorting result; filtering the compilation options based on the first sorting result to obtain a first compilation option set; for any first compilation option in the first compilation option set, sorting the compilation option pair including the first compilation option based on the Shapley interaction value to obtain a second sorting result; filtering the compilation option pair based on the second sorting result to obtain a target compilation option pair, and recording the second compilation option in the target compilation option pair; forming a second compilation option set based on the second compilation option corresponding to each of the first compilation options in the first compilation option set; and updating the current compilation option set based on the first compilation option set and the second compilation option set.

[0067] In an embodiment of the present invention, the compilation options can be sorted in descending order based on the Shapley value to obtain a first sorting result, and the compilation options can be screened based on the preset screening condition and the first sorting result to obtain a first compilation option set; wherein the preset screening condition can be the compilation options ranked in the top 50% of the first sorting result. Further, for any first compilation option in the first compilation option set, the compilation option pair containing the first compilation option is sorted in descending order based on the Shapley interaction value to obtain a second sorting result; the compilation option pair with the highest ranking in the second sorting result is determined as the target compilation option pair, and the second compilation option in the target compilation option pair is recorded; a second compilation option set is formed based on the second compilation option corresponding to each first compilation option in the first compilation option set; the compilation options in the first compilation option set and the second compilation option set are merged to obtain a new compilation option set, and the current compilation option set is updated based on the new compilation option set. It should be noted that the first compilation option is a compilation option in the first compilation option set, and the second compilation option is another compilation option in the compilation option pair with the highest Shapley interaction value in the compilation option pair containing the first compilation option.

[0068] S150: When a preset condition is met, determine the current option set as a target option set.

[0069] The preset condition is to determine whether the current option set meets the compilation optimization purpose condition. Specifically, the preset condition can be a preset number of iterations of iteratively executing steps S110-S140, or a preset compilation optimization threshold of the current option set. In an embodiment of the present invention, when the preset condition is met, the current option set is determined as the target option set. The target option set is the optimal option set under the preset condition.

[0070] The technical solution of this embodiment generates multiple compilation option combinations by searching in the current compilation option set based on a preset distributed meta-search strategy; predicts the performance of the compilation option combination based on a pre-trained random forest model to obtain performance data corresponding to the compilation option combination; establishes an analysis sample set based on the compilation option combination and the performance data corresponding to the compilation option combination; establishes a SHAP interpreter based on the random forest model, and analyzes the analysis sample set based on the SHAP interpreter to obtain the Shapley value of each compilation option in the analysis sample set and the Shapley interaction value of each compilation option pair; the compilation option pair is determined by any two compilation options in the analysis sample set; the current compilation option set is screened based on the Shapley value of each compilation option and the Shapley interaction value of each compilation option pair, and the current compilation option set is updated; and when the preset conditions are met, the current option set is determined as the target option set. The performance of the compilation option combinations obtained by search is predicted through the random forest model, which reduces the actual execution times and time and reduces energy consumption. At the same time, by building a SHAP interpreter, the current compilation option set is screened using Shapley values ​​and Shapley interaction values ​​to update the current compilation option combination. This solves the problem that the existing search space optimization methods are difficult to fully explore the deep dependencies between compilation options, thereby missing potential optimization opportunities. This improves search efficiency while reducing the dimension of the search space.

[0071] Embodiment 2

[0072] Figure 2 Schematic diagram of the structure of a distributed compilation and tuning device based on a random forest model provided by the second embodiment of the present invention. Figure 2 As shown, the device comprises:

[0073] The compiling option combination search and performance prediction module 210 is used to search in the current compiling option set based on a preset distributed meta-search strategy to generate multiple compiling option combinations; perform performance prediction on the compiling option combinations based on a pre-trained random forest model to obtain performance data corresponding to the compiling option combinations;

[0074] An analysis sample set establishing module 220, configured to establish an analysis sample set based on the compilation option combination and the performance data corresponding to the compilation option combination;

[0075] A compilation option analysis module 230 is used to establish a SHAP interpreter based on the random forest model, analyze the analysis sample set based on the SHAP interpreter, and obtain the Shapley value of each compilation option in the analysis sample set and the Shapley interaction value of each compilation option pair; the compilation option pair is determined by any two compilation options in the analysis sample set;

[0076] A current compilation option set updating module 240, configured to filter the current compilation option set based on the Shapley value of each compilation option and the Shapley interaction value of each compilation option pair, and update the current compilation option set;

[0077] The target option set determination module 250 is used to determine the current option set as the target option set when a preset condition is met.

[0078] The technical solution of this embodiment generates multiple compilation option combinations by searching in the current compilation option set based on a preset distributed meta-search strategy; predicts the performance of the compilation option combination based on a pre-trained random forest model to obtain performance data corresponding to the compilation option combination; establishes an analysis sample set based on the compilation option combination and the performance data corresponding to the compilation option combination; establishes a SHAP interpreter based on the random forest model, and analyzes the analysis sample set based on the SHAP interpreter to obtain the Shapley value of each compilation option in the analysis sample set and the Shapley interaction value of each compilation option pair; the compilation option pair is determined by any two compilation options in the analysis sample set; the current compilation option set is screened based on the Shapley value of each compilation option and the Shapley interaction value of each compilation option pair, and the current compilation option set is updated; and when the preset conditions are met, the current option set is determined as the target option set. The performance of the compilation option combinations obtained by search is predicted through the random forest model, which reduces the actual execution times and time and reduces energy consumption. At the same time, by building a SHAP interpreter, the current compilation option set is screened using Shapley values ​​and Shapley interaction values ​​to update the current compilation option combination. This solves the problem that the existing search space optimization methods are difficult to fully explore the deep dependencies between compilation options, thereby missing potential optimization opportunities. This improves search efficiency while reducing the dimension of the search space.

[0079] Based on the above embodiment, optionally, the compilation option combination search and performance prediction module 210 is used to:

[0080] In each search round, a target search technology is determined from among the multiple search technologies based on the credit values ​​of the multiple search technologies; the higher the credit value of the search technology, the greater the probability of being selected;

[0081] Based on the target search technology, multiple searches are performed in the current compilation option set to obtain a batch of compilation option combinations; based on the pre-trained random forest model, performance prediction is performed on the compilation option combinations to obtain performance data corresponding to the compilation option combinations;

[0082] A first credit item and a second credit item of the target search technology are determined based on the performance data respectively corresponding to the batch of compilation option combinations; and a credit value of the target search technology is updated based on the first credit item and the second credit item.

[0083] Based on the above embodiment, optionally, the compilation option combination search and performance prediction module 210 includes a target search technology determination unit, which is used to:

[0084] When the search round is an initial round, the credit values ​​of the multiple search technologies are initialized, and a search technology is randomly selected from the multiple search technologies as a target search technology; wherein the credit value of each search technology after initialization is the same.

[0085] Based on the above embodiment, optionally, the device further includes a measurement verification module, which is used to:

[0086] The performance data corresponding to the compilation option combination is compared with the performance threshold. If the performance data corresponding to the compilation option combination is less than or equal to the performance threshold, the compilation option combination is submitted to the computing node for distributed compilation and operation to obtain the measured performance data corresponding to the compilation option combination.

[0087] Based on the above embodiment, optionally, the device further includes a training module of a random forest model, which is used to:

[0088] Establishing a sample set, the sample set comprising a training sample set and a verification sample set, each sample in the sample set comprising a compilation option combination and measured performance data corresponding to the compilation option combination;

[0089] The random forest model is trained based on the training sample set, and the random forest model is verified based on the verification sample set to obtain the pre-trained random forest model.

[0090] Based on the above embodiment, optionally, the device also includes a performance threshold determination module, which is used to: determine the performance threshold based on the compilation option combinations in the training sample set and the verification sample set and the measured performance data corresponding to the compilation option combinations, the number of elements in the training sample set, the number of elements in the verification sample set, and the determination coefficient of the pre-trained random forest model.

[0091] Based on the above embodiment, optionally, the current compilation option set updating module 250 is used to:

[0092] Sorting the compilation options based on the Shapley value to obtain a first sorting result;

[0093] Filtering the compilation options based on the first sorting result to obtain a first compilation option set;

[0094] For any first compiling option in the first compiling option set, sorting the compiling option pairs including the first compiling option based on the Shapley interaction value to obtain a second sorting result; screening the compiling option pairs based on the second sorting result to obtain a target compiling option pair, and recording the second compiling option in the target compiling option pair;

[0095] forming a second compilation option set based on the second compilation option corresponding to each of the first compilation options in the first compilation option set;

[0096] The current compilation option set is updated based on the first compilation option set and the second compilation option set.

[0097] The distributed compilation and tuning device based on the random forest model provided in the embodiment of the present invention can execute the distributed compilation and tuning method based on the random forest model provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0098] Embodiment 3

[0099] Figure 3 1 is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0100] like Figure 3 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0101] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0102] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 11 executes the various methods and processes described above, such as a distributed compilation tuning method based on a random forest model.

[0103] In some embodiments, the distributed compilation and tuning method based on the random forest model can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the distributed compilation and tuning method based on the random forest model described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to execute the distributed compilation and tuning method based on the random forest model in any other appropriate manner (for example, by means of firmware).

[0104] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0105] The computer program for implementing the distributed compilation and tuning method based on the random forest model of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or the block diagram are implemented. The computer program can be executed completely on the machine, partially on the machine, partially on the machine as an independent software package and partially on a remote machine, or completely on a remote machine or server.

[0106] Embodiment 4

[0107] Embodiment 4 of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to execute a distributed compilation and tuning method based on a random forest model, the method comprising:

[0108] Based on a preset distributed meta-search strategy, a search is performed in the current compilation option set to generate multiple compilation option combinations; based on a pre-trained random forest model, a performance prediction is performed on the compilation option combination to obtain performance data corresponding to the compilation option combination;

[0109] Establishing an analysis sample set based on the compilation option combination and the performance data corresponding to the compilation option combination;

[0110] A SHAP interpreter is established based on the random forest model, and the analysis sample set is analyzed based on the SHAP interpreter to obtain the Shapley value of each compilation option in the analysis sample set and the Shapley interaction value of each compilation option pair; the compilation option pair is determined by any two compilation options in the analysis sample set;

[0111] The current compilation option set is filtered based on the Shapley value of each compilation option and the Shapley interaction value of each compilation option pair, and the current compilation option set is updated;

[0112] When the preset conditions are met, the current option set is determined as the target option set.

[0113] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0114] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0115] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0116] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0117] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0118] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A distributed compilation tuning method based on a random forest model, characterized in that: include: Searching in the current compilation option set based on a preset distributed meta-search strategy to generate multiple compilation option combinations; Performing performance prediction on the compilation option combination based on a pre-trained random forest model to obtain performance data corresponding to the compilation option combination; Establishing an analysis sample set based on the compilation option combination and the performance data corresponding to the compilation option combination; Establishing a SHAP interpreter based on the random forest model, analyzing the analysis sample set based on the SHAP interpreter to obtain a Shapley value of each compilation option in the analysis sample set and a Shapley interaction value of each compilation option pair; the compilation option pair is determined by any two compilation options in the analysis sample set; Filtering the current compilation option set based on the Shapley value of each compilation option and the Shapley interaction value of each compilation option pair, and updating the current compilation option set; When the preset conditions are met, the current option set is determined as the target option set.

2. The method according to claim 1, characterized in that The method searches in the current compilation option set based on a preset distributed meta-search strategy to generate a plurality of compilation option combinations; The performance of the compilation option combination is predicted based on a pre-trained random forest model to obtain performance data corresponding to the compilation option combination, including: In each search round, a target search technology is determined from among the multiple search technologies based on the credit values ​​of the multiple search technologies; the higher the credit value of the search technology, the greater the probability of being selected; Based on the target search technology, multiple searches are performed in the current compilation option set to obtain a batch of compilation option combinations; based on the pre-trained random forest model, performance prediction is performed on the compilation option combinations to obtain performance data corresponding to the compilation option combinations; A first credit item and a second credit item of the target search technology are determined based on the performance data respectively corresponding to the batch of compilation option combinations; and a credit value of the target search technology is updated based on the first credit item and the second credit item.

3. The method according to claim 2, characterized in that The step of determining a target search technology from among the multiple search technologies based on the credit values ​​of the multiple search technologies includes: When the search round is an initial round, the credit values ​​of the multiple search technologies are initialized, and a search technology is randomly selected from the multiple search technologies as a target search technology; wherein the credit value of each search technology after initialization is the same.

4. The method according to claim 1 or 2, characterized in that: After the pre-trained random forest model is used to perform performance prediction on the compilation option combination and performance data corresponding to the compilation option combination is obtained, the method further includes: The performance data corresponding to the compilation option combination is compared with the performance threshold. If the performance data corresponding to the compilation option combination is less than or equal to the performance threshold, the compilation option combination is submitted to the computing node for distributed compilation and operation to obtain the measured performance data corresponding to the compilation option combination.

5. The method according to claim 4, characterized in that The training method of the random forest model comprises: Establishing a sample set, the sample set comprising a training sample set and a verification sample set, each sample in the sample set comprising a compilation option combination and measured performance data corresponding to the compilation option combination; The random forest model is trained based on the training sample set, and the random forest model is verified based on the verification sample set to obtain the pre-trained random forest model.

6. The method according to claim 5, characterized in that The method for determining the performance threshold comprises: The performance threshold is determined based on the compilation option combinations in the training sample set and the verification sample set and the measured performance data corresponding to the compilation option combinations, the number of elements in the training sample set, the number of elements in the verification sample set, and the determination coefficient of the pre-trained random forest model.

7. The method according to claim 1, characterized in that The filtering the current compilation option set based on the Shapley value of each compilation option and the Shapley interaction value of each compilation option pair, and updating the current compilation option set, comprises: Sorting the compilation options based on the Shapley value to obtain a first sorting result; Filtering the compilation options based on the first sorting result to obtain a first compilation option set; For any first compiling option in the first compiling option set, sorting the compiling option pairs including the first compiling option based on the Shapley interaction value to obtain a second sorting result; screening the compiling option pairs based on the second sorting result to obtain a target compiling option pair, and recording the second compiling option in the target compiling option pair; forming a second compilation option set based on the second compilation option corresponding to each of the first compilation options in the first compilation option set; The current compilation option set is updated based on the first compilation option set and the second compilation option set.

8. A distributed compilation and tuning device based on a random forest model, characterized in that: include: A compilation option combination search and performance prediction module is used to search in the current compilation option set based on a preset distributed meta-search strategy to generate multiple compilation option combinations; Performing performance prediction on the compilation option combination based on a pre-trained random forest model to obtain performance data corresponding to the compilation option combination; An analysis sample set establishing module, used to establish an analysis sample set based on the compilation option combination and the performance data corresponding to the compilation option combination; A compilation option analysis module, used for establishing a SHAP interpreter based on the random forest model, analyzing the analysis sample set based on the SHAP interpreter, and obtaining a Shapley value of each compilation option in the analysis sample set and a Shapley interaction value of each compilation option pair; the compilation option pair is determined by any two compilation options in the analysis sample set; a current compiling option set updating module, configured to filter the current compiling option set based on the Shapley value of each compiling option and the Shapley interaction value of each compiling option pair, and update the current compiling option set; The target option set determination module is used to determine the current option set as the target option set when a preset condition is met.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the distributed compilation tuning method based on the random forest model according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the distributed compilation and tuning method based on a random forest model according to any one of claims 1 to 7 when executed.

Citation Information

Cited By

  • Multi-dimensional slow tracking performance analysis method and device, equipment and storage medium

    CN120632661A