SMT solving method and device based on machine learning and GPU parallelism

By constructing the SMT problem as a SAT problem and using GPU parallel solution, combining genetic algorithms and gradient optimization methods, the existing SMT solution methods are solved inefficient problems in large-scale and high-complexity problems, and efficient and accurate SMT solution is achieved.

CN119990267APending Publication Date: 2025-05-13BEIJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510151429.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-11
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

The existing SMT solution methods are inefficient in computing and long solution time when dealing with large-scale and complex SMT problems, especially in high-performance computing and real-time applications.

Method used

Using the SMT solution method based on machine learning and GPU parallelism, the SMT problem is constructed into a SAT problem, and the GPU-accelerated parallel SAT solver is used for the solution. If the solution result is satisfactory, a differentiable objective function is constructed, the optimal solution is determined using genetic algorithms and gradient optimization methods, and satisfactory verification is performed through a deterministic solver.

Benefits of technology

It improves the efficiency and accuracy of SMT solution, reduces invalid calculations and resource waste, and significantly improves the solution performance of large-scale and complex SMT problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119990267A_ABST
    Figure CN119990267A_ABST
Patent Text Reader

Abstract

The invention discloses an SMT solving method and device based on machine learning and GPU parallelism, and relates to the technical field of SMT solving, and the method comprises the steps: constructing a to-be-solved SMT problem into a to-be-solved SAT problem based on machine learning; a GPU accelerated parallel SAT solver is adopted to solve the SAT problem, and a solving result is obtained; judging whether the solving result is met or not; if not, ending the process; if yes, constructing a differentiable objective function according to the SAT problem and a preset rule; generating a high-quality population by adopting a genetic algorithm; each individual in the high-quality population represents a group of candidate solutions of a differentiable objective function; carrying out local search on the candidate solution by adopting a gradient optimization method, and determining an optimal solution of the differentiable objective function; and carrying out satisfiability verification on the optimal solution through a deterministic solver, and outputting the optimal solution passing the satisfiability verification. According to the invention, the SMT solving efficiency and accuracy are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of SMT solution, and in particular to a SMT solution method and device based on machine learning and GPU parallelism. Background Art

[0002] Satisfiability Modulo Theories (SMT) refers to the problem of determining whether there is a solution that satisfies the formula under a given variable assignment in a logical formula. SMT is widely used in many fields, such as cloud computing and cloud storage, access control, multi-core problems, program defect detection and verification, bounded model detection, register transfer level (RTL) verification, optimization problem solving, static analysis and program verification. In these fields, actual problems can be transformed into satisfiability problems through modeling, and SMT has outstanding advantages in the expression and solution of these problems.

[0003] Related SMT solving methods mainly rely on heuristic search and logical reasoning, which have improved the solving efficiency to a certain extent. However, as the scale and complexity of the problem increase, the related methods still face the challenges of low computational efficiency and long solving time when dealing with large-scale and complex SMT problems. This limitation is particularly evident in high-performance computing and real-time applications. Summary of the invention

[0004] The purpose of this application is to provide a SMT solving method and device based on machine learning and GPU parallelism, which can improve the efficiency and accuracy of SMT solving.

[0005] To achieve the above objectives, this application provides the following solutions:

[0006] In a first aspect, the present application provides an SMT solving method based on machine learning and GPU parallelism, and the SMT solving method based on machine learning and GPU parallelism includes:

[0007] Based on machine learning, the SMT problem to be solved is constructed as a SAT problem to be solved;

[0008] Solve the SAT problem using a GPU-accelerated parallel SAT solver to obtain a solution result;

[0009] Determine whether the solution result is satisfied;

[0010] If the solution result is not satisfied, the process ends;

[0011] If the solution result is satisfied, construct a differentiable objective function according to the SAT problem and preset rules;

[0012] Generate a high-quality population using a genetic algorithm; each individual in the high-quality population represents a set of candidate solutions for the differentiable objective function;

[0013] Based on the high-quality population, a gradient optimization method is used to perform local search on candidate solutions to determine the optimal solution of the differentiable objective function;

[0014] The optimal solution is verified for satisfiability by a deterministic solver, and the optimal solution that passes the satisfiability verification is output.

[0015] Optionally, the SMT problem to be solved is constructed as a SAT problem to be solved based on machine learning, specifically including:

[0016] By parsing the SMT formula, the SMT formula is converted into a graph structure; the SMT problem is represented by the SMT formula, the nodes in the graph structure are variables or sub-formulas obtained by parsing the SMT formula, and the edges in the graph structure are logical relationships between the nodes;

[0017] The graph structure is optimized by using a graph neural network to obtain an optimized graph structure; the variables in the optimized graph structure are glued variables;

[0018] The SAT problem is determined according to the optimized graph structure.

[0019] Optionally, a GPU-accelerated parallel SAT solver is used to solve the SAT problem to obtain a solution, which specifically includes:

[0020] Decomposing the SAT problem into multiple subspaces, each subspace is a combination of glue variable assignments;

[0021] Allocating each of the subspaces to different GPU computing nodes respectively; each of the GPU computing nodes performs parallel computing;

[0022] Applying a minimum constraint variable selection algorithm on each GPU computing node to obtain a minimum constraint variable set; the minimum constraint variable selection algorithm is to calculate the conflict probability between each glue variable, and determine the minimum constraint variable set by eliminating glue variables with small conflict probability;

[0023] In a multi-threaded environment on each GPU computing node, based on the minimum constrained variable set, each thread executes the elimination of redundant clauses in parallel to obtain a unit clause set; the unit clause set is composed of unit clauses, and each clause is composed of glue variables;

[0024] On each GPU computing node, based on each set of unit clauses, a clause propagation mechanism is used to solve the SAT problem to obtain a solution result; the clause propagation mechanism is for each GPU computing node to propagate a high-priority learning clause through a message passing interface; the high-priority learning clause is a unit clause whose value exceeds a set value during the solution process.

