An apparatus that runs according to an instruction set
By optimizing data processing through multiple operation instruction sets and master-slave architecture, the problems of resource waste and low efficiency in image data processing of traditional instruction sets are solved, and efficient image data processing and neural network computing are achieved.
Patent Information
- Application Number
- CN202011502565.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-17
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2040-12-17
AI Technical Summary
Traditional CPU and GPU instruction sets suffer from resource waste and low computational efficiency when processing image data. In particular, they cannot fully utilize hardware resources when performing parallel operations on small, fragmented data, and thus cannot meet the large and repetitive computational needs of the field of artificial intelligence.
It employs a multi-operation instruction set, combined with shared memory units and processor cores, to process image data in batches through multiple operation instructions. It also utilizes a master-slave architecture to optimize data dependency issues and avoids additional processor architecture design or compilation optimization.
It improves the execution speed of the operation sequence, makes full use of hardware resources, and enhances computing efficiency, especially significantly improving processing capabilities in image processing and neural network applications.
Smart Images

Figure CN114647442B_ABST
Abstract
Description
Technical Field
[0001] This invention generally relates to the field of neural networks. More specifically, this invention relates to computing devices, integrated circuit devices, and circuit boards that operate according to an instruction set. Background Technology
[0002] Traditional CPU, GPU, and DSP instruction sets are designed to maximize programmability, employing a one-instruction-one-action approach, such as RISC (reduced instruction set computing) or VLIW (very long instruction word) instruction sets. These instructions are collectively referred to as single-operation instructions, or single-instruction-single-data (SISD) instructions. The instruction unit decodes only one instruction at a time, and provides only one set of data to the operation unit during execution.
[0003] Because single-operation instructions cannot process batches of data at once, the SIMD (single instruction multiple data) instruction set was developed for CPUs. This allows a single instruction to operate on multiple data points, primarily supporting parallel operations on small, fragmented data. Taking image processing as an example, common image data types include RGB565, RGBA8888, and YUV422 formats. These formats typically use less than or equal to 8 bits per component of a pixel. However, CPU registers generally have storage units of 32 or 64 bits. Using single-operation instructions to control this would require 32 or 64 bits of register space to process an 8-bit pixel, resulting in wasted resources. SIMD instructions, on the other hand, can process 4 or 8 pixels simultaneously, completing 4 or 8 operations concurrently, fully utilizing register space and improving computational efficiency several times over.
[0004] With the rapid development of artificial intelligence, more and more dedicated AI processors are emerging. Various applications of neural networks (such as image processing) require a large number of repetitive tasks, such as data transfer, matrix multiplication, and matrix addition. If only single-operation instructions are used for control, hardware resources cannot be fully utilized. Therefore, an AI processing solution capable of executing multiple operation instructions is urgently needed. Summary of the Invention
[0005] In order to at least partially solve the technical problems mentioned in the background art, the present invention provides a computing device, integrated circuit device, and board that operates according to an instruction set.
[0006] In one aspect, the present invention discloses a computing device operating according to an instruction set, connected to off-chip memory. The instruction set includes a first multiple-operation instruction and a plurality of single-operation instructions. The computing device includes a shared memory unit and a processor core. The shared memory unit is used to load a plurality of data from off-chip memory according to the first multiple-operation instruction. The processor core includes an arithmetic module, a control module, and a storage module, wherein the control module is used to input one of the plurality of data to the arithmetic module for arithmetic operations according to the plurality of single-operation instructions to generate intermediate results; the storage module is used to store the intermediate results.
[0007] In another aspect, the present invention discloses an integrated circuit device including the aforementioned computing device, and also discloses a board including the integrated circuit device according to the aforementioned.
[0008] This invention utilizes multiple operation instructions to process operation sequences with data dependencies, enabling batch processing of image data. It eliminates the need for additional processor architecture design or compilation optimization techniques to address data dependency issues, significantly improving the execution speed of the operation sequences. Attached Figure Description
[0009] The above and other objects, features, and advantages of exemplary embodiments of the present invention will become readily apparent from the following detailed description taken in conjunction with the accompanying drawings. In the drawings, several embodiments of the invention are illustrated by way of example and not limitation, and like or corresponding reference numerals denote like or corresponding parts wherein:
[0010] Figure 1 This is a structural diagram of the board card according to an embodiment of the present invention;
[0011] Figure 2 This is a structural diagram illustrating an integrated circuit device according to an embodiment of the present invention;
[0012] Figure 3 This is a schematic diagram illustrating the internal structure of a computing device according to an embodiment of the present invention;
[0013] Figure 4 This is a schematic diagram illustrating the internal structure of the processor core according to an embodiment of the present invention;
[0014] Figure 5 This is a diagram illustrating when one processor core wants to write data to another processor core in a different cluster;
[0015] Figure 6 This is a schematic diagram illustrating image data being loaded from DRAM to SRAM and then to NRAM;
[0016] Figure 7 This is a schematic diagram illustrating the internal structure of a processor core according to another embodiment of the present invention;
[0017] Figure 8This is a schematic diagram illustrating the internal structure of a processor core according to another embodiment of the present invention;
[0018] Figure 9 This is a flowchart illustrating another embodiment of the present invention for processing image data;
[0019] Figure 10 This is a flowchart illustrating another embodiment of the present invention for processing image data; and
[0020] Figure 11 This is a flowchart illustrating another embodiment of the present invention for processing image data. Detailed Implementation
[0021] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0022] It should be understood that the terms "first," "second," "third," and "fourth," etc., in the claims, specification, and drawings of this invention are used to distinguish different objects, rather than to describe a specific order. The terms "comprising" and "including" used in the specification and claims of this invention indicate the presence of the described features, integrals, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or collections thereof.
[0023] It should also be understood that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in this specification and claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes such combinations.
[0024] As used in this specification and claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection."
[0025] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0026] Figure 1 A schematic diagram of the structure of a board 10 according to an embodiment of the present invention is shown. Figure 1As shown, board 10 includes chip 101, which is a system-on-chip (SoC) integrating one or more combined processing units. These combined processing units are artificial intelligence computing units used to support various deep learning and machine learning algorithms, meeting the intelligent processing needs of complex scenarios in fields such as computer vision, speech, natural language processing, and data mining. In particular, deep learning technology is widely used in cloud intelligence. A significant characteristic of cloud intelligence applications is the large amount of input data, placing high demands on the platform's storage and computing capabilities. Board 10 in this embodiment is suitable for cloud intelligence applications, possessing massive off-chip memory, on-chip storage, and powerful computing capabilities.
[0027] Chip 101 is connected to external device 103 via external interface device 102. External device 103 may be, for example, a server, computer, camera, monitor, mouse, keyboard, network card, or Wi-Fi interface. Data to be processed can be transmitted from external device 103 to chip 101 via external interface device 102. The calculation results from chip 101 can be transmitted back to external device 103 via external interface device 102. Depending on the application scenario, external interface device 102 may have different interface forms, such as a PCIe interface.
[0028] The board 10 also includes a storage device 104 for storing data, which includes one or more memory cells 105. The storage device 104 is connected to and transmits data with the controller 106 and the chip 101 via a bus. The controller 106 in the board 10 is configured to regulate the state of the chip 101. Therefore, in one application scenario, the controller 106 may include a microcontroller (MCU).
[0029] Figure 2 This is a structural diagram illustrating the combined processing device in chip 101 of this embodiment. (As shown) Figure 2 As shown, the combined processing device 20 includes a computing device 201, an interface device 202, a processing device 203, and a DRAM 204.
[0030] The computing device 201 is configured to perform user-specified operations. It is mainly implemented as a single-core intelligent processor or a multi-core intelligent processor to perform deep learning or machine learning calculations. It can interact with the processing device 203 through the interface device 202 to jointly complete the user-specified operations.
[0031] Interface device 202 is used to transmit data and control commands between computing device 201 and processing device 203. For example, computing device 201 can obtain input data from processing device 203 via interface device 202 and write it to on-chip storage device of computing device 201. Further, computing device 201 can obtain control commands from processing device 203 via interface device 202 and write them to on-chip control cache of computing device 201. Alternatively or optionally, interface device 202 can also read data from storage device of computing device 201 and transmit it to processing device 203.
[0032] The processing device 203, as a general-purpose processing device, performs basic controls including but not limited to data transfer and starting / stopping the computing device 201. Depending on the implementation, the processing device 203 may be one or more types of processors, such as a central processing unit (CPU), a graphics processing unit (GPU), or other general-purpose and / or special-purpose processors. These processors include, but are not limited to, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., and their number can be determined according to actual needs. As mentioned above, the computing device 201 of this invention can be considered as having a single-core structure or a homogeneous multi-core structure. However, when the computing device 201 and the processing device 203 are considered together, they are considered to form a heterogeneous multi-core structure.
[0033] DRAM 204 is used to store data to be processed. It is off-chip memory, typically 16GB or larger, and is used to store data in computing device 201 and / or processing device 203.
[0034] Figure 3 A schematic diagram of the internal structure of computing device 201 is shown. Computing device 201 is used to process input data such as computer vision, speech, natural language, and data mining. The computing device 201 in the figure adopts a multi-core hierarchical structure design. As a system-on-a-chip, computing device 201 includes multiple clusters, and each cluster includes multiple processor cores. In other words, computing device 201 is constructed in a hierarchical structure of system-on-a-chip, cluster, and processor core.
[0035] From the perspective of system-on-a-chip hierarchy, such as Figure 3As shown, the computing device 201 includes an external storage controller 301, a peripheral communication module 302, an on-chip interconnect module 303, a synchronization module 304, and multiple clusters 305.
[0036] There can be multiple external storage controllers 301; two are shown as an example in the figure. These controllers are used to respond to access requests from the processor core to access external storage devices, such as… Figure 2 The DRAM 204 in the chip allows the computing device 201 to read data from external sources or write data to external sources. The peripheral communication module 302 receives control signals from the processing device 203 via the interface device 202, initiating the computing device 201 to execute tasks. The on-chip interconnect module 303 connects the external storage controller 301, the peripheral communication module 302, and multiple clusters 305 to transmit data and control signals between the modules. The synchronization module 304 is a global barrier controller (GBC) used to coordinate the working progress of each cluster and ensure information synchronization. The multiple clusters 305 are the computing core of the computing device 201. Four are shown exemplary in the figure; however, with hardware development, the computing device 201 of this invention can also include 8, 16, 64, or even more clusters 305. The clusters 305 are used to efficiently execute deep learning algorithms.
[0037] From the perspective of cluster hierarchy, such as Figure 3 As shown, each cluster 305 includes multiple processor cores (IPU cores) 306 and one memory core (MEM core) 307.
[0038] Four processor cores 306 are shown exemplarily in the figure, but the present invention does not limit the number of processor cores 306. Its internal architecture is as follows: Figure 4 As shown. Each processor core 306 includes three main modules: a control module 41, an arithmetic module 42, and a storage module 43.
[0039] The control module 41 coordinates and controls the operation of the computation module 42 and the storage module 43 to complete the deep learning task. It includes an instruction fetch unit (IFU) 411 and an instruction decode unit (IDU) 412. The instruction fetch unit 411 fetches instructions from the processing device 203, and the instruction decode unit 412 decodes the fetched instructions and sends the decoding result as control information to the computation module 42 and the storage module 43.
[0040] The computation module 42 includes a vector operation unit 421, a pre-conversion unit 422, a matrix operation unit 423, and a post-conversion unit 424. The vector operation unit 421 is used to perform vector operations and can support complex operations such as vector multiplication, addition, and nonlinear transformations; the pre-conversion unit 422 is used to convert floating-point numbers into fixed-point numbers; the matrix operation unit 423 is based on fixed-point numbers and is responsible for the core calculations of deep learning algorithms, namely matrix multiplication, matrix addition, and convolution; the post-conversion unit 424 is used to convert the matrix operation results back from fixed-point numbers to floating-point numbers.
[0041] Storage module 43 is used to store or move related data, including neuron RAM (NRAM) 431, weight RAM (WRAM) 432, input / output direct memory access (IODMA) 433, and move direct memory access (MVDMA) 434. NRAM 431 is used to store feature maps for computation by processor core 306 and intermediate results after computation; WRAM 432 is used to store the weights of the deep learning network; IODMA 433 controls the memory access of NRAM 431 / WRAM 432 and DRAM 204 through broadcast bus 309; MVDMA 434 controls the memory access of NRAM 431 / WRAM 432 and SRAM 308.
[0042] Back Figure 3 The storage core 307 is primarily used for storage and communication, namely storing shared data or intermediate results among processor cores 306, and performing communication between cluster 305 and DRAM 204, communication between clusters 305, and communication between processor cores 306. In other embodiments, the storage core 307 has scalar operation capabilities and is used to perform scalar operations.
[0043] Storage core 307 includes a shared memory unit (SRAM) 308, a broadcast bus 309, a cluster direct memory access (CDMA) module 310, and a global direct memory access (GDMA) module 311. SRAM 308 acts as a high-performance data relay station. Data multiplexed between different processor cores 306 within the same cluster 305 does not need to be obtained from DRAM 204 by each processor core 306 individually. Instead, it is relayed between processor cores 306 via SRAM 308. Storage core 307 only needs to quickly distribute the multiplexed data from SRAM 308 to multiple processor cores 306, thereby improving inter-core communication efficiency and significantly reducing on-chip and off-chip I / O access.
[0044] Broadcast bus 309, CDMA 310, and GDMA 311 are used to perform communication between processor cores 306, communication between clusters 305, and data transfer between cluster 305 and DRAM 204, respectively. These will be explained below.
[0045] The broadcast bus 309 is used to complete high-speed communication between the processor cores 306 within the cluster 305. In this embodiment, the broadcast bus 309 supports inter-core communication methods including unicast, multicast, and broadcast. Unicast refers to point-to-point (i.e., data transmission from one processor core to another) data transmission. Multicast is a communication method that transmits a piece of data from SRAM 308 to several specific processor cores 306. Broadcast is a communication method that transmits a piece of data from SRAM 308 to all processor cores 306, and is a special case of multicast.
[0046] CDMA 310 is used to control SRAM 308 access between different clusters 305 within the same computing device 201. Figure 5 This diagram illustrates the operation of CDMA310 when one processor core attempts to write data to another processor core in a different cluster. In this application scenario, the same computing device comprises multiple clusters. For simplicity, only clusters 0 and 1 are shown in the diagram. Both clusters 0 and 1 contain multiple processor cores; similarly, for ease of explanation, only processor core 0 is shown in cluster 0, and only processor core 1 is shown in cluster 1. Processor core 0 intends to write data to processor core 1.
[0047] First, processor core 0 sends a unicast write request to write data into its local SRAM 0. CDMA 0 acts as the master and CDMA 1 acts as the slave. The master pushes the write request to the slave, that is, the master sends the write address AW and the write data W to transmit the data to SRAM 1 of cluster 1. Then, the slave sends a write response B as a response. Finally, processor core 1 of cluster 1 sends a unicast read request to read the data from SRAM 1.
[0048] Back Figure 3 The GDMA 311, in conjunction with the external memory controller 301, controls memory access from the SRAM 308 to the DRAM 204 of the cluster 305, or reads data from the DRAM 204 into the SRAM 308. As previously described, communication between the DRAM 204 and the NRAM 431 or WRAM 432 can be achieved through two channels. The first channel is a direct connection between the DRAM 204 and the NRAM 431 or WRAM 432 via the IODAM 433; the second channel involves first transmitting data between the DRAM 204 and SRAM 308 via the GDMA 311, and then transmitting data between the SRAM 308 and the NRAM 431 or WRAM 432 via the MVDMA 434. Although the second channel appears to require more components and has a longer data flow, in some embodiments, the bandwidth of the second channel is actually much greater than that of the first channel. Therefore, communication between the DRAM 204 and the NRAM 431 or WRAM 432 may be more efficient via the second channel. The embodiments of the present invention can select the data transmission channel according to their own hardware conditions.
[0049] In other embodiments, the functions of GDMA 311 and IODMA 433 can be integrated into the same component. For ease of description, GDMA 311 and IODMA 433 are considered different components. For those skilled in the art, any component that performs similar functions and achieves similar technical effects to this invention falls within the scope of protection of this invention. Furthermore, the functions of GDMA 311, IODMA 433, CDMA 310, and MVDMA 434 can also be implemented by the same component.
[0050] Since the data flow and computation process of neural network image processing algorithms are relatively fixed and involve a large number of repetitive operations, based on this characteristic, the instruction set of this invention is set as a master-slave architecture, including multiple operation instructions and multiple single operation instructions. The multiple operation instructions, as master instructions, describe the shape of a large amount of data in memory, that is, to use multiple operation instructions to batch process parallel data, and several single operation instructions, as slave instructions, specifically execute or consume the data provided by the master instructions.
[0051] One embodiment of the present invention is a system for processing image data using a neural network, which has the following characteristics: Figures 1 to 4 The various devices shown are described. When processing image data, a large amount of data needs to be moved between DRAM 204 and SRAM 308, and between SRAM 308 and NRAM 431 / WRAM 432, and highly homogeneous operations such as matrix multiplication and matrix addition need to be performed. If single operation instructions are used to process one data at a time, it will consume a lot of input / output, data movement and operation time. This embodiment utilizes the aforementioned master-slave instructions to make image processing more efficient.
[0052] Taking the processing of matrix addition or multiplication by computing device 201 as an example, computing device 201 first needs to load image data from DRAM 204 into SRAM 308. When image data is stored in DRAM 204, it typically occupies an entire block of storage space. Figure 6 The diagram illustrates the loading of image data from DRAM 204 to SRAM 308 and then to NRAM 431. The image data occupies P in DRAM 204. X ×P Y The storage space is contiguous and complete. If the user loads this image data with a single operation command, the user needs to write a P... X ×P Y Each single-operation instruction controls the movement of data at a single address.
[0053] This embodiment utilizes a first multiple operation instruction to load the entire image data into SRAM 308 at once; that is, a single main instruction controls P. X ×P Y The image data of size 100 is loaded into SRAM 308. Since the multi-operation instruction does not involve data movement to individual addresses, but only describes the shape of the image data in DRAM 204, when the first multi-operation instruction is used, the image data is loaded as a whole into SRAM 308. X ×P Y Storage space. Assume that SRAM 308 does not have a complete P... X ×P YThere is a storage space, but there are two non-contiguous spaces. For example, one of the storage spaces is P. X1 ×P Y One storage space, and the other storage space is for P. X2 ×P Y storage space, P X1 +P X2 =P X If so, the first multi-operation instruction cannot complete the task, that is, the first multi-operation instruction cannot transfer P. X ×P Y Image data split into P X1 ×P Y Image data and P X2 ×P Y The image data is stored separately.
[0054] When processing the image data, the image data stored in SRAM 308 needs to be split into multiple sub-images, which are then sent to processor core 306 for processing. Taking each cluster 305 as an example, which includes four processor cores 306, the image data will be split into four sub-images, such as... Figure 6 As shown, the data is sent to the NRAM 431 of each processor core 306. To accomplish this operation, the control module 41 can use multiple single-operation instructions from the instruction set, each single-operation instruction moving a subgraph to the NRAM 431 of the storage module 43, and using the same method to move the corresponding weights to the WRAM 432.
[0055] Regardless of whether it's a matrix multiplication or matrix addition operation, the control module 41, according to a single operation instruction, causes the front turn-by-turn unit 422 to read the subgraph data from the NRAM 431, convert it into a fixed-point number, and then perform matrix multiplication or matrix addition with the weights through the matrix operation unit 423. The result of the fixed-point operation is then input to the rear turn-by-turn unit 424 to convert it back into a floating-point intermediate result. The control module 41 then stores the intermediate result back into the NRAM 431 according to a single operation instruction. The intermediate results are stored continuously and completely in the NRAM 431.
[0056] Next, the second multi-operation instruction in the instruction set describes the shape of the intermediate results stored in NRAM 431, causing MVDMA 434 to transfer the operation results from NRAM 431 to SRAM 308 in one go. These operation results are also stored continuously and completely in SRAM 308. Finally, the third multi-operation instruction in the instruction set describes the shape of the operation results stored in SRAM 308. According to the third multi-operation instruction, these operation results are stored back from SRAM 308 to DRAM 204 in one go to complete the matrix multiplication or matrix addition task.
[0057] Another embodiment of the present invention is a system for processing image data using a neural network, which has the following characteristics: Figures 1 to 3 The various devices shown. The structure of the processor core 306 in this embodiment is as follows: Figure 7 As shown, with Figure 4 The difference in structure is that the operation module 42 in this embodiment also includes an activation unit 701, which implements an activation function to activate the intermediate result output by the matrix operation unit 423, and then converts the activated intermediate result back to a floating-point number by the post-transformation unit 424.
[0058] Taking matrix addition or multiplication as an example, computing device 201 uses the first multiple operation instruction in the instruction set to load the entire image data from DRAM 204 into SRAM 308 in one go; that is, one instruction controls P. X ×P Y The image data of a certain size is loaded into SRAM 308. When calculating the image data, multiple single-operation instructions in the instruction set are used to split the image data stored in SRAM 308 into multiple sub-images, which are then transferred to multiple processor cores 306 for calculation. Then, single-operation instructions are used to move one sub-image to NRAM 431 of storage module 43 address by address, and the corresponding weights are moved to WRAM 432 in the same way.
[0059] The control module 41 then, according to a single operation instruction, causes the front rotation unit 422 to read the sub-graph data from the NRAM 431, convert it into a fixed-point number, and then the matrix operation unit 423 performs matrix multiplication or matrix addition on the sub-graph data and weights. The activation unit 701 activates the intermediate result output by the matrix operation unit 423 and inputs the activated intermediate result into the rear rotation unit 424 to convert it back into a floating-point number.
[0060] Next, this embodiment utilizes the second multiple-operation instruction in the instruction set to cause the MVDMA 434 to transfer the operation results from the NRAM 431 to the SRAM 308 in one go. These operation results are stored continuously and completely in the SRAM 308. Finally, this embodiment utilizes the third multiple-operation instruction in the instruction set to store these operation results from the SRAM 308 back to the DRAM 204 in one go, thereby completing the task of performing matrix multiplication or matrix addition.
[0061] Another embodiment of the present invention is a system for processing image data using a neural network, which has the following characteristics: Figures 1 to 3 The various devices shown. The structure of the processor core 306 in this embodiment is as follows: Figure 8 As shown, with Figure 7The difference in structure is that the operation module 42 in this embodiment also includes a batch standardization unit 801, which is used to standardize the activation result generated by the activation unit 701, and then convert the intermediate result of batch standardization back to a floating-point number by the post-transfer unit 424.
[0062] Taking matrix addition or multiplication as an example, the computing device 201 uses the first multiple operation instruction in the instruction set to load the entire image data from DRAM 204 into SRAM 308 in one go. When calculating the image data, according to the single operation instruction in the instruction set, the image data stored in SRAM 308 is split into multiple sub-images, which are then transferred to multiple processor cores 306 for calculation. Then, using the single operation instruction, one sub-image is moved to NRAM 431 of storage module 43 address by address, and the corresponding weights are moved to WRAM 432 in the same way.
[0063] The control module 41 then, according to the single operation instruction, causes the front turn number unit 422 to read the subgraph data from the NRAM 431, convert it into a fixed-point number, and then the matrix operation unit 423 performs matrix multiplication or matrix addition on the subgraph data and weights. The activation unit 701 activates the intermediate result output by the matrix operation unit 423, the batch normalization unit 801 normalizes the activation result generated by the activation unit 701, and inputs the batch normalized intermediate result into the rear turn number unit 424 to convert it back into a floating-point number.
[0064] Next, according to the second multi-operation instruction in the instruction set, the MVDMA 434 moves the operation results from the NRAM 431 to the SRAM 308 in one go. These operation results are stored continuously and completely in the SRAM 308. Finally, the third multi-operation instruction in the instruction set uses the same instruction to store these operation results from the SRAM 308 back to the DRAM 204 in one go, thus completing the matrix multiplication or matrix addition task.
[0065] Another embodiment of the present invention is a method for processing image data using a neural network, this method being based on... Figures 1 to 4 The various devices shown are used to achieve this. Figure 9 The flowchart shown illustrates how this embodiment handles matrix addition or multiplication.
[0066] In step 901, image data is loaded from DRAM 204 according to the first multiple operation instruction. This embodiment utilizes the first multiple operation instruction to load the entire image data into SRAM 308 at once; that is, a single instruction controls P. X ×P Y The image data of a certain size is loaded into SRAM 308. The image data will be loaded into SRAM 308 in whole blocks. X ×PY Storage space.
[0067] In step 902, the image data is split into multiple sub-images according to a single-operation instruction. When calculating this image data, the image data stored in SRAM 308 needs to be split into multiple sub-images and transferred to multiple processor cores 306 for processing. To accomplish this, a single-operation instruction is used to move one sub-image at a time to the NRAM 431 of the storage module 43, and the corresponding weights are moved to WRAM 432 in the same way.
[0068] In step 903, according to a single operation instruction, image data is input to the front rotation unit, matrix operation unit, and rear rotation unit for calculation to generate a result. The control module 41 then, according to the single operation instruction, causes the front rotation unit 422 to read sub-image data from NRAM 431, convert it into a fixed-point number, and then the matrix operation unit 423 performs matrix multiplication or matrix addition on the image data and weights. The result of the fixed-point calculation is then input to the rear rotation unit 424 to be converted back to a floating-point number.
[0069] In step 904, according to the second multiple operation instruction, the result of the floating-point operation is transferred to SRAM 308. The second multiple operation instruction causes MVDMA 434 to transfer the operation result on NRAM 431 to SRAM 308 in one go, and these operation results are stored continuously and completely in SRAM 308.
[0070] In step 905, the calculation results are stored in DRAM 204 according to the third multi-operation instruction. Then, according to the third multi-operation instruction, these calculation results are stored back from SRAM 308 to DRAM 204 in one go to complete the matrix multiplication or matrix addition task.
[0071] Another embodiment of the present invention is a method for processing image data using a neural network, this method being based on... Figures 1 to 3 and Figure 7 The various devices shown are used to achieve this. Figure 10 The flowchart shown illustrates how this embodiment handles matrix addition or multiplication.
[0072] In step 1001, image data is loaded from DRAM 204 according to the first multiple operation instruction. This embodiment utilizes a single multiple operation instruction to load the entire image data into SRAM 308 at once, meaning that one instruction controls P. X ×P Y The image data of a certain size is loaded into SRAM 308. The image data will be loaded into SRAM 308 in whole blocks. X ×P YStorage space.
[0073] In step 1002, the image data is split into multiple sub-images according to a single-operation instruction. When calculating this image data, the image data stored in SRAM 308 needs to be split into multiple sub-images and transferred to processor core 306 for processing. To accomplish this, a sub-image is moved address by address to NRAM 431 of storage module 43 using a single-operation instruction, and the corresponding weights are moved to WRAM 432 in the same way.
[0074] In step 1003, according to a single operation instruction, image data is input to the front rotation unit, matrix operation unit, activation unit, and rear rotation unit for calculation to generate a calculation result. According to the single operation instruction, the control module 41 causes the front rotation unit 422 to read sub-image data from NRAM 431, convert it into fixed-point numbers, and then the matrix operation unit 423 performs matrix multiplication or matrix addition on the sub-image data and weights. The activation unit 701 activates the intermediate result output by the matrix operation unit 423 and inputs the activated intermediate result to the rear rotation unit 424 to convert it back to a floating-point number.
[0075] In step 1004, according to the second multiple operation instruction, the result of the floating-point operation is transferred to SRAM 308. The second multiple operation instruction enables MVDMA 434 to transfer the operation result on NRAM 431 to SRAM 308 in one go, and these operation results are stored continuously and completely in SRAM 308.
[0076] In step 1005, the calculation results are stored in DRAM 204 according to the third multi-operation instruction. Using the third multi-operation instruction, these calculation results are stored back from SRAM 308 to DRAM 204 in one go to complete the task of performing matrix multiplication or matrix addition.
[0077] Another embodiment of the present invention is a method for processing image data using a neural network, this method being based on... Figures 1 to 3 and Figure 8 The various devices shown are used to achieve this. Figure 11 The flowchart shown illustrates how this embodiment handles matrix addition or multiplication.
[0078] In step 1101, image data is loaded from DRAM 204 according to the first multiple operation instruction. This embodiment utilizes a single multiple operation instruction to load the entire image data into SRAM 308 at once, meaning that one instruction controls P. X ×P Y The image data of a certain size is loaded into SRAM 308. The image data will be loaded into SRAM 308 in whole blocks. X×P Y Storage space.
[0079] In step 1102, the image data is split into multiple sub-images according to a single-operation instruction. When calculating this image data, the image data stored in SRAM 308 needs to be split into multiple sub-images and transferred to processor core 306 for processing. To accomplish this, a sub-image is moved one address at a time to NRAM 431 of storage module 43 using a single-operation instruction, and the corresponding weights are moved to WRAM 432 in the same way.
[0080] In step 1103, according to a single operation instruction, image data is input to the front rotation unit, matrix operation unit, activation unit, batch normalization unit, and rear rotation unit for calculation to generate a calculation result. According to the single operation instruction, the control module 41 causes the front rotation unit 422 to read sub-image data from NRAM 431, convert it into fixed-point numbers, and then the matrix operation unit 423 performs matrix multiplication or matrix addition on the sub-image data and weights. The activation unit 701 activates the intermediate result output by the matrix operation unit 423, and the batch normalization unit 801 normalizes the activation result generated by the activation unit 701. The batch normalization intermediate result is then input to the rear rotation unit 424 to convert it back to a floating-point number.
[0081] In step 1104, according to the second multiple operation instruction, the result of the floating-point operation is transferred to SRAM 308. The second multiple operation instruction enables MVDMA 434 to transfer the operation result on NRAM 431 to SRAM 308 in one go, and these operation results are stored continuously and completely in SRAM 308.
[0082] In step 1105, the calculation results are stored in DRAM 204 according to the third multi-operation instruction. The third multi-operation instruction is used to store these calculation results from SRAM 308 back to DRAM 204 at once to complete the task of performing matrix multiplication or matrix addition.
[0083] Another embodiment of the present invention is a computer-readable storage medium storing computer program code for processing image data. When the computer program code is run by a processor, it executes the methods described in the preceding embodiments. In some implementation scenarios, the integrated units described above can be implemented as software program modules. If implemented as software program modules and sold or used as independent products, the integrated units can be stored in a computer-readable memory. Based on this, when the solution of the present invention is embodied in the form of a software product (e.g., a computer-readable storage medium), the software product can be stored in a memory, which may include several instructions to cause a computer device (e.g., a personal computer, a server, or a network device) to execute some or all of the steps of the methods described in the embodiments of the present invention. The aforementioned memory may include, but is not limited to, various media capable of storing program code, such as USB flash drives, flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0084] This invention utilizes a master-slave architecture to establish multiple-operation instructions and single-operation instructions. The multiple-operation instructions, acting as master instructions, describe the shape of large amounts of data in memory, enabling batch processing of parallel data. The single-operation instructions, acting as slave instructions, specifically execute or consume the data provided by the master instructions. This invention does not require additional processor architecture design or compilation optimization techniques to resolve data dependency issues, offering advantages in processor performance, power consumption, and area gains, significantly improving the execution speed of computational sequences (algorithms).
[0085] Depending on the application scenario, the electronic devices or apparatus of the present invention may include servers, cloud servers, server clusters, data processing devices, robots, computers, printers, scanners, tablet computers, smart terminals, PC devices, IoT terminals, mobile terminals, mobile phones, dashcams, navigators, sensors, cameras, video cameras, projectors, watches, headphones, mobile storage, wearable devices, visual terminals, autonomous driving terminals, vehicles, home appliances, and / or medical devices. The vehicles include airplanes, ships, and / or vehicles; the home appliances include televisions, air conditioners, microwave ovens, refrigerators, rice cookers, humidifiers, washing machines, lights, gas stoves, and range hoods; the medical devices include MRI scanners, ultrasound machines, and / or electrocardiographs. The electronic devices or apparatus of the present invention can also be applied in fields such as the Internet, IoT, data centers, energy, transportation, public management, manufacturing, education, power grids, telecommunications, finance, retail, construction sites, and healthcare. Furthermore, the electronic devices or apparatus of the present invention can also be used in application scenarios related to artificial intelligence, big data, and / or cloud computing, such as cloud computing, edge computing, and terminal computing. In one or more embodiments, the high-computing-power electronic devices or apparatuses according to the present invention can be applied to cloud devices (e.g., cloud servers), while the low-power electronic devices or apparatuses can be applied to terminal devices and / or edge devices (e.g., smartphones or cameras). In one or more embodiments, the hardware information of the cloud devices and the hardware information of the terminal devices and / or edge devices are compatible with each other, so that suitable hardware resources can be matched from the hardware resources of the cloud devices to simulate the hardware resources of the terminal devices and / or edge devices based on the hardware information of the terminal devices and / or edge devices, so as to complete the unified management, scheduling and collaborative work of end-to-cloud or cloud-edge-end integration.
[0086] It should be noted that, for the sake of brevity, this invention describes some methods and their embodiments as a series of actions and combinations thereof. However, those skilled in the art will understand that the solution of this invention is not limited to the order of the described actions. Therefore, based on the disclosure or teachings of this invention, those skilled in the art will understand that some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art will understand that the embodiments described in this invention can be considered as optional embodiments, that is, the actions or modules involved are not necessarily essential for the implementation of one or more solutions of this invention. In addition, depending on the solution, the description of some embodiments of this invention also has different emphases. In view of this, those skilled in the art will understand that parts not described in detail in a certain embodiment of this invention can also refer to the relevant descriptions of other embodiments.
[0087] In terms of specific implementation, based on the disclosure and teachings of this invention, those skilled in the art will understand that the several embodiments disclosed herein can also be implemented in other ways not disclosed herein. For example, regarding the various units in the electronic device or device embodiments described above, this document has divided them based on logical functions, but in actual implementation, there may be other ways of division. As another example, multiple units or components can be combined or integrated into another system, or some features or functions in a unit or component can be selectively disabled. Regarding the connection relationship between different units or components, the connection discussed above in conjunction with the accompanying drawings can be a direct or indirect coupling between units or components. In some scenarios, the aforementioned direct or indirect coupling involves a communication connection utilizing an interface, wherein the communication interface can support electrical, optical, acoustic, magnetic, or other forms of signal transmission.
[0088] In this invention, the units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units. The aforementioned components or units may be located in the same position or distributed across multiple network units. Furthermore, depending on actual needs, some or all of the units can be selected to achieve the purpose of the solution described in the embodiments of this invention. Additionally, in some scenarios, multiple units in the embodiments of this invention may be integrated into one unit or each unit may exist physically independently.
[0089] In other implementation scenarios, the integrated units described above can also be implemented in hardware, i.e., as specific hardware circuits, which may include digital circuits and / or analog circuits. The physical implementation of the circuit's hardware structure may include, but is not limited to, physical devices, which may include, but are not limited to, transistors or memristors. Therefore, the various devices described herein (e.g., computing devices or other processing devices) can be implemented using appropriate hardware processors, such as central processing units, GPUs, FPGAs, DSPs, and ASICs. Furthermore, the aforementioned storage units or storage devices can be any suitable storage medium (including magnetic storage media or magneto-optical storage media), such as resistive random access memory (RRAM), dynamic random access memory (DRAM), static random access memory (SRAM), enhanced dynamic random access memory (EDRAM), high-bandwidth memory (HBM), hybrid memory cube (HMC), ROM, and RAM.
[0090] The foregoing can be better understood in accordance with the following terms:
[0091] Clause A1. A computing device operating according to an instruction set, connected to off-chip memory, the instruction set including a first multiple-operation instruction and a plurality of single-operation instructions, the computing device comprising: a shared memory unit for loading a plurality of data from the off-chip memory according to the first multiple-operation instruction; and a processor core including: an arithmetic module; a control module for inputting one of the plurality of data into the arithmetic module for arithmetic operation according to the plurality of single-operation instructions to generate an intermediate result; and a storage module for storing the intermediate result.
[0092] Clause A2, the computing device according to Clause A1, wherein the control module loads one of the plurality of data into the storage module according to one of the plurality of single operation instructions.
[0093] Clause A3. The computing device according to Clause A2, wherein the control module inputs one of the plurality of data from the storage module to the arithmetic module for arithmetic operation based on one of the plurality of single operation instructions to generate the intermediate result.
[0094] Clause A4. The computing device according to Clause A3, wherein the control module stores the intermediate result back to the storage module according to one of the plurality of single operation instructions.
[0095] Clause A5. The computing device according to Clause A1, wherein the instruction set further includes a second multiple operation instruction, and the shared storage unit stores the operation result according to the second multiple operation instruction, the operation result being a set of all intermediate results.
[0096] Clause A6. The computing device according to Clause A5, wherein the instruction set further includes a third multiple operation instruction, and the shared memory unit stores the operation result back to the off-chip memory according to the third multiple operation instruction.
[0097] Clause A7. An integrated circuit device comprising a computing device according to any one of Clauses A1 to A6.
[0098] Clause A8, a board including an integrated circuit device as described in Clause A7.
[0099] The embodiments of the present invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A computing device that operates according to an instruction set, connected to off-chip memory, the instruction set including a first multiple-operation instruction and a plurality of single-operation instructions, the computing device comprising: A shared storage unit is used to load multiple data from the off-chip memory according to the first multiple operation instruction; as well as Processor cores, including: Computation module; The control module is configured to input one of the multiple data sets into the calculation module for processing, based on the multiple single-operation instructions, to generate intermediate results; and A storage module for continuously and completely storing the intermediate results; The control module loads one of the multiple data into the storage module one address at a time according to one of the multiple single operation instructions, and continuously and completely stores the intermediate results back into the storage module according to one of the multiple single operation instructions. The instruction set further includes a second multiple operation instruction, which allows the shared storage unit to store, at one time, the set of all intermediate results that are continuously and completely stored in the storage module as the operation result, according to the second multiple operation instruction.
2. The computing device according to claim 1, wherein the control module inputs one of the plurality of data from the storage module to the arithmetic module for operation according to one of the plurality of single operation instructions to generate the intermediate result.
3. The computing device according to claim 1, wherein the instruction set further includes a third multiple operation instruction, and the shared storage unit stores the operation result back to the off-chip memory according to the third multiple operation instruction.
4. An integrated circuit device comprising a computing device according to any one of claims 1 to 3.
5. A board comprising the integrated circuit device according to claim 4.
Citation Information
Patent Citations
Multicore-parallel digital signal processor and method for operating parallel instruction sets
CN102508643A
