An in-memory computing system

By designing parallel in-memory computing units, cache modules and neural network optimization modules in the in-memory computing system, the problem of difficulty in realizing parallel computing acceleration of neural networks in the existing technology is solved, and efficient data transmission and computing efficiency are achieved to meet the needs of Computational requirements of complex algorithms.

CN118626408BActive Publication Date: 2024-10-25HUAZHONG UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411088042.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-09
Publication Date
2024-10-25
Estimated Expiration
2044-08-09

AI Technical Summary

Technical Problem

Existing in-memory computing systems are difficult to achieve parallel computing acceleration of neural networks and cannot meet the computing needs of complex algorithms.

Method used

An in-memory computing system is designed, including n parallel in-memory computing units, storage modules and cache modules. It realizes efficient transmission and processing of data through the cache control unit and interconnection network structure, and supports virtual memory cache channels and dual channels. Bus, uses sparse data compression to improve transmission efficiency, and uses the neural network optimization module to perform weight compression and topology adjustment on the original neural network.

Benefits of technology

It implements a pipelined parallel computing architecture, reduces data transmission overhead, improves computing efficiency and data transmission rate, supports efficient neural network calculations, and accelerates the calculation process of complex algorithms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118626408B_ABST
    Figure CN118626408B_ABST
Patent Text Reader

Abstract

The invention discloses an in-memory computing system, belonging to the technical field of integrated circuits; the invention comprises an in-memory computing module, a storage module and a cache module; the in-memory computing module comprises n parallel in-memory computing units, which are used to realize the operations of n network layers of a preset neural network in a one-to-one correspondence; n≥1; the cache module comprises: a cache control unit, n cache channels and an interconnection network structure; when data required by an in-memory computing unit A is generated by an in-memory computing unit B, the data generated by the in-memory computing unit B is temporarily stored in the corresponding cache channel, and when the in-memory computing unit A needs it, the data is transmitted from the cache channel corresponding to the in-memory computing unit B to the cache channel corresponding to the in-memory computing unit A through the interconnection network structure, and then transmitted to the in-memory computing unit A, and the process does not need to interact through the memory module, thereby reducing the data transmission overhead, having high transmission efficiency, and improving the computing efficiency of the neural network in the in-memory computing system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of integrated circuits, and more specifically, relates to an in-memory computing system. Background Art

[0002] In recent years, with the development of artificial intelligence, computing system design faces a series of profound challenges. The complexity of neural network structure has brought better benefits, but it also greatly increases the complexity of the interaction between computing units and storage units in computing devices, and the amount of data required to be generated and calculated has increased dramatically. At the same time, different algorithms have different data flows, which brings a series of difficulties to the algorithm mapping, storage architecture, and computing architecture design of the computing system. General computing systems need to consider the reconfigurable design optimization of algorithm mapping, storage architecture, and computing architecture.

[0003] Among many computing systems, in-memory computing systems based on non-volatile memory have been widely used in the industry. Existing in-memory computing systems often support simple neural network deployments through a single in-memory computing macro. However, with the advancement of neural networks, artificial intelligence algorithms have become more complex and diverse, the number of neural network layers has greatly increased, and the interaction between storage and computing architecture has become more complex. Existing in-memory computing systems are difficult to achieve parallel computing acceleration of neural networks and cannot meet the computing requirements of complex algorithms. Summary of the invention

[0004] In view of the above defects or improvement needs of the prior art, the present invention provides an in-memory computing system to solve the technical problem that it is difficult to achieve parallel computing acceleration of neural networks in existing in-memory computing systems.

[0005] In order to achieve the above object, the present invention provides an in-memory computing system, including: an in-memory computing module, a storage module and a cache module;

[0006] The in-memory computing module includes n parallel in-memory computing units, which are used to implement the operations of n network layers of the preset neural network in a one-to-one correspondence;

[0007] The storage module is used to store the data to be calculated in n network layers; n≥1;

[0008] The cache module includes: a cache control unit, n cache channels and an interconnection network structure; the n cache channels are connected to the n in-memory computing units in a one-to-one correspondence; the interconnection network structure is used to cross-connect the n cache channels in pairs; the cache channel includes: a first input end, a first output end, a second input end and a second output end;

[0009] The cache control unit is used to obtain the downstream in-memory computing unit of each in-memory computing unit according to the data flow relationship between different network layers of the preset neural network, and then determine the downstream cache channel of each cache channel, and perform the following control:

[0010] When the storage module has i When there is data to be calculated in the network layer, control i The first cache channel obtains the first i The data to be calculated in the network layer is cached and output to the first output terminal. i In an in-memory computing unit;

[0011] In the i After the in-memory computing unit completes an operation, the control i The first buffer channel receives the i The calculation result of the in-memory computing unit is cached and transmitted to the corresponding downstream cache channel through the interconnection network structure, and output to the corresponding in-memory computing unit through the second output end of the downstream cache channel; i =1,2,...,n.

[0012] Further preferably, the cache channel is a virtual memory cache channel;

[0013] The cache control unit also stores a mapping relationship between virtual addresses and physical addresses in each cache channel, so that when the cache channel caches data, the data to be cached is cached to the corresponding physical address in the cache channel based on the mapping relationship between virtual addresses and physical addresses.

[0014] More preferably, i The cache channel and i The in-memory computing units are connected via a dual-channel bus.

[0015] Further preferably, the cache control unit obtains the first i After the data to be calculated in the first network layer, the proportion of non-zero data in the data to be calculated is calculated. If the proportion is less than the preset threshold, the data to be calculated is compressed and output to the first network layer. i Otherwise, the output is sent directly to the i In-memory computing unit;

[0016] No. i After each in-memory computing unit completes an operation, it also calculates the proportion of non-zero data in the operation result. If the proportion is less than the preset threshold, the operation result is compressed and then output to the first i cache channel; otherwise, output directly to the i cache channels;

[0017] When i After receiving the compressed data, the in-memory computing unit decompresses the received compressed data to obtain corresponding data to be calculated.

[0018] Further preferably, the storage module includes n memory blocks, which store the data to be calculated of n network layers in a one-to-one correspondence; the n cache channels are also connected to the n memory blocks in a one-to-one correspondence;

[0019] When the storage module has i When there is data to be calculated at the first network layer, the cache control unit controls the i The buffer channel is connected through its first input terminal from i Get the first i The data to be calculated for each network layer.

[0020] Further preferably, the above-mentioned in-memory computing system also includes: a neural network optimization module, used for performing weight compression on the original neural network to obtain the preset neural network.

[0021] Further preferably, the in-memory computing system further comprises: a neural network optimization module, which is used to optimize the original neural network by the following optimization method to obtain the preset neural network; wherein the above optimization method comprises:

[0022] S1, initialize the current neural network to the original neural network;

[0023] S2. Compress the weights of the current neural network and deploy it to a hardware simulation unit to obtain the current performance index of the hardware simulation unit; the hardware simulation unit is used to simulate the in-memory computing process implemented by the in-memory computing module, storage module and cache module;

[0024] S3, judging whether the first cutoff condition is met, if so, go to S4; otherwise, go to step S2 for iteration; wherein the first cutoff condition includes: the current performance index meets the performance requirement, or the number of iterations of the compression operation reaches a first preset number of iterations; the performance requirement includes: the computing power consumption is less than the preset power consumption, and the throughput is greater than the preset throughput;

[0025] S4, determining whether the second cutoff condition is met, if so, go to step S6; otherwise, go to step S5; wherein the second cutoff condition includes: the current performance index meets the performance requirement, or the number of iterations of changing the neural network topology structure reaches a second preset number of iterations;

[0026] S5, changing the topological structure of the current neural network and deploying it to the hardware simulation unit to obtain the current performance index of the hardware simulation unit, and then going to step S4;

[0027] S6. Use the current neural network as the optimized neural network.

[0028] Further preferably, the in-memory computing unit includes one processing unit or multiple parallel processing units;

[0029] When the network layer corresponding to the in-memory computing unit is a convolutional layer or a fully connected layer, the processing unit is a matrix multiplication circuit;

[0030] When the network layer corresponding to the in-memory computing unit is a pooling layer, the processing unit is a pooling circuit;

[0031] When the network layer corresponding to the in-memory computing unit is an activation layer, the processing unit is a circuit for implementing the activation function.

[0032] Further preferably, the matrix multiplication circuit comprises a digital-to-analog converter, a memristor array and an analog-to-digital converter; the output end of the memristor array is connected to the digital-to-analog converter, and the output end of the memristor array is connected to the analog-to-digital converter.

[0033] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects:

[0034] 1. The present invention provides an in-memory computing system and a pipeline parallel computing architecture, wherein the in-memory computing module includes n parallel in-memory computing units for realizing the operation of n network layers of a preset neural network in a one-to-one correspondence; the in-memory computing module is connected to the storage module through a cache module; the cache module includes: a cache control unit, n cache channels and an interconnection network structure; the n cache channels are connected to the n in-memory computing units in a one-to-one correspondence; the interconnection network structure is used to cross-connect the n cache channels in pairs; when the data required by a certain in-memory computing unit A is generated by an in-memory computing unit B, the data generated by the in-memory computing unit B is temporarily stored in the corresponding cache channel, and when the in-memory computing unit A needs it, the data is transmitted from the cache channel corresponding to the in-memory computing unit B to the cache channel corresponding to the in-memory computing unit A through the interconnection network structure, and then transmitted to the in-memory computing unit A for calculation, the process does not need to interact through the memory module, reduces the data transmission overhead, has high transmission efficiency, improves the computing efficiency of the neural network in the in-memory computing system, and solves the technical problem that it is difficult to realize parallel computing acceleration of the neural network in the existing in-memory computing system.

[0035] 2. Furthermore, in the in-memory computing system provided by the present invention, the cache channel is a virtual memory cache channel. The cache control unit continuously obtains the free physical addresses in the cache channel, generates an address mapping between the free physical addresses and the virtual addresses, and allocates the corresponding virtual address space to the data to be cached, thereby realizing the mutual conversion between virtual memory and physical memory and improving the efficiency and flexibility of data caching.

[0036] 3. Furthermore, in the in-memory computing system provided by the present invention, the cache channel and the corresponding in-memory computing unit are connected by a dual-channel bus. In this way, the in-memory computing system can separately process the transmission of input data and output data between the cache channel and the in-memory computing unit, and the output bus and the input bus can be converted to each other, which facilitates the transfer of data between different in-memory computing units, supports higher data transmission rates, and realizes high-pipelined processing.

[0037] 4. Furthermore, the in-memory computing system provided by the present invention identifies whether the data to be transmitted is sparse data during data transmission between the cache channel and the corresponding in-memory computing unit, and further improves the data transmission efficiency in the in-memory computing system by compressing the sparse data, thereby further improving the computing efficiency.

[0038] 5. Furthermore, in the in-memory computing system provided by the present invention, the storage module includes n memory blocks, which store the data to be calculated of n network layers in a one-to-one correspondence; the n cache channels are also connected to the n memory blocks in a one-to-one correspondence, thereby further reducing the interaction complexity and improving the computing efficiency.

[0039] 6. Furthermore, the in-memory computing system provided by the present invention also includes: a neural network optimization module for compressing the weights of the original neural network. By compressing the weights of the neural network, the computing speed of the neural network in the in-memory computing system can be further improved with less loss of accuracy.

[0040] 7. Furthermore, the in-memory computing system provided by the present invention also includes: a neural network optimization module for optimizing the original neural network, which optimizes the original neural network by compressing the weights of the neural network and changing the network topology; in the optimization process, the performance indicators of the neural network in the in-memory computing system are extracted by pre-simulating the optimized neural network in the hardware simulation unit to guide the optimization direction of the neural network; by opening up the path between the device structure and the network optimization, the network optimization is linked with the actual system, so that the neural network can be dynamically adjusted and adapted according to the parameters of the system's storage architecture and computing architecture, effectively improving the computing speed of the neural network in the in-memory computing system and making it more matched. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 A schematic diagram of the structure of an in-memory computing system provided by the present invention.

[0042] Figure 2 A detailed structural diagram of an in-memory computing system provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0044] In order to achieve the above object, the present invention provides an in-memory computing system, such as Figure 1 As shown, it includes: an in-memory computing module, a storage module and a cache module;

[0045] The in-memory computing module includes n parallel in-memory computing units, which are used to implement the operations of n network layers in the preset neural network in a one-to-one correspondence;

[0046] The storage module is used to store the data to be calculated of n network layers; n≥1; the data to be calculated includes: the weights in the neural network, and the input data of the neural network.

[0047] The cache module includes: a cache control unit, n cache channels and an interconnection network structure; the n cache channels are connected to the n in-memory computing units in a one-to-one correspondence; the interconnection network structure is used to cross-connect the n cache channels in pairs; the cache channel includes: a first input end, a first output end, a second input end and a second output end;

[0048] The cache control unit is used to obtain the downstream in-memory computing unit of each in-memory computing unit according to the data flow relationship between different network layers of the preset neural network, and then determine the downstream cache channel of each cache channel, and perform the following control:

[0049] When the storage module has i When there is data to be calculated in the network layer, control i The first cache channel obtains the first i The data to be calculated in the network layer is cached and output to the first output terminal. i In an in-memory computing unit;

[0050] In the i After the in-memory computing unit completes an operation, the control i The first buffer channel receives the i The calculation result of the in-memory computing unit is cached and transmitted to the corresponding downstream cache channel through the interconnection network structure, and output to the corresponding in-memory computing unit through the second output end of the downstream cache channel; i =1,2,...,n.

[0051] It should be noted that if the data required by an in-memory computing unit is generated by other in-memory computing units, the data will be marked as related data and temporarily stored in the cache channel. When other in-memory computing units need it, it will be directly output from the cache channel without passing through the memory module, reducing data transmission overhead. At the same time, the data in the cache channel will enter other cache channels through the interconnection network structure, thereby reducing the hardware requirements for data transmission between cache channels.

[0052] It should be noted that the interconnection network structure can be a variety of non-direct connection topologies such as a crossbar switch, a butterfly network, a CLOS network, a fat tree network, etc. The storage module can be a static random access memory, a dynamic random access memory, a synchronous dynamic random access memory, a ferroelectric random access memory, etc., preferably a static random access memory.

[0053] In an optional implementation, the cache channel is a virtual memory cache channel;

[0054] The cache control unit also stores a mapping relationship between virtual addresses and physical addresses in each cache channel, so that when the cache channel caches data, the data to be cached is cached to the corresponding physical address in the cache channel based on the mapping relationship between virtual addresses and physical addresses.

[0055] The cache control unit continuously obtains the free physical addresses in the cache channel, generates an address mapping between the free physical addresses and the virtual addresses, and allocates the corresponding virtual address space for the data to be cached, thereby realizing the mutual conversion between virtual memory and physical memory and improving the efficiency and flexibility of data caching.

[0056] In an optional embodiment, i The cache channel and i The in-memory computing units are connected through a dual-channel bus. In this way, the in-memory computing system can process the transmission of input data and output data separately between the cache channel and the in-memory computing unit, and the output bus and the input bus can be converted to each other, which facilitates the transfer of data between different in-memory computing units, supports higher data transmission rates, and realizes high-pipelined processing.

[0057] In an optional implementation manner, the cache control unit obtains the first i After the data to be calculated in the first network layer, the proportion of non-zero data in the data to be calculated is calculated. If the proportion is less than the preset threshold, the data to be calculated is determined to be sparse data. After compressing the data to be calculated, it is output to the first network layer. i Otherwise, the output is sent directly to the i In-memory computing unit;

[0058] No. iAfter each in-memory computing unit completes an operation, it also calculates the proportion of non-zero data in the operation result. If the proportion is less than a preset threshold, the data to be operated is determined to be sparse data, and the operation result is compressed before being output to the first i cache channel; otherwise, output directly to the i cache channels;

[0059] When i After receiving the compressed data, the in-memory computing unit decompresses the received compressed data to obtain corresponding data to be calculated.

[0060] It should be noted that the method for compressing sparse data to be calculated can adopt compressed sensing coding, sparse matrix storage format coding, data difference compression coding, etc., which is not limited here.

[0061] By compressing sparse data, the data transmission efficiency in the in-memory computing system is further improved, thereby further improving the computing efficiency.

[0062] In an optional implementation, the storage module includes n memory blocks, which store the data to be calculated of n network layers in a one-to-one correspondence; the n cache channels are also connected to the n memory blocks in a one-to-one correspondence;

[0063] When the storage module has i When there is data to be calculated at the first network layer, the cache control unit controls the i The buffer channel is connected through its first input terminal from i Get the first i The data to be calculated for each network layer.

[0064] By adopting a storage module including n memory blocks connected to n cache channels in a one-to-one correspondence, the interaction complexity is further reduced and the computing efficiency is improved.

[0065] In an optional implementation, the in-memory computing system further includes: a neural network optimization module, which is used to perform weight compression on the original neural network to obtain the preset neural network.

[0066] It should be noted that the weights of the original neural network can be compressed by network pruning, knowledge distillation, parameter quantization and other methods, which are not limited here.

[0067] By compressing the weights of the neural network, the computing speed of the neural network in the in-memory computing system can be further improved with less loss of accuracy.

[0068] In another optional implementation, the in-memory computing system further includes: a neural network optimization module, which is used to optimize the original neural network by the following optimization method to obtain the preset neural network; wherein the above-mentioned optimization method includes:

[0069] S1, initialize the current neural network to the original neural network;

[0070] S2. Compress the weights of the current neural network and deploy it to the hardware simulation unit to obtain the current performance indicators of the hardware simulation unit; the hardware simulation unit is used to simulate the in-memory computing process implemented by the in-memory computing module, storage module and cache module; the performance indicators include: computing power consumption and throughput;

[0071] It should be noted that pruning, knowledge distillation, parameter quantization and other methods can be used to compress the weights of the current neural network, which is not limited here.