[0025] Optionally, constructing a differentiable objective function according to the SAT problem and preset rules specifically includes:

[0026] Based on the optimized graph structure and according to preset rules, the logical formula in the SAT problem is converted into a differentiable mathematical form to obtain a differentiable objective function.

[0027] Optionally, based on the high-quality population, a gradient optimization method is used to perform a local search on candidate solutions to determine the optimal solution of the differentiable objective function, specifically including:

[0028] The gradient of the differentiable objective function corresponding to each candidate solution is calculated, and the candidate solution is updated according to the gradient of the differentiable objective function using the back-propagation algorithm, gradually approaching the optimal solution through multiple iterations.

[0029] Optionally, performing satisfiability verification on the optimal solution by a deterministic solver and outputting the optimal solution that passes the satisfiability verification specifically includes:

[0030] Verifying whether the optimal solution satisfies all constraints in the SMT problem through a deterministic solver;

[0031] If all constraints in the SMT problem are not met, an error message is output and the step of using a genetic algorithm to generate a high-quality population is returned;

[0032] If all constraints in the SMT problem are met, the optimal solution that passes the satisfiability verification is output.

[0033] In a second aspect, the present application provides an SMT solving device based on machine learning and GPU parallelism, and the SMT solving device based on machine learning and GPU parallelism includes:

[0034] A problem conversion module, which is used to construct the SMT problem to be solved into the SAT problem to be solved based on machine learning;

[0035] A SAT problem solving module, used to solve the SAT problem using a GPU-accelerated parallel SAT solver to obtain a solution result;

[0036] A judgment module, used to judge whether the solution result is satisfied;

[0037] A process ending module, used to end the process if the solution result is not satisfied;

[0038] A differentiable objective function construction module is used to construct a differentiable objective function according to the SAT problem and preset rules if the solution result is satisfied;

[0039] A candidate solution generation module, used to generate a high-quality population using a genetic algorithm; each individual in the high-quality population represents a set of candidate solutions for the differentiable objective function;

[0040] An optimal solution determination module, used to perform local search on candidate solutions based on the high-quality population using a gradient optimization method to determine the optimal solution of the differentiable objective function;

[0041] The verification module is used to perform satisfiability verification on the optimal solution through a deterministic solver and output the optimal solution that passes the satisfiability verification.

[0042] Optionally, the question conversion module includes:

[0043] An SMT formula conversion unit is used to convert the SMT formula into a graph structure by parsing the SMT formula; the SMT problem is represented by the SMT formula, the nodes in the graph structure are variables or sub-formulas obtained by parsing the SMT formula, and the edges in the graph structure are logical relationships between the nodes;

[0044] A graph structure optimization unit, used to optimize the graph structure using a graph neural network to obtain an optimized graph structure; the variables in the optimized graph structure are glued variables;

[0045] The SAT problem determination unit is used to determine the SAT problem according to the optimized graph structure.

[0046] Optionally, a SAT problem solving module includes:

[0047] A subspace partitioning unit, used for decomposing the SAT problem into a plurality of subspaces, each subspace being a glue variable assignment combination;

[0048] A subspace allocation unit, used to allocate each of the subspaces to different GPU computing nodes respectively; each of the GPU computing nodes performs parallel computing;

[0049] A minimum constraint variable set determination unit is used to apply a minimum constraint variable selection algorithm on each GPU computing node to obtain a minimum constraint variable set; the minimum constraint variable selection algorithm is to calculate the conflict probability between each glue variable, and determine the minimum constraint variable set by eliminating glue variables with small conflict probability;

[0050] A redundant clause elimination unit is used for, in a multi-threaded environment on each GPU computing node, based on the minimum constraint variable set, each thread executes the elimination of redundant clauses in parallel to obtain a unit clause set; the unit clause set is composed of unit clauses, and each clause is composed of glue variables;

[0051] The SAT problem solving unit is used to solve the SAT problem on each GPU computing node based on the set of unit clauses and adopt a clause propagation mechanism to obtain a solution result; the clause propagation mechanism is for each GPU computing node to propagate a high-priority learning clause through a message passing interface; the high-priority learning clause is a unit clause whose value exceeds a set value during the solution process.

[0052] Optionally, the differentiable objective function building block includes

[0053] The differentiable objective function construction unit is used to convert the logical formula in the SAT problem into a differentiable mathematical form based on the optimized graph structure and according to preset rules to obtain a differentiable objective function.

[0054] According to the specific embodiments provided in this application, this application discloses the following technical effects:

[0055] The present application provides an SMT solving method and device based on machine learning and GPU parallelism. Based on machine learning, the SMT problem to be solved is constructed as a Boolean Satisfiability Problem (SAT) problem to be solved; a GPU-accelerated parallel SAT solver is used to solve the SAT problem to obtain a solution result; according to the solution result, it is determined whether the SMT problem has a solution, and if there is no solution, the process is stopped, thereby reducing invalid calculations and reducing resource waste; if the solution result is satisfied, a differentiable objective function is constructed according to the SAT problem and preset rules, and based on the differentiable objective function, a genetic algorithm and a gradient optimization method are used to determine the optimal solution, thereby improving the efficiency of SMT solving, and the satisfiability of the optimal solution is verified by a deterministic solver, thereby improving the accuracy of SMT solving. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0057] Figure 1 A flowchart of an SMT solving method based on machine learning and GPU parallelism is provided in accordance with an embodiment of the present application.

[0058] Figure 2 A schematic diagram of SMT preprocessing and logic conversion provided in one embodiment of the present application.

[0059] Figure 3 A schematic diagram of a GPU parallel acceleration solution process provided in one embodiment of the present application.

[0060] Figure 4 A schematic diagram of a process of solving space segmentation by gluing variables provided in one embodiment of the present application.

[0061] Figure 5 A schematic diagram of the minimum constraint variable selection process provided in one embodiment of the present application.

