CN112433706A - Compiling option tuning method and device, processor chip and server - Google Patents

Compiling option tuning method and device, processor chip and server Download PDF

Info

Publication number
CN112433706A
CN112433706A CN202011367895.4A CN202011367895A CN112433706A CN 112433706 A CN112433706 A CN 112433706A CN 202011367895 A CN202011367895 A CN 202011367895A CN 112433706 A CN112433706 A CN 112433706A
Authority
CN
China
Prior art keywords
compiling
option
result
source file
tested
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011367895.4A
Other languages
Chinese (zh)
Other versions
CN112433706B (en
Inventor
康梦博
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Haiguang Information Technology Co Ltd
Original Assignee
Haiguang Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Haiguang Information Technology Co Ltd filed Critical Haiguang Information Technology Co Ltd
Priority to CN202011367895.4A priority Critical patent/CN112433706B/en
Publication of CN112433706A publication Critical patent/CN112433706A/en
Application granted granted Critical
Publication of CN112433706B publication Critical patent/CN112433706B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/37Compiler construction; Parser generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

One or more embodiments of the invention disclose a compiling option tuning method, a device, a processor chip and a server, wherein the compiling option tuning method comprises the following steps: acquiring a source file and a compiling configuration option of a program to be subjected to parameter tuning; determining a compiling option combination to be tested according to the compiling configuration options; compiling the source file according to the compiling option combination to be tested to obtain a compiling result; selecting an operation script of the compiling result according to a preset test set; running the compiling result based on the running script to obtain a running result; and evaluating each compiling option combination to be tested according to the operation result to obtain an evaluation result, and improving the efficiency of optimizing the compiling options.

Description

Compiling option tuning method and device, processor chip and server
Technical Field
The invention relates to the technical field of computers, in particular to a compiling option tuning method, a compiling option tuning device, a processor chip and a server.
Background
In the ecological development work of a Central Processing Unit (CPU), the work of optimizing compiling option parameters for various programs is involved. Including HPC (High Performance Computing), SPEC (Standard Performance Evaluation Corporation) CPU, FFTW (fast Fourier Transform in the West, Standard C language suite of fast Computing discrete Fourier transforms), and the like. Taking a SPEC CPU as an example, the SPEC CPU2017 is a set of CPU subsystem testing tools, and includes 43 tests of 4 kinds, including a SPEC speed 2017 integrating, a SPEC speed 2017 Floating Point, and a SPEC rate 2017 integrating and a SPEC rate 2017 Floating Point, which are performance tests for testing Integer speed and Floating Point operation speed. The processor, memory subsystem and compiler used in the SPEC CPU2017 test system all affect the final test performance. The SPEC CPU provides source code and allows the test user some compilation optimization. The compiler, as one of the important influencing factors, needs to optimally compile options on different test software compared with other compilers while continuously exploring the optimal compiling options of different compilers for the processor.
The source code scale of most programs to be called is huge, the hot-point function is not unique during operation, the execution mode is complex, and the input set is various. Meanwhile, the number of optimization options of the Compiler is large, and if all the compilation options are arranged and combined for a certain program, taking GCC (GNU Compiler Collection) as an example, the combination mode thereof may exceed 10800+The workload of manual referencing is enormous, wherein the GNU compiler suite includes C, C + +, Objective-C, Fortran, Java, Ada, and Go language front-ends, as well as libraries of these languages. In actual work, when compiling option parameter adjustment work is performed on a program, parameter adjustment work on the whole program is often involved. However, in the existing iterative tuning framework, the thermal function inside the program needs to be objectively and accurately packaged, and then further tuning is performed. The optimal parameter options analyzed for the encapsulated hotspot functions cannot guarantee the same optimization effect in the original program. In addition, the interface realized by the framework at present is simpler, only single-file source code parameter tuning is supported, and the test evaluation module can not support a more complex program well. The actual parameter tuning requirement is that a certain application program includes a plurality of operation subsets, and the operation parameters of each subroutine are different, and the respective hotspot functions are also different. At present, only automatic iterative parameter adjustment can be carried out on some extracted hotspot functions, and a set of integral compiling option optimization mode cannot be provided for each program. When the compiling option is optimized, if only part is selectedAnd a single file is optimized, and some optimization points are missed. Currently existing compilers provide optimization techniques for inter-procedural analysis and inter-procedural optimization that can globally optimize an entire program, rather than just within a single file, a single function, or a single code segment. Inter-process optimization can reduce inter-process recalculation, inefficient access to memory, and simplify iterative processes. Inter-process optimization may also rearrange the order of the code to optimize memory allocation and locality. In the process of actually calling the program, the compiler combines the compiling option optimized in the process with other compiling options, and can greatly improve the performance of the program. At present, only internal automatic parameter tuning optimization is supported for single files and single module code segments, and the effect of optimizing options such as inter-process tuning cannot be measured.
Disclosure of Invention
In view of this, one or more embodiments of the present invention provide a method, an apparatus, a processor chip, and a server for tuning compiling options, which can effectively improve the tuning efficiency of the compiling options of the program.
One or more embodiments of the present invention provide a compiling option tuning method, including: acquiring a source file and a compiling configuration option of a program to be subjected to parameter tuning; determining a compiling option combination to be tested according to the compiling configuration options; compiling the source file according to the compiling option combination to be tested to obtain a compiling result; selecting an operation script of the compiling result according to a preset test set; running the compiling result based on the running script to obtain a running result; and evaluating each compiling option combination to be tested according to the operation result to obtain an evaluation result.
Optionally, compiling the source file according to the combination of the compiling options to be tested to obtain a compiling result, where the compiling result includes: in response to determining that the source file includes a plurality of sub-source files written in different programming languages according to the type of the source file, selecting a compiler corresponding to each sub-source file from the compilation configuration options according to the type of each sub-source file; and compiling each sub-source file according to the compiling option combination to be tested by using a compiler corresponding to each sub-source file.
Optionally, the compiling configuration option at least includes one of the following information: header files, compile-time link libraries, macro definition files, and programming languages.
Optionally, the preset test set includes a plurality of test subsets, and each test subset corresponds to a different test index.
Optionally, the method further includes: after evaluating each compiling option combination to be tested according to the operation result, obtaining an evaluation result, and sequencing each compiling option combination to be tested according to the evaluation result;
determining an optimal compiling option combination according to the sequenced compiling option combinations to be tested;
and determining an optimized proportion coefficient corresponding to each compiling option in the optimal compiling option combination.
One or more embodiments of the present invention provide a compiling option tuning apparatus, including:
the acquisition module is configured to acquire a source file and compiling configuration options of a program to be subjected to parameter tuning; the first determination module is configured to determine a compiling option combination to be tested according to the compiling configuration options; the compiling module is configured to compile the source file according to the compiling option combination to be tested to obtain a compiling result; the selection module is configured to select the running script of the compiling result according to a preset test set; the running module is configured to run the compiling result based on the running script to obtain a running result; and the evaluation module is configured to evaluate each compiling option combination to be tested according to the running result to obtain an evaluation result.
Optionally, the compiling module is specifically configured to: in response to determining that the source file includes a plurality of sub-source files written in different programming languages according to the type of the source file, selecting a compiler corresponding to each sub-source file from the compilation configuration options according to the type of each sub-source file; and compiling each sub-source file according to the compiling option combination to be tested by using a compiler corresponding to each sub-source file.
Optionally, the compiling configuration option at least includes one of the following information: header files, compile-time link libraries, macro definition files, and programming languages.
Optionally, the preset test set includes a plurality of test subsets, and each test subset corresponds to a different test index.
Optionally, the apparatus further comprises: the sequencing module is configured to obtain an evaluation result after evaluating each compiling option combination to be tested according to the operation result, and sequence each compiling option combination to be tested according to the evaluation result; the second determining module is configured to determine an optimal compiling option combination according to the ordered compiling option combinations to be tested; and the third determining module is configured to determine an optimization scaling factor corresponding to each compiling option in the optimal compiling option combination.
One or more embodiments of the present invention also provide a processor chip, including: at least one processor core, a cache; the processor core is used for executing any one of the compiling option tuning methods.
One or more embodiments of the present invention also provide a server, including: the device comprises a shell, a processor, a memory, a circuit board and a power circuit, wherein the circuit board is arranged in a space enclosed by the shell, and the processor and the memory are arranged on the circuit board; the power supply circuit is used for supplying power to each circuit or device of the server; the memory is used for storing executable program codes; the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory, and is used for executing any one of the compiling option tuning methods.
According to the compiling option tuning method provided by one or more embodiments of the invention, before tuning the compiling options of the program, compiling configuration options and a source file of the program can be configured for the program, when tuning the compiling options, a compiling option combination to be tested is determined according to the compiling configuration options, the source file is compiled according to the compiling option combination to be tested to obtain a compiling result, the compiling result is run based on the running script to obtain a running result, and the running result is evaluated to obtain an evaluation result of each compiling option combination to be tested, so that a better compiling option combination is determined from a large number of compiling option combinations corresponding to the program, the efficiency of tuning the compiling options is improved, and tuning and optimization of the compiling options of the whole program are realized.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a block diagram illustrating an automated compilation option tuning system in accordance with one or more embodiments of the present invention;
FIG. 2 is a flow diagram illustrating a method for compiling option tuning in accordance with one or more embodiments of the invention;
FIG. 3 is a flow diagram illustrating a method for compiling option tuning in accordance with one or more embodiments of the invention;
FIG. 4 is a block diagram illustrating a compile option tuning apparatus according to one or more embodiments of the invention;
FIG. 5 is a schematic diagram of a chip according to one or more embodiments of the invention;
fig. 6 is a schematic diagram illustrating a configuration of a server according to one or more embodiments of the invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
It should be understood that the described embodiments are only some embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic diagram illustrating a compiling option automatic tuning system according to one or more embodiments of the present invention, and as shown in fig. 1, the system may include a Search module (Search), a user program module, a multi-file compiling process module, and a Results Database (Results Database). Each component in the dotted line frame forms an iterative parameter calling module supporting a multi-file complete program. The search module is used for inputting a search set according to a specific service model, searching a parameter space through a search algorithm and providing configuration to be evaluated; the user program module is used for configuring a program to be subjected to parameter tuning; the multi-file compiling processing module is used for reading a compiling configuration file customized by a user, extracting a source file list, selecting a search algorithm from a result database, acquiring an option to be compiled by using the search algorithm, completing compiling operation on the source file and evaluating whether a compiling result is correct or not; the result database is used for providing guiding and optimizing suggestions according to the result data.
Fig. 2 is a flow diagram illustrating a compilation option tuning method, such as may be implemented by the compilation option automatic tuning system shown in fig. 1, according to one or more embodiments of the invention, and as shown in fig. 2, the method includes:
step 201: acquiring a source file and a compiling configuration option of a program to be subjected to parameter tuning;
before executing the step 201, the following information may be pre-configured for the program to be parameter-tuned through the user program module in the compiling option automatic tuning system:
compiling an option search set configuration file, and a source program: source code file, compile execution parameters: compile configuration options, runtime environment: run dependency libraries, import files, etc. The operation method comprises the following steps: supporting a plurality of different test subset operating methods. The configuration file of the program to be subjected to parameter tuning can be defined by a user. In step 201, source file information may be obtained, for example, by reading a compilation option configuration file and reading compilation configuration information in a working directory.
Before the compiling option is optimized, the program is configured, so that the automatic optimizing of the multi-source file of the whole program and the customizable compiling option of the whole program can be realized, and the method is not limited to the optimizing of the local hot spot function of the program.
Step 202: determining a compiling option combination to be tested according to the compiling configuration options;
still taking the compiling option automatic tuning system shown in fig. 1 as an example, the multi-file compiling processing module in the system can perform the following processing in the parameter processing stage:
reading a compiling configuration script and acquiring source file information; obtaining parameters used at compile time: include (header file), compile-time link library, macro definition file, programming language, etc.;
and loading all the compiling options to be combined from the compiling option configuration through a searching module to obtain the compiling options to be combined.
Still taking the compiling option automatic tuning system shown in fig. 1 as an example, the multi-file compiling processing module in the system can perform the following processing in the compiling stage:
and a two-stage search mode is adopted, the first stage selects a search algorithm from the result database, the second stage obtains a compiling option combination to be tested according to the compiling options to be combined through the selected search algorithm, outputs the compiling option combination to be tested and writes the compiling option combination to the result database.
Step 203: compiling the source file according to the compiling option combination to be tested to obtain a compiling result;
still taking the compiling option automatic tuning system shown in fig. 1 as an example, the compiling of the source file can be realized through the following two stages by the multi-file compiling processing module in the system:
the multi-file compiling processing module can also perform the following processing in the parameter processing stage:
reading a compiling option combination to be tested from a result database;
traversing the source file list, and compiling the source file by combining with other parameters read in the parameter processing stage and used in compiling;
selecting a compiler corresponding to the compiling language to compile to obtain a compiling result when the source file relates to the condition realized by different programming languages;
judging whether the compiling result is abnormal or not;
the multi-file compiling processing module can perform the following processing in the linking stage:
when the source file relates to a plurality of programming language file links, selecting a linker corresponding to the programming language, and linking the compiled target file;
and returning a link result.
Step 204: selecting an operation script of the compiling result according to a preset test set;
step 205: running the compiling result based on the running script to obtain a running result;
for example, the running script may be copied from different working directories according to the size of the preset test set, so as to run the compiled executable file, and obtain the running result.
Step 206: and evaluating each compiling option combination to be tested according to the operation result to obtain an evaluation result.
In step 206, the algorithm for evaluating the compiling option combination may be invoked to evaluate the compiling option to be tested according to the running result corresponding to the compiling option combination to be tested, so as to determine the quality of each compiling option combination to be tested.
According to the compiling option tuning method provided by one or more embodiments of the invention, before tuning the compiling options of the program, compiling configuration options and a source file of the program can be configured for the program, when tuning the compiling options, a compiling option combination to be tested is determined according to the compiling configuration options, the source file is compiled according to the compiling option combination to be tested to obtain a compiling result, the compiling result is run based on the running script to obtain a running result, and the running result is evaluated to obtain an evaluation result of each compiling option combination to be tested, so that a better compiling option combination is determined from a large number of compiling option combinations corresponding to the program, the efficiency of tuning the compiling options is improved, and tuning and optimization of the compiling options of the whole program are realized.
In one or more embodiments of the present invention, compiling the source file according to the combination of the compiling options to be tested to obtain a compiling result may include: in response to determining that the source file includes a plurality of sub-source files written in different programming languages according to the type of the source file, selecting a compiler corresponding to each sub-source file from the compilation configuration options according to the type of each sub-source file; and compiling each sub-source file according to the compiling option combination to be tested by using a compiler corresponding to each sub-source file. For example, the type of each sub-source file can be determined according to the suffix of the sub-source file, and after the type of the sub-source file is determined, a compiler corresponding to the type can be selected from compiling configuration options according to the type of the sub-source file to compile the sub-source file, so that an executable file is obtained.
In one or more embodiments of the invention, the compiling configuration options may include at least one of the following information: header files (include), compile-time link libraries, macro definition files, and programming languages, which are parameters required in the compilation process. When the source file is compiled, all the compiling options to be combined can be loaded from the compiling configuration options to obtain the compiling options to be combined.
In one or more embodiments of the present invention, the preset test set includes a plurality of test subsets, each test subset corresponding to a different test indicator. The preset test set may include, for example, a plurality of different test subsets, and when the compiling result is tested by the preset test set, the compiling may be performed based on one test subset each time.
In one or more embodiments of the present invention, the above compiling option tuning method may further include: after evaluating each compiling option combination to be tested according to the operation result, obtaining an evaluation result, and sequencing each compiling option combination to be tested according to the evaluation result; determining an optimal compiling option combination according to the sequenced compiling option combinations to be tested; determining an optimized scaling factor corresponding to each compiling option in the optimal compiling option combination, for example, calling an operation script of a preset evaluation algorithm, selecting different operation parameters to operate according to the scale of a preset test set to obtain an operation result, evaluating and sequencing the compiling option combination to be tested based on the operation result, and determining the optimal compiling option combination, where the optimal compiling combination may include a plurality of compiling options, and based on this, further determining the contribution of each compiling option to the optimized performance of the optimal compiling option combination, that is, the optimized scaling factor of each compiling option in the optimal compiling option combination. For example, when the optimal compiling option combination is determined by the preset evaluation algorithm, the target compiling option combinations can be sorted according to the high-to-low quality of the evaluation result of each target compiling option combination, and the target compiling option combination with the top sorting is determined as the optimal compiling option combination.
Fig. 3 is a flow diagram illustrating a compilation option tuning method that may be implemented based on the compilation option automatic tuning system according to one or more embodiments of the invention, and may include a parameter preparation and search phase, a compilation phase, a linking phase, and a run phase, as shown in fig. 3.
Wherein, the parameter preparation and search stage comprises: reading a compiling option configuration file; reading the compiling configuration under the working directory and obtaining a source file option; the search module dynamically provides a compiling option combination scheme through a heuristic search algorithm, writes the compiling option combination scheme into a result database, and enters a compiling and linking stage.
The compiling and linking stage comprises the following steps: traversing the source file list, and reading the compiling option combination from the result database; judging whether the source file is realized by different compiling languages through a suffix of the source file, traversing the source file one by one, and compiling the source file; judging whether the compiling result is abnormal or not, if so, returning and executing the steps of traversing the source file list and reading the compiling option combination from the result database, and if not, selecting a linker from the compiling configuration options; reading a linker and a path from the compiling configuration options, and linking the compiled target file and an additional library into an executable file; and judging whether the link result is abnormal or not, if so, returning and executing the steps of traversing the source file list and reading the compiling option combination from the result database, and if not, entering an operation stage.
The operation stage comprises the following steps: copying the running script from different catalogs according to the size of the preselected test set to run to obtain a running result; judging whether the operation result is abnormal or not, if the operation result is abnormal, returning and executing a search module to dynamically provide a compiling option combination scheme through a heuristic search algorithm, writing the compiling option combination scheme into a result database, and if the operation result is not abnormal, storing the operation result and corresponding configuration information into the result database; and judging whether a preset search stopping condition is met, if so, sequencing and analyzing the compiling option combination to be tested, if not, returning to a search module, dynamically providing a compiling option combination scheme through a heuristic search algorithm, and writing the compiling option combination scheme into a result database.
Fig. 4 is a block diagram illustrating a compiling option tuning apparatus according to one or more embodiments of the invention, and as shown in fig. 4, the apparatus 40 includes:
an obtaining module 41 configured to obtain a source file and a compiling configuration option of a program to be parameter-tuned;
a first determining module 42 configured to determine a compiling option combination to be tested according to the compiling configuration options;
a compiling module 43 configured to compile the source file according to the compiling option combination to be tested, so as to obtain a compiling result;
a selection module 44 configured to select a running script of the compilation result according to a preset test set;
an execution module 45 configured to execute the compiling result based on the execution script to obtain an execution result
And the evaluation module 46 is configured to evaluate each compiling option combination to be tested according to the running result to obtain an evaluation result.
In one or more embodiments of the present invention, the compiling module may be specifically configured to: in response to determining that the source file includes a plurality of sub-source files written in different programming languages according to the type of the source file, selecting a compiler corresponding to each sub-source file from the compilation configuration options according to the type of each sub-source file; and compiling each sub-source file according to the compiling option combination to be tested by using a compiler corresponding to each sub-source file.
In one or more embodiments of the invention, the compiling configuration option may include at least one of the following information: header files, compile-time link libraries, macro definition files, and programming languages.
In one or more embodiments of the present invention, the preset test set may include a plurality of test subsets, each test subset corresponding to a different test indicator.
In one or more embodiments of the present invention, the compiling option tuning device may further include: the sequencing module is configured to obtain an evaluation result after evaluating each compiling option combination to be tested according to the operation result, and sequence each compiling option combination to be tested according to the evaluation result; the second determining module is configured to determine an optimal compiling option combination according to the ordered compiling option combinations to be tested; and the third determining module is configured to determine an optimization scaling factor corresponding to each compiling option in the optimal compiling option combination.
One or more embodiments of the present invention further provide a processor chip, and fig. 5 is a schematic diagram of a processing chip according to one or more embodiments of the present invention, as shown in fig. 5, the processing chip 50 includes: at least one processor core 51 and a cache 52; the processor core 51 is configured to execute any one of the above compiling option tuning methods.
Accordingly, as shown in fig. 6, a server provided in an embodiment of the present invention may include: the electronic device comprises a shell 61, a processor 62, a memory 63, a circuit board 64 and a power circuit 65, wherein the circuit board 64 is arranged inside a space enclosed by the shell 61, and the processor 62 and the memory 63 are arranged on the circuit board 64; a power supply circuit 65 for supplying power to each circuit or device of the electronic apparatus; the memory 63 is used to store executable program code; the processor 62 executes a program corresponding to the executable program code by reading the executable program code stored in the memory 63, for executing any one of the compiling option tuning methods provided by the foregoing embodiments.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments.
In particular, as for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
For convenience of description, the above devices are described separately in terms of functional division into various units/modules. Of course, the functionality of the units/modules may be implemented in one or more software and/or hardware implementations of the invention.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (12)

1. A compilation option tuning method, comprising:
acquiring a source file and a compiling configuration option of a program to be subjected to parameter tuning;
determining a compiling option combination to be tested according to the compiling configuration options;
compiling the source file according to the compiling option combination to be tested to obtain a compiling result;
selecting an operation script of the compiling result according to a preset test set;
running the compiling result based on the running script to obtain a running result;
and evaluating each compiling option combination to be tested according to the operation result to obtain an evaluation result.
2. The method of claim 1, wherein compiling the source file according to the combination of compilation options to be tested to obtain a compilation result comprises:
in response to determining that the source file includes a plurality of sub-source files written in different programming languages according to the type of the source file, selecting a compiler corresponding to each sub-source file from the compilation configuration options according to the type of each sub-source file;
and compiling each sub-source file according to the compiling option combination to be tested by using a compiler corresponding to each sub-source file.
3. The method of claim 1, wherein the compiling configuration option includes at least one of:
header files, compile-time link libraries, macro definition files, and programming languages.
4. The method of claim 1, wherein the predetermined test set comprises a plurality of test subsets, each test subset corresponding to a different test metric.
5. The method according to any one of claims 1 to 4, further comprising:
after evaluating each compiling option combination to be tested according to the operation result, obtaining an evaluation result, and sequencing each compiling option combination to be tested according to the evaluation result;
determining an optimal compiling option combination according to the sequenced compiling option combinations to be tested;
and determining an optimized proportion coefficient corresponding to each compiling option in the optimal compiling option combination.
6. A compiling option tuning apparatus comprising:
the acquisition module is configured to acquire a source file and compiling configuration options of a program to be subjected to parameter tuning;
the first determination module is configured to determine a compiling option combination to be tested according to the compiling configuration options;
the compiling module is configured to compile the source file according to the compiling option combination to be tested to obtain a compiling result;
the selection module is configured to select the running script of the compiling result according to a preset test set;
the running module is configured to run the compiling result based on the running script to obtain a running result;
and the evaluation module is configured to evaluate each compiling option combination to be tested according to the running result to obtain an evaluation result.
7. The apparatus of claim 6, wherein the compiling module is specifically configured to:
in response to determining that the source file includes a plurality of sub-source files written in different programming languages according to the type of the source file, selecting a compiler corresponding to each sub-source file from the compilation configuration options according to the type of each sub-source file;
and compiling each sub-source file according to the compiling option combination to be tested by using a compiler corresponding to each sub-source file.
8. The apparatus of claim 6, wherein the compiling configuration option comprises at least one of:
header files, compile-time link libraries, macro definition files, and programming languages.
9. The apparatus of claim 6, wherein the predetermined test set comprises a plurality of test subsets, each test subset corresponding to a different test metric.
10. The apparatus of any one of claims 6 to 9, further comprising:
the sequencing module is configured to obtain an evaluation result after evaluating each compiling option combination to be tested according to the operation result, and sequence each compiling option combination to be tested according to the evaluation result;
the second determining module is configured to determine an optimal compiling option combination according to the ordered compiling option combinations to be tested;
and the third determining module is configured to determine an optimization scaling factor corresponding to each compiling option in the optimal compiling option combination.
11. A processor chip, comprising: at least one processor core, a cache;
the processor core configured to perform the compilation option tuning method of any of the preceding claims 1-5.
12. A server, comprising: the device comprises a shell, a processor, a memory, a circuit board and a power circuit, wherein the circuit board is arranged in a space enclosed by the shell, and the processor and the memory are arranged on the circuit board; the power supply circuit is used for supplying power to each circuit or device of the server; the memory is used for storing executable program codes; the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory, for executing the compilation option tuning method of any one of the preceding claims 1 to 5.
CN202011367895.4A 2020-11-27 2020-11-27 Compiling option tuning method and device, processor chip and server Active CN112433706B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011367895.4A CN112433706B (en) 2020-11-27 2020-11-27 Compiling option tuning method and device, processor chip and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011367895.4A CN112433706B (en) 2020-11-27 2020-11-27 Compiling option tuning method and device, processor chip and server

Publications (2)

Publication Number Publication Date
CN112433706A true CN112433706A (en) 2021-03-02
CN112433706B CN112433706B (en) 2023-03-14

Family

ID=74699250

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011367895.4A Active CN112433706B (en) 2020-11-27 2020-11-27 Compiling option tuning method and device, processor chip and server

Country Status (1)

Country Link
CN (1) CN112433706B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114676026A (en) * 2022-03-28 2022-06-28 明阳产业技术研究院(沈阳)有限公司 Processor performance test method, device, equipment and medium
CN116931955A (en) * 2023-09-18 2023-10-24 之江实验室 Compiler automatic optimization method and device based on artificial intelligence

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070061784A1 (en) * 2005-09-09 2007-03-15 Sun Microsystems, Inc. Automatic code tuning
CN102455897A (en) * 2010-10-27 2012-05-16 无锡江南计算技术研究所 Iterative compilation method and device based on embodiment
CN103136029A (en) * 2013-03-12 2013-06-05 无锡江南计算技术研究所 Real-time compiling system self-adapting adjusting and optimizing method
CN103677814A (en) * 2013-11-29 2014-03-26 广州视源电子科技股份有限公司 Program acquisition method, device and system
US20170123773A1 (en) * 2015-11-04 2017-05-04 International Business Machines Corporation Optimized compilation using an auto-tuned compiler as a service
JP2018032082A (en) * 2016-08-22 2018-03-01 富士通株式会社 Program generation program, program generation method, program generation device, and compile program
CN107885503A (en) * 2017-11-11 2018-04-06 湖南大学 A kind of iteration based on performance of program analysis compiles optimization method
CN109542446A (en) * 2017-08-14 2019-03-29 中兴通讯股份有限公司 A kind of compiling system, method and compiler
CN111444513A (en) * 2019-11-14 2020-07-24 中国电力科学研究院有限公司 Firmware compiling optimization option identification method and device for power grid embedded terminal

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070061784A1 (en) * 2005-09-09 2007-03-15 Sun Microsystems, Inc. Automatic code tuning
CN102455897A (en) * 2010-10-27 2012-05-16 无锡江南计算技术研究所 Iterative compilation method and device based on embodiment
CN103136029A (en) * 2013-03-12 2013-06-05 无锡江南计算技术研究所 Real-time compiling system self-adapting adjusting and optimizing method
CN103677814A (en) * 2013-11-29 2014-03-26 广州视源电子科技股份有限公司 Program acquisition method, device and system
US20170123773A1 (en) * 2015-11-04 2017-05-04 International Business Machines Corporation Optimized compilation using an auto-tuned compiler as a service
JP2018032082A (en) * 2016-08-22 2018-03-01 富士通株式会社 Program generation program, program generation method, program generation device, and compile program
CN109542446A (en) * 2017-08-14 2019-03-29 中兴通讯股份有限公司 A kind of compiling system, method and compiler
CN107885503A (en) * 2017-11-11 2018-04-06 湖南大学 A kind of iteration based on performance of program analysis compiles optimization method
CN111444513A (en) * 2019-11-14 2020-07-24 中国电力科学研究院有限公司 Firmware compiling optimization option identification method and device for power grid embedded terminal

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114676026A (en) * 2022-03-28 2022-06-28 明阳产业技术研究院(沈阳)有限公司 Processor performance test method, device, equipment and medium
CN114676026B (en) * 2022-03-28 2023-03-10 明阳产业技术研究院(沈阳)有限公司 Processor performance test method, device, equipment and medium
CN116931955A (en) * 2023-09-18 2023-10-24 之江实验室 Compiler automatic optimization method and device based on artificial intelligence
CN116931955B (en) * 2023-09-18 2024-01-09 之江实验室 Compiler automatic optimization method and device based on artificial intelligence

Also Published As

Publication number Publication date
CN112433706B (en) 2023-03-14

Similar Documents

Publication Publication Date Title
US8024719B2 (en) Bounded hash table sorting in a dynamic program profiling system
CN110990020A (en) Software compiling method and device, electronic equipment and storage medium
US7237234B2 (en) Method for selective solicitation of user assistance in the performance tuning process
Shen et al. Cudaadvisor: Llvm-based runtime profiling for modern gpus
US9081586B2 (en) Systems and methods for customizing optimization/transformation/ processing strategies
CN112433706B (en) Compiling option tuning method and device, processor chip and server
US20100115494A1 (en) System for dynamic program profiling
US9170919B2 (en) Apparatus and method for detecting location of source code error in mixed-mode program
Ball et al. Using paths to measure, explain, and enhance program behavior
US9274925B2 (en) Programmable symbolic execution based dynamic checker
CN113094252B (en) Test case generation method and device, computer equipment and storage medium
US10528691B1 (en) Method and system for automated selection of a subset of plurality of validation tests
US9146719B2 (en) Data layout using data type information
Fornaia et al. JSCAN: Designing an easy to use LLVM-based Static Analysis Framework
US8756580B2 (en) Instance-based field affinity optimization
JP4763743B2 (en) Program operation comparison apparatus and method and program
Zhao et al. Distributed parallelizability analysis of legacy code
Nobre et al. Fast heuristic-based GPU compiler sequence specialization
Jost et al. Interfacing computer aided parallelization and performance analysis
JP2002014847A (en) Device for checking program and method for the same and recording medium with checking program stored
WO2023164897A1 (en) Optimization method and apparatus for binary program
US20220100483A1 (en) Compiler for risc processor having specialized registers
JP2024118113A (en) Compiler dependency extraction device and source code analysis system
Botezatu A study on compiler flags and performance events
Hu et al. The camino compiler infrastructure

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant