CN115904768A - Method, system and related equipment for detecting and repairing weak memory sequence - Google Patents

Method, system and related equipment for detecting and repairing weak memory sequence Download PDF

Info

Publication number
CN115904768A
CN115904768A CN202111160173.6A CN202111160173A CN115904768A CN 115904768 A CN115904768 A CN 115904768A CN 202111160173 A CN202111160173 A CN 202111160173A CN 115904768 A CN115904768 A CN 115904768A
Authority
CN
China
Prior art keywords
program
code
repair
file
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111160173.6A
Other languages
Chinese (zh)
Inventor
侯凯
张汝涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202111160173.6A priority Critical patent/CN115904768A/en
Publication of CN115904768A publication Critical patent/CN115904768A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

The application provides a method, a system and related equipment for detecting and repairing a weak memory sequence, which are characterized by comprising the following steps: providing a program input interface, wherein the program input interface is used for acquiring a program uploaded by a user, carrying out weak memory sequence detection on the program, and outputting a detection result, the detection result comprises position information of a code needing to be repaired in the program, outputting range information for carrying out weak memory sequence repair on the program according to the position information, codes corresponding to the range information at least comprise the code needing to be repaired, and carrying out weak memory sequence repair on the codes corresponding to the range information. And when the scale of the program is larger, the repairing efficiency can be improved by repairing the code corresponding to the range information.

Description

