An incremental regression verification method for parallel programs based on refined constraint reuse

By adopting an abstract refinement method based on scheduling constraints in parallel program verification, reusing and adapting refined constraints solves the problem of low parallel program verification efficiency, realizes incremental regression verification of parallel programs, and improves verification efficiency. and reduce overhead.

CN115033479BActive Publication Date: 2024-09-24NAT UNIV OF DEFENSE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210682116.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-16
Publication Date
2024-09-24
Estimated Expiration
2042-06-16

AI Technical Summary

Technical Problem

The verification efficiency of parallel programs is low, and it is difficult for existing technology to effectively perform incremental regression verification, resulting in the need to verify the entire program from scratch after each code modification, resulting in a large amount of verification overhead.

Method used

A parallel program verification method based on abstract refinement of scheduling constraints is adopted. Through refined constraint reuse and adaptation, the refined constraints in previous program version verification are reused, reducing redundant analysis and improving verification efficiency.

Benefits of technology

It effectively improves the regression verification efficiency of parallel programs in a code evolution environment, reduces verification overhead, and supports any type of code modification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115033479B
    Figure CN115033479B
Patent Text Reader

Abstract

The present invention discloses a parallel program incremental regression verification method based on refined constraint reuse, which includes: i When performing parallel program verification based on abstract refinement of refinement constraints, each iteration in the verification process is performed for the current program version M i The loop in the event sequence diagram of the corresponding program abstraction generates key sources and records them in the key source library, the key source validity is determined for the key source library, and refined constraints are generated for each valid key source through refined constraint adaptation to participate in the iteration of the next round of verification process. The present invention implements incremental regression verification technology based on the existing parallel program verification method based on scheduling constraint abstraction refinement. By accurately calculating the impact of code modifications on refined constraints and adapting refined constraints, it can realize the reuse of refined constraints in the previous program version verification, thereby effectively improving the regression verification efficiency of parallel programs in the code evolution environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a formal analysis and verification technology of parallel programs in the field of software engineering, and in particular to an incremental regression verification method of parallel programs based on refined constraint reuse. Background Art

[0002] In recent years, multi-core processors have developed rapidly, and parallel and distributed computing has played an increasingly important and irreplaceable role in computer technology. However, while achieving high performance and high efficiency, the correctness guarantee of parallel programs has become an important bottleneck restricting the development of parallel programs. Automatic program verification is an important method to ensure the correctness of concurrent programs. However, due to the uncertainty of thread interactions, concurrent program verification is usually time-consuming. Although researchers have conducted a lot of research on the control state explosion problem of parallel programs and proposed some effective algorithms, including partial order reduction, combinatorial verification, bounded model checking and abstract refinement, it usually takes several hours or more to verify actual concurrent programs.

[0003] What's worse is that programs are constantly evolving throughout their lifecycle. Every time a program is modified, new errors may be introduced. Therefore, regression verification of the modified program is required after each program modification. However, due to the high overhead of parallel program verification, it is impractical to verify the program from scratch every time a small modification is made. Given that most of the code of the modified program may be the same as its previous version, it is a trend in program verification to speed up the verification of the modified version based on the intermediate results of the previous verification. This is the idea of ​​incremental regression verification.

[0004] There are currently two main ways to perform incremental regression verification of program code. One is to prove the equivalence of the program. To prove that the program is still correct after some modifications, it should be proved that the two program versions are partially equivalent, that is, their behavior is the same in some way. For this problem, one method is to simplify the equivalence verification problem of the two program versions into Horn constraints on uninterpreted predicates, which are then solved by an SMT solver; another method is to first determine the parts of the program affected by the change, and then check the equivalence of the affected program behavior. Another way to perform incremental regression verification of program code is to reuse the intermediate results of program verification technology. Specifically, for explicit model checking, considering that the state spaces of consecutive program versions may have certain similarities, the state space used for explicit model checking can be retained, and incremental state space exploration can be implemented in the program verification of later versions; for bounded model checking, noting the important role of intermediate results of constraint solving in software verification, the intermediate results of constraint solving can be reused between different analysis runs and even different program verifications; for combinatorial verification technology, contextual assumptions can be reused for regression-based hypothesis assurance testing to maximize the reuse of contextual assumptions; for abstract refinement technology, the final abstract precision can be recorded in the previous verification run, and then the previous abstract precision can be reused in the verification of later versions; for inter-procedural analysis technology, in order to avoid re-analyzing those unchanged procedures, the state-based process summaries generated by the inter-procedural analysis technology can be reused.