[0072] S3, judging whether the first cutoff condition is met, if so, go to S4; otherwise, go to step S2 for iteration; wherein the first cutoff condition includes: the current performance index meets the performance requirement, or the number of iterations of the compression operation reaches a first preset number of iterations (in an optional implementation mode, the value is 10 times); the performance requirement includes: the computing power consumption is less than the preset power consumption, and the throughput is greater than the preset throughput;

[0073] It should be noted that the above-mentioned performance indicators may also include computing time, congestion degree of data flow scheduling, etc. When the performance indicators also include computing time, the performance requirements also include: the computing time is less than the preset computing time; when the performance indicators also include the congestion degree of data flow scheduling, the performance requirements also include: the congestion degree of data flow scheduling is less than the preset congestion degree.

[0074] S4, judging whether the second cutoff condition is met, if so, go to step S6; otherwise, go to step S5; wherein the second cutoff condition includes: the current performance index meets the performance requirement, or the number of iterations of changing the neural network topology structure reaches a second preset number of iterations (in an optional implementation mode, the value is 10 times);

[0075] S5, changing the topological structure of the current neural network and deploying it to the hardware simulation unit to obtain the current performance index of the hardware simulation unit, and then going to step S4;

[0076] S6. Use the current neural network as the optimized neural network.

[0077] The original neural network is optimized by compressing the weights of the neural network and changing the network topology. During the optimization process, the optimized neural network is pre-simulated in the hardware simulation unit and the performance indicators of the neural network in the in-memory computing system are extracted to guide the optimization direction of the neural network. By opening up the path between the device structure and the network optimization, the network optimization is linked with the actual system, so that the neural network can be dynamically adjusted and adapted according to the parameters of the system's storage architecture and computing architecture, effectively improving the computing speed of the neural network in the in-memory computing system and making it more compatible.

[0078] In an optional embodiment, the in-memory computing unit includes one processing unit or multiple parallel processing units;

[0079] When the network layer corresponding to the in-memory computing unit is a convolutional layer or a fully connected layer, the processing unit is a matrix multiplication circuit;

[0080] When the network layer corresponding to the in-memory computing unit is a pooling layer, the processing unit is a pooling circuit;

[0081] When the network layer corresponding to the in-memory computing unit is an activation layer, the processing unit is a circuit for implementing an activation function, such as a polynomial fitting circuit for implementing a Sigmoid function, an absolute value circuit for fitting a Tanh function, etc.

[0082] In an optional implementation, the matrix multiplication circuit includes a digital-to-analog converter, a nonvolatile memory array, and an analog-to-digital converter; the output end of the nonvolatile memory array is connected to the digital-to-analog converter, and the output end is connected to the analog-to-digital converter. Preferably, the nonvolatile memory array is a memristor array.

[0083] In order to further illustrate the in-memory computing system provided by the present invention, a detailed description is given below in conjunction with an embodiment:

[0084] In this embodiment, Figure 2 As shown, the in-memory computing system includes: an in-memory computing module, a storage module and a cache module;

[0085] Before the in-memory computing system is run, the module characteristics, weight parameters, and computing system parameters of the original neural network are taken as input through the optimization module, and the optimized neural network is taken as output to train the neural network that can be mapped to the in-memory computing system.

[0086] The optimization module in this embodiment includes: a hardware simulation unit, a weight compression unit and a fusion reconstruction unit;

[0087] For hardware emulation units:

[0088] The hardware simulation unit is built according to the extracted hardware parameters of the in-memory computing system and is used to simulate the in-memory computing system to obtain a series of performance indicators such as computing time, computing power consumption, throughput, and congestion degree of data flow scheduling.

[0089] In this embodiment, the computing architecture of the in-memory computing system includes n×m processing units, and each row of m processing units processes one network layer of the neural network. The in-memory computing system can process n network layers in parallel. In this embodiment, n=m=8.

[0090] In this embodiment, the PyTorch deep learning framework is used to model the convolutional neural network and construct a specific convolutional neural network for image recognition. By automatically adjusting the hyperparameters of the model, the recognition accuracy of the neural network is improved when it is initially constructed. In this embodiment, a neural network for image recognition is trained and constructed based on Pytorch with a total of 16 layers, including 10 convolutional layers and 6 fully connected layers.

[0091] For weight compression units:

[0092] The weight compression unit is used to compress the weights of the neural network. Specifically, according to the different modules of the neural network, a mixed precision quantization strategy is used to compress the values ​​of the weights of the original neural network. Through the strategies of random pruning and reinforcement learning, the weights of the neural network are iteratively compressed layer by layer, thereby quantizing the entire neural network.

