Calculation hardware architecture of neural network accelerator and control method
By combining near-memory tensor multiplication hardware and general computing hardware in the neural network accelerator, and utilizing internal cache units and specific computing circuits, tensor multiplication calculations are optimized, solving the efficiency and bandwidth limitations of traditional platforms in efficiently processing high-dimensional data. problem, achieving efficient neural network computation.
Patent Information
- Application Number
- CN202411037077.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-08-30
AI Technical Summary
Existing computing platforms, especially CPUs and GPUs based on traditional architectures, are difficult to achieve optimal efficiency when performing complex tensor calculations, especially when processing high-dimensional data, and are limited by memory bandwidth, resulting in limited improvement in computing speed. limit.
Design a computing hardware architecture for a neural network accelerator, which uses near-memory tensor multiplication hardware combined with general computing hardware to reduce the frequency of memory access through an internal cache unit, and optimizes tensor operations through specific computing circuits to achieve tensor multiplication reduction. Dimension calculation.
It significantly improves the efficiency of tensor calculations, reduces data transmission requirements, reduces bandwidth pressure, and can flexibly handle diverse neural network computing tasks, improving the utilization of hardware resources.
Smart Images

Figure CN118569330A
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of neural network accelerators, and more particularly to a computing hardware architecture and a control method of a neural network accelerator. Background Art
[0002] As a key technology in the field of artificial intelligence, neural networks play an important role in many fields such as image recognition, natural language processing, and data mining. However, as the scale and depth of neural network models continue to expand, the demand for computing power has also increased dramatically. Existing computing platforms, especially CPUs and GPUs based on traditional architectures, face multiple technical bottlenecks.
[0003] Although CPUs and GPUs perform well in a variety of computing tasks, they are not designed for large-scale tensor operations in neural networks. These platforms often fail to achieve optimal computational efficiency when performing complex tensor calculations, especially when processing high-dimensional data. Secondly, existing computing platforms are often limited by memory bandwidth, which is particularly evident when performing large-scale data parallel processing. Data transmission becomes a bottleneck that restricts performance and limits the improvement of computing speed. Although there are some hardware accelerators designed specifically for neural network computing on the market, they often have difficulty striking a balance between versatility and specialization. Although specialized hardware performs well on specific tasks, it lacks flexibility and is difficult to adapt to changing algorithm requirements. Summary of the invention
[0004] The purpose of the embodiment of the present invention is to provide a computing hardware architecture and control method of a neural network accelerator. The implementation of the embodiment of the present invention can improve the efficiency of tensor computing and reduce bandwidth pressure.
[0005] To achieve the above objectives, in a first aspect, an embodiment of the present invention provides a computing hardware architecture of a neural network accelerator, and the technical solution adopted is: at least one memory; Near-memory tensor multiplication hardware; General purpose computing hardware; among which, The near memory tensor multiplication hardware receives input from the memory and the general computing hardware through a data transmission path, and performs tensor multiplication dimension reduction calculation; The output result of the near memory tensor multiplication hardware is transmitted to the memory and the general computing hardware through the data transmission path; The memory and general computing hardware transmit data through a data transmission path.
[0006] As a further improvement of the present application, the near memory tensor multiplication hardware includes: The internal interface of the memory is used to exchange data with the memory; A tensor multiplication calculation circuit is connected to the internal interface of the memory and the external interface of the memory to perform tensor multiplication dimension reduction calculation; Memory external interface used to exchange data with general computing hardware.
[0007] As a further improvement of the present application, the near memory tensor multiplication hardware further includes: The internal cache unit is used to temporarily store the intermediate data in the tensor multiplication and dimension reduction calculation process to reduce the access frequency to the memory and improve the data exchange efficiency; among them, The internal cache unit is connected to the tensor multiplication calculation circuit, the internal interface of the memory and the external interface of the memory through data transmission paths, so that data can be processed and transmitted in the near-memory tensor multiplication hardware.
[0008] As a further improvement of the present application, the internal cache unit is connected to the tensor multiplication calculation circuit, the memory internal interface and the memory external interface respectively through a data transmission path, including: The internal cache unit receives input data from the internal interface of the memory and temporarily stores the input data; The tensor multiplication calculation circuit requests data from the internal cache unit and performs tensor multiplication dimension reduction calculation; The calculation result of the tensor multiplication dimensionality reduction calculation is output by the tensor multiplication calculation circuit to the internal cache unit, and is sent to the general computing hardware or written back to the memory through the external memory interface.
[0009] As a further improvement of the present application, the internal cache unit is connected to the tensor multiplication calculation circuit, the memory internal interface and the memory external interface respectively through a data transmission path, including: The internal cache unit receives the intermediate data processed by the tensor multiplication calculation circuit and stores the intermediate data; The internal memory interface obtains data from the internal cache unit and outputs it according to the request of the general computing hardware; The internal cache unit transmits the final output result of the tensor multiplication calculation circuit to the external memory interface.
[0010] As a further improvement of the present application, the internal cache unit is connected to the tensor multiplication calculation circuit, the memory internal interface and the memory external interface respectively through a data transmission path, including: The internal cache unit receives the raw data from the internal interface of the memory, performs preliminary processing and transmits it to the tensor multiplication calculation circuit; The output result of the tensor multiplication calculation circuit is stored in the internal cache unit, and the data is sent to the memory or to the general computing hardware through the external interface of the memory according to the control logic.
[0011] As a further improvement of the present application, the near memory tensor multiplication hardware further includes a specific computing circuit; The specific computing circuit is connected to the internal cache unit and is used to perform specific tensor operations or format conversions to optimize the performance of the tensor multiplication computing circuit; The specific computing circuit receives the intermediate data from the internal cache unit and outputs the processed data to the tensor multiplication computing circuit.
[0012] As a further improvement of the present application, the specific calculation circuit further includes: The specific computing circuit receives the output result of the tensor multiplication computing circuit; The output result is stored in an internal cache unit or sent to general computing hardware through an external memory interface.
[0013] In a second aspect, an embodiment of the present invention provides a method for controlling a computing hardware architecture of a neural network accelerator, and the technical solution adopted is: receiving data from at least one memory via a memory internal interface; temporarily storing the received data in an internal cache unit in the near memory tensor multiplication hardware; requesting data from an internal cache unit and providing it to a tensor multiplication computation circuit; performing a tensor multiplication dimension reduction calculation in a tensor multiplication calculation circuit; Store the calculation results back to the internal cache unit; Depending on the control logic, the result data is sent to the general computing hardware through the memory external interface or written back to the memory.
[0014] As a further improvement of the present application, it also includes: performing pre-processing or post-processing operations on the intermediate data in the internal cache unit through a specific computing circuit; transmitting the pre-processed or post-processed data to a tensor multiplication calculation circuit; performing a computation operation according to the optimized tensor operation in a tensor multiplication computation circuit; Storing the results of the optimization calculation into an internal cache unit; The result data is sent to the general-purpose computing hardware through the external memory interface as needed, or written back to the memory through the internal memory interface.
[0015] The above embodiments of the present invention at least include the following beneficial effects: Through the design of near-memory tensor multiplication hardware, special optimization of tensor multiplication dimensionality reduction calculations is achieved, which significantly improves computing efficiency; the use of internal cache units reduces the frequency of access to central memory, thereby reducing the demand for data transmission and alleviating bandwidth pressure; combined with general-purpose computing hardware, this architecture can flexibly handle diverse tasks in neural network calculations, including non-tensor multiplication operations; through specific computing circuits, the hardware can perform more specific operations, improving the utilization of hardware resources.
[0016] In addition, the invention summary does not list all the features required for the embodiments of the present invention, and other combinations of these feature groups can also become embodiments of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the background technology, the drawings required for use in the embodiments of the present invention or the background technology will be described below.
[0018] Figure 1 is a schematic diagram of the computing hardware architecture structure of a neural network accelerator in an embodiment of the present invention; Figure 2 is a schematic diagram of the computing hardware architecture structure of another neural network accelerator in an embodiment of the present invention; Figure 3 It is a flowchart of a computing hardware architecture structure of a neural network accelerator in an embodiment of the present invention; Figure 4 is a schematic diagram of the computing hardware architecture structure of another neural network accelerator in an embodiment of the present invention; Figure 5 is a flowchart of another computing hardware architecture of a neural network accelerator in an embodiment of the present invention; Figure 6 is a schematic diagram of the computing hardware architecture structure of another neural network accelerator in an embodiment of the present invention; Figure 7 is a flowchart of another computing hardware architecture of a neural network accelerator in an embodiment of the present invention; Figure 8 is a schematic diagram of the computing hardware architecture structure of another neural network accelerator in an embodiment of the present invention; Fig. 9 It is a flowchart diagram of another computing hardware architecture structure of a neural network accelerator in an embodiment of the present invention; Fig.10 is a schematic diagram of the computing hardware architecture structure of another neural network accelerator in an embodiment of the present invention; Fig.11 It is a flowchart diagram of another computing hardware architecture structure of a neural network accelerator in an embodiment of the present invention; Fig.12 It is a schematic diagram of the application of the artificial neural network algorithm in the dimension reduction computing architecture in the embodiment of the present invention. DETAILED DESCRIPTION
[0019] In order to make the technical means, creative features, objectives and effects achieved by the embodiments of the present invention easy to understand, the embodiments of the present invention are further described below in combination with diagrams and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the embodiments of the present invention and are not used to limit the embodiments of the present invention.
[0020] It should be understood that in this application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0021] Reference below Figure 1 , Figure 1 A schematic diagram of a computing hardware architecture of a neural network accelerator provided by an embodiment of the present invention. Figure 1 As shown, a computing hardware architecture of a neural network accelerator includes: at least one memory; Near-memory tensor multiplication hardware; General purpose computing hardware; among which, The near memory tensor multiplication hardware receives input from the memory and the general computing hardware through a data transmission path, and performs tensor multiplication dimension reduction calculation; The output result of the near memory tensor multiplication hardware is transmitted to the memory and the general computing hardware through the data transmission path; The memory and general computing hardware transmit data through a data transmission path.
[0022] It should be noted that the computing hardware architecture of a neural network accelerator of the present invention combines general computing hardware and near-memory tensor multiplication hardware, and can be applied to accelerate the calculation of neural networks. In this architecture, the computing tasks of the neural network are divided into two parts: tensor multiplication calculation and non-tensor multiplication calculation. Tensor multiplication calculation is mainly performed in near-memory tensor multiplication hardware, while other types of calculations are completed by general computing hardware.
[0023] Near memory tensor multiplication hardware receives input data from memory and general computing hardware, and is specifically responsible for performing tensor multiplication dimensionality reduction calculations. Input data is transmitted through a specific data transmission path to ensure efficient data flow. Near memory tensor multiplication hardware can optimize the data flow of tensor operations, reduce data transmission volume, and improve computing performance.
[0024] The near-memory tensor multiplication hardware can be connected to the memory and general-purpose computing hardware through a specific data transfer path to achieve efficient data exchange. In this process, tensor 2 is used as the main input data and is transferred from the memory to the near-memory tensor multiplication hardware through the near-memory data transfer path. At the same time, tensor 1 is transferred to the general-purpose computing hardware through the ordinary data transfer path, and may be further transferred to the near-memory tensor multiplication hardware when necessary.
[0025] After receiving tensor 2, the near memory tensor multiplication hardware performs a multiplication operation with tensor 1. Tensor 1 may have been stored in general computing hardware or passed in through a common data transmission path. In some embodiments, tensor 1 may also be directly transmitted to the near memory tensor multiplication hardware through a specific data transmission path.
[0026] During the multiplication operation, the intermediate data generated can be temporarily stored in the internal cache unit of the near memory tensor multiplication hardware. This design allows further processing of the intermediate data, such as tensor operations or format conversion of specific computing circuits, to optimize performance. After the multiplication operation is completed, the resulting tensor 3 is the result of the operation. The data size of tensor 3 is designed to be less than or equal to the largest data size in the input tensor, which helps reduce the burden of subsequent data transmission.
[0027] Tensor 3 can be selectively transferred back to the memory via the near memory data transfer path, or sent to general computing hardware via data transfer path 3 as required by the computational process. This flexibility reduces the amount of data transferred on the normal data path because the entire tensor 2 no longer needs to be transferred.
[0028] The collaboration between the near-memory tensor multiplication hardware and general-purpose computing hardware is achieved through data transmission paths 2 and 3. This design ensures the efficiency and smoothness of the entire system when processing neural network computing tasks. By reducing the amount of data transmission and optimizing tensor multiplication operations, the near-memory tensor multiplication hardware significantly improves computing performance while reducing the demand for memory and general-purpose computing hardware bandwidth.
[0029] Specifically, the data provided by the memory to the tensor multiplication and dimensionality reduction computing hardware is transmitted through the near memory data transmission path, while the data sent by the general computing hardware to the tensor multiplication and dimensionality reduction computing hardware is transmitted through the data transmission path 1. After the calculation is completed, the result can be returned through the same path, that is, the output data is sent back to the memory through the near memory data transmission path, or sent to the general computing hardware through the data transmission path 1. In addition, data is exchanged between the memory and the general computing hardware through the data transmission path 2.
[0030] In some embodiments, the memory unit is used to store the parameters and intermediate calculation results of the neural network model. The memory can be a static random access memory (SRAM), a dynamic random access memory (DRAM) or other types of high-performance storage devices.
[0031] Preferably, the near memory tensor multiplication hardware is connected to the memory and is responsible for performing tensor multiplication operations. The general computing hardware is composed of a general processor such as a CPU or a GPU, and is used to handle other computing tasks besides tensor multiplication, such as control flow operations, nonlinear activation functions, etc.
[0032] Data transfer pathways form a network of connections between components, allowing data to be efficiently transferred between memory, near-memory tensor multiplication hardware, and general-purpose computing hardware. These pathways are channels for data flow in the hardware architecture, ensuring the continuity and real-time nature of the computing process.
[0033] Furthermore, the near memory tensor multiplication hardware includes: The internal interface of the memory is used to exchange data with the memory; The tensor multiplication calculation circuit is connected to the internal interface of the memory and the external interface of the memory to perform tensor multiplication dimension reduction calculation; the external interface of the memory is used to exchange data with general computing hardware.
[0034] like Figure 2 As shown. In some embodiments, the internal memory interface is used for data exchange between the near-memory tensor multiplication hardware and the memory, reading necessary input data from the memory and writing result data back to the memory after the calculation is completed. The internal memory interface is designed to have high bandwidth to support fast data transfer rates, ensuring that the tensor multiplication calculation circuit can obtain and feedback data in a timely manner.
[0035] The tensor multiplication calculation circuit is used to perform tensor multiplication dimension reduction calculations. It is connected to the internal interface of the memory, receives input data, and performs necessary mathematical operations. The design of the tensor multiplication calculation circuit can optimize the performance of tensor operations and support high-efficiency parallel processing capabilities.
[0036] The memory external interface is used to exchange data with the general computing hardware, receive output data from the tensor multiplication calculation circuit, and transmit the data to the general computing hardware for further processing or analysis. At the same time, the memory external interface also allows the general computing hardware to send control signals or additional input data to the tensor multiplication calculation circuit.
[0037] For example, Figure 3 The workflow of the computing hardware architecture of a neural network accelerator of the present invention includes: First, the neural network computing task is decomposed into two parts: tensor multiplication calculation and non-tensor multiplication calculation. Then, the tensor multiplication dimensionality reduction calculation task is assigned to the near-memory tensor multiplication hardware for execution, while the general-purpose computing hardware is responsible for handling the remaining computing tasks. During the execution process, the tensor multiplication dimensionality reduction computing hardware receives input data from the memory and the general-purpose computing hardware, and after completing the calculation, sends the output data to the memory or the general-purpose computing hardware. At the same time, the general-purpose computing hardware also receives input data from the memory and the near-memory tensor multiplication hardware, performs the corresponding computing tasks, and sends the result data to the memory or the near-memory tensor multiplication hardware. It can be understood that this process is continuous until all the computing tasks of the neural network are completed.
[0038] Furthermore, in the near-memory tensor multiplication hardware, data is first read from the memory through the memory internal interface and then transferred to the tensor multiplication calculation circuit for calculation. After the calculation is completed, the result is sent to the general computing hardware through the memory external interface. In addition, the general computing hardware can also send data requests or control instructions to the tensor multiplication calculation circuit through the memory external interface to coordinate the entire calculation process.
[0039] The near memory tensor multiplication hardware also includes: an internal cache unit for temporarily storing intermediate data in the tensor multiplication dimension reduction calculation process to reduce the access frequency to the memory and improve the data exchange efficiency; wherein, The internal cache unit is connected to the tensor multiplication calculation circuit, the internal interface of the memory and the external interface of the memory through data transmission paths, so that data can be processed and transmitted in the near-memory tensor multiplication hardware.
[0040] The internal cache unit temporarily stores the intermediate data generated during the tensor multiplication dimension reduction calculation process, effectively reducing the frequency of access to the memory, thereby significantly improving the efficiency of data exchange. This function of the internal cache unit is crucial to optimizing the performance of the entire hardware architecture. At the beginning of the data flow, the internal interface of the memory receives the original input data from the memory and transfers this data to the internal cache unit. The internal cache unit temporarily stores this data in preparation for the subsequent tensor multiplication calculation. Subsequently, according to the requirements of the tensor multiplication calculation circuit, the internal cache unit sends the input data to be calculated to the tensor multiplication calculation circuit through the data transmission path.
[0041] The tensor multiplication circuit receives data from the internal cache unit and performs the necessary calculation tasks. After the calculation is completed, the original output data is sent back to the internal cache unit, at which time the internal cache unit plays its role again and temporarily stores these calculation results.
[0042] The internal cache unit can send data to the external memory interface through the data transmission path according to the control logic of the system. This step involves a decision-making process, and the internal cache unit needs to determine whether to store the data back to the memory or whether further tensor multiplication calculations are required. If necessary, the data may re-enter the tensor multiplication calculation circuit; if not, the data will be sent to the general computing hardware through the external memory interface, or stored back to the memory.
[0043] Throughout the process, the connection between the internal cache unit and the tensor multiplication calculation circuit, the internal memory interface and the external memory interface ensures efficient processing and transmission of data in the near-memory tensor multiplication hardware. This design not only improves computing performance, but also reduces system energy consumption by reducing memory access and improves overall data processing capabilities.
[0044] like Figure 4 The internal cache unit is connected to the tensor multiplication calculation circuit, the internal memory interface and the external memory interface through a data transmission path, including: The internal cache unit receives input data from the internal interface of the memory and temporarily stores the input data; The tensor multiplication calculation circuit requests data from the internal cache unit and performs tensor multiplication dimension reduction calculation; The calculation result of the tensor multiplication dimensionality reduction calculation is output by the tensor multiplication calculation circuit to the internal cache unit, and is sent to the general computing hardware or written back to the memory through the external memory interface.
[0045] The internal cache unit first receives the original input data from the internal interface of the memory and temporarily stores it. Subsequently, the tensor multiplication calculation circuit requests this data from the internal cache unit for tensor multiplication dimensionality reduction calculation. After the calculation is completed, the tensor multiplication calculation circuit outputs the result data (tensor 3) back to the internal cache unit. According to the control logic of the system, the internal cache unit sends these results to the general computing hardware through the external interface of the memory, or directly writes them back to the memory.
[0046] like Figure 5 As shown. The tensor multiplication calculation circuit requests the required data from the internal cache unit according to the requirements of the calculation task. The internal cache unit responds to these requests and provides the corresponding input data to the tensor multiplication calculation circuit. After the calculation is completed, the tensor multiplication calculation circuit outputs the calculation results, and these results are sent back to the internal cache unit again. Here, the data is temporarily stored and prepared for the next step of processing or transmission. Then, the internal cache unit sends the data to the general computing hardware through the external interface of the memory for further calculation processing according to the control logic and decision of the system, or writes the data back to the memory for storage as needed.
[0047] like Figure 6 As shown. The function of the internal cache unit is extended to store the intermediate data processed by the tensor multiplication calculation circuit. These intermediate data may require further processing or can be obtained by the general computing hardware upon request. The internal memory interface reads the required data from the internal cache unit and outputs it according to the request of the general computing hardware. Finally, after the tensor multiplication calculation circuit completes all the calculation steps, the final output result is transmitted to the internal cache unit, and then the internal cache unit sends it to the general computing hardware through the external memory interface.
[0048] like Figure 7 As shown in the figure, the system receives the neural network model data as input, and the data is split into tensor multiplication calculation and non-tensor multiplication calculation. The original input data in the memory is transferred to the internal cache unit, and the internal cache unit sends the data to the tensor multiplication calculation circuit.
[0049] The raw output data after calculation is directly transmitted to the general-purpose computing hardware. The general-purpose computing hardware decides whether to store the data back to the memory as needed. The general-purpose computing hardware is also responsible for deciding whether tensor multiplication calculations need to be performed again.
[0050] Preferably, the internal cache unit is connected to the tensor multiplication calculation circuit, the memory internal interface and the memory external interface respectively through a data transmission path, including: The internal cache unit receives the raw data from the internal interface of the memory, performs preliminary processing and transmits it to the tensor multiplication calculation circuit; The output result of the tensor multiplication calculation circuit is stored in the internal cache unit, and the data is sent to the memory or to the general computing hardware through the external interface of the memory according to the control logic.
[0051] like Figure 8 As shown. After receiving the raw data from the internal interface of the memory, the internal cache unit first performs preliminary processing and then transmits the processed data to the tensor multiplication calculation circuit. After the tensor multiplication calculation circuit completes the calculation task, it stores the output results in the internal cache unit. According to the control logic of the system, these results can be sent to the memory, or transmitted to the general computing hardware through the external interface of the memory for subsequent calculation or analysis.
[0052] like Fig. 9 As shown. The system first receives the neural network model data to be calculated and starts the entire calculation process. After receiving the data, the system breaks the data into two parts: tensor multiplication calculation and non-tensor multiplication calculation, so that they can be processed separately. Subsequently, the input data to be calculated in the memory is transferred to the internal cache unit, which is responsible for temporarily storing these data to ensure that the tensor multiplication calculation circuit can efficiently access the required data. When the tensor multiplication calculation circuit is ready for calculation, the internal cache unit sends the data to the circuit. The circuit performs tensor multiplication dimensionality reduction calculation and generates original output data. These data are then transmitted back to the internal cache unit, where they are temporarily stored for the next step.
[0053] The internal cache unit makes two key decisions based on the system's control logic and the current computational needs. First, it decides whether to store the original output data back to memory for possible subsequent re-access or long-term storage. Second, it determines whether further tensor multiplication calculations are required on these data. If it is determined that it is necessary, the data will be sent back to the tensor multiplication calculation circuit for reprocessing. If not, the data can be sent to general-purpose computing hardware for other types of calculations, or directly stored back in memory for future use.
[0054] In the above embodiment, the internal cache unit, as a key component for data temporary storage and transfer, optimizes the data flow path, reduces the access frequency to the main memory, and improves the data exchange efficiency. As a component for performing core computing tasks, the tensor multiplication calculation circuit works closely with the internal cache unit to ensure the continuity and efficiency of the computing tasks. The internal memory interface and the external memory interface are responsible for data exchange with the memory and general computing hardware, respectively, to achieve fast data input and output.
[0055] like Fig.10 As shown. The near memory tensor multiplication hardware also includes a specific computing circuit; The specific computing circuit is connected to the internal cache unit and is used to perform specific tensor operations or format conversions to optimize the performance of the tensor multiplication computing circuit; The specific computing circuit receives the intermediate data from the internal cache unit and outputs the processed data to the tensor multiplication computing circuit.
[0056] In some embodiments, the specific computing circuit further includes: the specific computing circuit receives the output result of the tensor multiplication computing circuit; and stores the output result in an internal cache unit or sends it to general computing hardware through an external memory interface.
[0057] like Fig.11 As shown in the figure, the neural network model data to be processed is first received, which marks the beginning of the entire calculation process. The input data is precisely split by the system into two main parts: tensor multiplication calculation and non-tensor multiplication calculation, to achieve more efficient data processing.
[0058] The raw input data is then transferred from the memory to the internal cache unit through the input interface, which is a key step to ensure that the data can enter the calculation stage quickly and in order. Then, the internal cache unit sends the input data to be processed to the tensor multiplication calculation circuit for tensor operations.
[0059] In addition to the basic computing functions, the tensor multiplication calculation circuit also includes specific computing circuits that are responsible for processing specific tasks that require special computing methods or optimized algorithms. This design significantly enhances the computing power and flexibility of the system. When the tensor multiplication calculation circuit completes its computing task and generates raw output data, the system will choose whether to store this data back to the memory. If the system decides to store this data, the raw output data will be stored back in the memory through the memory interface for subsequent use or to retain the calculation results. Subsequently, the system makes another judgment, this time to decide whether further tensor multiplication calculations need to be performed on the data. If this requirement is confirmed, the data will be sent back to the tensor multiplication calculation circuit for necessary recalculation.
[0060] Once the computation is complete, or the system determines that no further tensor multiplications are required, the data is transferred to general-purpose computing hardware.
[0061] like Fig.12 shown. Fig.12 The present invention is an implementation example of the algorithm for generating Q, K, and V in a Transformer-based artificial neural network algorithm in a dimension reduction computing architecture.
[0062] The Transformer artificial neural network algorithm introduces a multi-head attention mechanism. The multi-head attention mechanism learns different context representations by applying the self-attention mechanism to multiple sets of different query matrices Q, key matrices K, and value matrices V. Specifically, the input sequence is transformed through different linear transformations, that is, the input data X is transformed with different matrices ( ) performs matrix-vector / matrix-matrix multiplication to obtain multiple sets of query matrices Q, key matrices K, and value matrices V, which are then input into multiple parallel self-attention mechanisms for processing.
[0063] In this example, the Transformer artificial neural network algorithm is divided into multi-head attention mechanism calculation and other calculation parts. The multi-head attention mechanism part is assigned to the tensor multiplication dimensionality reduction calculation hardware for implementation, and the rest of the calculation is implemented in general computing hardware. The multi-head attention mechanism is a tensor multiplication operation, and The amount of data is greater than the amount of output data Q, K, and V, and therefore satisfies the definition of dimensionality reduction calculation for tensor calculation. The input data X is passed from the memory to the dimension reduction computing hardware, and is calculated in the dimension reduction computing hardware to obtain the output data Q, K, V. Q, K, V are sent to the general computing hardware to perform other calculations. The memory can be NAND Flash, NOR Flash, DDR, HBM, pSRAM and other memories.
[0064] The beneficial effects of the above-mentioned embodiments of the present invention are as follows: through the design and implementation of near-memory tensor multiplication hardware, the present invention optimizes the execution of tensor multiplication dimensionality reduction calculations and significantly improves the ability to process large-scale neural network data; the use of internal cache units reduces the frequency of access to the memory and reduces the data transmission delay between the memory and the computing unit; by reducing the number of accesses to the memory, the present invention reduces the burden on the memory bandwidth and allows more efficient data transmission and processing; the introduction of specific computing circuits provides pre-processing and post-processing capabilities for tensor operations and enhances the processing flexibility of different types of tensor data.
[0065] Another embodiment of the present invention provides a computing hardware architecture control method for a neural network accelerator, comprising: receiving data from at least one memory via a memory internal interface; temporarily storing the received data in an internal cache unit in the near memory tensor multiplication hardware; requesting data from an internal cache unit and providing it to a tensor multiplication computation circuit; performing a tensor multiplication dimension reduction calculation in a tensor multiplication calculation circuit; Store the calculation results back to the internal cache unit; Depending on the control logic, the result data is sent to the general computing hardware through the memory external interface or written back to the memory.
[0066] The method further comprises: Performing pre-processing or post-processing operations on the intermediate data in the internal cache unit through a specific computing circuit; transmitting the pre-processed or post-processed data to a tensor multiplication calculation circuit; performing a computation operation according to the optimized tensor operation in a tensor multiplication computation circuit; Storing the results of the optimization calculation into an internal cache unit; The result data is sent to the general-purpose computing hardware through the external memory interface as needed, or written back to the memory through the internal memory interface.
[0067] It is understandable that the computing hardware architecture control method of the neural network accelerator corresponds to the various modules, units, structures, etc. in the computing hardware architecture of the neural network accelerator. Therefore, the features and beneficial effects described above for the computing hardware architecture of the neural network accelerator are also applicable to the computing hardware architecture control method of the neural network accelerator, and will not be repeated here.
[0068] Furthermore, another embodiment of the present application includes a storage medium storing program instructions capable of implementing all the above methods, wherein the program instructions can be stored in the above storage medium in the form of a software product, including several instructions for enabling a computer device (which may be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media capable of storing program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or terminal devices such as a computer, a server, a mobile phone, and a tablet.
[0069] The above descriptions are only some preferred embodiments of the present invention and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present invention is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above inventive concept. For example, the above features are replaced with (but not limited to) technical features with similar functions disclosed in the embodiments of the present invention.
Claims
1. A computing hardware architecture of a neural network accelerator, characterized in that: include: at least one memory; Near-memory tensor multiplication hardware; General purpose computing hardware; among which, The near memory tensor multiplication hardware receives input from the memory and the general computing hardware through a data transmission path, and performs tensor multiplication dimension reduction calculation; The output result of the near memory tensor multiplication hardware is transmitted to the memory and the general computing hardware through the data transmission path; The memory and general computing hardware transmit data through a data transmission path.
2. The computing hardware architecture of a neural network accelerator according to claim 1, characterized in that: The near memory tensor multiplication hardware includes: The internal interface of the memory is used to exchange data with the memory; A tensor multiplication calculation circuit is connected to the internal interface of the memory and the external interface of the memory to perform tensor multiplication dimension reduction calculation; Memory external interface used to exchange data with general computing hardware.
3. The computing hardware architecture of a neural network accelerator according to claim 2, characterized in that: The near memory tensor multiplication hardware further includes: The internal cache unit is used to temporarily store the intermediate data in the tensor multiplication and dimension reduction calculation process to reduce the access frequency to the memory and improve the data exchange efficiency; among them, The internal cache unit is connected to the tensor multiplication calculation circuit, the internal interface of the memory and the external interface of the memory through data transmission paths, so that data can be processed and transmitted in the near-memory tensor multiplication hardware.
4. The computing hardware architecture of a neural network accelerator according to claim 3, characterized in that: The internal cache unit is connected to the tensor multiplication calculation circuit, the internal interface of the memory and the external interface of the memory respectively through a data transmission path, including: The internal cache unit receives input data from the internal interface of the memory and temporarily stores the input data; The tensor multiplication calculation circuit requests data from the internal cache unit and performs tensor multiplication dimension reduction calculation; The calculation result of the tensor multiplication dimensionality reduction calculation is output by the tensor multiplication calculation circuit to the internal cache unit, and is sent to the general computing hardware or written back to the memory through the external memory interface.
5. The computing hardware architecture of a neural network accelerator according to claim 3, characterized in that: The internal cache unit is connected to the tensor multiplication calculation circuit, the internal interface of the memory and the external interface of the memory respectively through a data transmission path, including: The internal cache unit receives the intermediate data processed by the tensor multiplication calculation circuit and stores the intermediate data; The internal memory interface obtains data from the internal cache unit and outputs it according to the request of the general computing hardware; The internal cache unit transmits the final output result of the tensor multiplication calculation circuit to the external memory interface.
6. The computing hardware architecture of a neural network accelerator according to claim 3, characterized in that: The internal cache unit is connected to the tensor multiplication calculation circuit, the internal interface of the memory and the external interface of the memory respectively through a data transmission path, including: The internal cache unit receives the raw data from the internal interface of the memory, performs preliminary processing and transmits it to the tensor multiplication calculation circuit; The output result of the tensor multiplication calculation circuit is stored in the internal cache unit, and the data is sent to the memory or to the general computing hardware through the external interface of the memory according to the control logic.
7. The computing hardware architecture of a neural network accelerator according to claim 3, characterized in that: The near memory tensor multiplication hardware also includes specific computation circuits; The specific computing circuit is connected to the internal cache unit and is used to perform specific tensor operations or format conversions to optimize the performance of the tensor multiplication computing circuit; The specific computing circuit receives the intermediate data from the internal cache unit and outputs the processed data to the tensor multiplication computing circuit.
8. The computing hardware architecture of a neural network accelerator according to claim 7, characterized in that: The specific computing circuit also includes: The specific computing circuit receives the output result of the tensor multiplication computing circuit; The output result is stored in an internal cache unit or sent to general computing hardware through an external memory interface.
9. A method for controlling the computing hardware architecture of a neural network accelerator, characterized in that: include: receiving data from at least one memory via a memory internal interface; temporarily storing the received data in an internal cache unit in the near memory tensor multiplication hardware; requesting data from an internal cache unit and providing it to a tensor multiplication computation circuit; performing a tensor multiplication dimension reduction calculation in a tensor multiplication calculation circuit; Store the calculation results back to the internal cache unit; Depending on the control logic, the result data is sent to the general computing hardware through the memory external interface or written back to the memory.
10. The method for controlling the computing hardware architecture of a neural network accelerator according to claim 9, characterized in that: Also includes: Performing pre-processing or post-processing operations on the intermediate data in the internal cache unit through a specific computing circuit; transmitting the pre-processed or post-processed data to a tensor multiplication calculation circuit; performing a computation operation according to the optimized tensor operation in a tensor multiplication computation circuit; Storing the results of the optimization calculation into an internal cache unit; The result data is sent to the general-purpose computing hardware through the external memory interface as needed, or written back to the memory through the internal memory interface.
Citation Information
Patent Citations
Accelerator for sparse matrix multiplication in neural network
CN116108914A
Convolutional network hardware accelerator device, system and method
US20200310758A1
Artificial intelligence (AI) / machine learning (ML) tensor processor
US20240020239A1
Matrix transposition in matrix multiplication array circuitry
US20240168723A1