[0005] The incremental regression verification technology of the above program code is mainly aimed at serial programs. Since parallel programs involve multiple threads executing simultaneously and the execution order between statements in different threads is non-deterministic, the behavior and correctness verification of parallel programs is more complicated than that of serial programs. There are only a few studies on the incremental regression verification of parallel programs. One is to extend the concept of program equivalence to multi-threaded programs, and propose the concept of partial equivalence for multi-threaded programs, and then prove the partial equivalence of multi-threaded program behaviors through proof rules; the other is to consider that the pointer allocation graph (PAG) and the execution sequence graph (HBG) are important components of the static analysis of multi-threaded programs. After the program is modified, only the impact of the program change can be recalculated, and the pointer allocation graph (PAG) can be quickly obtained by updating and modifying the original program version. This method is mainly aimed at static analysis technology for data competition and deadlock in Java multi-threaded programs.

[0006] In summary, designing and implementing an incremental regression verification method for parallel programs is an important means to improve the efficiency of parallel program verification in a code evolution environment. However, research on incremental regression verification of parallel programs is still in its infancy. There is relatively little research on how code modifications affect the behavior of parallel programs and how to reuse the intermediate results of previous versions of parallel programs. Specific technical achievements are still rare. Currently, the mainstream verification algorithm for parallel programs can only verify one program version. Every time a small modification is made to the code, the entire program needs to be verified from scratch, which generates a lot of verification overhead. Summary of the invention

[0007] Technical problem to be solved by the present invention: A parallel program verification method based on abstract refinement of scheduling constraints is one of the mainstream methods of parallel program verification at present. The present invention provides an incremental regression verification method for parallel programs based on reuse of refined constraints. The present invention implements incremental regression verification technology based on the existing parallel program verification method based on abstract refinement of scheduling constraints. By accurately calculating the impact of code modifications on refined constraints and adapting the refined constraints, the refined constraints in the previous program version verification can be reused, thereby effectively improving the regression verification efficiency of parallel programs in a code evolution environment.

[0008] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0009] A parallel program incremental regression verification method based on refined constraint reuse, comprising:

[0010] S1, in the current program version M i When performing parallel program verification based on scheduling constraint abstract refinement after the abstract program, each iteration of the verification process is executed for the current program version M i The corresponding key source is generated for the ring in the event sequence diagram of the corresponding program abstraction and recorded in the key source library, and then jumps to the next step; wherein, the ring is composed of edges, and the key source of the ring is composed of the key sources of the edges that constitute the ring. Each edge in the ring represents a read-write order relationship in the program abstraction, or a program order relationship, or a new order relationship derived from the two;

[0011] S2, the current program version M given for the target parallel program i , determine the validity of the key sources in the key source library and determine the current program version M i Valid key sources;

[0012] S3, respectively for the current program version M i Each effective key source of M generates refined constraints through refined constraint adaptation to participate in the current program version M i The next iteration of the verification process.

[0013] Optionally, in step S1, for the current program version M i When the corresponding key source is generated for the edge in the event sequence graph of the corresponding program abstraction, the key source generation for any edge λ includes: if the edge λ is a program sequence edge or a read-write sequence edge, then the key source φ corresponding to the edge λ is the edge λ itself; if the edge λ is derived from two edges λ1 and λ2, then the key source φ corresponding to the edge λ for in The key source φ λ The occurrence sequence set of The key source φ λ A set of read and write order, and there is in and The read and write order sets of the key sources of edges λ1 and λ2 respectively. If the edge λ is derived from the two edges λ1 and λ2 based on the transfer rule and the read and write order sets of the key sources of edges λ1 and λ2 are and are all empty sets, then the key source φ λ The occurrence sequence of is the edge λ itself, otherwise the key source φ λ The occurrence sequence of for in and are the occurrence order sets of the key sources of edges λ1 and λ2 respectively, and ∪ is the union operation.

[0014] Optionally, in step S1, for the current program version M i When the corresponding key source is generated for the ring in the event sequence diagram of the corresponding program abstraction, the key source generation for any ring C includes: merging the continuous program sequence edges in the ring C to obtain a new ring C', and taking the union of the key sources of all edges of the new ring C' as the key source of the new ring C'.

[0015] Optionally, the function expression of taking the union of the key sources of all edges of the new ring C' as the key source of the new ring C' is:

[0016]

[0017] In the above formula, φ C' is the key source of the new ring C', φ λ is the key source of edge λ of the new ring C', and ∪ is the union operation.

[0018] Optionally, when determining the validity of key sources in the key source library in step S2, determining the validity of any target key source includes:

[0019] S2.1. Establish a read-write event sequence for all read-write events of each program version, and store the variable name and read-write type for each read-write event.

[0020] S2.2. Use the longest common subsequence algorithm to identify the correspondence between the read-write event sequence of the current program version M i and the read-write event sequence of the program version M j that generates the critical source, and the version j of the program version M j that generates the critical source and the version i of the current program version M i satisfy the constraint relationship j < i.

[0021] S2.3. Traverse to obtain a relationship in the target critical source as the current relationship.

[0022] S2.4. Determine whether both nodes of the current relationship are in the code of the current program version M i . If not, determine that the target critical source is an invalid critical source, end and exit; otherwise, jump to the next step.