Method, system and related equipment for detecting and repairing weak memory sequence
Technical Field
The present application relates to the field of computers, and in particular, to a method, a system, and a related device for detecting and repairing a weak memory sequence.
Background
In order to make the operation unit inside the processor fully utilized, the Central Processing Unit (CPU) may perform out-of-order execution (out-of-order) optimization on the input code, that is, change the execution sequence of some statements in the program. In a multiprocessor system, however, multiple threads running on a processor may have different instruction execution orders on processors of different memory models, thereby causing a logical error in the running of a multi-threaded program.
For example, when a multithread developed based on a non-weak memory model runs in a processor using a weak memory model (weak memory model), because instruction semantics supported by hardware under different memory models are different, threads running in parallel in a program associated with the multithread may be out of order when executing read and write instructions for memory access, thereby causing a problem of weak memory order. In this case, a logical error may occur in the function to be implemented by the program, which may result in an inaccurate output result after the program is executed.
For the weak memory order problem, a memory barrier instruction may be inserted before the access instruction to ensure that the two access instructions can be executed according to the sequence required by the program. However, the determination of the location in the program where the memory barrier instruction needs to be inserted is typically determined empirically by the developer. When the program size is large, the efficiency of the method is extremely low, and the processing efficiency of a system where the processor is located is influenced. Therefore, how to provide an efficient weak memory sequence detection and repair method becomes a technical problem to be solved urgently.
Disclosure of Invention
The application provides a method, a system and related equipment for detecting and repairing a weak memory sequence, which are used for solving the problems that the method for detecting and repairing the weak memory sequence is low in efficiency and affects the processing efficiency of a system where a processor is located.
In a first aspect, a method for detecting and repairing a weak memory order is provided, and the method includes the following steps: providing a program input interface, wherein the program input interface is used for acquiring a program uploaded by a user, carrying out weak memory sequence detection on the program, outputting a detection result, the detection result comprises position information of a code needing to be repaired in the program, outputting range information for carrying out weak memory sequence repair on the program according to the position information, the code corresponding to the range information at least comprises the code needing to be repaired, and finally carrying out weak memory sequence repair on the code corresponding to the range information.
In a specific implementation, the program input interface may be a GUI or an API. The program uploaded by the user may include at least one program file, and when the number of the program files is multiple, the multiple program files may further include multiple file categories, for example, the user provides 5 program files, where 3 program files belong to category 1, and the remaining 2 program files belong to category 2; the program files can also belong to different program function libraries (such as a so library), for example, a user provides 45 program files, wherein 15 program files belong to a first so library, and the remaining 30 program files belong to a second so library; the program files may also be assigned to different software modules, for example, 150 program files are provided by the user, wherein 50 program files belong to the first software module, and the remaining 100 program files belong to the second software module.
By implementing the method described in the first aspect, the number of programs participating in weak memory order repair can be reduced, insertion of unnecessary memory barrier instructions is reduced, and thus the running performance of the repaired multi-thread program is improved.
In a possible implementation manner, the repair granularity input by the user may be obtained, and the position of the code that needs to be repaired is expanded according to the repair granularity to obtain the range information, so that the code corresponding to the expanded range information at least includes the code that needs to be repaired.
Optionally, the range information may include a file list, where the file list may include a file name and/or a file path of the file to be repaired, and may further include other obtaining manners for the repairing unit to obtain the file to be repaired, which is not specifically limited in this application.
In some optional implementation manners, if the repair unit cannot obtain the file to be repaired according to the file list, the range information may further include the file to be repaired itself, which is not limited in this application.
In a specific implementation, the file to be repaired may be a program uploaded by a user, or may be a program file in which a code to be repaired is located in a detection result generated by the program detection unit, and the application is not particularly limited.
Optionally, the scope information may also include a function used by the code that needs to be repaired. The repair unit may perform weak memory order repair on a code segment using the function in each program file in the file list according to the file list and the function. In a specific implementation, the function may be a function used according to the code that needs to be repaired in the detection result, the number of the functions may be one or more, and when the number of the functions is multiple, the function may be recorded in the form of a function list.
Optionally, the range information may include class information where the code that needs to be repaired is located, the class information may be a class corresponding to the program file where the code that needs to be repaired is located in the detection result, and the repair unit may perform weak memory order repair on the program file belonging to the class in the file list according to the file list and the class information.
Optionally, the range information may include library information to which the code requiring repair belongs, and the library information may be related to the library of program functions used by the code requiring repair. The repair unit may perform weak memory order repair on the program file of the program function library corresponding to the library information in the file list according to the file list and the library information.
Optionally, the range information may include information of a software module to which the code that needs to be repaired belongs, and the software module information may be related information of the software module in which the code that needs to be repaired is located. The repair unit may perform weak memory order repair on the program file in the file list about the file module according to the file list and the software module information.
In specific implementation, the range information can be displayed to a user through the display interface, and the user can modify the range information.
In specific implementation, several types of range information can be displayed to a user as a plurality of options through the display interface, the user can determine a required repair granularity according to service requirements, and select appropriate range information to repair a weak memory sequence, for example, if the user needs to quickly repair, the range information can be selected to include a file list and software module information, for example, if the user needs to accurately and specifically repair a weak memory sequence for a code uploaded by the user, the range information can be determined according to a software module where the repaired code is located; if the user needs to quickly repair the weak memory sequence of the code uploaded by the user, all code segments using the function in the file can be repaired according to the function used by the code needing to be repaired, and the range information can be specifically determined according to the requirement of the user, which is not limited in the application.
By implementing the implementation mode, the positions of the codes needing to be repaired in the detection result are enlarged, the codes corresponding to the enlarged range information are repaired, the positions of the codes which are not detected in the weak memory sequence detection process can be repaired, and the accuracy of the program in repairing the weak memory sequence is improved.
In another possible implementation, the detection result may be obtained according to the query parameter and the program. Wherein the query parameter is used to indicate a maximum interval at which two operations of the program occur to be reordered. Specifically, the detection result may be obtained according to the query parameter, an interval between a first operation in a first thread of the program and a second operation in the first thread, and an interval between a third operation in a second thread of the program and a fourth operation in the second thread.
In a specific implementation, the first operation and the third operation may be a pair of read and write operations performed on the same variable, the second operation and the fourth operation may be a pair of read and write operations performed on the same variable, the first operation and the second operation may be operations performed on different variables, and the third operation and the fourth operation may be operations performed on different variables. For example, the variable may be a shared variable. One pair of operations may be: the first operation is a read operation on the first variable, and the third operation is a write operation on the first variable; alternatively, the first operation is a write operation to the first variable and the third operation is a read operation to the first variable. Similarly, the second operation is a read operation on the second variable, and the fourth operation is a write operation on the second variable; alternatively, the second operation is a write operation to the second variable and the fourth operation is a read operation to the second variable. The first variable may include a global variable, a shared variable, etc., and the second variable may include a global variable, a shared variable, etc.
Optionally, a memory read-write mode query rule may be adopted to detect a first operation in a first thread of the program, a second operation in the first thread, a third operation in a second thread of the program, and a fourth operation in the second thread, so as to obtain a detection result.
Optionally, the memory read/write mode query rule may be determined according to the query parameter, and the memory read/write mode query rule may be used to determine whether the first thread and the second thread overlap in time.
Optionally, the detection result may be displayed to a user through a display interface, and may be specifically provided to the user in the form of a detection report, where the detection report at least includes location information of the code to be modified, for example, a font color of the code to be modified is converted into a color different from a font color of other codes in the program, and the color is displayed to the user through the display interface, or a row and column information of the code to be modified and a name, a path, and the like of a program file where the code is located are recorded in the detection report, which is not specifically limited in this application.
By implementing the implementation mode, the detection of the weak memory order is carried out before the weak memory order repair is carried out, so that the user can be helped to quickly complete the check of the program running on the weak memory environment, and a basis can be provided for the range information of the subsequent weak memory order repair, so that the codes in the repair range can be repaired in a targeted manner by the weak memory order repair, the weak memory order repair efficiency is improved, and the requirement on the professional ability of the user is low.
In another possible implementation manner, the code to be repaired in the program may be determined according to the range information, and weak memory order repair may be performed on the code to be repaired based on an optimization policy, where the optimization policy is used to indicate that a memory barrier instruction is inserted into the code to be repaired, and the memory barrier instruction is located before a non-weak memory order security instruction.
Alternatively, if the range information includes only a file list, the code to be repaired may be a code in all program files in the file list. For example, if the program uploaded by the user is 100 program files, and the file list in the range information determined by the range determining unit includes file names and file paths of the first 20 program files, the repairing unit may perform weak memory repair on the 20 program files. It is to be understood that the above description is illustrative, and that the present application is not limited to this description.
Alternatively, if the scope information includes a file list and a function, the code to be repaired may be a code segment in the file list that uses the function. For example, if the scope information includes a file list and functions, where the file list is file names and file paths of the first 20 program files, and the functions are F1 and F2, the repair unit may perform weak memory repair on code segments of the 20 program files that include the functions F1 and F2. It is to be understood that the above description is illustrative, and that the present application is not limited to this description.
Optionally, if the range information includes a file list and class information, the code to be repaired may be a code in a sequential file belonging to the file class in the file list. For example, if the scope information includes a file list and class information, where the file list is file names and file paths of the first 20 program files, and the class information is the first class and the second class, the repair unit may perform weak memory order repair on the program files belonging to the first class and the second class of the 20 program files. It is to be understood that the above description is illustrative, and that the present application is not limited to this description.
Optionally, if the range information includes a file list and library information, the code to be repaired may be a code in a program file of a program function library corresponding to the library information in the file list. For example, if the scope information includes a file list and library information, where the file list is file names and file paths of the first 20 program files, and the library information is a so library, the repair unit may perform weak memory repair on the program file using the so library in the 20 program files. It is to be understood that the foregoing is illustrative and that this application is not intended to be limiting.
Alternatively, if the scope information includes a file list and software module information, the repair code may be a code in a program file related to the file module in the file list. For example, if the range information includes a file list and software module information, where the file list is file names and file paths of the first 20 program files, and the software module information is software module 1, the repair unit may perform weak memory repair on the program file belonging to software module 1 in the 20 program files. It is to be understood that the foregoing is illustrative and that this application is not intended to be limiting.
By implementing the implementation mode, the weak memory order can be repaired according to the range information, and the codes uploaded by the user can be repaired in a targeted manner, so that the insertion of unnecessary memory barrier instructions can be reduced, and the running performance of the repaired multithread program is improved.
In another possible implementation manner, a read-write instruction set may be determined in the code to be repaired, instructions in the read-write instruction set are classified to determine a target instruction, and a memory barrier instruction is inserted between a previous read-write instruction of the target instruction and the target instruction, where the read-write instruction set includes a read instruction and/or a write instruction in the code to be repaired, and the instruction in the read-write instruction set is used to access the memory.
A first type of instruction can be determined in the read-write instruction set, and a target instruction is determined according to the first type of instruction. The instructions in the first type of instructions are weak memory order security instructions, and the target instructions are instructions in the read-write instruction set except the first type of instructions.
The instruction in the first type of instruction may be an instruction that does not have a weak memory order problem, or may be an instruction that does not have a weak memory order problem in a preset context, which is not limited herein. Optionally, the first type of instruction may include at least one of an instruction for reading and writing an unshared variable between threads, or a read and write instruction with order-preserving semantics. Among them, the inter-thread non-shared variable is a variable dedicated within one thread (for example, the first thread), and the variable is not called by the threads except the first thread. Thus, weak memory problems are not typically generated for instructions that read and write such variables.
Alternatively, the target instruction may be determined in the target instruction set based on at least one of the following optimization strategies. The optimization strategy is used for indicating the type of the read-write instruction needing to repair the weak memory order problem. The optimization policy may be preset, or the optimization policy configured by the user may be obtained when the code to be repaired starts to be repaired, which is not limited to this.
Optionally, the optimization strategy may include a first strategy-a fourth strategy described below. It is to be understood that the first policy-the fourth policy are merely exemplary, and the present application is not limited thereto.
The first strategy is as follows: the read-write instruction belonging to the white list in the target instruction set may be determined as the target instruction, or the read-write instruction except the read-write instruction in the black list in the target instruction set may be determined as the target instruction. The white list and the black list may be black lists and white lists of functions in the code to be repaired, may be black lists and white lists of different functional modules in the code to be repaired, and are not limited to this. The blacklist of functions generally includes functions such as a security function and/or a hot spot function in the code to be repaired, where the security function may generally be a function that does not have a weak memory problem after an executable program obtained through normal compilation is run, or the security function may be a function that does not include a shared variable in the source code, and the like, which is not limited herein. Hot spot functions are typically functions that are frequently called by programs.
The second strategy is as follows: the read-write instruction with the context dependency in the target instruction set can be determined as the target instruction only as the dependent read-write instruction. Optionally, the instructions in the target instruction set may be analyzed, and the read-write instruction only serving as a dependency may be determined according to the context dependency of the read-write instruction in the target instruction set. Here, the read/write instruction that is dependent only means an instruction that is not dependent on another read/write instruction in the target instruction set. For read and write instructions that have context dependencies and depend on the execution of other instructions, weak memory order issues typically do not occur for such instructions. Therefore, repair may not typically be required for this type of instruction.
The third strategy is as follows: read and write instructions in the target instruction set, other than the read and write instructions associated with the special purpose registers, may be determined to be target instructions. Where a special purpose register generally refers to a register that is used only for a particular instruction or instance. For example, the special purpose register may be a floating point register. Here, the floating point register is a register for storing a floating point number.
The fourth strategy is as follows: the read-write instruction in the target instruction set except the read-write instruction related to the input-output parameter can be determined as the target instruction. The input and output parameters comprise parameters needing to be input when the function is called and return values of the function.
It should be noted that, when the adopted optimization policy is any combination policy of the first policy to the fourth policy, priorities of a plurality of policies in the combination policy may be preset. Thus, when the same read-write instruction produces opposite results based on two different strategies, the read-write instruction can be processed through the strategy with high priority based on the priority. Wherein the priority is used to indicate the priority level of the policy, and the policy with higher priority level is used in preference to the policy with lower optimization level.
By implementing the implementation mode, the code to be repaired is identified to determine a read-write instruction set in the code to be repaired, wherein the read-write instruction set comprises read-write instructions for access and storage. Then, the repairing device classifies the read-write instructions in the read-write instruction set based on the determined read-write instruction set so as to determine a target instruction needing to be inserted into the memory barrier. And finally, inserting a memory barrier instruction before the target instruction, thereby realizing the automatic repair of the weak memory order problem of the code to be repaired and greatly improving the efficiency of repairing the weak memory order problem of the code to be repaired.
In a second aspect, a system for detecting and repairing weak memory order is provided, the system comprising: the interface providing unit is used for providing a program input interface, and the program input interface is used for acquiring a program uploaded by a user; the program detection unit is used for carrying out weak memory sequence detection on the program and outputting a detection result, wherein the detection result comprises position information of a code needing to be repaired in the program; the range determining unit is used for outputting range information for repairing the weak memory sequence by the program according to the position information, and codes corresponding to the range information at least comprise codes needing to be repaired; and the repair unit is used for repairing the weak memory order of the code corresponding to the range information.
In the system described in the second aspect, the code detection device performs weak memory sequence detection on the program uploaded by the user to obtain the location information of the program where the code to be repaired is located, the range determination device can expand the location information to obtain the range information of repairing the weak memory sequence, and the repair device can repair the weak memory sequence of the code corresponding to the range information. In this way, because the range information of the repair device is expanded, the codes with weak memory sequences in the missed detection part of the code detection device can be repaired, and meanwhile, the repair device only detects the codes in the range information, so that the program quantity for repairing the weak memory sequences can be reduced, the insertion of unnecessary memory barrier instructions is reduced, the running performance of the repaired multithread program is improved, and when the scale of the program is large, the repair efficiency can be improved by repairing the codes corresponding to the range information.
In a possible implementation manner, the range determining unit is configured to obtain a repair granularity input by a user, and expand location information of a code to be repaired in the program according to the repair granularity input by the user to obtain the range information.
In another possible implementation manner, the range information includes a file list, the file list includes one or more of a file name, a file path, and a file itself of the program, and a program file corresponding to the file list is a program file where a code that needs to be repaired is located; and the repair unit is used for repairing the program files corresponding to the file list in the weak memory order.
In another possible implementation manner, the scope information includes a function, the function is used by the code needing to be repaired, and a repair unit is used for performing weak memory repair on the code segment using the function in the program.
In another possible implementation manner, the range information includes class information, where the class information is information of a file class to which a program file of the code that needs to be repaired belongs, and the repair unit is configured to perform weak memory repair on the program file in the program that belongs to the file class.
In another possible implementation manner, the range information includes library information, where the library information is information of a function library used by a program file in which a code that needs to be repaired is located, and the repair unit is configured to perform weak memory repair on the program file in the program that uses the function library.
In another possible implementation manner, the range information includes software module information, the software module information is information of a software module to which a program file where a code to be repaired belongs, and the repair unit is configured to perform weak memory order repair on the program file belonging to the software module in the program.
In another possible implementation manner, the repair unit is configured to determine a code to be repaired in the program according to the range information; and the repairing unit is used for repairing the weak memory order of the code to be repaired based on an optimization strategy, wherein the optimization strategy is used for indicating that a memory barrier instruction is inserted into the code to be repaired, and the memory barrier instruction is positioned before the non-weak memory order safety instruction.
In a third aspect, a chip is provided, where the chip includes an integrated circuit, and the integrated circuit is configured to implement the functions of the respective modules as implemented in the first aspect or any one of the possible implementations of the first aspect.
In a fourth aspect, a motherboard is provided, where the motherboard is provided with a processor for executing the functions of the respective modules implemented in the first aspect or any one of the possible implementations of the first aspect.
In a fifth aspect, there is provided a computing device comprising a processor and a memory, the memory storing code, the processor comprising functionality to perform the respective modules implemented in the first aspect or any one of the possible implementations of the first aspect.
In a sixth aspect, a computer-readable storage medium is provided, having stored therein instructions, which when executed on a computer, cause the computer to perform the method of the above aspects.
The present application can further combine to provide more implementations on the basis of the implementations provided by the above aspects.
Drawings
FIG. 1 is a schematic diagram of a process for compiling program source code into machine executable program code;
FIG. 2 is a schematic diagram of an architecture of a detection and repair system provided herein;
FIG. 3 is a schematic diagram of the internal structure of the inspection and repair system provided in the present application;
fig. 4 is a schematic flowchart illustrating steps of a weak memory sequence detection and repair method provided in the present application;
FIG. 5 is a diagram illustrating an exemplary format of range information in an application scenario provided by the present application;
fig. 6 is a schematic diagram illustrating a result of weak memory order repair performed on a code in an application scenario provided by the present application;
FIG. 7 is an exemplary diagram of a display interface provided by itself;
fig. 8 is a schematic structural diagram of a computing device provided in the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
First, for the sake of understanding, the following description will be made of terms and concepts related to the embodiments of the present application.
(1) Strong memory model (strong memory model)
The strong memory model describes that each instruction implies an acquire (acquire) and release (release) semantics, the acquire semantics can be used to prevent the read-acquire (read-acquire) and any read-write operations following it from being out of order, and the release semantics can be used to prevent the write-release (write-release) and any read-write operations preceding it from being out of order, i.e., the sequence of write operations performed by one core (core) on memory can be observed by the other cores of the CPU in the same order.
(2) Weak memory model (Weakly ordered memory model)
The weak memory model describes that in an independent thread, any read-write operation to the memory can exchange sequence with other read-write operations without changing the behavior of the thread.
(3) Compiler with a plurality of compiler modules
Compilers are commonly used to translate "one language" into "another language". For example, program source code developed by a developer in a high-level computer language (e.g., C language, C + + language, etc.) is translated into machine language code (e.g., binary code) that a machine can recognize and run according to requirements.
In general, a compiler may integrate assembly functions. In this way, the compiler can compile the program source code processed by the preprocessor into the assembly code. The assembly code is assembly language code. Then, the assembly code is further compiled into object code by an assembly function. The object code is a language code that can be recognized by the machine, and is a binary code, for example. In this way, the object code combines the machine language programs independently assembled in the object code via a linker (linker) to obtain a machine executable program code.
By way of example, FIG. 1 illustrates a process diagram for compiling program source code into machine-executable program code. As shown in fig. 1, a program source code is processed by a preprocessor 11 and then input to a compiler 12. The sub-compiler 121 of the compiler 12 may compile the preprocessed program source code into assembly code and output it. Next, the assembler 122 assembles and compiles the assembly code output by the sub-compiler 121 to obtain the object code. The object code is a code that can be recognized by a machine. Finally, the object code is processed by the linker 13, and then the executable program which can be run by the machine can be obtained.
(4) Multi-threaded program
An instance of a program that is running is often referred to as a process. A process may include at least one thread, which refers to a single sequential control flow in the process. Typically, multiple threads may be concurrent in a process, and may be run in parallel by multiple processing cores in a computing device to perform different tasks. Of course, there may be only one thread in one process, and this is not limited.
Therefore, a multi-threaded program is a program in which a plurality of threads are included in one process of the program during execution.
It should be understood that threads running in parallel in a multi-thread program are control flows independent of each other, but there may be a logical relationship between instructions used to access a memory (for simplicity of description, the embodiments of the present application will simply refer to "accessing a memory" as "accessing a memory") in different threads. Here, the instruction for accessing memory generally includes a read instruction and/or a write instruction.
Next, an application scenario related to the present application will be explained.
In order to make the operation units inside the processor fully utilized as much as possible, the processor may perform out-of-order execution (out-of-order optimization) on the input codes, that is, change the execution sequence of some statements in the program. In a multiprocessor system, however, a multithread program may have different instruction execution sequences on processors of different memory models, thereby causing a logical error in the operation of the multithread program.
As an example, in a multi-threaded program developed based on the non-weak memory model, a write instruction 1 for access in the first thread is used to write a value of 0 in register 1 to (store) memory. And a read instruction 2 for accessing in the second thread is used for reading (load) the value 0 from the memory to the register 2. Therefore, there is a logical sequential relationship between the write command 1 and the read command 2, that is, after the write command 1 writes the value 0 of the register 1 into the memory, the read command 2 can read the value 0 in the memory into the register.
When a first thread and a second thread of the multi-threaded program are run in parallel by two processing cores of a computer device employing a weak memory model, if a write instruction 1 is executed before a read instruction or a write instruction preceding the write instruction 1 in the first thread, this may cause the write instruction 1 to be executed later than a read instruction 2 in the second thread. When the write instruction 1 is executed later than the read instruction 2 in the second thread, the read instruction 2 in the second thread is executed, and the memory is empty, i.e. the value 0 in the register 1 has not been written into the memory. In this way, a logical error occurs in the task executed by the first thread and the second thread, which may cause program crash or inaccurate output result. This situation, known as write instruction 1 in the first thread, creates a weak memory order problem.
Generally, when a thread of a program is running, situations in which weak memory ordering may occur include: read (loadload), write (store), read and write (loadstore), and write and read (store). I.e. the execution order of the two read instructions is reversed, the execution order of the two write instructions is reversed, the execution order of the read and write instructions is reversed, and the execution order of the write and read instructions is reversed. Here, the instruction execution order is reversed, which means that the execution order of the instructions is reversed from that required by the program itself.
For the weak memory order problem, a memory barrier instruction may be inserted before the access instruction to ensure that the two access instructions can be executed according to the sequence required by the program.
For example, in program 1 developed based on the non-weak memory model, the normal execution order of instruction 1 for memory access and instruction 2 for memory access is "instruction 1 → instruction 2". When the program 1 is running in a computer device that employs a weak memory model, a weak memory problem may arise between instruction 1 and instruction 2. At this time, a memory barrier instruction may be inserted between instruction 1 and instruction 2, so that it is ensured that instruction 1 and instruction 2 may be executed in the order of "instruction 1 → instruction 2" when program 1 is run in a computer device using a weak memory model.
However, the determination of the location in the program where the memory barrier instruction needs to be inserted is generally determined empirically by the developer, and this approach is extremely inefficient when the size of the program is large.
In order to solve the problem that the efficiency of repairing a weak memory sequence is extremely low, an embodiment of the present application provides a detection and repair system, where the system includes a program detection unit, a range determination unit, and a repair unit, where the program detection unit may perform weak memory sequence detection on a program uploaded by a user to obtain location information in the program where a code to be repaired is located, the range determination unit may expand the location information to obtain range information for repairing the weak memory sequence, and the repair unit may perform weak memory sequence repair on the code corresponding to the range information. Because the range information of the repair unit is enlarged, codes with weak memory sequences in the missed detection part of the program detection unit can be repaired, and meanwhile, the repair unit only detects the codes in the range information, so that the program number of repairing the weak memory sequences can be reduced, unnecessary insertion of memory barrier instructions is reduced, and the running performance of the repaired multithread program is improved.
Fig. 2 is a schematic diagram of an architecture of a detection and repair system provided in the present application, and as shown in fig. 2, the architecture includes a detection and repair system 200 and a compiler 100, where a communication connection exists between the detection and repair system 200 and the compiler 100, and the communication connection may be a wired connection or a wireless connection, which is not limited in the present application. It should be understood that fig. 2 is only an exemplary division manner, and that more or fewer systems, apparatuses, and modules may be combined or divided among various systems, apparatuses, and modules, and the present application is not limited in particular.
The system 200 and the compiler 100 may be deployed in a physical server, such as a server where a processor of an X86 architecture is located (also referred to as an X86 server for short), a server where a processor of an ARM architecture is located (also referred to as an ARM server for short), and the like; the detection and repair system 200 and the compiler 100 may also be a Virtual Machine (VM) implemented based on a general physical server in combination with a Network Function Virtualization (NFV) technology, where the VM refers to a complete computer system that has a complete hardware system function and operates in a completely isolated environment through software simulation, such as a virtual device in cloud computing, and the application is not particularly limited; the detection and repair system 200 and the compiler 100 may also be a server cluster composed of a plurality of physical servers or virtual machines.
The system for repairing detection 200 and the compiler 100 may also be disposed in a chip (system) or other components or assemblies of the above physical server, virtual machine or server cluster, which is not limited in this application.
In a specific implementation, the detection and repair system 200 and the compiler 100 may be in the same server, or may be in different servers, for example, the detection and repair system 200 is deployed in the server 1, and the compiler 100 is deployed in the server 2, where the server may be a physical server or a virtual machine, and the application is not limited in particular. The detection and repair system 200 may also be sold to a user as a cloud service, and the user obtains the operation authority of the detection and repair system 200 through a cloud platform of a cloud service provider.
As shown in fig. 2, the detection and repair system 200 may receive a program a, detect and repair a weak memory sequence of the program a, insert a memory barrier instruction into a code of the program a having a weak memory sequence problem, generate a processed program a, and input the processed program a into the compiler 100, so as to obtain a program a ', where the program a is a program running on a strong memory model hardware platform, and the program a' is a program running on a weak memory model hardware platform. In brief, the program a has no memory barrier instruction, and the instruction is used to ensure that the two memory access instructions can be executed according to the sequence required by the program, so the program a can only run on a strong memory model hardware platform that prevents the disorder of read-write operations, and the program a 'is obtained after passing through the detection and repair system 200 and the compiler 100, so the program a' includes the memory barrier instruction and can run on a weak memory model hardware platform.
It should be understood that the compiler 100 may also be deployed in the inspection repair system 200 as part of the inspection repair system 200, which is not limited in this application.
Further, the detection and repair system 200 may be divided into a plurality of unit modules, for example, as shown in fig. 3, the detection and repair system 200 may include a program detection unit 210, a range determination unit 220, a repair unit 230, and an interface providing unit 240, where there is a communication connection between the units, specifically, a wired connection or a wireless connection, and the present application is not limited in particular. It should be understood that fig. 1 is only an exemplary division manner, and each module unit may be combined or split into more or less module units, and the present application is not limited in particular.
Each unit module in the detection and repair system 200 may be deployed in the same server, which may be a physical server or a virtual machine in the foregoing description, and may also be deployed in the same or different chips (systems) or other components or assemblies in the same server, for example, the program detection unit 210 is deployed in the CPU1, and the range determination unit 220 and the repair unit 230 are deployed in the CPU2, where the CPU1 employs a strong memory model and the CPU2 employs a weak memory model, it should be understood that the foregoing examples are used for illustration, and the present application is not limited in particular.
The interface providing unit 240 may provide the user with a program input interface for acquiring the program uploaded by the user. In a specific implementation, the program input interface may be a Graphical User Interface (GUI) or an Application Programming Interface (API), which is not limited in this application.
It should be noted that, the program provided by the user may include at least one program file, and when the number of the program files is multiple, the multiple program files may further include multiple file categories, for example, the user provides 5 program files, where 3 program files belong to category 1, and the remaining 2 program files belong to category 2; the program files can also belong to different program function libraries (such as a so library), for example, a user provides 45 program files, wherein 15 program files belong to a first so library, and the remaining 30 program files belong to a second so library; the plurality of program files may also be assigned to different software modules, for example, 150 program files provided by the user, wherein 50 program files belong to a first software module and the remaining 100 program files belong to a second software module.
The program detecting unit 210 is configured to obtain a detection result according to the query parameter and the program. The query parameter may be determined by a user, and is used to indicate a maximum interval at which reordering occurs, and specifically may include an on-chip write operation delay. The detection result may include location information of the code that needs to be repaired, such as a code line number, a column number, and a program file name.
In a specific implementation, the program detecting unit 210 may obtain the detection result according to the query parameter, an interval between a first operation in a first thread of the program and a second operation in the first thread, and an interval between a third operation in a second thread of the program and a fourth operation in the second thread. Alternatively, the first operation and the third operation may be a pair of read and write operations performed on the same variable, the second operation and the fourth operation may be a pair of read and write operations performed on the same variable, the first operation and the second operation may be operations performed on different variables, and the third operation and the fourth operation may be operations performed on different variables. Therefore, the position information of the code needing to be repaired can be obtained without testing the program by a user, and the detection efficiency of the program can be improved.
It can be understood that the program detection unit 210 may obtain the detection result according to the program provided by the user and according to the query parameter and the program for indicating the maximum interval at which the two operations of the program are reordered, so as to improve the detection efficiency of the program and have low requirements on the professional ability of the user.
Optionally, the program detecting unit 210 may display the detection result to a user through a display interface for the user to refer to, and in a specific implementation, the program detecting unit 210 may display the detection result to the user in a form of a detection report, where the detection report may include location information of codes that need to be repaired, the number of codes that need to be repaired, and the like, and the specific content of the detection report is not limited by itself.
In a specific implementation, after the user uploads the program through the program input interface, the user may wait for the program detection unit 210 to perform weak memory order detection on the program, and then see a detection report on the display interface.
The range determining unit 220 is configured to determine range information according to the detection result generated by the program detecting unit 210, and then send the range information to the repairing unit 230, where the range information is used for the repairing unit 230 to repair a weak memory sequence of a part of the program corresponding to the range information, and the range information is determined according to the location information of the code that needs to be repaired in the detection result.
In a specific implementation, the range determining unit 220 may expand the position of the code that needs to be repaired, and obtain the range information, so that the code corresponding to the expanded range information at least includes the code that needs to be repaired.
It can be understood that although the program detection unit 210 may determine the location information of the code that needs to be repaired in the program, the program detection unit 210 may have a problem of missing report, if only the code that needs to be repaired is repaired, a part of the code that has been missed report still has a weak memory order, and the code corresponding to the expanded range information is repaired, so that the location of the code that has been missed report by the program detection unit 210 may also be repaired, thereby improving the accuracy of repairing the weak memory order by the program.
In an embodiment, the range information may include a file list, where the file list may include a file name and/or a file path of the file to be repaired, and may further include other obtaining manners for the repairing unit 230 to obtain the file to be repaired, which is not specifically limited in this application. In some optional embodiments, if the repair unit 230 cannot obtain the file to be repaired according to the file list, the range information may further include the file to be repaired itself, which is not limited in this application.
In a specific implementation, the file to be repaired may be a program uploaded by a user, or may also be a program file in which a code that needs to be repaired in a detection result generated by the program detection unit 210 is located, which is not limited in this application.
Optionally, the scope information may further include a function used by the code that needs to be repaired, and the repair unit 230 may perform weak memory repair on a code segment that uses the function in each program file in the file list according to the file list and the function. In a specific implementation, the function may be a function used according to the code that needs to be repaired in the detection result, the number of the functions may be one or more, and when the number of the functions is multiple, the function may be recorded in a form of a function list.
It should be understood that although the program detection unit 210 may determine the location information of the code that needs to be repaired in the program, the program detection unit 210 may have a problem of missing report, and determine the range information as a function used by the code corresponding to the location information detected by the program detection unit 210, and if a certain read/write instruction has a problem of weak memory order under the function, then other read/write instructions under the function also have a possibility of weak memory order problem, so the repair unit 230 repairs the weak memory order of the code that all uses the function in the program, may expand the range information, and also repairs the code location that the program detection unit 210 misses report, thereby improving the accuracy of repairing the weak memory order by the program.
Optionally, the range information may include class information of the code that needs to be repaired, the class information may be a class corresponding to the program file of the code that needs to be repaired in the detection result, and the repairing unit 230 may perform weak memory repair on the program file belonging to the class in the file list according to the file list and the class information.
It should be understood that the range information is determined as a class corresponding to a program file where a code corresponding to the position information detected by the program detection unit 210 is located, so that the repair unit 230 performs weak memory repair on the program file belonging to the class in the file list, the range information may be expanded, and a code position that is missed by the program detection unit 210 is also repaired, thereby improving accuracy of performing weak memory repair on the program.
Optionally, the range information may include library information to which the code requiring repair belongs, and the library information may be related to the library of program functions used by the code requiring repair. The repair unit 230 may perform weak memory order repair on the program file of the program function library corresponding to the library information in the file list according to the file list and the library information.
It should be understood that the range information is determined as the program function library used by the program file where the code corresponding to the position information detected by the program detection unit 210 is located, so that the repair unit 230 performs weak internal memory repair on the program file using the program function library in the file list, the range information may be expanded, the code position that is missed by the program detection unit 210 is also repaired, and the accuracy of performing weak internal memory repair on the program is improved.
Optionally, the range information may include information of a software module to which the code that needs to be repaired belongs, and the software module information may be related information of the software module in which the code that needs to be repaired is located. The repair unit 230 may perform weak in-memory repair on the program file in the file list about the file module according to the file list and the software module information.
It should be understood that the range information is determined as the software module where the code corresponding to the position information detected by the program detection unit 210 is located, so that the repair unit 230 performs weak memory repair on the program file belonging to the software module in the file list, which may expand the range information, and repair the code position that is missed by the program detection unit 210, thereby improving the accuracy of weak memory repair performed by the program.
In an embodiment, the range determining unit 220 may display the range information to a user through the display interface, and the user may modify the range information, and it should be understood that the user is allowed to modify the range information, so that the method provided in the embodiment of the present application may be more flexibly applied. In a specific implementation, the range determining unit 220 may display the range information and the detection report to the user through the display interface.
It should be noted that the range information may be determined according to the repair granularity required by the user, for example, if the user needs to precisely and specifically repair a weak memory sequence of a code uploaded by the user, the range information may be determined according to a software module where the repaired code is located; if the user needs to quickly repair the weak memory sequence of the code uploaded by the user, all code segments using the function in the file can be repaired according to the function used by the code needing to be repaired, and the range information can be specifically determined according to the requirement of the user, which is not limited in the application.
In a specific implementation, several types of range information may be displayed to a user through the display interface as multiple options, and the user may determine a required repair granularity according to a service requirement, and select appropriate range information to repair a weak memory sequence, for example, if the user needs to quickly repair, the range information may be selected to include a file list and software module information.
The repair unit 230 is configured to determine a code to be repaired in the program according to the range information, and perform weak memory order repair on the code to be repaired based on an optimization policy, where the optimization policy is used to indicate that a memory barrier instruction is inserted into the code to be repaired, and the memory barrier instruction is located before a non-weak memory order security instruction.
In specific implementation, the repair unit may determine a read-write instruction set in the code to be repaired, classify instructions in the read-write instruction set to determine a target instruction, and insert a memory barrier instruction between a read-write instruction before the target instruction and the target instruction, where the read-write instruction set includes a read instruction and/or a write instruction in the code to be repaired, and the instruction in the read-write instruction set is used to access the memory.
In a specific implementation, a first type of instruction may be determined in the read-write instruction set, and a target instruction may be determined according to the first type of instruction. Wherein, the instruction in the first kind of instruction is a weak memory order security instruction, the target instruction is an instruction except the first kind of instruction in the read-write instruction set, and the first kind of instruction includes: and at least one of an instruction for reading and writing an unshared variable between threads or a read and write instruction with order-preserving semantics.
It should be understood that the repair unit 230 may determine the target instruction by classifying the instruction to be repaired. Then, a memory barrier instruction is inserted before the target instruction, so that the target instruction can be executed according to the sequence required by the program, and the problem of automatically repairing the weak memory sequence of the multi-thread program is solved.
It should be noted that, after the repair unit 230 performs weak memory order repair on the code corresponding to the range information, the repair result may be displayed through the display interface, and if a user has a need for manual detection, the repair result may be further detected through the display interface, so that accuracy of code repair is further improved.
Alternatively, if the range information received by the repair unit 230 includes only a file list, the code to be repaired may be a code in all program files in the file list.
Alternatively, if the scope information received by the repair unit 230 includes a file list and a function, the code to be repaired may be a code segment in the file list using the function.
Alternatively, if the range information received by the repair unit 230 includes a file list and class information, the code to be repaired may be a code in a sequential file belonging to the file class in the file list.
Alternatively, if the range information received by the repair unit 230 includes a file list and library information, the code to be repaired may be a code in a program file of a program function library corresponding to the library information in the file list.
Alternatively, if the scope information received by the repair unit 230 includes a file list and software module information, the repair code may be a code in a program file related to the file module in the file list.
For example, if the program uploaded by the user is 100 program files, and the file list in the range information determined by the range determining unit 220 includes file names and file paths of the first 20 program files, the repairing unit 230 may perform weak memory order repair on the 20 program files.
If the scope information includes a file list and functions, where the file list is file names and file paths of the first 20 program files, and the functions are F1 and F2, the repair unit 230 may perform weak memory repair on code segments of the 20 program files that include the functions F1 and F2.
If the scope information includes a file list and class information, where the file list is file names and file paths of the first 20 program files, and the class information is a first class and a second class, the repair unit 230 may perform weak memory order repair on the program files belonging to the first class and the second class in the 20 program files.
If the scope information includes a file list and library information, where the file list is file names and file paths of the first 20 program files, and the library information is a so library, the repair unit 230 may perform weak memory order repair on the program file using the so library in the 20 program files.
If the range information includes a file list and software module information, where the file list is file names and file paths of the first 20 program files, and the software module information is software module 1, the repair unit 230 may perform weak memory order repair on the program files belonging to the software module 1 among the 20 program files.
It is to be understood that the above description is illustrative, and that the present application is not limited to this description.
It can be understood that the range determining unit 220 sends the range information to the repairing unit 230, so that the repairing unit 230 can specifically repair the code uploaded by the user, and thus, unnecessary insertion of memory barrier instructions can be reduced, and the running performance of the repaired multithreading program is improved.
In summary, the detection and repair system provided by the application performs weak memory order detection on a program uploaded by a user through the program detection unit to obtain position information in the program where a code to be repaired is located, can expand the position information through the range determination unit to obtain range information of weak memory order repair, and can perform weak memory order repair on the code corresponding to the range information through the repair unit. Therefore, because the range information of the repair unit is enlarged, codes with weak memory sequences in the missed detection part of the program detection unit can be repaired, and meanwhile, the repair unit detects the codes in the range information, so that the program quantity of repairing the weak memory sequences can be reduced, and the insertion of unnecessary memory barrier instructions can be reduced, thereby improving the running performance of the repaired multithread program.
The following explains the method for detecting and repairing a weak memory sequence provided by the present application. As shown in fig. 4, the present application provides a method for detecting and repairing weak memory sequences, which can be applied to the system 200 shown in fig. 2 and 3, and the method can include the following steps:
s410: and providing a program input interface, wherein the program input interface is used for acquiring the program uploaded by the user. The above steps can be implemented by the program detecting unit 210 in fig. 3.
In a specific implementation, the program input interface may be a GUI or an API. The program uploaded by the user may include at least one program file, and when the number of the program files is multiple, the multiple program files may further include multiple file categories, for example, the user provides 5 program files, where 3 program files belong to category 1, and the remaining 2 program files belong to category 2; the program files can also belong to different program function libraries (such as a so library), for example, a user provides 45 program files, wherein 15 program files belong to a first so library, and the remaining 30 program files belong to a second so library; the plurality of program files may also be assigned to different software modules, for example, 150 program files provided by the user, wherein 50 program files belong to a first software module and the remaining 100 program files belong to a second software module.
S420: and carrying out weak memory order detection on the program, and outputting a detection result, wherein the detection result comprises the position information of the code needing to be repaired in the program. The above steps can be implemented by the program detecting unit 210 in fig. 3, and it should be understood that the detection result is obtained by statically analyzing the code by the program detecting unit 210, and the program provided by the user does not need to be run.
In one embodiment, the detection results may be obtained based on query parameters and procedures. Wherein the query parameter is used to indicate a maximum interval at which reordering of two operations of the program occurs. Specifically, the detection result may be obtained according to the query parameter, an interval between a first operation in a first thread of the program and a second operation in the first thread, and an interval between a third operation in a second thread of the program and a fourth operation in the second thread.
In a specific implementation, the first operation and the third operation may be a pair of read-write operations performed on the same variable, the second operation and the fourth operation may be a pair of read-write operations performed on the same variable, the first operation and the second operation may be operations performed on different variables, and the third operation and the fourth operation may be operations performed on different variables. For example, the variable may be a shared variable. One pair of operations may be: the first operation is a read operation on the first variable, and the third operation is a write operation on the first variable; alternatively, the first operation is a write operation to the first variable and the third operation is a read operation to the first variable. Similarly, the second operation is a read operation on the second variable, and the fourth operation is a write operation on the second variable; alternatively, the second operation is a write operation to the second variable, and the fourth operation is a read operation to the second variable. The first variable may include a global variable, a shared variable, and the like, and the second variable may include a global variable, a shared variable, and the like.
In an embodiment, a memory read-write mode query rule may be adopted to detect a first operation in a first thread of a program, a second operation in the first thread, a third operation in a second thread of the program, and a fourth operation in the second thread, so as to obtain a detection result.
Optionally, the memory read/write mode query rule may be determined according to the query parameter, and the memory read/write mode query rule may be used to determine whether the first thread and the second thread overlap in time.
Illustratively, the memory read-write mode query rule may include a read-read, write-write out-of-order query rule, and/or a read-write, write-read out-of-order query rule.
For example, the read-read and write-write out-of-order query rule may include one or more of the following conditions: the first operation instruction and the second operation instruction are two adjacent operation instructions in a first thread, the first operation instruction is a write operation instruction for a first variable, the second operation instruction is a write operation instruction for a second variable, the third operation instruction and the fourth operation instruction are two adjacent operation instructions in a second thread, the third operation instruction is a read operation instruction for the first variable, and the fourth operation instruction is a read operation instruction for the second variable; the first operation instruction and the third operation instruction are in a competitive relationship, and the second operation instruction and the fourth operation instruction are in a competitive relationship; the interval between the first operation instruction and the second operation instruction is smaller than the sum of a value corresponding to the on-chip write operation delay and a value corresponding to the cross-NUMA write operation delay; and the spacing between the third operational instruction and the fourth operational instruction is less than a value corresponding to a read-across-NUMA delay. Therefore, the detection result comprising at least two threads can be obtained by adopting the reading, reading and writing out-of-order query rule.
Illustratively, the read-write, write-read out-of-order query rules may include one or more of the following conditions: the fifth operation instruction and the sixth operation instruction are two adjacent operation instructions in the first thread, the fifth operation instruction is a write operation instruction for the third variable, the sixth operation instruction is a read operation instruction for the fourth variable, the seventh operation instruction and the eighth operation instruction are two adjacent operation instructions in the second thread, the seventh operation instruction is a read operation instruction for the third variable, and the eighth operation instruction is a write operation instruction for the fourth variable; the fifth operation instruction and the seventh operation instruction are in a competitive relationship, and the sixth operation instruction and the eighth operation instruction are in a competitive relationship; the interval between the fifth operation instruction and the sixth operation instruction is smaller than the sum of the value corresponding to the on-chip write operation delay, the value corresponding to the NUMA-crossing write operation delay and the value corresponding to the NUMA-crossing read operation delay, and the interval between the third operation instruction and the eighth operation instruction is smaller than the sum of the value corresponding to the on-chip write operation delay, the value corresponding to the NUMA-crossing write operation delay and the value corresponding to the NUMA-crossing read operation delay. Therefore, the detection results of at least two threads can be obtained by adopting the read-write and read-write out-of-order query rule, and one thread comprises the read-write operation and the other thread comprises the program of the read-write operation. Specifically, the competing relationship may be that the execution order of the two operation instructions may affect the execution result. The third variable may include a global variable, a shared variable, etc., and the fourth variable may include a global variable, a shared variable, etc.
Program statements that satisfy the above-described memory read-write pattern query rules may be determined as dangerous statements that result in errors due to out-of-order instructions in a weak memory environment. Therefore, if the program meets the memory read-write mode query rule, the detection result is an error, and if the problem of weak memory order is easily generated; if the memory read-write mode query rule is not satisfied, the detection result is correct, if the detection result is correct, the user does not need to repeatedly test the program, and the detection result can be quickly obtained.
Optionally, the detection result may be displayed to a user through a display interface, and may be specifically provided to the user in the form of a detection report, where the detection report at least includes location information of the code to be modified, for example, a font color of the code to be modified is converted into a color different from a font color of other codes in the program, and the color is displayed to the user through the display interface, or a row and column information of the code to be modified and a name, a path, and the like of a program file where the code is located are recorded in the detection report, which is not specifically limited in this application.
S430: and outputting range information for the weak memory order repair of the program according to the position information, wherein codes corresponding to the range information at least comprise the codes needing repair. This step may be implemented by the range determination unit 220 in the embodiment of fig. 3.
In a specific implementation, the position of the code that needs to be repaired may be expanded to obtain the range information, so that the code corresponding to the expanded range information at least includes the code that needs to be repaired. It can be understood that although the step S420 determines the location information of the code that needs to be repaired, a problem of missed detection may occur, if only the code that needs to be repaired is repaired, a problem that a part of the code that is missed to be reported still has a weak memory order, and when the code corresponding to the expanded range information is repaired, the location of the code that is missed to be reported may also be repaired, so as to improve the accuracy of repairing the weak memory order by the program.
In an embodiment, the range information may include a file list, where the file list may include a file name and/or a file path of the file to be repaired, and may further include other obtaining manners for the repairing unit 230 to obtain the file to be repaired, which is not specifically limited in this application. In some optional embodiments, if the repair unit 230 cannot obtain the file to be repaired according to the file list, the range information may further include the file to be repaired itself, which is not limited in this application.
In a specific implementation, the file to be repaired may be a program uploaded by a user, or may also be a program file in which a code that needs to be repaired in a detection result generated by the program detection unit 210 is located, which is not limited in this application.
Optionally, the scope information may also include a function used by the code that needs to be repaired. The repair unit 230 may perform weak memory order repair on a code segment using a function in each program file in the file list according to the file list and the function. In a specific implementation, the function may be a function used according to the code that needs to be repaired in the detection result, the number of the functions may be one or more, and when the number of the functions is multiple, the function may be recorded in a form of a function list. It should be understood that if a certain read-write instruction under the function has a problem of weak memory order, then other read-write instructions under the function also have a possibility of having a problem of weak memory order, so that the range information is determined as a function used by a code corresponding to the position information, the range information can be expanded, the code position that is missed by the program detection unit 210 is also repaired, and the accuracy of repairing the weak memory order by the program is improved.
Optionally, the range information may include class information where the code that needs to be repaired is located, the class information may be a class corresponding to the program file where the code that needs to be repaired is located in the detection result, and the repairing unit 230 may perform weak memory order repair on the program file belonging to the class in the file list according to the file list and the class information.
It should be understood that, if a read-write instruction in a program file in a certain file class has a problem of weak memory order, then the read-write instruction in another program file in the file class also has a possibility of weak memory order, so that the range information is determined as a class corresponding to the program file in which the code corresponding to the position information detected by the program detection unit 210 is located, so that the repair unit 230 performs weak memory order repair on the program file belonging to the class in the file list, the range information may be expanded, the code position that is missed by the program detection unit 210 is also repaired, and the accuracy of performing weak memory order repair on the program is improved.
Optionally, the range information may include library information to which the code requiring repair belongs, and the library information may be related to the library of program functions used by the code requiring repair. The repair unit 230 may perform weak memory repair on the program file of the program function library corresponding to the library information in the file list according to the file list and the library information.
It should be understood that the range information is determined as the program function library used by the program file where the code corresponding to the position information detected by the program detection unit 210 is located, so that the repair unit 230 performs weak internal memory repair on the program file using the program function library in the file list, the range information may be expanded, the code position that is missed by the program detection unit 210 is also repaired, and the accuracy of performing weak internal memory repair on the program is improved.
Optionally, the range information may include information of a software module to which the code requiring repair belongs, and the software module information may be related to the software module to which the code requiring repair belongs. The repair unit 230 may perform weak memory order repair on the program file in the file list about the file module according to the file list and the software module information.
In an embodiment, the range information may be displayed to a user through the display interface, and the user may modify the range information, which should be understood that the user is allowed to modify the range information, so that the method provided in the embodiment of the present application may be applied more flexibly.
It should be noted that the repair granularity input by the user may be obtained, the location information of the code to be repaired in the program is expanded according to the repair granularity, and the range information is obtained, for example, if the user needs to accurately and specifically repair the weak memory sequence of the code uploaded by the user, the range information may be determined according to the software module where the repaired code is located; if the user needs to quickly repair the weak memory sequence of the code uploaded by the user, all code segments using the function in the file can be repaired according to the function used by the code needing to be repaired, the range information can be specifically determined according to the requirement of the user, and the method is not limited by the application.
In a specific implementation, several types of range information may be displayed to a user as a plurality of options through the display interface, and the user may determine a required repair granularity according to a service requirement, and select appropriate range information to perform repair of a weak memory sequence, for example, if the user needs to perform quick repair, the range information may be selected to include a file list and software module information.
Taking the example that the scope information includes a list of files and a function, the format of the scope information may be as shown in fig. 5. Fig. 5 is a diagram illustrating a format of range information in an application scenario provided in the present application.
Here, "/path/to/file1" and "/path/to/file2" represent a file list including file names and paths of the program file1 and the program file 2. "int func1 (int)" and "char func2 (int, char)" represent function lists including functions func1 and func2. According to the range information, all code segments in the program files file1 and file2 using the function func1 and function func2 can be repaired by weak memory order. It should be understood that fig. 5 is for illustration purposes and the format of the range information is not specifically limited in this application.
It should be understood that the range information is determined as the software module where the code corresponding to the position information detected by the program detection unit 210 is located, so that the repair unit 230 performs weak memory repair on the program file belonging to the software module in the file list, the range information may be expanded, and the code position that is missed by the program detection unit 210 is also repaired, thereby improving the accuracy of performing weak memory repair on the program.
S440: and carrying out weak memory order repair on the codes corresponding to the range information. This step may be implemented by the repair unit 230 in fig. 2.
Specifically, the code to be repaired may be determined according to the range information, and weak memory order repair may be performed on the code to be repaired based on an optimization policy, where the optimization policy is used to indicate that a memory barrier instruction is inserted into the code to be repaired, and the memory barrier instruction is located before a non-weak memory order security instruction.
In a specific implementation, a read-write instruction set may be determined in a code to be repaired, instructions in the read-write instruction set may be classified to determine a target instruction, and a memory barrier instruction is inserted between a previous read-write instruction of the target instruction and the target instruction, where the read-write instruction set includes a read instruction and/or a write instruction in the code to be repaired, and the instruction in the read-write instruction set is used to access a memory.
Alternatively, if the range information includes only a file list, the code to be repaired may be a code in all program files in the file list. For example, if the program uploaded by the user is 100 program files, and the file list in the scope information determined by the scope determining unit 220 includes file names and file paths of the first 20 program files, the repairing unit 230 may perform weak memory repair on the 20 program files. It is to be understood that the foregoing is illustrative and that this application is not intended to be limiting.
Alternatively, if the scope information includes a file list and a function, the code to be repaired may be a code segment in the file list that uses the function. For example, if the scope information includes a file list and functions, where the file list is file names and file paths of the first 20 program files, and the functions are F1 and F2, the repair unit 230 may perform weak memory repair on code segments of the 20 program files that include the function F1 and the function F2. It is to be understood that the foregoing is illustrative and that this application is not intended to be limiting.
Optionally, if the range information includes a file list and class information, the code to be repaired may be a code in a sequential file belonging to the file class in the file list. For example, if the scope information includes a file list and class information, where the file list is file names and file paths of the first 20 program files, and the class information is the first class and the second class, the repair unit 230 may perform weak memory order repair on the program files belonging to the first class and the second class in the 20 program files. It is to be understood that the foregoing is illustrative and that this application is not intended to be limiting.
Optionally, if the range information includes a file list and library information, the code to be repaired may be a code in a program file of a program function library corresponding to the library information in the file list. For example, if the scope information includes a file list and library information, where the file list is file names and file paths of the first 20 program files, and the library information is a so library, the repair unit 230 may perform weak memory repair on the program file using the so library in the 20 program files. It is to be understood that the above description is illustrative, and that the present application is not limited to this description.
Alternatively, if the scope information includes a file list and software module information, the repair code may be code in a program file related to the file module in the file list. For example, if the scope information includes a file list and software module information, where the file list is file names and file paths of the first 20 program files, and the software module information is software module 1, the repair unit 230 may perform weak memory repair on the program file belonging to the software module 1 in the 20 program files. It is to be understood that the foregoing is illustrative and that this application is not intended to be limiting.
In a possible implementation manner, a first type of instruction may be determined in the read-write instruction set, and a target instruction may be determined according to the first type of instruction. The instructions in the first type of instructions are weak memory order security instructions, and the target instructions are instructions in the read-write instruction set except the first type of instructions.
The instruction in the first type of instruction may be an instruction that does not cause a weak memory order problem, or may be an instruction that does not cause a weak memory order problem in a preset context, which is not limited herein. Optionally, the first type of instruction may include at least one of an instruction for reading and writing an unshared variable between threads, or a read and write instruction with order-preserving semantics. Among them, the inter-thread non-shared variable is a variable dedicated within one thread (for example, the first thread), and the variable is not called by the threads except the first thread. Thus, weak memory problems are generally not created for instructions that read and write such variables.
In another possible implementation, the target instruction may be determined in the target instruction set based on at least one of the following optimization strategies. The optimization strategy is used for indicating the read-write instruction type needing to repair the weak memory order problem. The repairing unit 230 may preset the optimization policy, or may obtain the optimization policy configured by the user when the code to be repaired starts to be repaired, which is not limited to this.
Optionally, the optimization strategy may include a first strategy-a fourth strategy described below. It is understood that the first policy-the fourth policy are only exemplary, and the embodiments of the present application are not limited thereto.
The first strategy is as follows: the repair unit may determine the read-write instruction belonging to the white list in the target instruction set as the target instruction, or the repair unit may determine the read-write instruction except the read-write instruction in the black list in the target instruction set as the target instruction. The white list and the black list may be a black list and a white list of functions in the code to be repaired, or may be a black list and a white list of different functional modules in the code to be repaired, which is not limited herein. The blacklist of functions generally includes functions such as a security function and/or a hot spot function in the code to be repaired, where the security function may generally be a function that does not have a weak memory problem after an executable program obtained through normal compilation is run, or the security function may be a function that does not include a shared variable in the source code, and the like, which is not limited herein. Hot spot functions are usually functions that are frequently called by programs.
The second strategy is as follows: the repair unit may determine, as the target instruction, only the read-write instruction that is dependent from the read-write instructions that have the context dependency in the target instruction set.
Optionally, the repair unit may analyze the instructions in the target instruction set, and determine the read-write instruction only as a dependency according to the context dependency of the read-write instruction in the target instruction set. Here, the read/write instruction that is merely dependent means an instruction that is independent of other read/write instructions in the target instruction set.
For read and write instructions that have context dependencies and depend on execution of other instructions, weak memory ordering problems typically do not occur for such instructions. Thus, the repair unit may not generally repair such instructions.
The third strategy is as follows: the repair unit may determine a read-write instruction other than the read-write instruction related to the special register in the target instruction set as the target instruction. Where a special purpose register is typically a register used only for a particular instruction or occasion. For example, the special purpose register may be a floating point register. Here, the floating point register is a register for storing a floating point number.
The fourth strategy is as follows: the repair unit may determine, as the target instruction, a read-write instruction other than the read-write instruction related to the input-output parameter in the target instruction set. The input and output parameters comprise parameters needing to be input when the function is called and return values of the function.
It should be noted that, when the optimization policy adopted by the repair unit is any combination policy of the first policy to the fourth policy, the repair unit may preset priorities of multiple policies in the combination policy. Thus, when the same read-write instruction generates opposite results based on two different strategies, the repair unit can process the read-write instruction through the strategy with high priority based on the priority. Wherein the priority is used to indicate the priority level of the policy, and the policy with high priority level is used in preference to the policy with low optimization level.
Still taking the range information shown in fig. 5 as an example, assuming that the range information received by the repair unit 230 is the file list and the function shown in fig. 5, the file list includes file1 and file2, and the function list includes func1 and func2, after the step S440 is executed, the repair unit 230 performs weak memory order repair on the code corresponding to the range information, inserts a memory barrier instruction, and the repair result may be as shown in fig. 6 and fig. 7. Fig. 6 and fig. 7 are code segments after weak memory repair is performed in an application scenario provided by the present application.
The code segment shown in fig. 6 uses functions func1 and func2, so that the repair unit 230 performs weak memory repair on the functions func1 and func2, and inserts a memory barrier instruction (i.e., the instruction dmb selected by the white solid line box in fig. 6) between the read-write instruction before the target instruction and the target instruction.
The code fragment shown in fig. 7 uses function func3, which is disposed in the scope information shown in fig. 5, so that the repair unit 230 does not perform weak memory repair on the code fragment, and no memory barrier instruction is inserted in fig. 7.
It can be understood that the range determining unit 220 sends the range information to the repairing unit 230, so that the repairing unit 230 can specifically repair the code uploaded by the user, and thus, unnecessary insertion of memory barrier instructions can be reduced, and the running performance of the repaired multithread program is improved.
In summary, according to the weak memory sequence detection and repair method provided by the application, the position information of the program where the code to be repaired is located is obtained by performing weak memory sequence detection on the program uploaded by the user, then the position information is expanded to obtain the range information of weak memory sequence repair, and finally the code corresponding to the range information is subjected to weak memory sequence repair. It can be understood that, by repairing the weak memory order of the code corresponding to the range information obtained after the position information is expanded, the code with the weak memory order of the missed part in the detection process of the weak memory order can be repaired, and meanwhile, by detecting the code in the range information, the number of the repaired programs of the weak memory order can be reduced, the insertion of unnecessary memory barrier instructions can be reduced, and thus the running performance of the repaired multithread program can be improved.
Fig. 8 is a schematic structural diagram of a computing device provided in the present application, and the computing device 800 may be the detection and repair system 200 in the embodiments of fig. 1 to 7.
The computing device 800 may specifically be a physical server, a virtual machine, or a server cluster; or may be a chip (system) or other component or assembly that may reside on a physical server or virtual machine; the mobile terminal can also be a smart phone, a handheld processing device, a tablet computer, a mobile notebook, an Augmented Reality (AR) device, a Virtual Reality (VR) device, an integrated palm computer and the like; it may also be a wearable device, which may be a portable device worn directly on the body, or integrated into the clothing or accessories of the user; and the system can also be vehicle-mounted equipment, intelligent conference equipment, intelligent advertising equipment, intelligent household appliances and the like. The intelligent household appliance may be a household appliance with a sound effect device, such as a smart television, or may be a household appliance without a sound effect device, such as a smart projector, a smart display screen, or the like, which is not limited herein.
Further, the computing device 800 comprises a processor 801, a storage unit 802, a storage medium 803, and a communication interface 804, wherein the processor 801, the storage unit 802, the storage medium 803, and the communication interface 804 communicate via a bus 805, and can also communicate via other means such as wireless transmission.
The processor 801 may be constituted by at least one general-purpose processor, such as a CPU, NPU, or a combination of a CPU and a hardware chip. The hardware chip may be an Application-Specific Integrated Circuit (ASIC), a Programmable Logic Device (PLD), or a combination thereof. The PLD may be a Complex Programmable Logic Device (CPLD), a Field-Programmable Gate Array (FPGA), general Array Logic (GAL), or any combination thereof. The processor 801 executes various types of digital storage instructions, such as software or firmware programs stored in the memory unit 802, which enable the computing device 800 to provide a wide variety of services.
In particular implementations, processor 801 may include one or more CPUs, such as CPU0 and CPU1 shown in fig. 8, as one embodiment.
In particular implementations, computing device 800 may also include multiple processors, such as processor 801 and processor 806 shown in FIG. 8, for one embodiment. Each of these processors may be a single-Core Processor (CPU) or a multi-Core Processor (CPU). A processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (e.g., computer program instructions).
The memory unit 802 is used for storing program codes and is controlled to be executed by the processor 801 to execute the processing steps of the workflow system in any one of the embodiments of fig. 1-7. One or more software modules may be included in the program code. The one or more software modules may be software modules provided in the embodiment shown in fig. 3, such as an interface providing unit, a program detecting unit, a range determining unit, and a repairing unit, where the interface providing unit is configured to provide a program input interface, the program detecting unit is configured to perform weak memory order detection on a program and output a detection result, the range determining unit is configured to output range information for performing weak memory order repair on the program according to the location information, and the repairing unit is configured to perform weak memory order repair on a code corresponding to the range information. Specifically, the steps S410 to S440 in the embodiment of fig. 4 and optional steps thereof may be executed, and are not described herein again.
The memory unit 802 may include a read-only memory and a random access memory, and provides instructions and data to the processor 801. The memory unit 802 may also include a nonvolatile random access memory. For example, the storage unit 802 may also store information of device types.
The memory unit 802 can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. The non-volatile memory may be a read-only memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash memory. Volatile memory can be Random Access Memory (RAM), which acts as external cache memory. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (static RAM, SRAM), dynamic Random Access Memory (DRAM), synchronous Dynamic Random Access Memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), and direct bus RAM (DR RAM).
The storage medium 803 is a carrier for storing data, such as a hard disk (hard disk), a USB (universal serial bus), a flash memory (flash), a SD Card (secure digital memory Card), a memory stick, etc., where the hard disk may be a Hard Disk Drive (HDD), a Solid State Disk (SSD), a mechanical hard disk (HDD), etc., and the present application is not limited in particular.
In an implementation, the communication interface 804 may be a wired interface (e.g., an ethernet interface), an internal interface (e.g., a Peripheral Component Interconnect express (PCIe) bus interface), a wired interface (e.g., an ethernet interface), or a wireless interface (e.g., a cellular network interface or a wireless lan interface), and is used for communicating with other servers or modules, and in particular, the communication interface 804 may be used to receive a message for the processor 801 to process the message.
The bus 805 may be a Peripheral Component Interconnect Express (PCIe) bus, an Extended Industry Standard Architecture (EISA) bus, a unified bus (UBs or UBs), a computer Express link (CXL), a cache coherent Interconnect protocol (CCIX) or the like. The bus 805 may be divided into an address bus, a data bus, a control bus, and the like.
The bus 805 may include a power bus, a control bus, a status signal bus, and the like, in addition to a data bus. But for clarity of illustration the various busses are labeled as bus 805 in the drawings.
It should be noted that fig. 8 is only one possible implementation manner of the embodiment of the present application, and in practical applications, the computing device 800 may further include more or less components, which is not limited herein. For the content that is not shown or described in the embodiment of the present application, reference may be made to the related explanation in the foregoing embodiments of fig. 1 to 7, which is not described herein again.
It should be understood that the computing device 800 shown in fig. 8 may also be a computer cluster formed by at least one physical server, and specific descriptions about the detection and repair system 200 may be specifically described with reference to the embodiments in fig. 1 to fig. 7, and are not repeated here to avoid repetition.
The present embodiment provides a chip, which may be specifically used for a server where a processor of an X86 architecture is located (also referred to as an X86 server), a server where a processor of an ARM architecture is located (also referred to as an ARM server for short), and the like, where the chip may include an integrated circuit and/or a device, and when the chip runs on the server, the chip causes the server to execute the detection and repair method described in the foregoing method embodiment.
Embodiments of the present application provide a motherboard, which may be referred to as a Printed Circuit Board (PCB), and the motherboard includes a processor, where the processor is configured to execute program codes to implement the method for detecting and repairing according to the above method embodiments. Optionally, the motherboard may further include a memory for storing the program code for execution by the processor.
An embodiment of the present application provides a computer-readable storage medium, including: the computer readable storage medium having stored therein computer instructions; when the computer instructions are run on a computer, the computer is caused to execute the method for detecting repair according to the above method embodiment.
The present application provides a computer program product containing instructions, including a computer program or instructions, which when run on a computer, causes the computer to execute the detection and repair method described in the above method embodiments.
The above-described embodiments may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, the above-described embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product includes at least one computer instruction. The procedures or functions according to the embodiments of the invention are wholly or partly generated when the computer program instructions are loaded or executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage node, such as a server, a data center, etc., that contains at least one collection of available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital Video Disk (DVD), or a semiconductor medium.
While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and those skilled in the art can easily conceive of various equivalent repairs or substitutions within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (19)