[0062] Figure 6 A schematic diagram of a parallel redundancy elimination process provided in an embodiment of the present application.

[0063] Figure 7 A schematic diagram of the high-priority clause propagation process provided in an embodiment of the present application.

[0064] Figure 8 An interaction diagram of GPU computing nodes for distributed parallel solution provided in one embodiment of the present application.

[0065] Fig. 9 A schematic diagram of the interaction of the SMT solution module provided in one embodiment of the present application.

[0066] Fig.10 A schematic diagram of an MPI parallel genetic algorithm and gradient optimization solution provided in one embodiment of the present application.

[0067] Fig.11 A schematic diagram of the interaction between a user and an SMT solving module provided in one embodiment of the present application. DETAILED DESCRIPTION

[0068] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0069] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0070] This application provides a SMT solution method based on machine learning and GPU parallelism, such as Figure 1As shown, the SMT solving method based on machine learning and GPU parallelism includes: steps 101 to 108.

[0071] Step 101: Based on machine learning, the SMT problem to be solved is constructed into a SAT problem to be solved.

[0072] Step 102: using a GPU-accelerated parallel SAT solver to solve the SAT problem and obtain a solution result.

[0073] Step 103: Determine whether the solution is satisfied.

[0074] If the solution in step 103 is not satisfied, step 104 is executed.

[0075] Step 104: The process ends.

[0076] If the solution in step 103 is satisfied, step 105 is executed.

[0077] Step 105: Construct a differentiable objective function according to the SAT problem and preset rules.

[0078] Step 106: Generate a high-quality population using a genetic algorithm; each individual in the high-quality population represents a set of candidate solutions to the differentiable objective function.

[0079] Step 107: Based on the high-quality population, a gradient optimization method is used to perform a local search on candidate solutions to determine the optimal solution of the differentiable objective function.

[0080] Step 108: Perform satisfiability verification on the optimal solution through a deterministic solver, and output the optimal solution that passes the satisfiability verification.

[0081] In an exemplary embodiment, in step 101, Figure 2 As shown in the figure, the SMT problem to be solved is preprocessed, and the formula is mapped into a graph structure through a graph neural network (GNN) to capture the complex relationship between variables and construct the corresponding SAT problem, specifically including: parsing the SMT formula to extract the variables, sub-formulas and logical relationships in the SMT formula.

[0082] The present application also includes simplifying the parsed SMT formulas (sub-formulas) by eliminating redundant constraints and conflicting constraints through variable dependency analysis, which not only reduces the size of the SMT formulas but also significantly improves the efficiency of subsequent solutions.

[0083] The SMT formula is converted into a graph structure according to the extracted variables, sub-formulas and logical relationships; the SMT problem is represented by the SMT formula, the nodes in the graph structure are variables or sub-formulas obtained by parsing the SMT formula, and the edges in the graph structure are logical relationships between the nodes, i.e., constraint relationships. Logical relationships include AND, OR, and NOT.

[0084] Through graph structure representation, the logical constraints and complex interactions between variables in SMT formulas can be clearly captured.

[0085] The graph structure is optimized using a graph neural network to obtain an optimized graph structure; the variables in the optimized graph structure are glued variables. This application uses a graph neural network to process the graph structure, captures the complex interaction information between variables through a message passing mechanism, and updates the state of each node to form a comprehensive understanding of the overall problem. The graph structure is further optimized to eliminate redundant constraints, simplify the representation of variables and sub-formulas, and ensure the simplicity and effectiveness of the graph structure. The graph neural network is a prediction model obtained through reinforcement learning training.

[0086] Graph neural networks gradually capture the deep interaction information between variables through their message passing mechanism. Specifically, each node updates its own state by aggregating the information of neighboring nodes. Through multiple rounds of iterations, each node can eventually form a global understanding of the entire formula.

[0087] The SAT problem is determined according to the optimized graph structure.

[0088] In the process of solving SMT, the preprocessing and structural modeling of the problem are the crucial first steps. Through preprocessing and structural modeling, the SMT problem to be solved is constructed as a SAT problem to be solved. The goal of preprocessing is to simplify the complex SMT problem into a form that is more suitable for solving, while establishing an intuitive understanding of the variables and constraint relationships.

[0089] In an exemplary embodiment, in step 102, if Figure 3 As shown in the figure, the GPU-accelerated parallel SAT solver performs satisfiability solving, which is divided into four aspects: glue variable solution space segmentation, minimum constraint variable selection, parallel redundancy elimination, and high-optimal clause propagation. It efficiently performs satisfiability solving of SAT problems, including:

[0090] Gluing variables to solve the space segmentation Figure 4 As shown, the SAT problem is decomposed into multiple subspaces, each of which is a combination of glue variable assignments. The glue variables are the glue variables predicted by the graph neural network, and the solution space is divided according to the glue variables predicted by the graph neural network. The solution space is used to find potential solutions for the optimal solution to the SMT problem.

[0091] Each subspace is assigned to a different GPU computing node; each GPU computing node performs parallel computing. Each GPU computing node processes a subspace independently. This method effectively utilizes the parallel computing capability of the GPU and significantly reduces the solution time. By processing different subspaces on different nodes, the speed of local solution can be accelerated while ensuring the consistency of global solution.

[0092] For example, a SAT question contains x 1 、x 2 、x 3 、x 4 、x 5 Five variables, after analysis x 1 and x 2 The glue variables have a great influence on the recursive depth of the solution, so the solution space can be divided into 4 subspaces according to the possible assignment combinations of the glue variables.

[0093] Subspace 1: x 1 =0,x 2 =0.

[0094] Subspace 2: x 1 =0,x 2 =1.

[0095] Subspace 3: x 1 =1,x 2 =0.

[0096] Subspace 4: x 1 =1,x 2 =1.

