Cloth simulation acceleration system and method based on memory computing architecture of memristor
Through in-memory calculations and simulation calculations using memristor arrays, the linear equation system is directly solved, and the challenges of fabric simulation algorithms in real-time and computing speed are achieved, and efficient fabric simulation acceleration is achieved.
Patent Information
- Application Number
- CN202411599570.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2044-11-11
AI Technical Summary
Existing fabric simulation algorithms have challenges in real-time and computing speed, especially when dealing with complex fabric surface textures and real physical motions, with high computing resources and time requirements, resulting in limited computing efficiency and performance.
A fabric simulation acceleration system based on a memristor in-memory computing architecture is adopted. By performing in-memory calculations, data transmission is reduced, and simulation calculations are performed using a memristor array to directly solve linear equation systems to improve the calculation speed.
It significantly improves the calculation speed of fabric simulation and reduces the computational complexity. It is suitable for all physical-based fabric simulation problems, meeting the pursuit of real-time reality by modern users.
Smart Images

Figure CN119559031A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of memristor in-memory computing and the technical field of graphics hardware acceleration, and specifically relates to a cloth simulation acceleration system and method based on a memristor in-memory computing architecture. Background Art
[0002] In the past few decades, with the rise of video games, virtual reality, and animation production industries, high-speed, real-time, and high-precision computer graphics computing technology has developed rapidly, which has significantly increased the demand for computing power. As one of the common algorithms in the field of graphics, cloth simulation algorithms play an important role in many application fields, including fashion design, video games, animation production, and virtual reality. However, with the rapid development of technologies such as game production, the main challenges faced by cloth simulation algorithms have gradually focused on real-time performance. The simulation details of complex cloth surface textures and real physical movements require a lot of computing resources and time, which has become a bottleneck in the development of technology and limits the ability to meet the pursuit of real-time realism by modern users.
[0003] There are many difficulties in improving the calculation speed of the current cloth simulation algorithm. First, a large amount of data needs to be frequently transmitted between the memory and the processor, but due to the bandwidth limitation of the data bus, a lot of time and energy are wasted in the data transmission process, which seriously affects the calculation efficiency and performance. Secondly, in cloth simulation, most of the calculations themselves are highly data-dependent and need to be executed sequentially, which limits the traditional parallel acceleration strategy. Furthermore, the physical and mathematical models involved in cloth simulation are complex, which not only increases the difficulty of calculation, but also affects the calculation speed. The calculation involves solving the system of equations, which not only has a large amount of data processing and high data dependence, but also has a high calculation complexity when the number of variables to be solved increases, which makes it very difficult for GPU and CPU to accelerate the solution.
[0004] In the past, researchers have proposed a variety of high-performance acceleration strategies based on GPU and software optimization. For example, optimized data structures and memory access patterns, parallel computing using CUDA or OpenCL, and parallelized algorithms designed for multi-core processors. However, limited by the traditional hardware structure, these methods have limited improvements in computing speed and energy consumption. The in-memory computing architecture allows data to be calculated in memory, fundamentally reducing the problems caused by a large amount of data transmission and handling. In addition, by using a memristor array to use analog computing, the linear equations can be solved directly in one step, greatly reducing the computational complexity of solving the equations. Therefore, it is of great significance to study a fabric simulation acceleration system and method based on a memristor in-memory computing architecture. Summary of the invention
[0005] In view of the problems existing in the above-mentioned prior art, the present invention proposes a cloth simulation acceleration system and method based on a memristor in-memory computing architecture. The memristor in-memory computing architecture is used to perform calculations in the memory, thereby avoiding frequent reading of data. At the same time, the memristor array is used to perform simulation calculations to directly solve the linear equations, thereby avoiding iterative solution of the equations. The high parallel characteristics of in-memory computing are used to process a large number of nodes and springs at the same time, thereby greatly improving the calculation speed of cloth simulation.
[0006] The technical solution of the present invention is as follows:
[0007] A fabric simulation acceleration system based on a memristor in-memory computing architecture includes a random access memory RAM, a content addressable memory CAM, a universal computing unit UCU, an equation solving unit ESU, a digital-to-analog conversion module ADC / DAC, a transimpedance amplifier TIA, and a controller module Controller; the random access memory is composed of a memristor array and is used to store spring information and temporary data; the content addressable memory is composed of a memristor array and is used to store a node position matrix X and a velocity matrix V; the universal computing unit is composed of a memristor array and is used to perform general computing tasks, including four arithmetic operations, vector dot multiplication, and cross multiplication; the equation solving unit includes a memristor array and an operational amplifier part, which is used to perform equation solving computing tasks, adopts an analog computing method, and uses the analog characteristics of the memristor array to calculate the solution of the equation in one step, and the memristor array is used to store a mass matrix M, a force matrix F, and a Jacobian matrix K; the digital-to-analog conversion module is used to convert between analog signals and digital signals; the transimpedance amplifier is used to convert between current signals and voltage signals; the controller is used to control the computing process of the circuit;
[0008] The equation solving unit ESU, the universal computing unit UCU and the transimpedance amplifier TIA constitute a node computing unit point core, which is used in the implicit integral solution and collision detection stage of the cloth simulation algorithm with the number of nodes as the parallelism. During the calculation, the data required for each node calculation is first written into a node computing unit point core, and the calculated data is written into the equation solving unit ESU in the implicit integral solution stage. In the collision detection stage, the calculated data is written into the universal computing unit UCU, and then the calculation is performed in parallel. After the calculation is completed, it is converted by TIA and written into CAM;
[0009] The transimpedance amplifier TIA and multiple universal computing units UCU form a spring computing unit spring core, which is used in the force calculation stage and the application of inverse dynamics stage in the cloth simulation algorithm with the number of springs as the parallelism. During calculation, the spring data corresponding to the adjacent nodes are first written into a spring computing unit spring core, that is, the calculation data is written into the universal computing unit UCU, and then the calculation is performed in parallel. After the calculation is completed, it is converted by TIA and written into ESU or CAM.
[0010] Furthermore, in the spring calculation unit spring core, the number of universal calculation units UCU in each spring calculation unit is 6.
[0011] Furthermore, the number of the general computing units is greater than the number of springs, the number of the equation solving units is greater than the number of nodes, and the number of springs is greater than the number of nodes.
[0012] Furthermore, the controller controls the calculation process of all modules: the data in the RAM can be used to index the data in the CAM, the indexed value in the CAM will be sent to the ESU or UCU for calculation, the calculation result in the UCU is written into the ESU or written back to the CAM after TIA conversion, and the calculation result of the ESU is written back to the CAM after TIA conversion.
[0013] Furthermore, the analog calculation method is used. The output of all modules in the circuit is in the form of current, which is converted into voltage by the transimpedance amplifier TIA as the write voltage of the lower module memristor. In the circuit calculation process, the calculation result will be calculated by inputting a certain read voltage V read , the data is transferred from the memristor with a current I out It is read out in the form of a signal, then converted into a voltage signal by TIA and rewritten into the memristor.
[0014] The present invention also provides a method for accelerating fabric simulation based on a memristor in-memory computing architecture. The computing process is divided according to fabric image frames. Each frame image is calculated multiple times according to the step length. The calculation of each step length includes the following steps:
[0015] S1. First, perform initialization. According to the given cloth position relationship and motion state, determine the initial position matrix X and velocity matrix V of all nodes, initialize the spring matrix spring according to the cloth material information, write the spring matrix spring into the random access memory RAM, and write the position matrix X and velocity matrix V into the content addressable memory CAM; the spring matrix spring includes the elastic coefficient of each spring, the original length of the spring, and the position information of the nodes at both ends of the spring;
[0016] S2. In the force calculation stage, the number of springs is used as the parallelism. For each spring, a universal computing unit (UCU) is assigned to calculate the forces on all springs at the same time. For a single spring, the position vector Δx between the two nodes of the spring is first obtained by indexing from RAM and CAM. f and the velocity vector Δv f The readout signal exists in the form of current. After being converted by the transimpedance amplifier TIA, it is sent to the universal computing unit UCU for calculation to obtain the force matrix F and the Jacobian matrix K. The calculation result is output from the universal computing unit UCU in the form of current. After the result is converted into voltage by the transimpedance amplifier TIA, the force matrix F and the Jacobian matrix K are sent to the equation solving unit ESU;
[0017] S3. In the implicit integral solution stage, the number of nodes is used as the parallelism. For each node, an equation solving unit ESU is assigned to solve the displacement and velocity changes of all nodes at the same time. For a single node, the velocity vector v of the node is first obtained by indexing from the CAM. i , and then divide the physical equations for each node, solve the physical equations of the corresponding node in the equation solving unit ESU, use the memristor array in the equation solving unit ESU to build an analog circuit, directly solve the solution of the linear equations, and calculate the position adjustment Δx required at this time i and speed adjustment Δv i , and finally adjust the position by Δx i and speed adjustment Δv i Write back the position matrix X and velocity matrix V in CAM;
[0018] S4. In the collision detection phase, the number of nodes is used as the degree of parallelism. For each node, a universal computing unit (UCU) is assigned to calculate the collision of all nodes at the same time. For a single node, the position vector x of the node is first obtained from the CAM index. c , the collision distance is calculated in the universal computing unit UCU, and compared to determine whether a collision occurs. If a collision occurs, the position adjustment amount Δx required at this time is calculated in the universal computing unit UCU c and speed adjustment Δv c , and finally adjust the position by Δx c and speed adjustment Δv c Write back the position matrix X and velocity matrix V in the CAM; for points where no collision occurs, the collision adjustment amount is 0;
[0019] S5. In the application of inverse dynamics, the number of springs is used as the degree of parallelism. For each spring, a universal computing unit (UCU) is assigned to calculate the forces on all springs at the same time. For a single spring, the position vector Δx between the two nodes of the spring is first calculated. a The index is obtained from the CAM and sent to the universal computing unit (UCU) to calculate the current length l of the spring, which is compared with the original length l0 of the spring read from the RAM to determine whether deformation occurs. If so, the speed adjustment Δv required at this time is calculated in the universal computing unit UCU a , and finally the speed adjustment Δv a Write back the velocity matrix V in CAM; if no deformation occurs, Δv a is 0;
[0020] Steps S2-S5 complete the calculation of a step length, and calculate the changes of all node position matrix X and velocity matrix V within a step length. Multiple steps constitute a frame. Repeat steps S2-S5 multiple times to obtain a frame of image, render and draw the cloth image, and realize cloth simulation acceleration.
[0021] Furthermore, in step S2, the position vector Δx between the two nodes of the spring is obtained by using the RAM and CAM indexes. f and the velocity vector Δv f The method is as follows:
[0022] First, obtain the node numbers of each spring from the RAM. For the two end nodes p1 and p2 obtained by the index, find the corresponding points in the CAM according to the number information. The numbers i1 and i2 of the points corresponding to the two end nodes p1 and p2 are obtained by searching. The position vectors x1 and x2 corresponding to the rows i1 and i2 in the CAM are obtained by indexing. At the same time, the position vector Δx between the two end nodes p1 and p2 is calculated by the universal computing unit UCU. f =x1-x2; In the same way, we can get the velocity vector Δv of the two end nodes f =v1-v2.
[0023] Furthermore, the method of using a memristor array to build an analog circuit to solve linear equations in step S3 uses a memristor array to solve using analog calculations, specifically as follows: when calculating the adjustment amount of the i-th node, it is necessary to construct a linear equation system based on the node force and the Jacobian matrix to solve the position and speed. The linear equation system is in the form of Ax+b=0, where A is a coefficient matrix, x is an unknown number, and b is a constant term; the coefficient matrix A is obtained in the following manner: the mass matrix M is a diagonal matrix of size 3x3, the diagonal elements are the masses of the nodes, and the other elements are 0, which is written into the memristor array in advance and is invertedly connected to the i-th Jacobian matrix K through an operational amplifier with an amplification factor of β. i , Ki is a 3x3 diagonal matrix, whose elements represent the partial derivatives of the components of the three-dimensional force in the x, y, and z directions respectively. The memristor array formed at this time can be equivalent to the coefficient matrix A i =M-βK i , β is the amplifier gain; the constant term b can be obtained by the following method: multiply the fixed matrix M by the velocity vector v of the i-th node i The resulting current, plus V read The voltage reading force matrix F is the current obtained by the i-th row of the matrix, which is equivalent to the constant term I bi =M·v i +F i ; M and K i The output current of each column is added and connected to the input of the operational amplifier. Using the amplifier virtual short principle and the node current equation, we can get A i V out +I bi =0, where the output voltage V outi is the unknown number in the original equation, representing the position adjustment Δx i According to the kinetic formula The speed adjustment Δv can be obtained i , the position adjustment amount Δx i and speed adjustment Δv i Write back the position matrix X and velocity matrix V in the CAM respectively.
[0024] Furthermore, in step S5, the required speed change adjustment amount Δv is calculated. a The method is as follows:
[0025] First, get the nodes p1 and p2 at both ends of the current spring from RAM, then get the corresponding position matrix from CAM, and calculate the position vector Δx between the two points through the universal computing unit UCU. a , and then the spring length l=||Δx is calculated by the universal calculation unit UCU a ||; If l is greater than the original length of the spring l0, it is necessary to calculate the stretching distance and the speed adjustment: If node p1 is a fixed point or a boundary point, the adjustment is added to the velocity vector of another node p2. If node p2 is a fixed point or a boundary point, the adjustment is subtracted from the velocity vector of node p1. If neither node is a fixed point or a boundary point, the adjustment Δv is subtracted from the velocity vector of node p1. a , add the adjustment Δv to the velocity vector of node p2 a .
[0026] The technical effects of the present invention are as follows:
[0027] A method and system for accelerating cloth simulation based on a memristor in-memory computing architecture. Based on a memristor analog computing circuit, on the one hand, the solution of a linear equation group is directly solved by analog computing, which reduces the computational complexity and improves the computational speed. On the other hand, the high parallelism of in-memory computing is utilized to process a large number of nodes and springs at the same time, thereby greatly improving the speed of cloth simulation. The method and system are applicable to all physics-based cloth simulation problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 It is a schematic diagram of a fabric simulation acceleration system based on a memristor in-memory computing architecture according to the present invention;
[0029] Figure 2 This is an architecture diagram of a fabric simulation acceleration system based on a memristor in-memory computing architecture according to the present invention;
[0030] Figure 3 It is a flow chart of the method for accelerating fabric simulation based on the memristor in-memory computing architecture of the present invention;
[0031] Figure 4 The circuit diagram of the equation solving unit of the fabric simulation acceleration system based on the memristor in-memory computing architecture of the present invention. DETAILED DESCRIPTION
[0032] The present invention will be further clearly and completely described below through specific embodiments in conjunction with the accompanying drawings.
[0033] The traditional physics-based cloth simulation algorithm includes four stages: force calculation, implicit integral solution, collision detection and application of inverse dynamics, each stage includes different calculations. The mass-spring model is used to simulate cloth, and the cloth is divided into node grids, and the nodes are connected by springs. First, the scene or user gives a specific cloth position relationship and motion state, determines the initial position matrix X and velocity matrix V of all nodes, and initializes the spring matrix spring according to the cloth material information. In the force solution stage, it is necessary to solve the force F on each spring node. i and the partial derivative of force with respect to position K i , the force F on all nodes i Form the force matrix F, the partial derivatives of all node forces with respect to position K i The Jacobian matrix K is formed. According to Hooke's law, the force condition of the node can be solved, so the force matrix F and Jacobian matrix K can be solved. In the implicit integral solution stage, according to the force matrix F and Jacobian matrix K solved previously, as well as the velocity V of each node i, we can get the linear equations after implicit integral linearization. By solving the equations, we can get the position adjustment Δx and velocity adjustment Δv caused by the force. In the collision detection stage, the distance between the node and the collision object is calculated through the position of each node. If the distance is less than a certain value (given by the system), it is determined that a collision has occurred. In the event of a collision, the position and velocity of the node need to be updated to simulate the collision process. In the application of inverse dynamics, according to the above calculation process, the node position will be updated again. According to the updated node position of each spring, the node velocities at both ends of the spring are calculated, and the node velocities are updated to simulate the spring stretching.
[0034] The present invention provides a fabric simulation acceleration system based on a memristor in-memory computing architecture, the system schematic diagram is shown in FIG. Figure 1 As shown, it includes a random access memory (RAM), a content addressable memory (CAM), a universal computing unit (UCU), an equation solving unit (ESU), a digital-to-analog conversion module (ADC, DAC), a transimpedance amplifier (TIA) and a controller module; the random access memory (RAM) is composed of a memristor array and is used to store spring information and temporary data; the content addressable memory (CAM) is composed of a memristor array and is used to store a node position matrix X and a velocity matrix V; the universal computing unit (UCU), composed of a memristor array, is used to perform general computing tasks, Including four arithmetic operations, vector dot multiplication and cross multiplication, etc.; the equation solving unit (ESU), including a memristor array and an operational amplifier part, is used to perform the equation solving calculation task, adopts an analog calculation method, and uses the analog characteristics of the memristor array to calculate the solution of the equation in one step. The memristor array is used to store the mass matrix M, the force matrix F and the Jacobian matrix K; the digital-to-analog conversion module (ADC, DAC) is used to convert between analog signals and digital signals; the transimpedance amplifier (TIA) is used to convert between current signals and voltage signals; the controller (Controller) is used to control the operation process of the circuit. In this system, the number of universal computing units (UCU) is greater than the number of springs, the number of equation solving units (ESU) is greater than the number of nodes, and the number of springs is always greater than the number of nodes.
[0035] The controller controls the calculation process of all modules: the data in the RAM can be used to index the data in the CAM, the indexed value in the CAM will be sent to the ESU or UCU for calculation, the calculation result in the UCU will be written into the ESU or written back to the CAM after TIA conversion, and the calculation result of the ESU will be written back to the CAM after TIA conversion.
[0036] The fabric simulation acceleration system adopts the method of analog calculation. The output of all modules in the circuit is in the form of current, which is converted into voltage by the transimpedance amplifier TIA as the write voltage of the lower module memristor. In the circuit calculation process, the calculation result will be calculated by inputting a certain read voltage V read (usually less than 1V), the data is transferred from the memristor with a current I out It is read out in the form of a signal, then converted into a voltage signal by TIA and rewritten into the memristor.
[0037] The schematic diagram of the fabric simulation acceleration system architecture based on the memristor in-memory computing architecture of the present invention is as follows: Figure 2 As shown, the computing unit is divided into two parts: one is the node computing unit point core, which is used for implicit integral solution and collision detection stages, including equation solving unit (ESU), universal computing unit (UCU), and transimpedance amplifier (TIA); the other is the spring computing unit spring core, which is used for force calculation and application of inverse dynamics stages, including multiple universal computing units (UCU) and transimpedance amplifier (TIA). When performing calculations with the number of nodes as the degree of parallelism, that is, the implicit integral solution and collision detection stages, the data required for each node calculation will first be written into a node calculation unit point core, and the calculation data will be written into the equation solution unit (ESU) in the implicit integral solution. In the collision detection stage, the calculation data will be written into the universal calculation unit (UCU), and then the calculations will be performed in parallel. After the calculations are completed, they will be converted into CAM through TIA. When performing calculations with the number of springs as the degree of parallelism, that is, the force calculation and application of inverse dynamics stages, the spring data corresponding to the adjacent nodes will first be written into a spring calculation unit spring core. Since a maximum of 6 springs are generated between adjacent nodes, the number of universal calculation units (UCU) in each spring calculation unit spring core is 6, and then the calculations will be performed in parallel. After the calculations are completed, they will be converted into ESU or CAM through TIA.
[0038] The traditional physics-based cloth simulation algorithm is implemented in the cloth simulation acceleration system based on the memristor in-memory computing architecture to accelerate cloth simulation. The traditional physics-based cloth simulation algorithm includes four stages: force calculation, implicit integral solution, collision detection and application of inverse dynamics, each stage including different calculations. The mass-spring model is used to simulate the cloth, and the cloth is divided into a node grid, and the nodes are connected by springs. The implicit integral solution is converted into a linear equation system by linearization. The overall flow chart of the cloth simulation acceleration method based on the memristor in-memory computing architecture of the present invention is as follows: Figure 3 As shown, the calculation process is divided according to the cloth image frame, and each frame image is calculated multiple times according to the step length. The calculation of each step length includes the following steps:
[0039] S1. First, perform initialization. According to the given cloth position relationship and motion state, determine the initial position matrix X and velocity matrix V of all nodes, initialize the spring matrix spring according to the cloth material information, write the spring matrix spring into the random access memory (RAM), and write the position matrix X and velocity matrix V into the content addressable memory (CAM); the spring matrix spring includes the elastic coefficient of each spring, the original length of the spring, and the position information of the nodes at both ends of the spring.
[0040] S2. In the force calculation stage, the number of springs is used as the parallelism. For each spring, a universal computing unit (UCU) is assigned to calculate the forces on all springs at the same time. For a single spring, the position vector Δx between the two nodes of the spring is first obtained by indexing from RAM and CAM. f and the velocity vector Δv f The readout signal exists in the form of current. After being converted by the transimpedance amplifier TIA, it is sent to the universal computing unit (UCU) for calculation to obtain the force matrix F and the Jacobian matrix K. The calculation result is output from the universal computing unit (UCU) in the form of current. After the result is converted into voltage by the transimpedance amplifier TIA, the force matrix F and the Jacobian matrix K are sent to the equation solving unit (ESU);
[0041] S3. In the implicit integral solution stage, the number of nodes is used as the parallelism. For each node, an equation solving unit (ESU) is assigned to solve the displacement and velocity changes of all nodes at the same time. For a single node, the velocity vector v of the node is first obtained by indexing from the CAM. i , and then divide the physical equations for each node, solve the physical equations of the corresponding node in the equation solving unit (ESU), use the memristor array in the equation solving unit (ESU) to build an analog circuit, directly solve the solution of the linear equations, and calculate the position adjustment Δx required at this time i and speed adjustment Δv i , and finally adjust the position by Δx i and speed adjustment Δv i Write back the position matrix X and velocity matrix V in CAM;
[0042] S4. In the collision detection phase, the number of nodes is used as the degree of parallelism. For each node, a universal computing unit (UCU) is assigned to calculate the collision of all nodes at the same time. For a single node, the position vector x of the node is first obtained from the CAM index. c, the collision distance is calculated in the universal computing unit (UCU), and a comparison is made to determine whether a collision occurs. If a collision occurs, the position adjustment amount Δx required at this time is calculated in the universal computing unit (UCU) c and speed adjustment Δv c , and finally adjust the position by Δx c and speed adjustment Δv c Write back the position matrix X and velocity matrix V in the CAM; for points where no collision occurs, the collision adjustment amount is 0.
[0043] S5. In the application of inverse dynamics, the number of springs is used as the degree of parallelism. For each spring, a corresponding universal computing unit (UCU) is assigned to calculate the forces on all springs at the same time. For a single spring, the position vector Δx between the two nodes of the spring is first calculated. a The index is obtained from the CAM and sent to the universal computing unit (UCU) to calculate the current length l of the spring, which is compared with the original length l0 of the spring read from the RAM to determine whether deformation occurs. If so, the speed adjustment Δv required at this time is calculated in the universal computing unit (UCU) a , and finally the speed adjustment Δv a Write back the velocity matrix V in CAM; if no deformation occurs, Δv a is 0.
[0044] Steps S2-S5 complete the calculation of a step length, and calculate the changes of all node position matrix X and velocity matrix V within a step length. Multiple steps constitute a frame. Repeat steps S2-S5 multiple times to obtain a frame of image, render and draw the cloth image, and realize cloth simulation acceleration.
[0045] In step S2, the position vector Δx between two nodes of the spring is obtained by using the RAM and CAM indexes. f and the velocity vector Δv f The method is as follows:
[0046] First, the node numbers of the two ends of each spring are obtained by indexing from the RAM. For the two end nodes p1 and p2 obtained by the index, the corresponding points are searched in the CAM according to the sequence information. The sequence numbers i1 and i2 of the points corresponding to the two end nodes p1 and p2 are obtained by searching, and the position vectors x1 and x2 corresponding to the rows i1 and i2 in the CAM are obtained by indexing. At the same time, the position vector Δx between the two end nodes p1 and p2 is calculated by the universal computing unit (UCU). f =x1-x2; In the same way, we can get the velocity vector Δv of the two end nodes f =v1-v2.
[0047] The method of using a memristor array to build an analog circuit to solve the linear equation in step S3 is different from the traditional method based on gradient descent iteration. Here, a memristor array is used to solve the linear equation by analog calculation. The circuit of the analog calculation equation solving unit ESU is as follows: Figure 4 , the specific simulation calculation method is as follows: when calculating the adjustment amount of the i-th node, it is necessary to construct a linear equation system based on the node force and the Jacobian matrix to solve the position and velocity. The linear equation system is in the form of Ax+b=0, where A is the coefficient matrix, x is the unknown number, and b is the constant term. The coefficient matrix A can be obtained in the following way: the mass matrix M is a 3x3 diagonal matrix, the diagonal elements are the masses of the nodes, and the other elements are 0, which is written into the memristor array in advance and connected to the i-th Jacobian matrix K through an operational amplifier with a gain factor of β. i , K i is a 3x3 diagonal matrix, whose elements represent the partial derivatives of the three-dimensional force components in the x, y, and z directions respectively. The memristor array formed at this time can be equivalent to the coefficient matrix A i =M-βK i , β is the amplifier gain; the constant term b can be obtained by multiplying the fixed matrix M by the velocity vector v of the i-th node i The resulting current, plus V read The current obtained from the i-th row of the voltage reading force matrix F can be equivalent to the constant term I bi =M·v i +F i . M and K i The output current of each column is added and connected to the input of the operational amplifier. Using the amplifier virtual short principle and the node current equation, we can get A i V out +I bi =0, where the output voltage V outi is the unknown number in the original equation, representing the position adjustment Δx i According to the kinetic formula The speed adjustment Δv can be obtained i , the position adjustment amount Δx i and speed adjustment Δv i Write back the position matrix X and velocity matrix V in the CAM respectively. At this point, the solution of the linear equations can be directly solved in one step by simulation calculation.
[0048] The step S4, performing collision detection and collision processing on nodes, includes the following specific steps:
[0049] 1) First, the position vector x obtained by indexing c Transform the coordinates to the coordinate system of the center of the ellipse, that is, the x obtained by indexingc Multiply the vector by the ellipse matrix E to get x0;
[0050] 2) Calculate the position difference Δx=x0-c between the node and the ellipse center c;
[0051] 3) Then calculate the distance between the node and the collision center by distance = ||Δx||, and determine whether a collision occurs if distance < 1;
[0052] 4) If a collision occurs, use the inverse E of the elliptic matrix -1 Solve for the position adjustment Δx c and speed adjustment Δv c ;
[0053] 5) Adjust the corresponding position by Δx c and speed adjustment Δv c Write back the position matrix X and velocity matrix V in CAM.
[0054] In step S5, the required speed change adjustment Δv is calculated a The method is as follows:
[0055] First, get the nodes p1 and p2 at both ends of the current spring from RAM, then get the corresponding position matrix from CAM, and calculate the position vector Δx between the two points through the universal computing unit (UCU) a , and then the spring length l = ||Δx is calculated by the universal computing unit (UCU) a ||. If l is greater than the original length of the spring l0, then it is necessary to calculate the stretching distance and the speed adjustment: If node p1 is a fixed point or a boundary point, the adjustment is added to the velocity vector of another node p2. If node p2 is a fixed point or a boundary point, the adjustment is subtracted from the velocity vector of node p1. If neither node is a fixed point or a boundary point, the adjustment Δv is subtracted from the velocity vector of node p1. a , add the adjustment Δv to the velocity vector of node p2 a .
[0056] Table 1 List of variables and their meanings used in the present invention
[0057]
[0058] Finally, it should be noted that the purpose of publishing the embodiments is to help further understand the present invention, but those skilled in the art can understand that various substitutions and modifications are possible without departing from the spirit and scope of the present invention and the appended claims. Therefore, the present invention should not be limited to the contents disclosed in the embodiments, and the scope of protection claimed by the present invention shall be subject to the scope defined in the claims.
Claims
1. A fabric simulation acceleration system based on a memristor in-memory computing architecture, characterized in that: It includes a random access memory RAM, a content addressable memory CAM, a universal computing unit UCU, an equation group solving unit ESU, a digital-to-analog conversion module ADC / DAC, a transimpedance amplifier TIA and a controller module Controller; the random access memory is composed of a memristor array and is used to store spring information and temporary data; the content addressable memory is composed of a memristor array and is used to store a node position matrix X and a velocity matrix V; the universal computing unit is composed of a memristor array and is used to perform general computing tasks, including four arithmetic operations, vector dot multiplication and cross multiplication; the equation group solving unit includes a memristor array and an operational amplifier part, which is used to perform the equation group solving computing task, adopts an analog computing method, and uses the analog characteristics of the memristor array to calculate the solution of the equation group in one step, and the memristor array is used to store the mass matrix M, the force matrix F and the Jacobian matrix K; the digital-to-analog conversion module is used to convert between analog signals and digital signals; the transimpedance amplifier is used to convert between current signals and voltage signals; the controller is used to control the computing process of the circuit; The equation solving unit ESU, the universal computing unit UCU and the transimpedance amplifier TIA form a node computing unit pointcore, which is used in the implicit integral solution and collision detection stage of the cloth simulation algorithm with the number of nodes as the parallelism. During calculation, the data required for each node calculation is first written into a node computing unit pointcore, and the calculated data is written into the equation solving unit ESU in the implicit integral solution stage. In the collision detection stage, the calculated data is written into the universal computing unit UCU, and then the calculation is performed in parallel. After the calculation is completed, it is converted by TIA and written into CAM; The transimpedance amplifier TIA and multiple universal computing units UCU form a spring computing unit spring core, which is used in the force calculation stage and the application of inverse dynamics stage in the cloth simulation algorithm with the number of springs as the parallelism. During calculation, the spring data corresponding to the adjacent nodes are first written into a spring computing unit spring core, that is, the calculation data is written into the universal computing unit UCU, and then the calculation is performed in parallel. After the calculation is completed, it is converted by TIA and written into ESU or CAM.
2. The fabric simulation acceleration system based on memristor in-memory computing architecture as claimed in claim 1, characterized in that: In the spring calculation unit spring core, the number of universal calculation units UCU in each spring calculation unit is 6.
3. The fabric simulation acceleration system based on memristor in-memory computing architecture as claimed in claim 1, characterized in that: The number of the general computing units is greater than the number of springs, the number of the equation solving units is greater than the number of nodes, and the number of springs is greater than the number of nodes.
4. The fabric simulation acceleration system based on memristor in-memory computing architecture as claimed in claim 1, characterized in that: The controller controls the calculation process of all modules: the data in the RAM can be used to index the data in the CAM, the indexed value in the CAM will be sent to the ESU or UCU for calculation, the calculation result in the UCU is written into the ESU or written back to the CAM after TIA conversion, and the calculation result of the ESU is written back to the CAM after TIA conversion.
5. The fabric simulation acceleration system based on memristor in-memory computing architecture as claimed in claim 1, characterized in that: Using the analog calculation method, the output of all modules in the circuit is in the form of current, which is converted into voltage by the transimpedance amplifier TIA as the write voltage of the lower module memristor. During the circuit calculation process, the calculation result will be calculated by inputting a certain read voltage V read , the data is transferred from the memristor with a current I out It is read out in the form of a signal, then converted into a voltage signal by TIA and rewritten into the memristor.
6. A method for accelerating fabric simulation based on a memristor in-memory computing architecture, wherein the computing process is divided according to fabric image frames, and each frame image is calculated multiple times according to the step length, characterized in that: The calculation of each step size includes the following steps: S1. First, perform initialization. According to the given cloth position relationship and motion state, determine the initial position matrix X and velocity matrix V of all nodes, initialize the spring matrix spring according to the cloth material information, write the spring matrix spring into the random access memory RAM, and write the position matrix X and velocity matrix V into the content addressable memory CAM; the spring matrix spring includes the elastic coefficient of each spring, the original length of the spring, and the position information of the nodes at both ends of the spring; S2. In the force calculation stage, the number of springs is used as the parallelism. For each spring, a universal computing unit (UCU) is assigned to calculate the forces on all springs at the same time. For a single spring, the position vector Δx between the two nodes of the spring is first obtained by indexing from RAM and CAM. f and the velocity vector Δv f The readout signal exists in the form of current. After being converted by the transimpedance amplifier TIA, it is sent to the universal computing unit UCU for calculation to obtain the force matrix F and the Jacobian matrix K. The calculation result is output from the universal computing unit UCU in the form of current. After the result is converted into voltage by the transimpedance amplifier TIA, the force matrix F and the Jacobian matrix K are sent to the equation solving unit ESU; S3. In the implicit integral solution stage, the number of nodes is used as the parallelism. For each node, an equation solving unit ESU is assigned to solve the displacement and velocity changes of all nodes at the same time. For a single node, the velocity vector v of the node is first obtained by indexing from the CAM. i , and then divide the physical equations for each node, solve the physical equations of the corresponding node in the equation solving unit ESU, use the memristor array in the equation solving unit ESU to build an analog circuit, directly solve the solution of the linear equations, and calculate the position adjustment Δx required at this time i and speed adjustment Δv i , and finally adjust the position by Δx i and speed adjustment Δv i Write back the position matrix X and velocity matrix V in CAM; S4. In the collision detection phase, the number of nodes is used as the degree of parallelism. For each node, a universal computing unit (UCU) is assigned to calculate the collision of all nodes at the same time. For a single node, the position vector x of the node is first obtained from the CAM index. c , the collision distance is calculated in the universal computing unit UCU, and compared to determine whether a collision occurs. If a collision occurs, the position adjustment amount Δx required at this time is calculated in the universal computing unit UCU c and speed adjustment Δv c , and finally adjust the position by Δx c and speed adjustment Δv c Write back the position matrix X and velocity matrix V in the CAM; for points where no collision occurs, the collision adjustment amount is 0; S5. In the application of inverse dynamics, the number of springs is used as the degree of parallelism. For each spring, a universal computing unit (UCU) is assigned to calculate the forces on all springs at the same time. For a single spring, the position vector Δx between the two nodes of the spring is first calculated. a The index is obtained from the CAM and sent to the universal computing unit (UCU) to calculate the current length l of the spring, which is compared with the original length l0 of the spring read from the RAM to determine whether deformation occurs. If so, the speed adjustment Δv required at this time is calculated in the universal computing unit UCU a , and finally the speed adjustment Δv a Write back the velocity matrix V in CAM; if no deformation occurs, Δv a is 0; Steps S2-S5 complete the calculation of a step length, and calculate the changes of all node position matrix X and velocity matrix V within a step length. Multiple steps constitute a frame. Repeat steps S2-S5 multiple times to obtain a frame of image, render and draw the cloth image, and realize cloth simulation acceleration.
7. The method for accelerating fabric simulation based on memristor in-memory computing architecture as claimed in claim 6, characterized in that: In step S2, the position vector Δx between two nodes of the spring is obtained by using the RAM and CAM indexes. f and the velocity vector Δv f The method is as follows: First, obtain the node numbers of each spring from the RAM. For the two end nodes p1 and p2 obtained by the index, find the corresponding points in the CAM according to the number information. The numbers i1 and i2 of the points corresponding to the two end nodes p1 and p2 are obtained by searching. The position vectors x1 and x2 corresponding to the rows i1 and i2 in the CAM are obtained by indexing. At the same time, the position vector Δx between the two end nodes p1 and p2 is calculated by the universal computing unit UCU. f =x1-x2; In the same way, we can get the velocity vector Δv of the two end nodes f =v1-v2.
8. The method for accelerating fabric simulation based on memristor in-memory computing architecture as claimed in claim 6, characterized in that: The method of using a memristor array to build an analog circuit to solve linear equations in step S3 uses a memristor array to solve the equations using analog calculations, specifically as follows: when calculating the adjustment amount of the i-th node, it is necessary to construct a linear equation system based on the node force and the Jacobian matrix to solve the position and speed. The linear equation system is in the form of Ax+b=0, where A is a coefficient matrix, x is an unknown number, and b is a constant term; the coefficient matrix A is obtained in the following way: the mass matrix M is a diagonal matrix of size 3x3, the diagonal elements are the masses of the nodes, and the other elements are 0, which is written into the memristor array in advance and is inverted and connected to the i-th Jacobian matrix K through an operational amplifier with an amplification factor of β. i , K i is a 3x3 diagonal matrix, whose elements represent the partial derivatives of the components of the three-dimensional force in the x, y, and z directions respectively. The memristor array formed at this time can be equivalent to the coefficient matrix A i =M-βK i , β is the amplifier gain; the constant term b can be obtained by the following method: multiply the fixed matrix M by the velocity vector v of the i-th node i The resulting current, plus V read The voltage reading force matrix F is the current obtained by the i-th row of the matrix, which is equivalent to the constant term I bi =M·v i +F i ; M and K i The output current of each column is added and connected to the input of the operational amplifier. Using the amplifier virtual short principle and the node current equation, we can get A i V out +I bi =0, where the output voltage V outi is the unknown number in the original equation, representing the position adjustment Δx i According to the kinetic formula The speed adjustment Δv can be obtained i , the position adjustment amount Δx i and speed adjustment Δv i Write back the position matrix X and velocity matrix V in the CAM respectively.
9. The method for accelerating fabric simulation based on memristor in-memory computing architecture as claimed in claim 6, characterized in that: In step S5, the required speed change adjustment Δv is calculated a The method is as follows: First, get the nodes p1 and p2 at both ends of the current spring from RAM, then get the corresponding position matrix from CAM, and calculate the position vector Δx between the two points through the universal computing unit UCU. a , and then the spring length l=||Δx is calculated by the universal calculation unit UCU a ||; If l is greater than the original length of the spring l0, it is necessary to calculate the stretching distance and the speed adjustment: If node p1 is a fixed point or a boundary point, the adjustment is added to the velocity vector of another node p2. If node p2 is a fixed point or a boundary point, the adjustment is subtracted from the velocity vector of node p1. If neither node is a fixed point or a boundary point, the adjustment Δv is subtracted from the velocity vector of node p1. a , add the adjustment Δv to the velocity vector of node p2 a .
Citation Information
Patent Citations
Equation set solver based on memristor linear neural network and operation method of equation set solver
CN111460365A
Equation solver based on memristor arrays, and operation method thereof
CN111507464A
General programmable multivariate matrix equation memristor circuit implementation method and circuit
CN118227933A
Method and device for implementing a matrix operation
DE102018219313A1
Analog Co-Processor
US20170228345A1