1. A method for detecting and repairing weak memory order is characterized in that the method comprises the following steps:
providing a program input interface, wherein the program input interface is used for acquiring a program uploaded by a user;
performing weak memory order detection on the program, and outputting a detection result, wherein the detection result comprises position information of a code needing to be repaired in the program;
outputting range information of weak memory sequence repair of the program according to the position information, wherein codes corresponding to the range information at least comprise the codes needing repair;
and repairing the codes corresponding to the range information by using the weak memory order.
2. The method of claim 1, wherein the outputting the range information for the program to repair weak memory sequences according to the location information comprises:
and acquiring the repair granularity input by the user, and expanding the position information of the code needing to be repaired in the program according to the repair granularity input by the user to acquire the range information.
3. The method according to claim 1 or 2, wherein the scope information includes a file list, the file list includes one or more of a file name, a file path, and a file itself of the program, the program file corresponding to the file list is a program file where the code that needs to be repaired is located, and performing weak memory order repair on the code corresponding to the scope information includes:
and repairing the program files corresponding to the file list by using the weak memory order.
4. The method according to any one of claims 1 to 3, wherein the range information includes a function, the function is a function used by the code requiring repair, and performing weak memory order repair on the code corresponding to the range information includes:
and repairing the weak memory order of the code sections using the function in the program.
5. The method according to any one of claims 1 to 3, wherein the range information includes class information, the class information is information of a file class to which a program file where the code that needs to be repaired belongs, and performing weak memory order repair on the code corresponding to the range information includes:
and carrying out weak memory order repair on the program files belonging to the file class in the program.
6. The method according to any one of claims 1 to 3, wherein the range information includes library information, the library information is information of a function library used by a program file where a code that needs to be repaired is located, and performing weak memory order repair on the code corresponding to the range information includes:
and repairing the weak memory order of the program file using the function library in the program.
7. The method according to any one of claims 1 to 3, wherein the scope information includes software module information, the software module information is information of a software module to which a program file where the code that needs to be repaired belongs, and performing weak memory repair on the code corresponding to the scope information includes:
and repairing the weak memory sequence of the program files belonging to the software module in the program.
8. The method according to any one of claims 1 to 7, wherein the performing weak memory repair on the code corresponding to the range information comprises:
determining a code to be repaired in the program according to the range information;
and performing weak memory order repair on the code to be repaired based on an optimization strategy, wherein the optimization strategy is used for indicating that a memory barrier instruction is inserted into the code to be repaired, and the memory barrier instruction is positioned before a non-weak memory order safety instruction.
9. A weak memory order detection and repair system, the system comprising:
the interface providing unit is used for providing a program input interface, and the program input interface is used for acquiring a program uploaded by a user;
the program detection unit is used for carrying out weak memory order detection on the program and outputting a detection result, wherein the detection result comprises position information of a code needing to be repaired in the program;
a range determining unit, configured to output range information for performing weak memory order repair on the program according to the location information, where a code corresponding to the range information at least includes the code to be repaired;
and the repair unit is used for repairing the weak memory order of the codes corresponding to the range information.
10. The system according to claim 9, wherein the range determining unit is configured to obtain a repair granularity input by a user, and expand the location information of the code needing to be repaired in the program according to the repair granularity input by the user to obtain the range information.
11. The system according to claim 9 or 10, wherein the scope information includes a file list, the file list includes one or more of a file name, a file path, and a file itself of the program, and the program file corresponding to the file list is a program file in which the code to be repaired is located;
and the repair unit is used for repairing the program files corresponding to the file list in a weak memory order.
12. The system according to any one of claims 9 to 11, wherein said scope information includes a function, said function being used by said code requiring repair, and said repair unit is configured to perform weak memory repair on a code section of said program using said function.
13. The system according to any one of claims 9 to 11, wherein the scope information includes class information, the class information is information of a file class to which a program file of the code that needs to be repaired belongs, and the repair unit is configured to perform weak memory access repair on the program file in the program that belongs to the file class.
14. The system according to any one of claims 9 to 11, wherein the range information includes library information, the library information is information of a function library used by a program file in which the code to be repaired is located, and the repair unit is configured to perform weak memory repair on the program file in the program using the function library.
15. The system according to any one of claims 9 to 11, wherein the scope information includes software module information, the software module information is information of a software module to which a program file of the code that needs to be repaired belongs, and the repair unit is configured to perform weak memory repair on the program file in the program that belongs to the software module.
16. The system according to any one of claims 9 to 15, wherein the repair unit is configured to determine a code to be repaired in the program according to the scope information;
the repairing unit is configured to perform weak memory order repairing on the code to be repaired based on an optimization policy, where the optimization policy is used to indicate that a memory barrier instruction is inserted into the code to be repaired, and the memory barrier instruction is located before a non-weak memory order security instruction.
17. A chip comprising an integrated circuit for implementing the functions of the operational steps of the method according to any one of claims 1 to 8.
18. A motherboard provided with a processor for implementing the functionality of the method as claimed in any one of claims 1 to 8.
19. A computing device comprising a processor and a memory, the memory storing computer-executable instructions, the processor executing the computer-executable instructions to perform functions of the operational steps of the method of any of claims 1 to 8.
CN202111160173.6A 2021-09-30 2021-09-30 Method, system and related equipment for detecting and repairing weak memory sequence Pending CN115904768A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111160173.6A CN115904768A (en) 2021-09-30 2021-09-30 Method, system and related equipment for detecting and repairing weak memory sequence

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111160173.6A CN115904768A (en) 2021-09-30 2021-09-30 Method, system and related equipment for detecting and repairing weak memory sequence