[0023] S2.5. Determine whether both nodes of the current relationship have an occurrence order relationship and belong to different processes. The occurrence order relationship means that there is a constraint on the execution order of the two nodes. If it holds, construct an occurrence order relationship graph for the new code of the current program version M i , and further determine whether the two nodes are reachable in the occurrence order relationship graph. If reachable, jump to the next step; if not reachable, determine that the target critical source is an invalid critical source, end and exit; otherwise, jump to the next step.

[0024] S2.6. Determine whether the relationships in the target critical source have been traversed. If not, jump to step S2.3; otherwise, determine that the target critical source is a valid critical source.

[0025] Optionally, when generating refined constraints for each valid critical source of the current program version M i in step S3 respectively, for any critical source φ C , the steps of generating refined constraints include:

[0026] S3.1. According to the correspondence between the read-write event sequence of the current program version M i and the read-write event sequence of the program version M j (j < i) that generates the critical source, find the execution condition literal g C for each read-write event e in the critical source φ i in the current program version M e , and the execution order relationship τ for each read-write order relationship in the current program version M iThe corresponding connection text S in τ ;

[0027] S3.2, according to the key source φ C Each read and write event e in the current program version M i The execution condition text g in e , and the read-write order relationship τ in the current program version M i The corresponding connection text S in τ , generating the key source φ C The corresponding refined constraints.

[0028] Optionally, in step S3.2, a key source φ is generated C The corresponding refined constraint function expression is:

[0029]

[0030] In the above formula, κ represents the generated refined constraint, Indicates negation, S τ Indicates the connection text corresponding to the read-write order relationship τ, ∧ indicates the AND operation, Represents the key source φ C A collection of read and write events, Represents the key source φ C The read and write order set The set of read and write events, g e Indicates the execution condition text of the read / write event e.

[0031] In addition, the present invention also provides a parallel program incremental regression verification system based on refined constraint reuse, including a microprocessor and a memory connected to each other, wherein the microprocessor is programmed or configured to execute the steps of the aforementioned parallel program incremental regression verification method based on refined constraint reuse.

[0032] In addition, the present invention also provides a parallel program incremental regression verification system based on refined constraint reuse, comprising:

[0033] Key source generation program unit for the current program version M i When performing parallel program verification based on scheduling constraint abstract refinement after the abstract program, each iteration of the verification process is executed for the current program version M i The corresponding key source is generated for the ring in the event sequence diagram of the corresponding program abstraction and recorded in the key source library, and the key source validity judgment program unit is jumped to execute; wherein the ring is composed of edges, the key source of the ring is composed of the key sources of the edges that constitute the ring, and each edge in the ring represents a read-write order relationship in the program abstraction, or a program order relationship, or a new order relationship derived from the two;

[0034] The key source validity determination program unit is used to determine the current program version M given by the target parallel program. i , determine the validity of the key sources in the key source library and determine the current program version M i Valid key sources;

[0035] The refined constraint adapter program unit is used to respectively adapt the current program version M i Each effective key source of M generates refined constraints through refined constraint adaptation to participate in the current program version M i The next iteration of the verification process.

[0036] In addition, the present invention also provides a computer-readable storage medium, in which a computer program is stored, and the computer program is used to be programmed or configured by a microprocessor to execute the steps of the aforementioned parallel program incremental regression verification method based on refined constraint reuse.

[0037] Compared with the prior art, the present invention has the following advantages: the mainstream verification algorithm for parallel programs can only verify one program version. Every time the code is slightly modified, the entire program needs to be verified from the beginning, which generates a lot of verification overhead. Considering that the parallel program verification method based on scheduling constraint abstract refinement is one of the mainstream methods for parallel program verification, the present invention studies the incremental regression verification technology of this method on the basis of this method. By accurately calculating the impact of code modification on refined constraints and adapting refined constraints, the refined constraints in the previous program version verification can be reused, thereby effectively improving the regression verification efficiency of parallel programs in the code evolution environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 Schematic diagram of the basic flow of the method of the embodiment of the present invention.

[0039] Figure 2 Schematic diagram of the process of validity determination in an embodiment of the present invention. DETAILED DESCRIPTION

[0040] like Figure 1 As shown, the parallel program incremental regression verification method based on refined constraint reuse in this embodiment includes:

[0041] S1, in the current program version M i When performing parallel program verification based on scheduling constraint abstract refinement after the abstract program, each iteration of the verification process is executed for the current program version M iThe corresponding key source is generated for the ring in the event sequence diagram of the corresponding program abstraction and recorded in the key source library, and then jumps to the next step; wherein, the ring is composed of edges, and the key source of the ring is composed of the key sources of the edges that constitute the ring. Each edge in the ring represents a read-write order relationship in the program abstraction, or a program order relationship, or a new order relationship derived from the two;

[0042] S2, the current program version M given for the target parallel program i , determine the validity of the key sources in the key source library and determine the current program version M i Valid key sources;