[0097] The minimum constraint variable selection is as follows Figure 5 As shown, a minimum constraint variable election algorithm is applied on each GPU computing node to obtain a minimum constraint variable set; the minimum constraint variable election algorithm calculates the conflict probability between each glue variable, and determines the minimum constraint variable set by selecting glue variables with small conflict probability for elimination. In order to avoid the data access conflict problem caused by GPU multi-threaded parallel elimination, the application proposes a minimum constraint variable election algorithm, which preferentially selects variables with small conflict probability for elimination and freezes all variables that are dependent on them.

[0098] The minimum constraint variable election algorithm evaluates the conflict probability of each variable by analyzing the relationship between variables and constraints. Variables with a smaller conflict probability are preferentially selected for elimination, thereby reducing data access conflicts in parallel computing. After the minimum constraint variable is elected, all variables that have dependencies with it are frozen to prevent data inconsistency during the elimination process. This strategy improves the efficiency of parallel processing while ensuring the stability of the elimination process.

[0099] Parallel redundancy elimination Figure 6 As shown, in a multi-threaded environment on each GPU computing node, based on the minimum set of constrained variables, each thread performs the elimination of redundant clauses in parallel to obtain a set of unit clauses; the set of unit clauses is composed of unit clauses, and each clause is composed of glue variables. The present application performs self-contained elimination and learning clause redundancy elimination in parallel on GPU multi-threads. During this process, a thread generates a new clause and stores it in a shared memory for use by other threads. If the newly generated clause is a unit clause, it is added to the set of unit clauses, and the unit clause can directly determine the assignment of the glue variables therein, thereby accelerating the subsequent solution process.

[0100] The parallel redundancy elimination strategy not only improves the solution efficiency, but also reduces unnecessary calculations and optimizes the use of overall resources.

[0101] In the SAT problem, a clause is composed of several variables, and in this application, a clause is composed of glued variables. Specifically, redundancy elimination is achieved through the Conflict Driven Clause Learning (CDCL) algorithm, which specifically includes identifying and removing redundant clauses and variables. During the redundancy elimination process, each GPU thread checks each variable in the minimum constrained variable set in parallel, and each thread performs self-contained elimination and redundancy elimination strategies. If a variable is dependent on any variable in the minimum constrained variable set, it will be added to the frozen set to avoid data competition during parallel processing.

[0102] For example, in the redundancy elimination process, there are the following clauses: C 1 : C 2 : C 3 : C 4 : C 1 , C 2 , C 3 and C 4 All are clauses.

[0103] 1) Generation of authorization candidate sets and candidate affiliations.

[0104] Initialization: The authorization candidate set B and the candidate affiliation set D are empty.

[0105] Filter variables: Assuming the frequency threshold μ is 2, traverse the variable set and filter out variables whose occurrence times are less than or equal to the frequency threshold. 1 Appears 2 times, x 2 Appears 2 times, x 3Appears 3 times, x 4 Appears 3 times. Therefore, B={x 1 ,x 2 ,x 3 ,x 4}.

[0106] Generate dependencies: Check the dependencies between pairs of variables in clauses.

[0107] For (x 1 ,x 2 ), in C 1 exists in both, so (x 1 ,x 2 )∈D.

[0108] For (x 1 ,x 3 ), in C 1 exists in both, so (x 1 ,x 3 )∈D.

[0109] For (x 1 ,x 4 ), in C 2 exists in both, so (x 1 ,x 4 )∈D.

[0110] For (x 2 ,x 3 ), in C 3 exists in both, so (x 2 ,x 3 )∈D.

[0111] For (x 3 ,x 4 ), in C 3 and C 4 exists in both, so (x 3 ,x 4 )∈D.

[0112] 2) Election of the set of elected candidates and the set of frozen variables.

[0113] Initialization: The set of elected candidates Φ and the set of frozen variables F are initially empty.

[0114] Traverse the authorization candidate set: detect x 1 , does not depend on any variable in Φ, add Φ, so Φ={x 1}.

[0115] Detection x 2 , and x in Φ 1 Dependent, add F, so F={x2}.

[0116] Detection x 3 , and x in Φ 1 Dependent, add F, so F={x 2 ,x 3}.

[0117] Detection x 4 , and x in Φ 1 Dependent, add F, so F={x 2 ,x 3 ,x 4}.

[0118] 3) Parallel processing of selected candidate variables.

[0119] Parallel processing: Start GPU thread, and process Φ={x 1} in parallel. 1 , get the relevant clause C 1 and C 2 , generate new clauses and store them.

[0120] Unit clause processing: If the newly generated clause is a unit clause, it is added to the unit clause set through atomic operations.

[0121] High-quality clause propagation Figure 7 As shown, on each GPU computing node, based on the set of each unit clause, a clause propagation mechanism is used to solve the SAT problem to obtain a solution result; the clause propagation mechanism is that each GPU computing node propagates a high-priority learning clause through a message passing interface (MPI); the high-priority learning clause is a unit clause whose value exceeds a set value during the solution process.

[0122] The value of a clause during the solution process is determined by a hybrid evaluation algorithm based on usage frequency and the Literals Blocks Distance (LBD).

[0123] The sharing of high-quality learning clauses between different GPU computing nodes can significantly accelerate the solution process. Through this efficient clause propagation mechanism, each GPU computing node is able to share key information, ensuring that all GPU computing nodes can use this key information to optimize their own solution process. This not only improves the overall solution efficiency, but also enhances the robustness of the solver when dealing with complex problems. The CDCL algorithm is used to optimize the solution process of each GPU computing node using key information, which includes avoiding repeated conflicts, pruning the search space, and enhancing heuristic decisions based on learning clauses.

[0124] The algorithm for CPU parallel SAT solving to accelerate the main process is shown in Table 1.

[0125] Table 1 CPU parallel SAT solution acceleration main process algorithm

[0126]