[0093] In this embodiment, for the first k (the value is 4 in this embodiment) network layers in the neural network, the corresponding weights are quantized with low precision; the corresponding weights of the following Nk network layers are quantized with high precision; k is the preset number of layers; N is the total number of layers in the neural network. Through the dynamic pruning method, the connections with smaller weight values ​​are deleted; at the same time, structured pruning is performed: specific convolution kernels are deleted, the size of the convolution kernel is reduced, the size of the pooling layer is increased, and the step size is increased, thereby reducing the amount of calculation. Through this method, the network is compressed into 8 layers, including 5 convolution layers and 3 fully connected layers; at this time, the above N value is 8.

[0094] It should be noted that this part is a pre-training preparation for the next step of changing the network topology. By means of compression and pruning, the parameters of the neural network can be reduced, the structure of the neural network can be simplified, and the topology of the neural network can be changed in the next step. The network compression method needs to ensure that the network is consistent with the original network in function, and at the same time, the network needs to be pre-adapted to the hardware architecture. In this embodiment, network compression will delete some convolution kernels and compress network weights according to the 8-layer row parallel structure and bus structure of the in-memory computing system, so as to match the network's computing parameters with the configurable computing accuracy of the non-volatile device as much as possible.

[0095] It should be noted that the above neural network can be a variety of neural networks such as convolutional neural networks, pulse neural networks, feedforward neural networks, etc., which are not limited here. The parameters of the neural network include the number of network layers, network topology and weight parameters. The parameters required by the hardware simulation unit include storage architecture scale, storage module parameters, computing architecture scale, non-volatile device array scale, transmission bus bandwidth, etc.

[0096] For the fusion reconstruction unit:

[0097] The fusion reconstruction unit is connected after the weight compression unit. After the weight compression is completed, the number of parameters of the neural network is reduced, but the network topology remains unchanged. The fusion reconstruction unit deploys the compressed neural network in the hardware simulation unit, and when the performance indicators do not meet the requirements, the network topology can be changed during the deployment process to make the network structure adapt to the computing system.

[0098] It should be noted that the fusion reconstruction unit can change the network topology so that the neural network can achieve the best hardware adaptation structure. This step is achieved by finding the key path of the network and changing the connection method of the network, such as adjusting the order of convolutional layers and fully connected layers in the convolutional neural network, or changing the weight bias, so that the neural network architecture can better match the hardware architecture, allowing the neural network to better realize fully parallel computing in hardware.

[0099] Specifically, after completing weight compression, the fusion reconstruction unit deploys the compressed neural network in the hardware simulation unit, and obtains the power consumption, computing power, energy consumption and other performance indicators of the neural network running on the in-memory computing system through the hardware simulation unit. If it is judged that the performance indicators do not meet the requirements, the topological results of the neural network are changed and redeployed to the hardware simulation unit, and the computing power, energy consumption, throughput and other performance indicators of the neural network running on the in-memory computing system are obtained again. The process of changing the topological results of the neural network and redeploying it to the hardware simulation unit is repeated for iteration until the performance indicators meet the requirements or the number of iterations reaches the preset number of times; if the performance indicators meet the requirements, the optimization of the neural network is completed. If the number of iterations reaches the preset number of times, but the performance indicators do not meet the requirements, the current optimized neural network is re-input into the weight compression unit for optimization until the performance indicators meet the requirements. At this time, the neural network is a neural network with the best topological structure, and then the compressed and reconstructed neural network is adapted to the specific hardware architecture. According to the hardware simulation unit, the control instructions required for the storage architecture and the computing architecture to work are generated, and the data flow path and the compilation timing control signal are optimized. First, the network structure information in the hardware simulation unit is extracted to generate computing instructions adapted to 8×8 processing units. These instructions cover specific operations such as convolution calculations, pooling operations, and fully connected calculations. Secondly, optimize the data flow path to ensure that data can be efficiently transmitted between different processing units and storage modules. Utilize the cache channel and interconnection network structure to design a data flow mapping scheme to ensure that data from adjacent network layers can be exchanged between different cache channels through ping-pong operations. Finally, compile the timing control signals to ensure that all calculations and data transfer operations can be performed in a predetermined order. Timing control also needs to ensure that the clock signals of all processing units and storage modules are synchronized and coordinate the parallel calculations of multiple processing units. The compilation tool chain will generate the final hardware execution code, integrating high-level control instructions, optimized data flows, and timing control signals to generate hardware executable machine code.