[0043] S3, respectively for the current program version M i Each effective key source of M generates refined constraints through refined constraint adaptation to participate in the current program version M i The next iteration of the verification process.

[0044] It should be noted that the parallel program verification based on scheduling constraint abstraction and refinement is an existing verification method, which can be found in: Liangze Yin, Wei Dong, Wanwei Liu, and Ji Wang. On Scheduling Constraint Abstraction for Multi-Threaded Program Verification. IEEE Transactions on Software Engineering, 46(5): 549-565(2020). For each current program version M i, the verification method will verify it independently. Specifically, the method first ignores the scheduling constraints in the parallel program to obtain an over-approximate abstraction of the original program, and then verifies the program using the method based on scheduling constraint abstract refinement. The entire verification process is divided into multiple iterations, and each iteration generates some refined constraints to refine the program abstraction until a counterexample is found or the correctness of the program is proved. In this embodiment, in order to achieve incremental regression verification, the verification information of the previous version is fully utilized in the verification process of the later version to accelerate the verification process. The impact of code modification on the refined constraints in this method is deeply analyzed, and on this basis, the concept of key sources of refined constraints is proposed. In the abstract refinement method based on scheduling constraints, each refined constraint corresponds to a ring of the event order graph in the program abstraction, and each edge in the ring is derived from the read-write order (Read-From Order) and program order (Program Order) in the program through certain inference rules. The key source of a refined constraint is the set of read-write order (Read-From Order) and occurrence order relation (Happen Before Relation) that can derive the ring. As long as all the orders and relations in the key source still exist in the modified program, a refined constraint can be generated based on the key source that is applicable to the modified version. Figure 1 In this embodiment, the parallel program incremental regression verification method based on the reuse of refined constraints generates each refined constraint during the program verification process, analyzes the key source corresponding to the refined constraint, and stores it in the key source library. When verifying subsequent versions, the effective key source is determined by comparing the current program code structure with the program code structure corresponding to the existing key source, and generates a refined constraint suitable for the current program through refined constraint adaptation. In this way, a large number of refined constraints are obtained before the program verification begins, reducing redundant analysis of the program code and effectively improving the verification efficiency of subsequent versions of the program. Figure 1As shown in the gray frame in the figure, the parallel program incremental regression verification method based on refined constraint reuse in this embodiment includes the following steps: (1) key source generation. Each time a refined constraint is generated, the key source corresponding to the refined constraint must be analyzed. When verifying each program version, the key source information corresponding to the read and write events of the program and its refined constraints will be recorded in the key source library. (2) Key source validity determination. Before verifying the modified program, the key source data generated during the verification process of the previous version of the program will be read from the key source library. By comparing the current program code structure with the program code structure corresponding to the key source, it is determined which key sources are valid in the current program version. (3) Refined constraint adaptation. For those valid key sources, a refined constraint suitable for the current program is generated for them through refined constraint adaptation, and it is added to the abstracted program to refine the abstraction. Through this method, a large number of refined constraints can be obtained before the program verification begins, thereby reducing redundant analysis of the program code and effectively improving the verification efficiency of the modified program. The above three steps are described in detail below.

[0045] (1) Key source generation.

[0046] The main purpose of key source generation is to analyze the minimum set of read-from order and happen-before relation that can be derived for each cycle in the event sequence graph (EOG). Each cycle in the event sequence graph (EOG) is composed of a series of edges, and each edge represents a read-from order relation, or a program order relation, or a new order relation derived from the two in the program abstraction. The edges representing the read-from order relation, the program order relation, the new order relation derived from the two, and the happen-before relation in the event sequence graph are called read-from order edge, program order edge, derived edge, and happen-before edge. Assume that all continuous program orders in the cycle are synthesized into one edge, that is, there is no continuous program order in the cycle. The key source of an edge is defined as the minimum set of read-from order relation and happen-before relation that can be derived for the edge. Then the key source of a cycle is the union of the key sources of all the edges constituting the cycle.

[0047] Therefore, the generation of key sources refers to the generation of key sources for the current program version M. i The corresponding key source is generated for the loop in the event sequence diagram of the corresponding program abstraction and recorded in the key source library

[0048] (1.1) Generation of key sources for edges in event sequence graphs.

[0049] For each edge in the event sequence graph, the key source refers to the minimum set that can deduce the occurrence order relation (HappenBefore Relation) and read-write order (Read-From Order) of the edge. λ Indicates its key source and uses and Respectively represent φ λ In step S1, for the current program version M i When the corresponding key source is generated by the edge in the event sequence graph of the corresponding program abstraction, the generation of any edge λ includes:

[0050] If the edge λ is a program order edge or a read-write order edge, then the key source φ corresponding to the edge λ is the edge λ itself, i.e. φ λ ={λ};