[0127] Among them, Require is input and Ensure is output. h is a set of formulas on the host side, representing the SAT problem to be solved. μ is the frequency threshold, which serves as the input of the constraint variable election algorithm to control the constraint variable election. phases is the number of shift clauses; S d It is a set of formulas stored on the device side (i.e., GPU side). INITIALIZEFORMULA() indicates initializing the formula, and COPYTODEVICE() indicates copying the formula set from the host to the GPU device side. Stream0, Stream1, Stream2, Stream3, and STREAM1 are all used for asynchronous data transmission and calculation streams. The GPU side uses stream0 to transfer S d Flatten into continuous unsigned literals and store into an array. A represents the result of sorting the formula and variables. p is a variable. SYNCALLSTREAMS() means synchronizing all streams to ensure that asynchronous operations are completed and data is consistent. T represents the frequency histogram. BCP means Boolean constraint propagation, simplifying formulas or eliminating conflicts. BCP is a function in the CDCL algorithm. LCVE represents the constraint variable election algorithm. EXECUTEERE() means executing GPU parallelized SAT solving operations. GRD() means parallel redundancy elimination. ASYNCOPYTOHOST is a public function that transfers data asynchronously from the GPU to the CPU through a stream. ASYNCOPYTOHOST is used to asynchronously copy data from the device back to the host to keep the data consistent. ASYNCOPYTOHOST is also used to asynchronously transfer clauses or intermediate results back. SORTVARIABLES() represents variable sorting, ALLOCATEPROOF represents record buffer initialization, P h Eliminate the proof buffer on the host side, P d The elimination record buffer is simplified for the GPU side and is located in the global memory (GPU video memory). GENERATEOT means generating an occurrence table based on the GPU side formula set, recording the occurrence position of each variable in all clauses (such as variable x appears in clauses C1 C2). It needs to be updated after each elimination loop. ORDEROT means sorting the occurrence table according to the custom sorting rules. d Indicates the GPU-side unit clause, U hIt represents the host-side unit clause, ORDEROT means that the table will be sorted according to the custom sorting rule, LISTKEY is the custom sorting rule, which provides deterministic sorting for the GRD elimination process, GATHER() is the host-side collection of unit clauses and proof streams returned by the GPU, SYNC is the proof write stream synchronization to ensure that the proof record is written to the file, and WRITEPROOF is a host-side system call to write the proof data to the file.

[0128] During the SMT solution process, the distributed parallel solution GPU computing nodes interact as follows Figure 8 During the entire SMT solution process, the interaction between the various functional modules is as follows: Fig. 9 As shown, Fig. 9 In the figure, Worker-1, Worker-2, and Worker-3 are different GPU computing nodes, and Master is the host.

[0129] In the present application, if the solution result obtained in step 102 is unsatisfactory (UNSAT), the solution process is terminated. If the solution result is satisfied (SAT), subsequent steps are required to further verify the SMT solution.

[0130] In an exemplary embodiment, step 105 specifically includes:

[0131] Based on the optimized graph structure, according to the preset rules, the logical formula in the SAT problem is converted into a differentiable mathematical form to obtain a differentiable objective function. More specifically, the logical formula of the SMT problem is converted into a mathematical form, derivatives and boundary conditions are introduced, the relationship between variables is established, and a differentiable objective function that comprehensively considers all constraints and optimization objectives is constructed. This process involves converting the logical formula in the SMT problem into a differentiable mathematical form so that it can express the relationship between variables through differential equations. By calculating the derivatives of these constraint relationships, the interaction between variables is clarified, providing a basis for subsequent gradient optimization. On this basis, the value of the variable is gradually updated using a numerical solution method. According to the characteristics of the differentiable function, the weight and step size of the variable are dynamically adjusted to improve the convergence speed and the stability of the optimization, ensuring that the optimal solution that satisfies all constraints is gradually approached.

[0132] In the process of constructing the differentiable objective function, the preset rules specifically include the following formulas:

[0133] f(φ 1 ∧…∧φ n ):=max(f(φ 1 )+log(1+f(φ 1 ) 2 ), ..., f(φ n )+log(1+f(φ n )2 ), 0);

[0134]

[0135] f(φ 1 ≤φ 2 ):=f(φ 1 )-f(φ 2 )+sin(f(φ 1 ))·cos(f(φ 2 ));

[0136]

[0137] f(φ 1 =φ 2 ):=(f(φ 1 )-f(φ 2 )) 2 +exp(-|f(φ 1 )-f(φ 2 )|);

[0138] (in represents a differentiable operator);

[0139] f(v): =v+log(1+v 2 );

[0140] f(c):=c+e -c ;

[0141] f(x n ):=f(x) n log(1+|f(x)|);

[0142] f(logx):=log(1+|f(x)|)·tanh(f(x));

[0143]

[0144] f(cos x):=cos(f(x))·(1-e -f(x) );

[0145] f(e x ):=e f(x) +log(1+f(x) 2 );

[0146] f(|x|):=|f(x)|·(1+sin(f(x)));

[0147]

[0148] f(tanhx):=tanh(f(x))+cos(f(x))·sin(f(x)).

[0149] Where φ is a logical formula, p and q both represent polynomials, v represents a unit variable, c represents a real number, 1≤i≤n, f(φ i ) represents the logic formula parsing mapping function, f(p) represents the first polynomial parsing function, f(q) represents the second polynomial parsing function, and f(x) represents the function of parsing the real number variable x.

[0150] For example, the original SMT problem is: φ=(x≥y)∧(y=2).

[0151] Parse the original SMT problem into subformulas: 1 =(x≥y),φ 2 =(y=2).

[0152] According to the differentiable construction rules, the above will be parsed into the following formula:

[0153] f(φ)=max(f(φ 1 )+log(1+f(φ 1 ) 2 ),f(φ 2 )+log(1+f(φ 2 ) 2 ),0).

[0154] Further parse f(φ according to the rules 1 ) and f(φ 2 ), the final differentiable objective function can be obtained.

[0155] In an exemplary embodiment, the MPI parallel genetic algorithm and the gradient optimization solver are as follows: Fig.10 As shown, step 106 specifically includes: using a genetic algorithm to generate a high-quality population and finding an optimal solution to the SMT problem in the solution space.