[0100] The in-memory computing system provided in this embodiment is based on a reconfigurable computing array including n×m processing units. After the preset neural network is confirmed, a row of m processing units jointly completes the operation of a network layer of the preset neural network, and different rows process the operation of different network layers. A dual-channel bus is set in the row to handle the transmission of input data and output data respectively, and the output bus and the input bus can be converted to each other, which facilitates the transfer of data between layers, supports higher data transmission rates, and realizes high pipeline processing.

[0101] Processing unit, used to complete the calculation of the network layer in the neural network,

[0102] When the network layer corresponding to the in-memory computing unit is a convolutional layer or a fully connected layer, the processing unit is a matrix multiplication circuit; in this embodiment, the matrix multiplication circuit includes a digital-to-analog converter, a memristor array, and an analog-to-digital converter; the output end of the memristor array is connected to the digital-to-analog converter, and the output end is connected to the analog-to-digital converter. When each processing unit can also dynamically adjust the calculation accuracy according to network requirements, at this time, the matrix multiplication circuit also includes a corresponding shift accumulation unit for realizing analog matrix operations with reconfigurable accuracy.

[0103] When the network layer corresponding to the in-memory computing unit is a pooling layer, the processing unit is a pooling circuit;

[0104] When the network layer corresponding to the in-memory computing unit is an activation layer, the processing unit is a circuit for implementing the activation function.

[0105] In addition, the processing unit also includes a communication unit for connecting to a dual-channel bus, receiving input data and outputting operation results.

[0106] Taking the network layer corresponding to the in-memory computing unit as a convolutional layer or a fully connected layer as an example, the weights required by the neural network are input into the storage array of all processing units, and then calculated according to the compiled data flow and timing flow. Data is communicated between the computing architecture and the storage architecture through the cache module.

[0107] The compressed and reconstructed neural network weights are loaded into the storage array. The specific process includes: extracting weights from the compressed and reconstructed neural network weights, distributing them to the memristor array of each processing unit, and ensuring the correct storage of weight data in the hardware system. Next, according to the generated control instructions, data flow and timing control signals, the neural network calculations are started.

[0108] The cache module uses an interconnected network structure at the hardware level to achieve efficient data transmission, making data exchange between any row processing units more flexible. At the same time, through the cache channel, the associated data between different rows can be directly exchanged without passing through the memory module. In this way, the calculations of each layer of the neural network can be carried out in parallel, improving the calculation efficiency. Throughout the process, the timing control signal ensures that the operations of each computing unit and storage unit are carried out synchronously to avoid data transmission congestion and calculation delays.

[0109] Specifically, data between the cache channel and the in-memory computing unit is transmitted in the form of a data packet, which includes a frame header, a data portion, and a frame trailer. The frame header stores the data format, the current cache channel sequence number, the sequence number of the next in-memory computing unit, and the computing format configuration.

[0110] After receiving the data transmitted from the cache channel, the in-memory computing unit identifies the serial number p of the next in-memory computing unit in the data packet frame header, controls the p-th cache channel to receive the calculation result of the in-memory computing unit through its second input end and the interconnection network structure, and changes the corresponding in-memory computing unit and calculation format configuration in the data packet frame header.

[0111] The cache channel in this embodiment is a virtual memory cache channel; the cache control unit also stores a mapping relationship between virtual addresses and physical addresses in each cache channel, so that when the cache channel caches data, the data to be cached is cached to the corresponding physical address in the cache channel based on the mapping relationship between virtual addresses and physical addresses.

[0112] After the calculation process of the neural network is completed, the system will output the processing results. The specific process includes: first, the final calculation results are extracted from the storage array of each processing unit through the cache channel and the interconnection network structure. Then, the processing results are transmitted to the output storage module or the external interface. For image recognition tasks, these results are usually classification results or feature extraction results. During the output process, the integrity and accuracy of data transmission are ensured to avoid data loss or mistransmission. Finally, the results are transmitted to external devices or storage media through the system interface for further processing or analysis. The entire output process needs to maintain the synchronization and efficiency of the system to ensure that the processing results can be quickly and accurately transmitted to the target location. In this way, the entire process from input data, calculation processing to result output is completed, and the efficient mapping and operation of neural networks in the in-memory computing system is realized.