[0051] If the edge λ is derived from two edges λ1 and λ2, then the key source φ corresponding to the edge λ for in The key source φ λ The occurrence sequence set of The key source φ λ A set of read and write order, with:

[0052] Occurrence Order Set in and are the read and write order sets of the key sources of edges λ1 and λ2 respectively,

[0053] Occurrence Order Set If the edge λ is a set of read and write order of the key sources of the two edges λ1 and λ2 derived based on the transfer rule and are all empty sets, then the key source φ λ The occurrence sequence of is the edge λ itself, otherwise the key source φ λ The occurrence sequence of for in and are the occurrence order sets of the key sources of edges λ1 and λ2 respectively, and ∪ is the union operation.

[0054] In this way, whenever an edge is generated, no matter whether it is a program order edge or a read-write order edge, or two edges are derived by a certain rule, the key source φ of the edge can be calculated by the above method. λ .

[0055] (1.2) Generation of key sources for loops in event sequence diagrams.

[0056] Given a cycle in an event sequence graph, if there is no continuous program sequence in the cycle, then its key source is the union of the key sources of all edges constituting the cycle. i When the corresponding key source is generated for the ring in the event sequence diagram of the corresponding program abstraction, the generation of any ring C includes: merging the continuous program sequence edges in the ring C to obtain a new ring C', and taking the union of the key sources of all edges of the new ring C' as the key source of the new ring C'.

[0057] Among them, the function expression of taking the union of the key sources of all edges of the new ring C' as the key source of the new ring C' is:

[0058]

[0059] In the above formula, φ C' The key source of the new ring C', φ λ is the key source of edge λ of the new ring C', and ∪ is the union operation.

[0060] In this way, every time a cycle C is found in the event sequence graph, its key source φ can be calculated C and add it to the key source library.

[0061] (2) Determination of the effectiveness of key sources.

[0062] Since the program has been modified, the key sources generated by the previous program version may no longer be applicable to the current program version due to the code modification, and refined constraints cannot be generated from it. Therefore, it is necessary to determine which key sources in the previous version are valid for the current program version. Given a key source φ C , if there is an event sequence diagram in the modified program code such that φ C All read-write order relations and occurrence order relations in are established, then the key source φ C is valid. Therefore, judging a key source φ C The method to determine whether the modified code is effective is to determine whether all read-write order relations and occurrence order relations in the modified code are established. If they are established, then the key source φ C It is valid in the modified code; if one of them is not true, it is invalid in the modified code.

[0063] After the code is modified, the position of the read-write event in the code and the number of the read-write event will change. In order to determine the validity of the key source generated by the previous program version in the modified code, it is first necessary to establish the correspondence between the read-write events of the two different versions. To this end, it is first necessary to identify which parts of the modified program code are the same as the original program. Since the event sequence diagram only cares about the read-write events in the program, a read-write event sequence needs to be established for each program version, and its variable name and read-write type are stored for each read-write event. Then, the longest common subsequence algorithm is used to identify the common part of the read-write event sequence of the current code and the event sequence of the previous version of the code, that is, the common part before and after the code is modified, and the correspondence between the read-write events before and after the code is modified is established accordingly. In order to determine whether the node of the relationship in a key source of the previous version exists in the modified version, it is necessary to analyze based on the correspondence between the read-write events before and after the code is modified.

[0064] Specifically, Figure 2 As shown, when determining the validity of the key sources in the key source library in step S2, determining the validity of any target key source includes:

[0065] S2.1, establish a read-write event sequence for all read-write events of each program version, and store the variable name and read-write type for each read-write event;

[0066] S2.2, use the longest common subsequence algorithm to identify the current program version M i The sequence of read and write events and the program version M that generates the key source j The correspondence between the read and write event sequences and the program version M of the key source is generated j Version j and current program version M i Version i satisfies constraint j <i;

[0067] S2.3, traverse and obtain a relation in the target key source as the current relation;

[0068] S2.4, determine whether the two nodes of the current relationship are in the current program version M i Is it true in the code? If not, the target key source is determined to be an invalid key source, and the process ends and exits; otherwise, jump to the next step;

[0069] S2.5, determine whether the two nodes of the current relationship are in an occurrence order relationship and the two nodes belong to different processes. The occurrence order relationship means that there is a constraint on the execution order of the two nodes. If it is true, the current program version M iConstruct the occurrence sequence relationship graph of the new code, and further determine whether the two nodes in the occurrence sequence relationship graph are reachable. If they are reachable, jump to the next step. If they are not reachable, determine that the target key source is an invalid key source, end and exit; otherwise, jump to the next step;

[0070] S2.6, determine whether the relationship in the target key source has been traversed. If not, jump to step S2.3; otherwise, determine that the target key source is a valid key source.

[0071] In this embodiment, the function expression of the read-write order relationship is:

[0072] τ:=(w v ,r v )

[0073] In the above formula, τ represents the read-write order relationship, w v Indicates a write operation on the variable v, r v Represents a read operation on the variable v.