[0156] Step 106 is to further optimize the solution space by combining genetic algorithm based on the establishment of differentiable functions. The genetic algorithm searches for the optimal solution to the SMT problem by initializing the population, fitness evaluation, selection, crossover and mutation. The generation of the initial population can be random or based on a heuristic method to ensure the diversity and coverage of the population. The fitness function is designed to evaluate each individual in the population to reflect the quality of the individual solution. Through fitness evaluation, high-quality individuals are selected as parents for crossover and mutation operations to ensure the transmission of high-quality genes. The crossover operation combines the genes of two parent individuals to generate new offspring individuals; the mutation operation introduces genetic diversity by randomly changing the genes of some individuals to prevent the population from falling into a local optimal solution. After multiple generations of iterations, the genetic algorithm continuously optimizes the quality of the population, improves the overall fitness of the population, and gradually approaches the optimal solution to the problem.

[0157] Step 106 more specifically includes: initializing the population, generating multiple random solutions as the initial population, each solution representing a possible solution vector of the SMT problem.

[0158] The fitness function is used to evaluate the quality of each solution, and a solution with a higher fitness is closer to satisfying all constraints.

[0159] According to the fitness function, excellent solutions are selected for crossover and mutation operations to generate a new generation of solutions. The crossover operation combines the excellent features of the two parent solutions, and the mutation operation introduces randomness to maintain population diversity. Through multiple generations of iterations, the population quality is continuously optimized to obtain a high-quality population, thereby improving the fitness of the candidate solutions.

[0160] In an exemplary embodiment, step 107 specifically includes: calculating the gradient of the differentiable objective function corresponding to each candidate solution, using a back propagation algorithm to update the candidate solution according to the gradient of the differentiable objective function, and gradually approaching the optimal solution through multiple iterations.

[0161] Through the back-propagation algorithm, the variable value is adjusted according to the gradient information so that it gradually approaches the solution that satisfies all constraints. The learning rate is dynamically adjusted to increase the convergence speed and avoid falling into the local optimal solution.

[0162] After each iteration, the SMT solver is used to verify the satisfiability of the current solution. If the solution does not meet the constraints, failure learning is performed and the optimization strategy is adjusted to avoid similar errors.

[0163] Step 107 more specifically includes: based on the generated high-quality population, using the gradient optimization method to perform local search on the candidate solution, calculating the gradient of the objective function (differentiable objective function) and adjusting the variable value through back propagation, gradually approaching the optimal solution of the SMT problem. Select the initial solution from the high-quality population generated by the genetic algorithm. According to the fitness evaluation results of the previous stage, select individuals with higher fitness as the starting point of gradient optimization. Calculate the gradient of each individual on the current objective function. By deriving the objective function, the derivative value of each variable in the current state is obtained. The derivative value reflects the direction and rate of change of the variable and is used to guide the optimization process. Using the back propagation algorithm, update the individual variable value according to the gradient information. With the reverse direction of the gradient as the adjustment direction, update the variable value according to a certain step size (learning rate) so that it gradually approaches the optimal solution. The back propagation algorithm propagates errors through the network layer by layer, gradually adjusts the parameters in the network, and improves the accuracy of the model. Dynamically adjust the learning rate to increase the convergence speed and avoid falling into the local optimal solution. During the optimization process, the learning rate is adjusted in real time according to the performance of the current solution to ensure the stability and rapid convergence of the optimization process. Through multiple iterations, the optimal solution of the problem is gradually approached. After each iteration, the SMT solver is used to verify the satisfiability of the current solution. If the solution does not meet the constraints, failure learning is performed and the optimization strategy is adjusted to avoid the recurrence of similar errors.

[0164] In an exemplary embodiment, step 108 specifically includes: verifying whether the optimal solution satisfies all constraints in the SMT problem through a deterministic solver.

[0165] If all constraints in the SMT problem are not met, an error message is output and the process returns to the step of using a genetic algorithm to generate a high-quality population.

[0166] If all constraints in the SMT problem are met, the optimal solution that passes the satisfiability verification is output to ensure that the variable assignments solved meet all constraints of the original SMT problem.

[0167] Step 108 more specifically includes: performing satisfiability verification on the final solution obtained by a deterministic solver to ensure that the variable assignments solved meet all the constraints of the original SMT problem. The final solution obtained by gradient optimization is input into the deterministic solver. The optimized solution assignment is passed to the solver for verification through a network interface or file transfer. The deterministic solver performs a comprehensive constraint check on the input solution. According to the constraints in the original SMT problem, it verifies one by one whether the variable assignments meet all constraints. If there are unsatisfied constraints, the deterministic solver will return an error message and point out the specific unsatisfied constraints. The deterministic solver will output the verification result. If the input solution meets all constraints, the final solution is output and the satisfiability of the problem is confirmed. If the solution does not meet the constraints, an error message is output and the optimization process is returned for adjustment until a final solution that meets all constraints is found. The performance of the solution process is evaluated, including indicators such as solution time, memory consumption, and computational efficiency. By analyzing these performance indicators, the solution algorithm is further optimized to improve the overall performance and stability of the system.

[0168] The user interacts with the SMT solver module as follows Fig.11 As shown, Fig.11 The client is connected to the Application Programming Interface (API) server through an authentication proxy, the API server is connected to multiple cluster controllers, and the Cluster controller is connected to etcd through the Tunnel protocol. etcd is a highly available key / value storage system mainly used for shared configuration and service discovery. The client is the system front-end UI or API.