[0113] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. An in-memory computing system, characterized in that: include: In-memory computing module, storage module and cache module; The in-memory computing module includes n parallel in-memory computing units, which are used to implement the calculation of n network layers of the preset neural network in a one-to-one correspondence; The storage module is used to store the data to be calculated of n network layers; n≥1; The cache module comprises: a cache control unit, n cache channels and an interconnection network structure; the n cache channels are connected to the n in-memory computing units in a one-to-one correspondence; the interconnection network structure is used to cross-connect the n cache channels in pairs; the cache channel comprises: a first input end, a first output end, a second input end and a second output end; The cache control unit is used to obtain the downstream in-memory computing unit of each in-memory computing unit according to the data flow relationship between different network layers of the preset neural network, and then determine the downstream cache channel of each cache channel, and perform the following control: When the storage module has i When there is data to be calculated in the network layer, control i The cache channel obtains the first i The data to be calculated in the network layer is cached and output to the first output terminal. i In an in-memory computing unit; In the i After the in-memory computing unit completes an operation, the control i The cache channel receives the first i The calculation result of the in-memory computing unit is cached, transmitted to the corresponding downstream cache channel through the interconnection network structure, and output to the corresponding in-memory computing unit through the second output end of the downstream cache channel; i= 1,2 ,..., n.

2. The in-memory computing system according to claim 1, characterized in that: The cache channel is a virtual memory cache channel; The cache control unit also stores a mapping relationship between virtual addresses and physical addresses in each cache channel, so that when caching data in the cache channel, the data to be cached is cached to the corresponding physical address in the cache channel based on the mapping relationship between virtual addresses and physical addresses.

3. The in-memory computing system according to claim 1, characterized in that: No. i The cache channel and i The computing units in the memory are connected through a dual-channel bus.

4. The in-memory computing system according to claim 1, characterized in that: The cache control unit obtains the first i After the data to be calculated in the first network layer, the proportion of non-zero data in the data to be calculated is calculated. If the proportion is less than the preset threshold, the data to be calculated is compressed and output to the first network layer. i Otherwise, the output is sent directly to the i In-memory computing unit; No. i After each in-memory computing unit completes an operation, it also calculates the proportion of non-zero data in the operation result. If the proportion is less than the preset threshold, the operation result is compressed and then output to the first i cache channels; Otherwise, directly output to i cache channels; When i After receiving the compressed data, the in-memory computing unit decompresses the received compressed data to obtain corresponding data to be calculated.

5. The in-memory computing system according to claim 1, characterized in that: The storage module includes n memory blocks, which store the data to be calculated of n network layers in a one-to-one correspondence; the n cache channels are also connected to the n memory blocks in a one-to-one correspondence; When the storage module has i When there is data to be calculated on the first network layer, the cache control unit controls the i The buffer channel is connected through its first input terminal from i Get the first i The data to be calculated for each network layer.

6. The in-memory computing system according to claim 1, characterized in that: The in-memory computing unit includes one processing unit or multiple parallel processing units; When the network layer corresponding to the in-memory computing unit is a convolutional layer or a fully connected layer, the processing unit is a matrix multiplication circuit; When the network layer corresponding to the in-memory computing unit is a pooling layer, the processing unit is a pooling circuit; When the network layer corresponding to the in-memory computing unit is an activation layer, the processing unit is a circuit for implementing an activation function.

7. The in-memory computing system according to claim 6, characterized in that: The matrix multiplication circuit comprises a digital-to-analog converter, a memristor array and an analog-to-digital converter; the output end of the memristor array is connected to the digital-to-analog converter, and the output end is connected to the analog-to-digital converter.

8. The in-memory computing system according to any one of claims 1 to 7, characterized in that: It also includes a neural network optimization module, which is used to perform weight compression on the original neural network to obtain the preset neural network.

9. The in-memory computing system according to any one of claims 1 to 7, characterized in that: It also includes a neural network optimization module, which is used to optimize the original neural network through the following optimization method to obtain the preset neural network; wherein the optimization method includes: S1, initialize the current neural network to the original neural network; S2, compressing the weights of the current neural network and deploying it to a hardware simulation unit to obtain current performance indicators of the hardware simulation unit; the hardware simulation unit is used to simulate the in-memory computing process implemented by the in-memory computing module, the storage module and the cache module; the performance indicators include: computing power consumption and throughput; S3, judging whether the first cutoff condition is met, if so, go to S4; otherwise, go to step S2 for iteration; wherein the first cutoff condition includes: the current performance index meets the performance requirement, or the number of iterations of the compression operation reaches a first preset number of iterations; the performance requirement includes: the computing power consumption is less than the preset power consumption, and the throughput is greater than the preset throughput; S4, determining whether the second cutoff condition is met, if so, go to step S6; otherwise, go to step S5; wherein the second cutoff condition includes: the current performance index meets the performance requirement, or the number of iterations of changing the neural network topology structure reaches a second preset number of iterations; S5, changing the topological structure of the current neural network and deploying it to the hardware simulation unit to obtain the current performance index of the hardware simulation unit, and then going to step S4; S6. Use the current neural network as the optimized neural network.