[0074] For a read-write order relation τ:=(w v ,r v ), if event w v and r v are in the modified code, then r v Probably read w v , that is, τ may hold in the modified code. For an occurrence order relation τ:=(e1,e2), a prerequisite for τ to still hold in the modified code is that events e1 and e2 are still in the modified code. At the same time, if e1 and e2 belong to the same thread, then according to the program order, e1 will naturally be executed before e2, that is, τ still holds in the modified code; if e1 and e2 belong to different threads, even if these two threads exist in the modified code, e1 may not necessarily be executed before e2, for example, a pthread_join statement is deleted in the modification. In this case, it is necessary to construct an occurrence order relation graph of the new code and determine whether e2 can be reached from e1 in the graph. If so, τ still holds in the modified code.

[0075] (3) Refine constraint adaptation.

[0076] In this embodiment, in step S3, the current program version M is respectively i When each effective key source of generates refined constraints through refined constraint adaptation, for any key source φ C The steps of adapting and generating refined constraints include:

[0077] S3.1, according to the current program version M i The sequence of read and write events and the program version M that generates the key sourcej Find the key source φ based on the correspondence between the read / write event sequences where (j < i). C For each read / write event e in, in the current program version M i the execution condition text g e , and for each read / write order relation τ in the current program version M i the corresponding connection text S τ ;

[0078] S3.2. Based on the key source φ C For each read / write event e in, in the current program version M i the execution condition text g e , and for each read / write order relation τ in the current program version M i the corresponding connection text S τ , generate the refinement constraint corresponding to the key source φ C .

[0079] For each valid key source φ C , to avoid the occurrence of a cycle C during the verification process of the modified program, a refinement constraint κ suitable for the current program version needs to be generated based on φ C . In this embodiment, the functional expression of the refinement constraint generated for the key source φ in step S3.2 is: C

[0080]

[0081] In the above formula, κ represents the generated refinement constraint, represents negation, S τ represents the connection text corresponding to the read / write order relation τ, ∧ represents the AND operation, represents the set of read / write events of the key source φ C . represents the set of read / write orders of the key source φ C . The set of read / write events, g e represents the execution condition text of the read / write event e (g e holds, that is, the event e exists in the current event sequence diagram). In the above formula: represents that all read / write order relations in the key source φ C hold. represents that all other events in the key source φ C except for the events in exist in the current event sequence diagram. For the events in , the previous has ensured their occurrence. The overall meaning of the refinement constraint is that the key source φ C ​At least one of the read-write order relationship and the occurrence order relationship in is not true, otherwise loop C will be introduced. To achieve the adaptation of refined constraints, one of the prerequisites is to first establish the correspondence between the events in the previous version and the events in the modified program version, and then find the execution conditions of the corresponding events and the connection text corresponding to the read-write order based on the relationship. After the program code is modified, the execution conditions of the events may change, and the program coding may be completely different from the original program coding. However, in the adaptation process of refined constraints, by first finding the corresponding events, and then generating refined constraints based on the conditions and coding of the events in the modified program, the correctness of the generated refined constraints for the modified version can be guaranteed.

[0082] In this embodiment, for a given parallel program to be verified and a tool that implements this method, the tool is first used to verify the program to be verified, and the verification result is that the attribute is established or not established. Then the user modifies the program, and the code modification may be due to the need to fix bugs, modify program logic, or add or reduce functions. The tool is then called again to verify the modified program, and the key source generated in the previous version verification process will be used to generate refined constraints during the verification process to accelerate the verification of the modified code. This method proposes the concept of key source in the abstract refinement method based on scheduling constraints, that is, the key source of an edge is defined as the minimum set that can derive the read-write order relation (Read-From OrderRelation) and the occurrence order relation (Happen Before Relation) of the edge, and the key source of a ring is the union of the key sources of all edges constituting the ring, and a method for generating key sources, determining the validity of key sources, and adapting refined constraints is proposed, thereby realizing incremental regression verification of parallel programs and improving the efficiency of regression verification of parallel programs. In summary, the current mainstream verification algorithm for parallel programs can only verify one program version. Every time the code is slightly modified, the entire program needs to be verified from the beginning, which generates a large amount of verification overhead. Considering that the parallel program verification method based on scheduling constraint abstract refinement is one of the current mainstream methods for parallel program verification, this embodiment studies its incremental regression verification technology based on this method, thereby realizing incremental regression verification of parallel programs. For each version of the verified program, the events of the version program and the key sources corresponding to the refined constraints generated during its verification process are first stored in the local library. When verifying the modified program, the key sources generated by the previous program version are first read, and the key sources that are still valid in the current program version are screened out, and the refined constraints suitable for the current program version are generated based on them, thereby reducing redundant analysis in the verification process and improving the regression verification efficiency of parallel programs. This method has no constraints on code modification and supports any type of code modification.