[0169] This application achieves efficient solution and verification by combining graph neural networks, reinforcement learning, genetic algorithms and gradient optimization methods. First, the SMT problem is preprocessed, and the formula is mapped into a graph structure using a graph neural network to capture the complex relationship between variables. Then, a differentiable objective function is designed to comprehensively consider the constraints and optimization objectives of the variables. Next, a genetic algorithm is used to generate a high-quality population, and the optimal solution is found in the solution space through fitness evaluation, selection, crossover and mutation operations. Based on the high-quality population, a gradient optimization method is used for local search, the gradient of the objective function is calculated and the variable value is adjusted to gradually approach the optimal solution. Finally, a satisfiability verification is performed through a deterministic solver to ensure that the variable assignment satisfies all constraints. The graph neural network uses a message passing mechanism in the modeling process, the differentiable objective function converts constraints into differential equations, the genetic algorithm optimizes the population through multiple generations of iterations, the gradient optimization method dynamically adjusts the learning rate and uses the backpropagation algorithm, and the deterministic solver verifies the completeness and accuracy of the solution. This application combines machine learning models with traditional SMT solvers to improve solution efficiency and accuracy. It has good scalability and is suitable for SMT problems of different scales and complexities, especially showing good solution efficiency for large-scale problems.

[0170] Based on the same inventive concept, the embodiment of the present application also provides a SMT solving device based on machine learning and GPU parallelism for implementing the SMT solving method based on machine learning and GPU parallelism involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more embodiments of the SMT solving device based on machine learning and GPU parallelism provided below can refer to the limitations of the SMT solving method based on machine learning and GPU parallelism in the above text, and will not be repeated here.

[0171] In an exemplary embodiment, a SMT solving device based on machine learning and GPU parallelism is provided, comprising:

[0172] The problem conversion module is used to construct the SMT problem to be solved into the SAT problem to be solved based on machine learning.

[0173] The SAT problem solving module is used to solve the SAT problem using a GPU-accelerated parallel SAT solver to obtain a solution result.

[0174] The judgment module is used to judge whether the solution result is satisfied.

[0175] The process ending module is used to end the process if the solution result is not satisfied.

[0176] The differentiable objective function construction module is used to construct a differentiable objective function according to the SAT problem and preset rules if the solution result is satisfied.

[0177] The candidate solution generation module is used to generate a high-quality population using a genetic algorithm; each individual in the high-quality population represents a set of candidate solutions of the differentiable objective function.

[0178] The optimal solution determination module is used to perform local search on candidate solutions based on the high-quality population using a gradient optimization method to determine the optimal solution of the differentiable objective function.

[0179] The verification module is used to perform satisfiability verification on the optimal solution through a deterministic solver and output the optimal solution that passes the satisfiability verification.

[0180] In an exemplary embodiment, the question conversion module includes:

[0181] An SMT formula conversion unit is used to convert the SMT formula into a graph structure by parsing the SMT formula; the SMT problem is represented by the SMT formula, the nodes in the graph structure are variables or sub-formulas obtained by parsing the SMT formula, and the edges in the graph structure are logical relationships between the nodes.

[0182] The graph structure optimization unit is used to optimize the graph structure by using a graph neural network to obtain an optimized graph structure; the variables in the optimized graph structure are glued variables.

[0183] The SAT problem determination unit is used to determine the SAT problem according to the optimized graph structure.

[0184] In an exemplary embodiment, the SAT problem solving module includes:

[0185] The subspace partitioning unit is used to decompose the SAT problem into multiple subspaces, each subspace is a glue variable assignment combination.

[0186] The subspace allocation unit is used to allocate each of the subspaces to different GPU computing nodes respectively; each of the GPU computing nodes performs parallel computing.

[0187] The minimum constraint variable set determination unit is used to apply the minimum constraint variable election algorithm on each GPU computing node to obtain the minimum constraint variable set; the minimum constraint variable election algorithm calculates the conflict probability between each glue variable, and determines the minimum constraint variable set by eliminating the glue variables with small conflict probability.

[0188] The redundant clause elimination unit is used to eliminate redundant clauses in parallel on each GPU computing node based on the minimum constraint variable set in a multi-threaded environment to obtain a unit clause set; the unit clause set is composed of unit clauses, and each clause is composed of glue variables.

[0189] The SAT problem solving unit is used to solve the SAT problem on each GPU computing node based on the set of unit clauses and adopt a clause propagation mechanism to obtain a solution result; the clause propagation mechanism is for each GPU computing node to propagate a high-priority learning clause through a message passing interface; the high-priority learning clause is a unit clause whose value exceeds a set value during the solution process.

[0190] In an exemplary embodiment, the differentiable objective function building module includes:

[0191] The differentiable objective function construction unit is used to convert the logical formula in the SAT problem into a differentiable mathematical form based on the optimized graph structure and according to preset rules to obtain a differentiable objective function.

[0192] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0193] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, according to the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.

Claims

1. A SMT solving method based on machine learning and GPU parallelism, characterized in that: The SMT solving method based on machine learning and GPU parallelism includes: Based on machine learning, the SMT problem to be solved is constructed as a SAT problem to be solved; Solve the SAT problem using a GPU-accelerated parallel SAT solver to obtain a solution result; Determine whether the solution result is satisfied; If the solution result is not satisfied, the process ends; If the solution result is satisfied, construct a differentiable objective function according to the SAT problem and preset rules; Generate a high-quality population using a genetic algorithm; each individual in the high-quality population represents a set of candidate solutions for the differentiable objective function; Based on the high-quality population, a gradient optimization method is used to perform local search on candidate solutions to determine the optimal solution of the differentiable objective function; The optimal solution is verified for satisfiability by a deterministic solver, and the optimal solution that passes the satisfiability verification is output.

2. The SMT solving method based on machine learning and GPU parallelism according to claim 1, characterized in that: Based on machine learning, the SMT problem to be solved is constructed into a SAT problem to be solved, including: By parsing the SMT formula, the SMT formula is converted into a graph structure; the SMT problem is represented by the SMT formula, the nodes in the graph structure are variables or sub-formulas obtained by parsing the SMT formula, and the edges in the graph structure are logical relationships between the nodes; The graph structure is optimized by using a graph neural network to obtain an optimized graph structure; the variables in the optimized graph structure are glued variables; The SAT problem is determined according to the optimized graph structure.