Publications (1)

Publication Number Publication Date
CN115904768A true CN115904768A (en) 2023-04-04

Family

ID=86488492

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111160173.6A Pending CN115904768A (en) 2021-09-30 2021-09-30 Method, system and related equipment for detecting and repairing weak memory sequence

Country Status (1)

Country Link
CN (1) CN115904768A (en)

Similar Documents

Publication Publication Date Title
EP3785127B1 (en) Selectively tracing portions of computer process execution
US10152309B2 (en) Cross-library framework architecture feature sets
CN100555218C (en) Be used to improve the apparatus and method of the simulation velocity of the middle-and-high-ranking language of analogue system on the sheet
US8544006B2 (en) Resolving conflicts by restarting execution of failed discretely executable subcomponent using register and memory values generated by main component after the occurrence of a conflict
US8312455B2 (en) Optimizing execution of single-threaded programs on a multiprocessor managed by compilation
US7779393B1 (en) System and method for efficient verification of memory consistency model compliance
US10241894B2 (en) Data-scoped dynamic data race detection
US10740219B2 (en) Selectively tracing portions of computer process execution
US7480768B2 (en) Apparatus, systems and methods to reduce access to shared data storage
EP4231138A1 (en) Method and apparatus for fixing weak memory ordering problem
US12093398B2 (en) Vulnerability analysis and reporting for embedded systems
US20140215483A1 (en) Resource-usage totalizing method, and resource-usage totalizing device
CN111666210A (en) Chip verification method and device
US20210004470A1 (en) Automatic Generation Of Patches For Security Violations
US10839124B1 (en) Interactive compilation of software to a hardware language to satisfy formal verification constraints
US10528691B1 (en) Method and system for automated selection of a subset of plurality of validation tests
US9817763B2 (en) Method of establishing pre-fetch control information from an executable code and an associated NVM controller, a device, a processor system and computer program products
CN109885489A (en) Data contention detection method and device in driver
US20200272553A1 (en) Configurable system for interaction with system or processor states in development tools
CN115904768A (en) Method, system and related equipment for detecting and repairing weak memory sequence
US10540254B2 (en) Technologies for analyzing persistent memory programs
US20070028218A1 (en) Apparatus, system, and method for a software test coverage analyzer using embedded hardware
CN118689481A (en) Code processing method and device
Shastri et al. HMTRace: Hardware-Assisted Memory-Tagging based Dynamic Data Race Detection
CN118152298A (en) Memory access detection method and device, electronic equipment and computer storage medium

Legal Events

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