[0083] In addition, this embodiment also provides a parallel program incremental regression verification system based on refined constraint reuse, including a microprocessor and a memory connected to each other, and the microprocessor is programmed or configured to execute the steps of the aforementioned parallel program incremental regression verification method based on refined constraint reuse.

[0084] In addition, this embodiment also provides a parallel program incremental regression verification system based on refined constraint reuse, including:

[0085] Key source generation program unit for the current program version M i When performing parallel program verification based on scheduling constraint abstract refinement after the abstract program, each iteration of the verification process is executed for the current program version M i The corresponding key source is generated for the ring in the event sequence diagram of the corresponding program abstraction and recorded in the key source library, and the key source validity judgment program unit is jumped to execute; wherein the ring is composed of edges, the key source of the ring is composed of the key sources of the edges that constitute the ring, and each edge in the ring represents a read-write order relationship in the program abstraction, or a program order relationship, or a new order relationship derived from the two;

[0086] The key source validity determination program unit is used to determine the current program version M given by the target parallel program. i , determine the validity of the key sources in the key source library and determine the current program version M i Valid key sources;

[0087] The refined constraint adapter program unit is used to respectively adapt the current program version M i Each effective key source of M generates refined constraints through refined constraint adaptation to participate in the current program version M i The next iteration of the verification process.

[0088] In addition, this embodiment further provides a computer-readable storage medium, in which a computer program is stored. The computer program is used to be programmed or configured by a microprocessor to execute the steps of the aforementioned parallel program incremental regression verification method based on refined constraint reuse.

[0089] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, may be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the functions in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0090] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.

Claims

1. A parallel program incremental regression verification method based on refined constraint reuse, characterized in that include: S1, in the current program version M i When performing parallel program verification based on scheduling constraint abstract refinement after the abstract program, each iteration of the verification process is executed for the current program version M i The corresponding key source is generated for the ring in the event sequence diagram of the corresponding program abstraction and recorded in the key source library, and then jumps to the next step; wherein, the ring is composed of edges, and the key source of the ring is composed of the key sources of the edges that constitute the ring. Each edge in the ring represents a read-write order relationship in the program abstraction, or a program order relationship, or a new order relationship derived from the two; S2, the current program version M given for the target parallel program i , determine the validity of the key sources in the key source library and determine the current program version M i Valid key sources; S3, respectively for the current program version M i Each effective key source of generates refined constraints through refined constraint adaptation to participate in the current program version M i Iteration of the next round of verification process; When determining the validity of the key sources in the key source library in step S2, determining the validity of any target key source includes: S2.1, establish a read-write event sequence for all read-write events of each program version, and store the variable name and read-write type for each read-write event; S2.2, use the longest common subsequence algorithm to identify the current program version M i The sequence of read and write events and the program version M that generates the key source j The correspondence between the read and write event sequences and the program version M of the key source is generated j Version j and current program version M i Version i satisfies constraint j <i; S2.3, traverse and obtain a relation in the target key source as the current relation; S2.4, determine whether the two nodes of the current relationship are in the current program version M i Is it true in the code? If not, the target key source is determined to be an invalid key source, and the process ends and exits; otherwise, jump to the next step; S2.5, determine whether the two nodes of the current relationship are in an occurrence order relationship and the two nodes belong to different processes. The occurrence order relationship means that there is a constraint on the execution order of the two nodes. If it is true, the current program version M i Construct the occurrence sequence relationship graph of the new code, and further determine whether the two nodes in the occurrence sequence relationship graph are reachable. If they are reachable, jump to the next step. If they are not reachable, determine that the target key source is an invalid key source, end and exit; otherwise, jump to the next step; S2.6, determine whether the relationship in the target key source has been traversed. If not, jump to step S2.

3. Otherwise, determine that the target key source is a valid key source. In step S3, the current program version M is i When each effective key source of generates refined constraints through refined constraint adaptation, for any key source The steps of adapting and generating refined constraints include: S3.1, according to the current program version M i of the read-write event sequence and the program version M j that generates the key source, find the key source according to the correspondence between the read-write event sequences of (j < i) for each read-write event e in the current program version M i of the execution condition text g e , and the corresponding connection text of each read-write order relationship λ in the current program version M i ; S λ ; S3.2, based on key sources Each read and write event e In the current program version M i The execution condition text in g e , and the read-write order relationship λ in the current program version M i The corresponding connection text S λ , generate key sources The corresponding refined constraints.

2. The parallel program incremental regression verification method based on refined constraint reuse according to claim 1, characterized in that: In step S1, for the current program version M i When the corresponding key source is generated for the edge in the event sequence graph of the corresponding program abstraction, the key source generation for any edge λ includes: if the edge λ is a program sequence edge or a read-write sequence edge, then the key source corresponding to the edge is is the edge itself; if the edge is two edges and The key source corresponding to this edge is derived for ,in For key sources The occurrence sequence set of For key sources A set of read and write order, and there is ,in and Side and The read and write order set of the key source, if the edge λ is two edges and Based on the transfer rule, the edge and A collection of key sources for read and write order and are all empty sets, then the key source The occurrence sequence of is the edge λ itself, otherwise the key source The occurrence sequence of for ,in and Side and The occurrence sequence of the key sources of For AND operation.

