Compilation acceleration method and apparatus, and computer-readable storage medium
By using hash calculations and mapping relationships to reuse compilation artifacts through a compilation acceleration system, the problem of long compilation time in existing compilation schemes is solved, achieving time savings and resource optimization.
Patent Information
- Application Number
- PCT/CN2025/095858
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-08-22
- Filing Date
- 2025-05-19
- Publication Date
- 2025-12-26
AI Technical Summary
Existing compilation methods are time-consuming, affecting software development efficiency and server resource consumption, thus limiting software iteration and time-to-market.
The compilation acceleration system obtains the impact factor of the compilation target, performs hash calculation, queries the mapping relationship to reuse historical compilation products, and skips the actual compilation process.
It saves compilation time, meets the need for accelerated compilation, improves software development efficiency, and reduces server resource consumption.
Smart Images

Figure CN2025095858_26122025_PF_FP_ABST
Abstract
Description
A compilation acceleration method, apparatus, and computer-readable storage medium
[0001] This application claims priority to Chinese Patent Application No. 202410805035.6, filed on June 20, 2024, entitled "Cache Acceleration Method, Apparatus and Computer-Readable Storage Medium", and Chinese Patent Application No. 202410805035.6, filed on August 22, 2024, entitled "A Compilation Acceleration Method, Apparatus and Computer-Readable Storage Medium", the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of computer technology, and in particular to a compilation acceleration method, apparatus, and computer-readable storage medium. Background Technology
[0003] Compilation is an important step in the software development process. It is the process of compiling (translating) the source code files of software written by software developers using high-level programming languages (such as C, C++, Java, etc.) into low-level machine language (such as assembly language or machine code) files that can be executed by the target machine (usually called compilation artifacts or artifact files).
[0004] Currently, the common compilation scheme used by various enterprises when compiling software is as follows: The compiler scheduler reads multiple compilation targets (also called build targets, usually stored as text code) written by software developers for the software. Each compilation target describes the process of compiling based on specified resources (such as source code files, other compilation targets) to obtain the compilation product of each compilation target. Specifically, each compilation target contains its own name, compilation command, and dependencies. The name of the compilation target is usually the name of the compilation product to be generated. The compilation command is the command required to implement the compilation target. The dependencies specify the resources (including source code files and / or other compilation targets, etc.) that the compilation process of the compilation target depends on. After obtaining multiple compilation targets, the compiler scheduler will call the appropriate compiler to execute the compilation command in the compilation target according to each compilation target, read the resources specified in the dependencies, and compile to obtain the compilation product of each compilation target. After all compilation targets have been compiled, the final product is the compilation product of the entire software.
[0005] However, the aforementioned common compilation schemes typically take 2-6 hours to compile software each time. This long compilation wait not only affects the work efficiency of software developers but also increases the cost of server resources and directly impacts the iteration and time-to-market of software. Therefore, there is a strong demand for compilation acceleration in the software development industry to meet the challenges of market competition. Summary of the Invention
[0006] This application provides a compilation acceleration method, apparatus, and computer-readable storage medium, which can improve compilation efficiency and meet the strong demand for compilation acceleration in the software development industry.
[0007] Firstly, a compilation acceleration method is provided, comprising the following steps: a compilation acceleration system obtains a first compilation target of the software, the first compilation target indicating the process of compiling to obtain the compilation product of the first compilation target; then, the compilation acceleration system obtains an influence factor of the first compilation target based on the first compilation target, the influence factor of the first compilation target being a factor affecting the compilation product of the first compilation target; next, the compilation acceleration system performs a hash calculation on the influence factor of the first compilation target to obtain a first hash value; finally, the compilation acceleration system queries multiple mapping relationships based on the first hash value; when it is determined, based on the queried first mapping relationship, that there exists a first historical compilation product corresponding to the first hash value among the stored multiple historical compilation products, the first historical compilation product is used as the compilation product of the first compilation target. The multiple mapping relationships include a first mapping relationship and a second mapping relationship. The first mapping relationship records the first historical compilation product and the first hash value corresponding to the first historical compilation product. The second mapping relationship records the second historical compilation product and the second hash value corresponding to the second historical compilation product. The multiple historical compilation products include the first historical compilation product and the second historical compilation product. The first historical compilation product is the compilation product of the first historical compilation target, and the second historical compilation product is the compilation product of the second historical compilation target. The first hash value corresponding to the first historical compilation product is obtained by hashing the influence factor of the compilation product of the first historical compilation target, and the second hash value corresponding to the second historical compilation product is obtained by hashing the influence factor of the compilation product of the second historical compilation target.
[0008] In the above scheme, the compilation acceleration system obtains the first compilation target of the software, then obtains the factors affecting the compilation output of the first compilation target, and performs hash calculation on the factors to obtain the hash value corresponding to the first compilation target (i.e., the first hash value mentioned above). Then, based on the first hash value, it queries multiple mapping relationships to determine whether there is a first mapping relationship that records the first hash value. When a first mapping relationship is found, since the first hash value recorded in the first mapping relationship is obtained by hash calculation of the factors affecting the first historical compilation target, it can be deduced that the factors affecting the first historical compilation target are the same as the factors affecting the first compilation target. Based on this reasoning, it can be further deduced that if the compilation operation based on the first compilation target is actually performed, the compilation output of the first compilation target will be the same as the compilation output of the first historical compilation target. Therefore, it is determined that the compilation output of the first historical compilation target can be used as the compilation output of the first compilation target, realizing the reuse of the compilation output of the first historical compilation target by the first compilation target, allowing the compilation scheduler to skip the actual compilation process of the first compilation target, thereby saving compilation time and achieving the effect of compilation acceleration, meeting the user's compilation acceleration needs. In one possible implementation, the factors affecting the first compilation target include the following:
[0009] The first compilation target includes the compilation command, the name of the first compilation target, the identifier of the source code file that the first compilation target depends on, the names of other compilation targets that the first compilation target depends on, the compilation commands in the other compilation targets, the first commit identifier, and the compilation environment variables corresponding to the first compilation target. The first commit identifier is the identifier of the commit record to which the source code file that the first compilation target depends belongs. The factor types included in the influence factors of the first historical compilation target and the second historical compilation target are the same as the factor types included in the influence factors of the first compilation target.
[0010] In one possible implementation, the above method further includes the following steps:
[0011] When the compilation acceleration system determines that there is no first historical compilation product corresponding to the first hash value among the multiple stored historical compilation products, it notifies the compilation scheduler to compile according to the first compilation target and obtain the compilation product of the first compilation target.
[0012] The compilation acceleration system obtains the compilation artifacts of the first compilation target and stores the compilation artifacts of the first compilation target;
[0013] The compilation acceleration system determines the third mapping relationship and adds the third mapping relationship to multiple mapping relationships. The third mapping relationship records the compilation artifacts of the first compilation target and the first hash value.
[0014] Implementing the above method, the compilation acceleration system stores the compilation artifacts of the first compilation target and adds a third mapping relationship recording the compilation artifacts and first hash values of the first compilation target to multiple mapping relationships. This allows the compilation acceleration system to, during subsequent software compilation, if a second compilation target exists to be compiled, and the influence factor of the second compilation target is the same as that of the first compilation target, calculate the hash value of the influence factor of the second compilation target. Then, after obtaining the hash value, the compilation acceleration system can query multiple mapping relationships based on this hash value to determine if a third mapping relationship with the same hash value exists. The compilation artifacts of the first compilation target recorded in the third mapping relationship are then used as the compilation artifacts of the second compilation target. This allows the second compilation target to reuse the compilation artifacts of the first compilation target, skipping the compilation process of the second compilation target, thereby saving compilation time and achieving compilation acceleration. In one possible implementation, the first compilation target obtained by the compilation acceleration system comes from the Ninja compilation system.
[0015] Secondly, a compilation acceleration system is provided, the system comprising:
[0016] The acquisition unit is used to acquire the first compilation target of the software, which indicates the process of compiling to obtain the compilation product of the first compilation target;
[0017] The acquisition unit is further configured to acquire the influence factor of the first compilation target based on the first compilation target, wherein the influence factor of the first compilation target is a factor that affects the compilation product of the first compilation target;
[0018] A query unit is used to perform a hash calculation on the influence factor of the first compilation target to obtain a first hash value;
[0019] The query unit is configured to query multiple mapping relationships based on the first hash value. When it is determined from the queried first mapping relationship that a first historical compilation product corresponding to the first hash value exists among the stored multiple historical compilation products, the first historical compilation product is used as the compilation product of the first compilation target. The multiple mapping relationships include the first mapping relationship and the second mapping relationship. The first mapping relationship records the first historical compilation product and the first hash value corresponding to the first historical compilation product. The second mapping relationship records the second historical compilation product and the second hash value corresponding to the second historical compilation product. The multiple historical compilation products include the first historical compilation product and the second historical compilation product. The first historical compilation product is the compilation product of the first historical compilation target, and the second historical compilation product is the compilation product of the second historical compilation target. The first hash value corresponding to the first historical compilation product is obtained by hashing the influence factor of the compilation product of the first historical compilation target, and the second hash value corresponding to the second historical compilation product is obtained by hashing the influence factor of the compilation product of the second historical compilation target.
[0020] In one possible implementation, the influencing factors of the first compilation target include the following:
[0021] The first compilation target includes the compilation command, the name of the first compilation target, the identifier of the source code file that the first compilation target depends on, the name of other compilation targets that the first compilation target depends on, the compilation command in the other compilation targets, the first commit identifier, and the compilation environment variables corresponding to the first compilation target. The first commit identifier is the identifier of the commit record to which the source code file that the first compilation target depends belongs. The factor types included in the influence factors of the first historical compilation target and the factor types included in the influence factors of the second historical compilation target are the same as the factor types included in the influence factors of the first compilation target.
[0022] In one possible implementation, the system further includes:
[0023] The notification unit is used to notify the compilation scheduler to compile according to the first compilation target and obtain the compilation product of the first compilation target when it is determined that there is no first historical compilation product corresponding to the first hash value among the stored plurality of historical compilation products.
[0024] The acquisition unit is further configured to acquire the compilation product of the first compilation target and store the compilation product of the first compilation target;
[0025] A mapping unit is used to determine a third mapping relationship and add the third mapping relationship to the plurality of mapping relationships. The third mapping relationship records the compilation product of the first compilation target and the first hash value.
[0026] In one possible implementation, the first compilation target obtained by the compilation acceleration system comes from the ninja compilation system.
[0027] Thirdly, a computing device cluster is provided, the computing device cluster including at least one computing device, each of the at least one computing device including a processor and a memory, the processor of the at least one computing device being configured to execute instructions stored in the memory of the at least one computing device to cause the computing device cluster to implement the method as described in the first aspect.
[0028] Fourthly, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and the instructions are executed by a computing device or a cluster of computing devices to implement the method described in the first aspect.
[0029] Fifthly, a computer program product including instructions is provided, the computer program product including instructions that enable software or program products to run on a computing device or stored in any available medium, and when the computer program product runs on a computing device or a cluster of computing devices, cause the computing device or cluster of computing devices to implement the method described in the first aspect. Attached Figure Description
[0030] Figure 1 is a schematic diagram of the structure of a compiler system provided in this application;
[0031] Figure 2 is a schematic diagram illustrating a software compilation process exemplarily shown in this application;
[0032] Figure 3A is a schematic diagram of the architecture of a compilation acceleration system provided in this application;
[0033] Figure 3B is an example diagram of a compiler acceleration system provided in this application deployed in a cloud environment;
[0034] Figure 4 is a schematic diagram of the architecture of another compilation acceleration system provided in this application;
[0035] Figure 5 is a flowchart illustrating a compilation acceleration method provided in this application;
[0036] Figure 6 is a schematic diagram of a first compilation target exemplarily shown in this application;
[0037] Figure 7 is a schematic diagram illustrating the dependencies between multiple compilation targets and multiple source code files as exemplarily shown in this application;
[0038] Figure 8 is a schematic diagram of the structure of a compiler acceleration system provided in this application;
[0039] Figure 9 is a schematic diagram of the structure of a computing device provided in this application;
[0040] Figure 10 is a schematic diagram of the structure of a computing device cluster provided in this application;
[0041] Figure 11 is a schematic diagram of another computing device cluster provided in this application. Detailed Implementation
[0042] The application scenarios of this application are described below.
[0043] This application relates to the compilation step in the software development process. Compilation refers to the process of compiling (translating) the source code files of software written by software developers using high-level programming languages (such as C, C++, Java, etc.) into low-level machine language (such as assembly language or machine code) files that can be executed by the target machine. The source code files are typically stored in text form (such as xxx.c files, xxx.java files, xxx.py files, xxx.h files), while the low-level machine language files that can be executed by the target machine are usually called compilation artifacts or artifact files, which can be xxx.o files, xxx.jar files, xxx.image files, xxx.exe files, etc.
[0044] The compilation steps in the software development process will be described in detail below with reference to Figures 1 and 2.
[0045] Referring to Figure 1, which is a schematic diagram of the structure of a compilation system provided in this application, the compilation system 100 includes a compilation scheduler 110 and multiple compilers 120 (compiler 120A and compiler 120B as shown in Figure 1).
[0046] Compilation system 100 is a system for compiling software source code files, such as the Ninja compilation system or the Android Open Source Project (AOSP) based on Ninja. It is typically deployed on development machines, servers used for software development, etc. The software can be any type of software capable of performing any function (such as applications, plugins, mini-programs, etc.), such as electronic payment software, instant messaging software, video playback software, online shopping software, etc. This application does not impose specific limitations.
[0047] The compiler scheduler 110 is a tool or component responsible for managing and scheduling compilation tasks. For example, during the compilation process, tasks at certain stages may depend on the compilation results of the previous stage. The compiler scheduler 110 needs to perform dependency analysis to ensure that tasks are executed in the correct order while satisfying dependencies, so as to avoid producing incorrect compilation artifacts.
[0048] Multiple compilers 120, called by the compiler scheduler 110, are the main entities that actually perform the compilation operations. Common compilers 120 include Gcc compiler, Clang compiler, javac compiler, GCJ compiler, python compiler, zip compiler, etc.
[0049] Currently, when compiling software, the compilation system 100 typically uses a compilation scheme with the following flow as shown in Figure 2: The compilation scheduler 110 reads multiple compilation targets written by the software developers for the developed software. These targets are usually stored in text format (such as Makefile, build.ninja, pom.xml, build.gradle, xmake.lua, etc.). Each compilation target describes the process of compiling based on specified resources (such as source code files, other compilation targets) to obtain the compilation output for each target. Specifically, each compilation target contains its own name, compilation command, etc. The compilation target name is usually the name of the compiled artifact to be generated. The compilation command is the command that needs to be executed to implement the compilation target. The dependency specifies the resources (including source code files and / or other compilation targets, etc.) that the compilation process of the compilation target depends on. After obtaining multiple compilation targets, the compilation scheduler 110 will call the appropriate compiler 120 to execute the compilation command in the compilation target according to each compilation target, read the resources specified in the dependency in each compilation target, and then compile to obtain the compilation artifact of each compilation target. After multiple compilation targets have been compiled, the final product is the compilation artifact of the entire software.
[0050] However, when using the common compilation scheme shown in Figure 2, the compilation time for each software compilation is usually as long as 2-6 hours. The long compilation wait not only affects the work efficiency of software developers, but also increases the cost of server resources and directly affects the iteration and time to market of software. Therefore, there is an urgent need to provide a compilation acceleration solution to meet the strong compilation acceleration needs of the software development industry.
[0051] Based on the above, this application provides a compilation acceleration method and a compilation acceleration system. During each software compilation process in the compilation system 100, after the compilation scheduler 110 reads the first compilation target of the software (which can be any compilation target included in the software), before the compilation scheduler 110 performs compilation operations based on the first compilation target, the compilation acceleration system obtains the influence factor of the first compilation target (referring to the factor affecting the compilation product of the first compilation target), and performs hash calculation on the influence factor of the first compilation target to obtain the hash value corresponding to the first compilation target (hereinafter referred to as the first hash value). Then, based on the first hash value, multiple mapping relationships are queried to determine whether the first hash value exists among the hash values corresponding to the multiple historical compilation products recorded in the multiple mapping relationships. When it is determined that the first hash value exists among the hash values corresponding to the multiple historical compilation products, since the multiple historical compilation products are multiple historical compilation targets... The compilation output, and the hash value corresponding to each historical compilation output among multiple historical compilation outputs, is obtained by hashing the influence factor of the historical compilation target corresponding to each historical compilation output. It can be deduced that there is already a first historical compilation target among multiple historical compilation targets with the same influence factor as the first compilation target. Then, based on the fact that the influence factor of the first historical compilation target is the same as the influence factor of the first compilation target, it can be inferred that if the compilation scheduler 110 actually performs the compilation operation according to the first compilation target, the compilation output of the first compilation target will be the same as the compilation output of the first historical compilation target. Therefore, based on this reasoning result, the compilation output of the first historical compilation target that can be reused can be determined as the compilation output of the first compilation target, so that the compilation scheduler 110 skips the compilation process of the first compilation target, thereby saving compilation time, achieving the effect of compilation acceleration, and meeting the user's compilation acceleration needs.
[0052] To facilitate a clearer understanding of the compilation acceleration method and system provided in this application, detailed descriptions will be provided below in conjunction with the corresponding accompanying figures.
[0053] Please refer to Figure 3A. Figure 3A is a schematic diagram of the architecture of a compilation acceleration system provided in this application. As shown in Figure 3A, the architecture includes a compilation system 100 and a compilation acceleration system 200, which is independent of the compilation system 100.
[0054] For details regarding the compilation system 100, please refer to the relevant content in the embodiments shown in Figures 1 and 2, which will not be repeated here.
[0055] The compilation acceleration system 200 can be invoked by the compilation system 100 to accelerate compilation during the software compilation process performed by the compilation system 100. Specifically, the compilation acceleration system 200 can establish a communication connection with the compilation system 100 via a network. This communication connection can be a wired connection or a wireless connection. The network can be the public Internet, an internal local area network (LAN), a virtual private network (VPN), a dedicated line such as fiber optic lines, copper wires, satellite connections, etc., or a wireless network such as wireless fidelity (Wi-Fi), cellular networks, etc. This application does not make any specific limitations.
[0056] In its implementation, the compilation acceleration system 200 can be deployed on computing devices or on a cluster of computing devices. These computing devices can be bare metal servers (BMS), virtual machines, or containers. A BMS refers to a general-purpose physical server, such as an ARM server or an x86 server; a virtual machine refers to a complete computer system simulated by software, possessing full hardware system functionality and running in a completely isolated environment. Any task that can be performed on a physical computer can also be performed in a virtual machine. When creating a virtual machine on a computing device, a portion of the physical machine's hard drive and memory capacity is used as the virtual machine's hard drive and memory capacity. Each virtual machine has an independent basic input / output system (BIOS), hard drive, and operating system, and can be operated like a physical machine. A container is a portable software unit that can combine an application and all its dependencies into a single software package. This package is not limited by the underlying host operating system, thus eliminating the need to build complex environments and simplifying the application development and deployment process. In practice, the computing device cluster can be a cloud data center, an enterprise private cluster, or a hybrid cloud environment, which is a deployment mode that uses both public and private clouds. This application does not impose any specific limitations.
[0057] In practice, when deploying the compilation acceleration system 200 shown in Figure 3A, it can be flexibly deployed according to specific application scenarios and business needs. The following is an example of the actual deployment method of the compilation acceleration system 200 in conjunction with specific application scenarios.
[0058] In one application scenario, the compilation acceleration system 200 can be deployed on the user's own equipment, such as on a server or server cluster purchased by the user. Before the compilation system 100 compiles the software, the user can configure the compilation system 100 to connect to the compilation acceleration system 200, so as to realize the compilation acceleration system 200 to accelerate the compilation process during the software compilation process of the compilation system 100.
[0059] In another application scenario, the compilation acceleration system 200 is provided by a cloud service provider and deployed in a cloud environment. Users can purchase related cloud services for the compilation acceleration system 200 from the cloud platform provided by the cloud service provider. In this case, the compilation acceleration system 200 is deployed on an instance within the cloud data center of the cloud service provider. As shown in Figure 3B, after a user accesses the cloud platform to purchase related cloud services for the compilation acceleration system 200, the cloud platform can grant the user access to these services. The user can then configure the compilation system 100 to connect to the compilation acceleration system 200 before the compilation system 100 compiles the software, thereby enabling the compilation acceleration system 200 to accelerate the compilation process during the software compilation process of the compilation system 100.
[0060] It should be understood that the above application scenarios are for illustrative purposes only, and the compilation acceleration system 200 can be flexibly deployed according to actual business needs.
[0061] In one possible embodiment, Figures 3A and 3B may further include a client 300 (not shown in Figures 3A and 3B). The client 300 can be deployed on a terminal device or a computing device to enable human-computer interaction. Users can configure the compilation system 100 to connect to the compilation acceleration system 200 through the client 300, thereby accelerating the compilation process of software compilation within the compilation system 100 by calling the compilation acceleration system 200. Terminal devices include personal computers (PCs), smartphones, wearable devices, handheld processing devices, tablets, mobile laptops, augmented reality (AR) devices, virtual reality (VR) devices, smart conferencing devices, etc., and are not specifically limited here. The description of computing devices can be found in the foregoing content and will not be repeated here.
[0062] In specific implementations, client 300 can be software or an application running on a user-controlled terminal device or computing device, such as a personal computer client, a World Wide Web (web) client accessed via a browser, or an application (APP) client running on a mobile terminal; this application does not impose specific limitations. Optionally, client 300 can also be a functional module or plugin within comprehensive software (such as compiler software or code writing software) running on a terminal device or computing device; this application does not impose specific limitations.
[0063] Optionally, client 300 can also be a cloud platform client, such as a cloud platform console. Specifically, it can be a web-based console or an application programming interface (API) based console; this application does not impose specific limitations. This console can provide users with cloud services related to the compilation acceleration system 200. Users can obtain access to the compilation acceleration system 200 provided by this application by purchasing cloud services. Alternatively, the cloud services related to the compilation acceleration system 200 provided by this application can be a sub-service within the comprehensive cloud services provided by the console, available for purchase and use by users; this application does not impose specific limitations.
[0064] In specific implementations, the client 300 and the compilation acceleration system 200 are deployed on different computing devices or computing device clusters, or they are deployed on the same computing device or the same computing device cluster. This application does not make any specific limitations.
[0065] Client 300 can establish a communication connection with compiler acceleration system 200 and compiler system 100 via a network. This communication connection can be wired or wireless. The network can be the public Internet, a LAN, a VPN, a dedicated line such as fiber optic lines, copper wires, or satellite connections, or a wireless network such as Wi-Fi or cellular networks. This application does not impose specific limitations. The number of clients 300 establishing a communication connection with compiler acceleration system 200 can be one or more, and this application does not impose specific limitations.
[0066] It should be understood that the architecture shown in Figures 3A and 3B is merely an example. For instance, in actual applications, network devices may be included for forwarding communication data between the compilation acceleration system 200 and the compilation system 100. The number of compilation systems 100 that establish communication connections with the compilation acceleration system 200 may be one or more, and this application does not impose any specific limitations.
[0067] Please refer to Figure 4, which is a schematic diagram of another compilation acceleration system architecture provided in this application. As shown in Figure 4, the architecture includes a compilation system 100 and a compilation acceleration system 200, with the compilation acceleration system 200 integrated into the compilation system 100.
[0068] For details regarding the compilation system 100, please refer to the embodiments in Figures 1 and 2, which will not be repeated here.
[0069] The compilation acceleration system 200 is used to accelerate the compilation process of the compilation system 100 during the software compilation process.
[0070] In a specific implementation, the compilation acceleration system 200 can be a separate software or application running on a device in the compilation system 100, specifically designed to implement compilation acceleration functions, such as compilation acceleration tools or compilation acceleration applications. Alternatively, it can be a compilation acceleration function module or plugin within a comprehensive software (such as compilation software or code writing software) running on a device. This application does not impose any specific limitations on this.
[0071] To better understand the specific process of compilation acceleration by the above-mentioned compilation acceleration system 200, a more detailed description is provided below with reference to the flowchart of a compilation acceleration method provided in this application, as shown in Figure 5.
[0072] As shown in Figure 5, the following steps may be included:
[0073] S501: The compilation acceleration system receives the first compilation target of the software sent by the compilation scheduler. The first compilation target indicates the process of compiling to obtain the compilation product of the first compilation target.
[0074] For information on the compiler scheduler, please refer to the relevant sections in Figures 1 and 2; they will not be repeated here.
[0075] The software can be any software capable of performing any function (such as applications, plugins, mini-programs, etc.), such as electronic payment software capable of electronic payment, instant messaging software capable of instant messaging, video playback software capable of video playback, online shopping software capable of online shopping, etc. This application does not impose any specific limitations. The software can contain one compilation target or multiple compilation targets; this application does not impose any specific limitations. The software typically also contains multiple source code files. Regarding compilation targets, please refer to the introduction to compilation targets above; it will not be repeated here.
[0076] The first compilation target, in the case of a software containing one compilation target, is that compilation target; in the case of a software containing multiple compilation targets, the first compilation target can be any one of the multiple compilation targets. Referring to the description of compilation targets in Figure 1, the first compilation target includes its name, a first compilation command, and a first dependency relationship. The name of the first compilation target is the name of the compilation artifact to be generated by the first compilation target; the first compilation command is the command executed to implement the first compilation target; the first dependency relationship specifies the resources (including source code files and / or other compilation targets, etc.) on which the compilation process of the first compilation target depends. Specifically, the first dependency relationship specifies the resources on which the first compilation target depends by carrying the identifiers of the resources on which the first compilation target depends, such as the identifiers of source code files and / or other compilation targets. The identifier of a source code file can be the name or access path of a source code file, etc., and the identifiers of other compilation targets can be the names of other compilation targets, etc.
[0077] Referring to the first compilation target illustrated in Figure 6, in Figure 6, the object "a" of the "name" variable is the name of the first compilation target, the object "gcc-ab xxx" of the "command" variable is the first compilation command, and the objects "b,c,xxx,xxx,…" of the "depends" variable contain "b" and "c" which are the names of other compilation targets that the first compilation target depends on, and "xxx" is the name of the source code file that the first compilation target depends on.
[0078] The following describes how the compilation acceleration system receives the first compilation target sent by the compilation scheduler.
[0079] Method 1: After reading the first compilation target, the compiler scheduler actively sends the first compilation target to the compilation acceleration system.
[0080] Method 2: The compilation acceleration system can monitor whether the compilation scheduler has read the compilation target. If it is detected that the compilation scheduler has read the compilation target, the compilation target read by the compilation scheduler is directly collected as the first compilation target.
[0081] It should be understood that the above methods 1 and 2 are merely examples of how the compilation acceleration system receives the first compilation target sent by the compilation scheduler, and should not be regarded as specific limitations.
[0082] In one possible embodiment, when the compilation acceleration system is deployed independently of the compilation system as shown in Figures 3A and 3B, and Figures 3A and 3B include a client 300, before S501, the compilation acceleration system can receive compilation acceleration instructions sent by the user through the client 300, and then execute S501 according to the compilation acceleration instructions. The compilation acceleration instructions may carry the identifier of the compilation system (such as an Internet Protocol (IP) address) so that the compilation acceleration system can locate the compilation system based on the identifier. Regarding the client 300, please refer to the description of the client 300 in Figures 3A and 3B; it will not be repeated here.
[0083] Optionally, if the compilation system requires verification before access is allowed when it is accessed, the compilation acceleration instruction can also carry the verification information of the compilation system, such as username and password, so that the compilation acceleration system can access the compilation system through the verification information carried by the compilation acceleration instruction, thereby accelerating the compilation process during software compilation.
[0084] In specific implementations, the client 300 receives compilation acceleration instructions from the user in the following ways, including but not limited to:
[0085] Method (1): Users can input compilation acceleration commands through the command-line interface (CLI) provided by the client 300.
[0086] Method (2): Users can input compilation acceleration instructions through the application programming interface (API) provided by the client 300.
[0087] Method (3): The client 300 provides a graphical user interface (GUI) to the user. The GUI can display the identification input interface of the compilation system and the compilation acceleration control. The user can input the identification of the compilation system through the input interface and then click the compilation acceleration control to input the compilation acceleration command.
[0088] S502: The compilation acceleration system obtains the influence factor of the first compilation target based on the first compilation target. The influence factor of the first compilation target is the factor that affects the compilation output of the first compilation target.
[0089] The first compilation target's influencing factors are those that affect the compilation output of the first compilation target. For example: (1) If the first compilation command contained in the first compilation target changes, for example, if the first compilation command changes from a C language type command to a Java language type command, then the compilation output of the first compilation target will usually change. Therefore, the first compilation command is a factor that affects the compilation output of the first compilation target. (2) If the source code file that the first compilation target depends on changes, for example, if the source code file that the first compilation target depends on changes from source code file A to source code file B, then the compilation output of the first compilation target will usually change. Therefore, the identifier of the source code file that the first compilation target depends on is a factor that affects the compilation output of the first compilation target. (3) If the other compilation targets that the first compilation target depends on change, for example, if the other compilation targets that the first compilation target depends on change from compilation target 1 to compilation target 2, then the compilation output of the first compilation target will usually change. Therefore, the name of the other compilation targets that the first compilation target depends on is a factor that affects the compilation output of the first compilation target. (4) If the name of the first compilation target changes, since the name of the first compilation target is the name of the compilation output to be generated by the first compilation target, the compilation output of the first compilation target will change accordingly. It can be seen that the name of the first compilation target is also a factor that affects the compilation output of the first compilation target.
[0090] It should be noted that the aforementioned first compilation command, the identifier of the source code file on which the first compilation target depends, the name of other compilation targets on which the first compilation target depends, and the name of the first compilation target are merely examples of the influencing factors of the first compilation target. In this application, the influencing factors of the first compilation target may include, in addition to the first compilation command, the identifier of the source code file on which the first compilation target depends, the name of other compilation targets on which the first compilation target depends, and the name of the first compilation target, the first commit identifier and the compilation environment variables corresponding to the first compilation target. It should also be noted that in specific implementations, the influencing factors of the first compilation target may include other or more influencing factors, for example, it may include the source code in the source code file on which the first compilation target depends; this application does not impose specific limitations.
[0091] The following section provides a detailed introduction to the compilation environment variables corresponding to the first commit identifier and the first compilation target.
[0092] (1) First submission identifier.
[0093] To make it easier to understand, let's first introduce the submission identifier.
[0094] A commit identifier is used to identify each commit record made by a user when submitting software code to the code repository. In practice, a user's software code (including compilation targets and source code files) is usually hosted in a code repository (such as a software version control system like Git). Each time a user updates the software code (e.g., modifies, adds, or deletes), and submits the updated code to the code repository, the code repository generates a unique identifier for that commit record based on the content of the submission. If a user does not update the software code but simply resubmits the same software code to the code repository, a unique identifier will still be generated for that commit record because the timestamp and committer information (e.g., username, email) will differ. The unique identifier generated by the code repository for each commit record is the commit identifier.
[0095] Building upon the above introduction to submission identifiers, we will now proceed to introduce the first submission identifier.
[0096] The first commit identifier is the identifier of the commit record to which the source code files depended by the first compilation target belong. The source code files depended by the first compilation target include those directly depended on and those indirectly depended on. Directly depended source code files refer to those specified in the first compilation target, while indirectly depended source code files refer to those specified in other compilation targets that the first compilation target depends on.
[0097] Referring to Figure 7, which illustrates the dependency relationships between multiple compilation targets and multiple source code files, the multiple compilation targets are target0 to target4, and the multiple source code files are source code files 5 to source code files 10. It can be seen that target1 directly depends on source code files 5 and 6, target2 directly depends on source code file 7, target3 directly depends on source code file 8, target4 directly depends on source code files 9 and 10, target0 directly depends on target1 to target4, and target0 indirectly depends on source code files 5 to source code files 10.
[0098] Taking the first compilation target as target1 shown in Figure 7 as an example, it can be seen from Figure 7 that the source code files 5 and 6 that target1 depends on belong to commit record A. The commit identifier of commit record A is "1709374385", so the first commit identifier is "1709374385".
[0099] Taking the first compilation target as target0 shown in Figure 7 as an example, it can be seen from Figure 7 that source code files 5 and 6, which target0 depends on, belong to commit record A. Source code files 7 and 8, which target0 depends on, belong to commit record B. The commit identifier of commit record B is "1804373475". Source code files 9 and 10, which target0 depends on, belong to commit record C. The commit identifier of commit record C is "2854673512". Therefore, the first commit identifier includes three commit identifiers: the commit identifier of commit record A "1709374385", the commit identifier of commit record B "1804373475", and the commit identifier of commit record C "2854673512".
[0100] (2) The compilation environment variables corresponding to the first compilation target.
[0101] The compilation environment variables corresponding to the first compilation target refer to some environment variables set by the user to meet the compilation requirements of the first compilation target. These include variables that specify the compiler used to compile according to the first compilation target, and environment variables that instruct the compiler where to find the header files, library files, tools, and dependencies required by the first compilation target. By setting these environment variables, it can be ensured that the resources required to compile the first compilation target can be found correctly during the compilation process, and the compilation is carried out in the expected way to obtain the compilation output of the first compilation target.
[0102] Common compiler environment variables include, but are not limited to, the following:
[0103] 1. The PATH variable is used to specify the search path for executable files.
[0104] 2. The C_INCLUDE_PATH variable is used to specify the search path for C language header files.
[0105] 3. The CPLUS_INCLUDE_PATH variable is used to specify the search path for C++ language header files.
[0106] 4. The LIBRARY_PATH variable is used to specify the search path for library files.
[0107] 5. The LD_LIBRARY_PATH variable is used to specify the search path for dynamic link library files.
[0108] 6. The CC variable is used to specify that a C language compiler should be used for compilation.
[0109] 7. CXX variables are used to specify the compilation method using a C++ compiler.
[0110] S503: The compilation acceleration system performs a hash calculation on the impact factor of the first compilation target to obtain the first hash value.
[0111] Specifically, the compilation acceleration system can perform hash calculations on the influence factors of the first compilation target using methods such as Method 1 and Method 2 to obtain the first hash value.
[0112] Method 1: The compilation acceleration system combines multiple influencing factors of the first compilation target, uses the combined information as input to the hash algorithm, and calculates the first hash value.
[0113] Method 2: The compilation acceleration system first calculates the hash value corresponding to each resource on which the first compilation target depends based on the impact factor of the first compilation target. Then, it calculates the first hash value based on the hash value corresponding to each resource on which the first compilation target depends and the impact factor of the first compilation target.
[0114] The following section will provide a detailed explanation of Method 2 using two specific examples.
[0115] Example 1, taking the first compilation target as target1 as shown in Figure 7, can be calculated first based on the influence factor of target1, then the hash values of source code file 5 and source code file 6 that target1 depends on can be calculated. Then, based on the hash values of source code file 5, source code file 6, and the influence factor of target1, the first hash value can be calculated. A more detailed process for calculating the first hash value is as follows:
[0116] From the introduction of the influence factors of the first compilation target in S502, we can know that the influence factors of target1 include: the compilation command in target1, the identifiers of source code file 5 and source code file 6 that target1 depends on, the name of target1, the commit identifier "1709374385" of commit record A, and the compilation environment variables corresponding to target1. The compilation acceleration system can execute the following steps S1-S3 to obtain the first hash value.
[0117] S1. Combine the commit identifier "1709374385" of commit record A, the identifier of source code file 5, and the compilation environment variable corresponding to target1. Use the combined information as input to the hash algorithm, and the calculated hash value is the hash value corresponding to source code file 5.
[0118] S2. Combine the commit identifier "1709374385" of commit record A, the identifier of source code file 6, and the compilation environment variable corresponding to target1. Use the combined information as input to the hash algorithm, and the calculated hash value is the hash value corresponding to source code file 6.
[0119] S3. Combine the hash value corresponding to source code file 5, the hash value corresponding to source code file 6, the compilation command in target1, and the name of target1. Use the combined information as the input of the hash algorithm, and the calculated hash value is the first hash value.
[0120] Example 2, taking the first compilation target as target0 as shown in Figure 7, can be calculated first based on the influence factor of target0, by calculating the hash value corresponding to source code file 5 that target0 depends on, down to the hash value corresponding to source code file 10 that target0 depends on. Then, based on the hash values corresponding to source code file 5 to source code file 10 and the influence factor of target0, the first hash value can be calculated. A more detailed process for calculating the first hash value is as follows:
[0121] From the introduction of the influence factors of the first compilation target in S502, we can know that the influence factors of target0 include: the compilation commands in target0, the identifiers of source code files 5 to 10 that target0 depends on, the name of target0, the names of target1 to target4 that target0 depends on, the compilation commands in target1 to target4, the commit identifier "1709374385" of commit record A, the commit identifier "1804373475" of commit record B, the commit identifier "2854673512" of commit record C, and the compilation environment variables corresponding to target0. The compilation acceleration system can execute the following steps S01-S11 to obtain the first hash value.
[0122] S01. Combine the commit identifier "1709374385" of commit record A, the identifier of source code file 5, and the compilation environment variable corresponding to target0. Use the combined information as the input of the hash algorithm, and the calculated hash value is the hash value corresponding to source code file 5.
[0123] S02. Combine the commit identifier "1709374385" of commit record A, the identifier of source code file 6, and the compilation environment variable corresponding to target0. Use the combined information as input to the hash algorithm, and the calculated hash value is the hash value corresponding to source code file 6.
[0124] S03. Combine the commit identifier "1804373475" of commit record B, the identifier of source code file 7, and the compilation environment variable corresponding to target0. Use the combined information as input to the hash algorithm, and the calculated hash value is the hash value corresponding to source code file 7.
[0125] S04. Combine the commit identifier "1804373475" of commit record B, the identifier of source code file 8, and the compilation environment variable corresponding to target0. Use the combined information as input to the hash algorithm, and the calculated hash value is the hash value corresponding to source code file 8.
[0126] S05. Combine the commit identifier "2854673512" of commit record C, the identifier of source code file 9, and the compilation environment variable corresponding to target0. Use the combined information as input to the hash algorithm, and the calculated hash value is the hash value corresponding to source code file 9.
[0127] S06. Combine the commit identifier "2854673512" of commit record C, the identifier of source code file 10, and the compilation environment variable corresponding to target0. Use the combined information as the input of the hash algorithm, and the calculated hash value is the hash value corresponding to source code file 10.
[0128] S07. Combine the hash value corresponding to source code file 5, the hash value corresponding to source code file 6, the compilation command in target1, and the name of target1. Use the combined information as the input of the hash algorithm, and the calculated hash value is the hash value corresponding to target1.
[0129] S08. Combine the hash value corresponding to source code file 7, the compilation command in target2, and the name of target2. Use the combined information as input to the hash algorithm, and the calculated hash value is the hash value corresponding to target2.
[0130] S09. Combine the hash value corresponding to source code file 8, the compilation command in target3, and the name of target3. Use the combined information as input to the hash algorithm, and the calculated hash value is the hash value corresponding to target3.
[0131] S10. Combine the hash value corresponding to source code file 9, the hash value corresponding to source code file 10, the compilation command in target4, and the name of target4. Use the combined information as input to the hash algorithm, and the calculated hash value is the hash value corresponding to target4.
[0132] S11. Combine the hash value corresponding to target1 to the hash value corresponding to target4, the compilation command in target0 and the name of target0, and use the combined information as the input of the hash algorithm. The calculated hash value is the first hash value.
[0133] In methods 1 and 2 above, the hash algorithm used by the compilation acceleration system can be message digest algorithm 5 (MD5), secure hash algorithm (SHA), cyclic redundancy check (CRC), etc., and this application does not make any specific limitation.
[0134] It should be understood that the above methods 1 and 2 are merely examples of how the compilation acceleration system performs hash calculations on the influence factors of the first compilation target to obtain the first hash value, and this application does not make any specific limitations on them.
[0135] S504: The compilation acceleration system queries multiple mapping relationships based on the first hash value to determine whether there is a first mapping relationship that records the first hash value among the multiple mapping relationships. If it is determined that the first mapping relationship exists, S505 is executed. If it is determined that the first mapping relationship does not exist, S506 and S508-S510 are executed.
[0136] The following section introduces several mapping relationships.
[0137] Each mapping relationship in the multiple mapping relationships records one of the multiple historical compilation products and the hash value corresponding to that historical compilation product. Taking the multiple mapping relationships including a first mapping relationship and a second mapping relationship as an example, the first mapping relationship records the first historical compilation product and the first hash value corresponding to the first historical compilation product, and the second mapping relationship records the second historical compilation product and the second hash value corresponding to the second historical compilation product. The first historical compilation product and the second historical compilation product belong to the multiple historical compilation products recorded by the multiple mapping relationships. The first historical compilation product is the compilation product of the first historical compilation target, and the second historical compilation product is the compilation product of the second historical compilation target. The first hash value corresponding to the first historical compilation product is obtained by hashing the influence factor of the compilation product of the first historical compilation target, and the second hash value corresponding to the second historical compilation product is obtained by hashing the influence factor of the compilation product of the second historical compilation target.
[0138] In specific implementation, the aforementioned historical compilation targets (such as the first historical compilation target and the second historical compilation target) can be the historical compilation targets of the software to which the first compilation target belongs. The factor types included in the influence factors of the aforementioned historical compilation targets are the same as the factor types included in the influence factors of the first compilation target in S502. The method of hashing the influence factors of the historical compilation targets is the same as the method of hashing the influence factors of the first compilation target described in S503, and will not be elaborated further.
[0139] In practice, multiple historical compilation artifacts can be stored locally on the compilation acceleration system or on a storage device independent of the compilation acceleration system; this application does not impose any specific limitations.
[0140] It is understandable that since the first hash value recorded in the first mapping relationship is obtained by hashing the influence factor of the first historical compilation target, and this hash value is the same as the first hash value obtained by hashing the influence factor of the first compilation target, it can be deduced that the influence factor of the first historical compilation target is the same as the influence factor of the first compilation target. In the case that the influence factors of the two compilation targets are the same, the compilation products of the two compilation targets are usually the same. Therefore, S505 can be executed to use the compilation product of the first historical compilation target as the compilation product of the first compilation target, so as to realize the reuse of the compilation product of the first historical compilation target by the first compilation target and skip the compilation process of the first compilation target.
[0141] S505: The compilation acceleration system sends the first historical compilation artifact recorded in the first mapping relationship to the compilation scheduler so that the compilation scheduler uses the first historical compilation artifact as the compilation artifact of the first compilation target.
[0142] S506: The compilation acceleration system instructs the compilation scheduler to compile according to the first compilation target to obtain the compilation product of the first compilation target.
[0143] S507: The compiler scheduler compiles according to the first compilation target to obtain the compilation output of the first compilation target.
[0144] Specifically, the compiler scheduler can call the compiler to execute the compilation instructions in the first compilation target to compile the first compilation target and obtain the compilation product of the first compilation target.
[0145] S508: The compilation acceleration system receives and stores the compilation artifacts of the first compilation target sent by the compilation scheduler.
[0146] Specifically, the compilation acceleration system can monitor the compilation scheduler's compilation process based on the first compilation target. When it detects that the compilation is complete and the compilation artifacts of the first compilation target are obtained, it can proactively retrieve the compilation artifacts of the first compilation target. Alternatively, the compilation scheduler can proactively send the compilation artifacts of the first compilation target to the compilation acceleration system after obtaining them.
[0147] S509: The compilation acceleration system determines the third mapping relationship, which records the compilation artifacts of the first compilation target and the first hash value.
[0148] S510: The compilation acceleration system adds a third mapping to multiple mappings.
[0149] It is understandable that the compilation acceleration system stores the compilation artifacts of the first compilation target and adds a third mapping relationship recording the compilation artifacts of the first compilation target and the first hash value to multiple mapping relationships. This allows the compilation acceleration system to query multiple mapping relationships based on the hash value after hashing the impact factor of the second compilation target to obtain a hash value after hashing the impact factor of the second compilation target. It can then determine if there is a third mapping relationship with the same hash value among the multiple mapping relationships. The compilation artifacts of the first compilation target recorded in the third mapping relationship are then used as the compilation artifacts of the second compilation target. This allows the second compilation target to reuse the compilation artifacts of the first compilation target, skipping the compilation process of the second compilation target, thereby saving compilation time and achieving the effect of compilation acceleration.
[0150] As can be seen from the embodiment in Figure 5, in the compilation acceleration method provided in this application, the compilation acceleration system can obtain the first compilation target of the user software read by the compilation scheduler, then obtain the factors of the compilation products that affect the first compilation target, and perform hash calculation on the factors to obtain the hash value corresponding to the first compilation target (i.e., the first hash value mentioned above). Then, based on the first hash value, multiple mapping relationships are queried to determine whether there is a first mapping relationship that records the first hash value. When a first mapping relationship is found, since the first hash value recorded in the first mapping relationship is obtained by hash calculation on the factors of the first historical compilation target, it can be deduced that the factors of the first historical compilation target are the same as the factors of the first compilation target. Based on this reasoning result, it can be deduced that if the compilation operation based on the first compilation target is actually performed, the compilation product of the first compilation target will be the same as the compilation product of the first historical compilation target. Therefore, it is determined that the compilation product of the first historical compilation target can be used as the compilation product of the first compilation target, so as to realize the reuse of the compilation product of the first historical compilation target by the first compilation target, allowing the compilation scheduler to skip the actual compilation process of the first compilation target, thereby saving compilation time and achieving the effect of compilation acceleration, thus meeting the user's compilation acceleration needs.
[0151] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0152] The architecture and compilation acceleration method of the synchronization system provided in this application have been described in detail above. The unit modules in the synchronization system provided in this application will be explained below with reference to Figure 8.
[0153] Figure 8 is a schematic diagram of the structure of a compilation acceleration system 200 provided in this application. The compilation acceleration system 200 can be the compilation acceleration system described in the embodiments of Figures 1-7. As shown in Figure 8, the compilation acceleration system 200 may include: an acquisition unit 211 and a query unit 212. The functions of each unit module of the compilation acceleration system 200 will be described by way of example below.
[0154] The acquisition unit 211 is used to acquire the first compilation target of the software. The first compilation target indicates the process of compiling to obtain the compilation product of the first compilation target.
[0155] The acquisition unit 211 is also used to acquire the influence factor of the first compilation target based on the first compilation target, wherein the influence factor of the first compilation target is the factor that affects the compilation product of the first compilation target.
[0156] The query unit 212 is used to perform a hash calculation on the influence factor of the first compilation target to obtain the first hash value.
[0157] The query unit 212 is used to query multiple mapping relationships based on a first hash value. When it is determined that a first historical compilation product corresponding to the first hash value exists among the stored multiple historical compilation products, the first historical compilation product is used as the compilation product of the first compilation target. The multiple mapping relationships include a first mapping relationship and a second mapping relationship. The first mapping relationship records the first historical compilation product and the first hash value corresponding to the first historical compilation product. The second mapping relationship records the second historical compilation product and the second hash value corresponding to the second historical compilation product. The multiple historical compilation products include a first historical compilation product and a second historical compilation product. The first historical compilation product is the compilation product of the first historical compilation target, and the second historical compilation product is the compilation product of the second historical compilation target. The first hash value corresponding to the first historical compilation product is obtained by hashing the influence factor of the compilation product of the first historical compilation target, and the second hash value corresponding to the second historical compilation product is obtained by hashing the influence factor of the compilation product of the second historical compilation target.
[0158] In some possible embodiments, the influence factors of the first compilation target mentioned above include the following:
[0159] The first compilation target includes the compilation command, the name of the first compilation target, the identifier of the source code file that the first compilation target depends on, the names of other compilation targets that the first compilation target depends on, the compilation commands in the other compilation targets, the first commit identifier, and the compilation environment variables corresponding to the first compilation target. The first commit identifier is the identifier of the commit record to which the source code file that the first compilation target depends belongs. The factor types included in the influence factors of the first historical compilation target and the second historical compilation target are the same as the factor types included in the influence factors of the first compilation target.
[0160] In some possible embodiments, as shown in FIG8, the compilation acceleration system 200 further includes: a notification unit 213 and a mapping unit 214. The notification unit 213 is used to notify the compilation scheduler to compile according to the first compilation target and obtain the compilation product of the first compilation target when it is determined that there is no first historical compilation product corresponding to the first hash value among the multiple stored historical compilation products. The acquisition unit 211 is also used to acquire the compilation product of the first compilation target and store the compilation product of the first compilation target. The mapping unit 214 is used to determine a third mapping relationship and to add the third mapping relationship to multiple mapping relationships. The third mapping relationship records the compilation product of the first compilation target and the first hash value.
[0161] In some possible embodiments, the first compilation target obtained by the compilation acceleration system 200 described above comes from the ninja compilation system.
[0162] In specific implementations, the acquisition unit 211, query unit 212, and notification unit 213 can all be implemented in software or in hardware. For example, the implementation of the query unit 212 will be described below. Similarly, the implementation of other units such as the acquisition unit 211 and notification unit 213 can refer to the implementation of the query unit 212.
[0163] As an example of a unit implemented in software, query unit 212 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, or a container. Further, the aforementioned computing instance may be one or more. For example, query unit 212 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Further, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one or more geographically proximate data centers. Typically, a region may include multiple AZs.
[0164] Similarly, multiple hosts / virtual machines / containers used to run this code can be distributed within the same Virtual Private Cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Communication between two VPCs within the same region, as well as between VPCs in different regions, requires a communication gateway to be set up within each VPC to enable interconnection between VPCs.
[0165] As an example of hardware implementation, query unit 212 may include at least one computing device, such as a server. Alternatively, query unit 212 may also be implemented using a central processing unit (CPU), application-specific integrated circuit (ASIC), programmable logic device (PLD), complex programmable logical device (CPLD), field-programmable gate array (FPGA), generic array logic (GAL), data processing unit (DPU), neural network processing unit (NPU), graphics processing unit (GPU), system on chip (SoC), offload card, accelerator card, or any combination thereof.
[0166] When query unit 212 includes multiple computing devices, these devices can be distributed in the same region or in different regions. Similarly, the multiple computing devices included in query unit 212 can be distributed in the same Availability Zone (AZ) or in different AZs. Likewise, the multiple computing devices included in query unit 212 can be distributed in the same Virtual Private Cloud (VPC) or in multiple VPCs. These multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, GALs, DPUs, NPUs, SoCs, offloading cards, and accelerator cards.
[0167] It should be noted that, in other embodiments, the query unit 212 can be used to execute any step in the compilation acceleration method provided in this application, the acquisition unit 211 can be used to execute any step in the compilation acceleration method provided in this application, and other units such as the notification unit 213 can be used to execute any step in the compilation acceleration method provided in this application. The steps implemented by each unit in FIG8 can be specified as needed, and different steps in the compilation acceleration method provided in this application can be implemented in a coordinated manner to realize all the functions of the compilation acceleration system 200.
[0168] It should be understood that the functions of each unit module described above are only the functions that the compilation acceleration system 200 may have in some embodiments of this application, and this application does not limit the functions of each unit module.
[0169] It should also be understood that Figure 8 is an exemplary division method. The compilation acceleration system 200 may also include more or fewer unit modules. The division method of unit modules in the compilation acceleration system 200 can be flexibly adjusted based on the actual business scenario. This application does not make specific limitations.
[0170] This application also provides a computing device 900, which can deploy the aforementioned compilation acceleration system. The operation and / or function of each unit module in the computing device 900 are respectively to implement the corresponding steps in the compilation acceleration method provided in this application.
[0171] As shown in Figure 9, the computing device 900 includes a processor 910, a memory 920, and a communication interface 930, wherein the processor 910, the memory 920, and the communication interface 930 can be interconnected via a bus 940.
[0172] The processor 910 can read program code (including instructions) stored in the memory 920, execute the program code stored in the memory 920, so that the computing device 900 executes the compilation acceleration method provided in this application, or so that the computing device 900 deploys the compilation acceleration system 200.
[0173] The processor 910 may include any one or more computing devices such as CPU, GPU, microprocessor (MP) or digital signal processor (DSP), ASIC, FPGA, CPLD, NPU, SoC, offload card, accelerator card, etc.
[0174] The processor 910 executes various types of digital storage instructions, such as software or firmware programs stored in the memory 920, which enables the computing device 900 to provide a wide range of services.
[0175] In a specific implementation, as one example, the processor 910 includes one or more CPUs.
[0176] In a specific implementation, as one example, the computing device 900 also includes multiple processors, each of which can be a single-core processor (single-CPU) or a multi-core processor (multi-CPU). Here, a processor refers to one or more devices, circuits, and / or processing cores used to process data (e.g., computer program instructions).
[0177] The memory 920 is used to store program code, which is executed by the processor 910 to perform the compilation acceleration method provided in this application. The program code may include one or more software modules, such as the software modules provided in the embodiment of FIG8, such as the acquisition unit 211, the query unit 212, the notification unit 213, and the mapping unit 214.
[0178] The memory 920 may include volatile memory, such as random access memory (RAM); the memory 920 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid-state drive (SSD); the memory 920 may also include combinations of the above types.
[0179] The communication interface 930 can be a wired interface (e.g., Ethernet interface, fiber optic interface, other types of interface (e.g., InfiniBand interface)) or a wireless interface (e.g., cellular network interface or wireless LAN interface) for communicating with other computing devices or apparatuses. The communication interface 930 can employ a protocol suite based on Transmission Control Protocol / Internet Protocol (TCP / IP), such as Remote Function Call (RFC), Simple Object Access Protocol (SOAP), Simple Network Management Protocol (SNMP), Common Object Request Broker Architecture (CORBA), and distributed protocols, etc.
[0180] The 940 bus can be a peripheral component interconnect express (PCIe) bus, an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a compute express link (CXL) bus, a cache coherent interconnect for accelerators (CCIX) bus, etc. The 940 bus can be divided into address bus, data bus, control bus, etc.
[0181] In addition to the data bus, bus 940 may also include a power bus, a control bus, and a status signal bus. However, for clarity, all buses are labeled as bus 940 in the figure. For ease of illustration, only one thick line is used in Figure 9, but this does not mean that there is only one bus or one type of bus.
[0182] As one possible implementation, the computing device 900 may also include a chip system, which includes a processor 910 and a power supply circuit. The power supply circuit supplies power to the processor 910, which executes the operation steps corresponding to the compilation acceleration method. For simplicity, further details are omitted here. The processor 910 can be implemented using a CPU, or it can be implemented using computing devices or chips such as a GPU, DPU, NPU, XPU, SoC, offloading card, or accelerator card.
[0183] As one possible implementation, the computing device 900 may include multiple types of processors 910, meaning the computing device 900 is a heterogeneous device. For example, the computing device 900 may include a CPU and a GPU, and at least one of these processors can execute the operation steps corresponding to the compilation acceleration method. For the sake of brevity, further details will not be elaborated here.
[0184] The aforementioned computing device 900 is used to execute the compilation acceleration method provided in this application. The specific implementation process is detailed in the above method embodiments and will not be repeated here.
[0185] It should be understood that the computing device 900 is merely one example provided in the embodiments of this application, and the computing device 900 may have more or fewer components than those shown in FIG. 9, may combine two or more components, or may be implemented with different configurations of components. For content not shown or described in the embodiments of this application, please refer to the relevant descriptions in the embodiments of FIG. 1-8 above, which will not be repeated here.
[0186] This application also provides a computing device cluster 1000, which can deploy the aforementioned compilation acceleration system. The operation and / or function of each unit module in the computing device cluster 1000 are respectively to implement the corresponding steps in the compilation acceleration method provided in this application.
[0187] As shown in Figure 10, the computing device cluster 1000 includes at least one computing device 900. The memory 920 of one or more computing devices 900 in the computing device cluster may store the same instructions for executing the compilation acceleration method provided in this application. The computing device 900 may be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device 900 may also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.
[0188] In some possible implementations, the memory 920 of one or more computing devices 900 in the computing device cluster 1000 may also store instructions for executing the compilation acceleration method provided in this application. In other words, a combination of one or more computing devices 900 can jointly execute the instructions for executing the compilation acceleration method provided in this application.
[0189] It should be noted that the memory 920 in different computing devices 900 within the computing device cluster 1000 can store different instructions, which are used to execute parts of the functions of the compilation acceleration system 200. That is, the instructions stored in the memory 920 in different computing devices 900 can implement the functions of one or more units among the fetch unit 211, query unit 212, notification unit 213, and mapping unit 214.
[0190] In some possible implementations, one or more computing devices 900 in the computing device cluster 1000 can be connected via a network. This network can be a wide area network (WAN) or a local area network (LAN), etc. Figure 11 illustrates one possible implementation, where two computing devices 900A and 900B are connected via a network. Specifically, they are connected to the network through communication interfaces in each computing device. In this type of possible implementation, the memory 920 in computing device 900A stores instructions for performing the functions of the acquisition unit 211 and the query unit 212. Simultaneously, the memory 920 in computing device 900B stores instructions for performing the functions of the notification unit 213 and the mapping unit 214.
[0191] The connection method between the computing device cluster 1000 shown in Figure 11 can be considered in light of the compilation acceleration method provided in this application, which requires compilation acceleration for a large number of users' software. Therefore, the functions implemented by the acquisition unit 211 and the query unit 212 are considered to be executed by the computing device 900A.
[0192] It should be understood that the functions of computing device 900A shown in Figure 11 can also be performed by multiple computing devices 900. Similarly, the functions of computing device 900B can also be performed by multiple computing devices 900.
[0193] This application also provides a computer program product containing instructions, which may be a software or program product containing instructions capable of running on a computing device or stored on any usable medium. When the computer program product is run on at least one computing device, the at least one computing device executes the compilation acceleration method provided in this application.
[0194] This application also provides a computer-readable storage medium, which can be any available medium capable of being stored by a computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., high-density digital video disc (DVD), or a semiconductor medium (e.g., solid-state drive), etc. The computer-readable storage medium includes instructions that instruct a computing device to execute the compilation acceleration method provided in this application.
[0195] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0196] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium, or a semiconductor medium, etc.
[0197] The above description is merely a specific embodiment of this application. Any variations or substitutions conceived by those skilled in the art based on the specific embodiments provided in this application should be covered within the protection scope of this application.
Claims
1. A method of compiling for acceleration, the method comprising: The method includes: The compilation acceleration system obtains the first compilation target of the software, and the first compilation target indicates the process of compiling to obtain the compilation product of the first compilation target; The compilation acceleration system obtains the influence factor of the first compilation target based on the first compilation target, wherein the influence factor of the first compilation target is the factor that affects the compilation product of the first compilation target; The compilation acceleration system performs hash calculation on the influence factors of the first compilation target to obtain a first hash value; The compilation acceleration system queries multiple mapping relationships based on the first hash value. When it determines that a first historical compilation product corresponding to the first hash value exists among the stored multiple historical compilation products based on the queried first mapping relationship, the first historical compilation product is used as the compilation product of the first compilation target. The multiple mapping relationships include the first mapping relationship and the second mapping relationship. The first mapping relationship records the first historical compilation product and the first hash value corresponding to the first historical compilation product. The second mapping relationship records the second historical compilation product and the second hash value corresponding to the second historical compilation product. The multiple historical compilation products include the first historical compilation product and the second historical compilation product. The first historical compilation product is the compilation product of the first historical compilation target, and the second historical compilation product is the compilation product of the second historical compilation target. The first hash value corresponding to the first historical compilation product is obtained by hashing the influence factor of the compilation product of the first historical compilation target, and the second hash value corresponding to the second historical compilation product is obtained by hashing the influence factor of the compilation product of the second historical compilation target.
2. The method of claim 1, wherein, The influencing factors of the first compilation target include the following: The first compilation target includes the compilation command, the name of the first compilation target, the identifier of the source code file that the first compilation target depends on, the name of other compilation targets that the first compilation target depends on, the compilation command in the other compilation targets, the first commit identifier, and the compilation environment variables corresponding to the first compilation target. The first commit identifier is the identifier of the commit record to which the source code file that the first compilation target depends belongs. The factor types included in the influence factors of the first historical compilation target and the factor types included in the influence factors of the second historical compilation target are the same as the factor types included in the influence factors of the first compilation target.
3. The method according to claim 1 or 2, characterized in that, The method further includes: When the compilation acceleration system determines that there is no first historical compilation product corresponding to the first hash value among the stored multiple historical compilation products, it notifies the compilation scheduler to compile according to the first compilation target to obtain the compilation product of the first compilation target. The compilation acceleration system obtains the compilation artifacts of the first compilation target and stores the compilation artifacts of the first compilation target; The compilation acceleration system determines a third mapping relationship and adds the third mapping relationship to the plurality of mapping relationships. The third mapping relationship records the compilation product of the first compilation target and the first hash value.
4. The method according to any one of claims 1 to 3, characterized in that, The first compilation target obtained by the compilation acceleration system comes from the Ninja compilation system.
5. A compiled acceleration system, characterized in that, The system includes: The acquisition unit is used to acquire the first compilation target of the software, wherein the first compilation target indicates the process of compiling to obtain the compilation product of the first compilation target; The acquisition unit is further configured to acquire the influence factor of the first compilation target based on the first compilation target, wherein the influence factor of the first compilation target is a factor that affects the compilation product of the first compilation target; A query unit is used to perform a hash calculation on the influence factor of the first compilation target to obtain a first hash value; The query unit is configured to query multiple mapping relationships based on the first hash value. When it is determined from the queried first mapping relationship that a first historical compilation product corresponding to the first hash value exists among the stored multiple historical compilation products, the first historical compilation product is used as the compilation product of the first compilation target. The multiple mapping relationships include the first mapping relationship and the second mapping relationship. The first mapping relationship records the first historical compilation product and the first hash value corresponding to the first historical compilation product. The second mapping relationship records the second historical compilation product and the second hash value corresponding to the second historical compilation product. The multiple historical compilation products include the first historical compilation product and the second historical compilation product. The first historical compilation product is the compilation product of the first historical compilation target, and the second historical compilation product is the compilation product of the second historical compilation target. The first hash value corresponding to the first historical compilation product is obtained by hashing the influence factor of the compilation product of the first historical compilation target, and the second hash value corresponding to the second historical compilation product is obtained by hashing the influence factor of the compilation product of the second historical compilation target.
6. The system of claim 5, wherein, The influencing factors of the first compilation target include the following: The first compilation target includes the compilation command, the name of the first compilation target, the identifier of the source code file that the first compilation target depends on, the name of other compilation targets that the first compilation target depends on, the compilation command in the other compilation targets, the first commit identifier, and the compilation environment variables corresponding to the first compilation target. The first commit identifier is the identifier of the commit record to which the source code file that the first compilation target depends belongs. The factor types included in the influence factors of the first historical compilation target and the factor types included in the influence factors of the second historical compilation target are the same as the factor types included in the influence factors of the first compilation target.
7. The system of claim 5 or 6, wherein, The system also includes: The notification unit is used to notify the compilation scheduler to compile according to the first compilation target and obtain the compilation product of the first compilation target when it is determined that there is no first historical compilation product corresponding to the first hash value among the stored plurality of historical compilation products. The acquisition unit is further configured to acquire the compilation product of the first compilation target and store the compilation product of the first compilation target; A mapping unit is used to determine a third mapping relationship and add the third mapping relationship to the plurality of mapping relationships. The third mapping relationship records the compilation product of the first compilation target and the first hash value.
8. The system according to any one of claims 5 to 7, characterized in that, The first compilation target obtained by the compilation acceleration system comes from the ninja compilation system.
9. A computing device cluster, characterized in that, It includes at least one computing device, each of the at least one computing device including a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device to cause the cluster of computing devices to perform the method as described in any one of claims 1 to 4.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed by a computing device or a cluster of computing devices, implement the method as claimed in any one of claims 1 to 4.
11. A computer program product containing instructions, characterized in that, When the instruction is executed by the computing device, the computing device performs the operational steps of the method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Compiling method, electronic equipment and computer readable storage medium
CN111880802A
File compiling method and device, equipment and storage medium
CN112783508A
Code deployment method and device, computer equipment and storage medium
CN114756239A
Compiling method, device and equipment
CN115421722A
Compiling method, compiler, and wasm virtual machine
WO2024045379A1