3. The SMT solving method based on machine learning and GPU parallelism according to claim 2, characterized in that: The SAT problem is solved by using a GPU-accelerated parallel SAT solver to obtain a solution, which specifically includes: Decomposing the SAT problem into multiple subspaces, each subspace is a combination of glue variable assignments; Allocating each of the subspaces to different GPU computing nodes respectively; each of the GPU computing nodes performs parallel computing; Applying a minimum constraint variable selection algorithm on each GPU computing node to obtain a minimum constraint variable set; the minimum constraint variable selection algorithm is to calculate the conflict probability between each glue variable, and determine the minimum constraint variable set by eliminating glue variables with small conflict probability; In a multi-threaded environment on each GPU computing node, based on the minimum constrained variable set, each thread executes the elimination of redundant clauses in parallel to obtain a unit clause set; the unit clause set is composed of unit clauses, and each clause is composed of glue variables; On each GPU computing node, based on each set of unit clauses, a clause propagation mechanism is used to solve the SAT problem to obtain a solution result; the clause propagation mechanism is for each GPU computing node to propagate a high-priority learning clause through a message passing interface; the high-priority learning clause is a unit clause whose value exceeds a set value during the solution process.

4. The SMT solving method based on machine learning and GPU parallelism according to claim 2, characterized in that: According to the SAT problem and preset rules, a differentiable objective function is constructed, specifically including: Based on the optimized graph structure and according to preset rules, the logical formula in the SAT problem is converted into a differentiable mathematical form to obtain a differentiable objective function.

5. The SMT solving method based on machine learning and GPU parallelism according to claim 1, characterized in that: Based on the high-quality population, a gradient optimization method is used to perform a local search on candidate solutions to determine the optimal solution of the differentiable objective function, specifically including: The gradient of the differentiable objective function corresponding to each candidate solution is calculated, and the candidate solution is updated according to the gradient of the differentiable objective function using the back-propagation algorithm, gradually approaching the optimal solution through multiple iterations.

6. The SMT solving method based on machine learning and GPU parallelism according to claim 1, characterized in that: The optimal solution is verified for satisfiability by a deterministic solver, and the optimal solution that passes the satisfiability verification is output, specifically including: Verifying whether the optimal solution satisfies all constraints in the SMT problem through a deterministic solver; If all constraints in the SMT problem are not met, an error message is output and the step of using a genetic algorithm to generate a high-quality population is returned; If all constraints in the SMT problem are met, the optimal solution that passes the satisfiability verification is output.

7. A SMT solving device based on machine learning and GPU parallelism, characterized in that: The SMT solving device based on machine learning and GPU parallelism includes: A problem conversion module, which is used to construct the SMT problem to be solved into the SAT problem to be solved based on machine learning; A SAT problem solving module, used to solve the SAT problem using a GPU-accelerated parallel SAT solver to obtain a solution result; A judgment module, used to judge whether the solution result is satisfied; A process ending module, used to end the process if the solution result is not satisfied; A differentiable objective function construction module is used to construct a differentiable objective function according to the SAT problem and preset rules if the solution result is satisfied; A candidate solution generation module, used to generate a high-quality population using a genetic algorithm; each individual in the high-quality population represents a set of candidate solutions for the differentiable objective function; An optimal solution determination module, used to perform local search on candidate solutions based on the high-quality population using a gradient optimization method to determine the optimal solution of the differentiable objective function; The verification module is used to perform satisfiability verification on the optimal solution through a deterministic solver and output the optimal solution that passes the satisfiability verification.

8. The SMT solving device based on machine learning and GPU parallelism according to claim 7, characterized in that: Question transformation module, including: An SMT formula conversion unit is used to convert the SMT formula into a graph structure by parsing the SMT formula; the SMT problem is represented by the SMT formula, the nodes in the graph structure are variables or sub-formulas obtained by parsing the SMT formula, and the edges in the graph structure are logical relationships between the nodes; A graph structure optimization unit, used to optimize the graph structure using a graph neural network to obtain an optimized graph structure; the variables in the optimized graph structure are glued variables; The SAT problem determination unit is used to determine the SAT problem according to the optimized graph structure.

9. The SMT solving device based on machine learning and GPU parallelism according to claim 8, characterized in that: SAT problem solving module, including: A subspace partitioning unit, used for decomposing the SAT problem into a plurality of subspaces, each subspace being a glue variable assignment combination; A subspace allocation unit, used to allocate each of the subspaces to different GPU computing nodes respectively; each of the GPU computing nodes performs parallel computing; A minimum constraint variable set determination unit is used to apply a minimum constraint variable selection algorithm on each GPU computing node to obtain a minimum constraint variable set; the minimum constraint variable selection algorithm is to calculate the conflict probability between each glue variable, and determine the minimum constraint variable set by eliminating glue variables with small conflict probability; A redundant clause elimination unit is used for, in a multi-threaded environment on each GPU computing node, based on the minimum constraint variable set, each thread executes the elimination of redundant clauses in parallel to obtain a unit clause set; the unit clause set is composed of unit clauses, and each clause is composed of glue variables; The SAT problem solving unit is used to solve the SAT problem on each GPU computing node based on the set of unit clauses and adopt a clause propagation mechanism to obtain a solution result; the clause propagation mechanism is for each GPU computing node to propagate a high-priority learning clause through a message passing interface; the high-priority learning clause is a unit clause whose value exceeds a set value during the solution process.

10. The SMT solving device based on machine learning and GPU parallelism according to claim 8, characterized in that: The differentiable objective function building blocks include: The differentiable objective function construction unit is used to convert the logical formula in the SAT problem into a differentiable mathematical form based on the optimized graph structure and according to preset rules to obtain a differentiable objective function.

Citation Information

Cited By

  • Double sorting optimization method for SAT generalization process in hardware verification

    CN122412750A