3. The parallel program incremental regression verification method based on refined constraint reuse according to claim 1, characterized in that: In step S1, for the current program version M i When the corresponding key source is generated from the loop in the event sequence diagram of the corresponding program abstraction, for any loop C The key sources of the generation include: Merge ring C The continuous program order edges in the , the new ring The union of the key sources of all edges of key source.

4. The parallel program incremental regression verification method based on refined constraint reuse according to claim 3 is characterized in that: The new ring The union of the key sources of all edges of The function expression of the key source is: In the above formula, For the new ring The key source of For the new ring The key source of edge λ, For AND operation.

5. The parallel program incremental regression verification method based on refined constraint reuse according to claim 1, characterized in that: Generate key source in step S3.2 The corresponding refined constraint function expression is: In the above formula, represents the generated refined constraints, Indicates negation. Indicates the read and write order relationship The corresponding connection text, Representation and operation, Indicates key source A collection of read and write events, Indicates key source The read and write order set A collection of read and write events, Indicates read and write events e The execution condition text.

6. A parallel program incremental regression verification system based on refined constraint reuse, comprising a microprocessor and a memory connected to each other, characterized in that: The microprocessor is programmed or configured to execute the steps of the parallel program incremental regression verification method based on refined constraint reuse as recited in any one of claims 1 to 5.

7. A parallel program incremental regression verification system based on refined constraint reuse, characterized in that include: Key source generation program unit for the current program version M i When performing parallel program verification based on scheduling constraint abstract refinement after the abstract program, each iteration of the verification process is executed for the current program version M i The corresponding key source is generated for the ring in the event sequence diagram of the corresponding program abstraction and recorded in the key source library, and the key source validity judgment program unit is jumped to execute; wherein the ring is composed of edges, the key source of the ring is composed of the key sources of the edges that constitute the ring, and each edge in the ring represents a read-write order relationship in the program abstraction, or a program order relationship, or a new order relationship derived from the two; The key source validity determination program unit is used to determine the current program version M given by the target parallel program. i , determine the validity of the key sources in the key source library and determine the current program version M i Valid key sources; The refined constraint adapter program unit is used to respectively adapt the current program version M i Each effective key source of generates refined constraints through refined constraint adaptation to participate in the current program version M i Iteration of the next round of verification process; When the critical source validity determination program unit determines the validity of the critical sources in the critical source library, the validity determination for any one of the target critical sources includes: S2.1, establishing a read-write event sequence for all read-write events of each program version, and storing the variable name and read-write type for each read-write event; S2.2, using the longest common subsequence algorithm to identify the correspondence between the read-write event sequence of the current program version M i and the read-write event sequence of the program version M j that generates the critical source, and the version j of the program version M j that generates the critical source and the version i of the current program version M i satisfy the constraint relationship j < i; S2.3, traversing to obtain a relationship in the target critical source as the current relationship; S2.4, judging whether both nodes of the current relationship are in the code of the current program version M i . If not, it is determined that the target critical source is an invalid critical source, and the process ends and exits; otherwise, it jumps to the next step; S2.5, judging whether both nodes of the current relationship are in the happens-before order relationship and belong to different processes. The happens-before order relationship means that there is an execution order constraint between the two nodes. If it holds, a happens-before order relationship graph for the new code is constructed for the current program version M i , and it is further judged whether the two nodes are reachable in the happens-before order relationship graph. If reachable, it jumps to the next step. If not reachable, it is determined that the target critical source is an invalid critical source, and the process ends and exits; otherwise, it jumps to the next step; S2.6, judging whether the relationships in the target critical source have been traversed. If not, it jumps to step S2.

3. Otherwise, it is determined that the target critical source is a valid critical source; The refined constraint adaptation program unit respectively processes the current program version M i When generating refined constraints for each valid key source through refined constraint adaptation, for any key source The steps of adapting and generating refined constraints include: S3.1, according to the read-write event sequence of the current program version M i And the read-write event sequence of the program version M j (j < i) that generates the key source, find the read-write events In the key source e The execution condition text i In the current program version M g e , and the connection text corresponding to each read-write order relationship λ in the current program version M i S λ i ; 3.2, according to the read-write events In the key source e The execution condition text i In the current program version M g e , and the connection text corresponding to each read-write order relationship λ in the current program version M i S λ include: , generate the refined constraint corresponding to the key source .

8. A computer-readable storage medium having a computer program stored therein, characterized in that: The computer program is used to be programmed or configured by a microprocessor to execute the steps of the parallel program incremental regression verification method based on refined constraint reuse as described in any one of claims 1 to 5.