CN111160543A - Integrated circuit chip device and related product - Google Patents
Integrated circuit chip device and related product Download PDFInfo
- Publication number
- CN111160543A CN111160543A CN201911401048.2A CN201911401048A CN111160543A CN 111160543 A CN111160543 A CN 111160543A CN 201911401048 A CN201911401048 A CN 201911401048A CN 111160543 A CN111160543 A CN 111160543A
- Authority
- CN
- China
- Prior art keywords
- processing circuit
- data
- circuit
- basic
- main processing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000006243 chemical reaction Methods 0.000 claims abstract description 56
- 238000013528 artificial neural network Methods 0.000 claims description 39
- 238000009825 accumulation Methods 0.000 claims description 24
- 238000012163 sequencing technique Methods 0.000 claims 1
- 238000004364 calculation method Methods 0.000 abstract description 40
- 230000008901 benefit Effects 0.000 abstract description 13
- 239000013598 vector Substances 0.000 description 119
- 239000011159 matrix material Substances 0.000 description 112
- 230000005540 biological transmission Effects 0.000 description 29
- 238000000034 method Methods 0.000 description 29
- 230000004913 activation Effects 0.000 description 18
- 238000010586 diagram Methods 0.000 description 15
- 230000006870 function Effects 0.000 description 14
- 230000015654 memory Effects 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 238000011773 genetically engineered mouse model Methods 0.000 description 4
- 230000017105 transposition Effects 0.000 description 4
- 238000013500 data storage Methods 0.000 description 3
- 210000002569 neuron Anatomy 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 230000008707 rearrangement Effects 0.000 description 2
- 239000007787 solid Substances 0.000 description 2
- 230000009466 transformation Effects 0.000 description 2
- 241000699670 Mus sp. Species 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 210000004556 brain Anatomy 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 238000012886 linear function Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/06—Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons
- G06N3/063—Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons using electronic means
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Theoretical Computer Science (AREA)
- Evolutionary Computation (AREA)
- General Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Artificial Intelligence (AREA)
- General Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Computational Linguistics (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Neurology (AREA)
- Complex Calculations (AREA)
- Image Processing (AREA)
- Advance Control (AREA)
- Logic Circuits (AREA)
Abstract
The present disclosure provides an integrated circuit chip device and related products, the integrated circuit chip device comprising: a main processing circuit and a plurality of basic processing circuits; the main processing circuit or at least one of the plurality of basic processing circuits comprises: a data type operation circuit for performing conversion between floating point type data and fixed point type data. The technical scheme provided by the disclosure has the advantages of small calculation amount and low power consumption.
Description
Technical Field
The present disclosure relates to the field of neural networks, and more particularly to an integrated circuit chip device and related products.
Background
Artificial Neural Networks (ANN) are a research hotspot in the field of Artificial intelligence since the 80 s of the 20 th century. The method abstracts the human brain neuron network from the information processing angle, establishes a certain simple model, and forms different networks according to different connection modes. It is also often directly referred to in engineering and academia as neural networks or neural-like networks. A neural network is an operational model, which is formed by connecting a large number of nodes (or neurons). The operation of the existing neural network is realized based on a Central Processing Unit (CPU) or a Graphics Processing Unit (GPU), and the operation has a large amount of calculation and high power consumption.
Disclosure of Invention
Embodiments of the present disclosure provide an integrated circuit chip device and related products, which can increase the processing speed and efficiency of a computing device.
In a first aspect, an integrated circuit chip device is provided, the integrated circuit chip device comprising: a main processing circuit and a plurality of basic processing circuits; the main processing circuit or at least one of the plurality of basic processing circuits comprises: a data type operation circuit for performing conversion between floating point type data and fixed point type data;
the main processing circuit is used for executing each continuous operation in the neural network operation and transmitting data with the basic processing circuit;
and the plurality of basic processing circuits are used for executing the operation in the neural network in a parallel mode according to the data transmitted by the main processing circuit and transmitting the operation result to the main processing circuit.
In a second aspect, a neural network computing device is provided, which includes one or more integrated circuit chip devices provided in the first aspect.
In a third aspect, there is provided a combined processing apparatus comprising: the neural network arithmetic device, the universal interconnection interface and the universal processing device are provided by the second aspect;
the neural network operation device is connected with the general processing device through the general interconnection interface.
In a fourth aspect, a chip is provided that integrates the apparatus of the first aspect, the apparatus of the second aspect, or the apparatus of the third aspect.
In a fifth aspect, an electronic device is provided, which comprises the chip of the fourth aspect.
In a sixth aspect, a method for operating a neural network is provided, where the method is applied in an integrated circuit chip device, and the integrated circuit chip device includes: the integrated circuit chip apparatus of the first aspect, configured to perform an operation of a neural network.
It can be seen that, by the embodiments of the present disclosure, the data conversion operation circuit is provided to perform the post-conversion operation on the type of the data block, so that transmission resources and calculation resources are saved, and therefore, the data conversion operation circuit has the advantages of low power consumption and small calculation amount.
Drawings
FIG. 1a is a schematic diagram of an integrated circuit chip device.
FIG. 1b is a schematic diagram of another integrated circuit chip device.
FIG. 1c is a schematic diagram of a basic processing circuit.
FIG. 1d is a schematic block diagram of a fixed point data type.
FIG. 2 is a schematic diagram of a process for multiplying a matrix by a vector.
Fig. 2a is a schematic representation of a matrix multiplied by a vector.
FIG. 2b is a schematic diagram of a process of multiplying a matrix by a matrix.
Fig. 2c is a schematic diagram of the matrix Ai multiplied by the vector B.
Fig. 2d is a schematic diagram of matrix a multiplied by matrix B.
Fig. 2e is a schematic diagram of matrix Ai multiplied by matrix B.
FIG. 3a is a schematic diagram of neural network training.
FIG. 3b is a schematic diagram of convolution operation.
FIG. 4a is a schematic diagram of the forward operation of the neural network.
FIG. 4b is a diagram illustrating the inverse operation of the neural network.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those skilled in the art, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure, and it is apparent that the described embodiments are only a part of the embodiments of the present disclosure, not all of the embodiments. All other embodiments, which can be derived by one of ordinary skill in the art from the embodiments disclosed herein without making any creative effort, shall fall within the scope of protection of the present disclosure.
In the apparatus provided in the first aspect, the integrated circuit chip apparatus further includes: branch processing circuitry disposed between the main processing circuitry and the at least one base processing circuitry; the branch processing circuit is used for forwarding data between the main processing circuit and at least one basic processing circuit.
In the apparatus provided in the first aspect, the main processing circuit is configured to obtain a data block to be computed and an operation instruction, convert the data block to be computed into a data block of a fixed-point type by the data type operation circuit, and divide the data block to be computed of the fixed-point type into a distribution data block and a broadcast data block according to the operation instruction; splitting the distribution data block to obtain a plurality of basic data blocks, distributing the plurality of basic data blocks to the at least one basic processing circuit, and broadcasting the broadcast data block to the at least one basic processing circuit;
the basic processing circuit is used for executing inner product operation on the basic data block and the broadcast data block in a fixed point type to obtain an operation result, and sending the operation result to the main processing circuit;
and the main processing circuit is used for processing the operation result to obtain the data block to be calculated and an instruction result of the operation instruction.
In the apparatus provided in the first aspect, the main processing circuit is specifically configured to broadcast the broadcast data block to the plurality of basic processing circuits at a time.
In the apparatus provided in the first aspect, the basic processing circuit is specifically configured to perform inner product processing on the basic data block and the broadcast data block according to a fixed-point data type to obtain an inner product processing result, accumulate the inner product processing result to obtain an operation result, and send the operation result to the main processing circuit.
In the apparatus provided in the first aspect, the main processing circuit is configured to, when the operation result is a result of inner product processing, accumulate the operation result to obtain an accumulation result, and arrange the accumulation result to obtain the data block to be calculated and an instruction result of the operation instruction.
In the apparatus provided in the first aspect, the main processing circuit is specifically configured to divide the broadcast data block into a plurality of partial broadcast data blocks, and broadcast the plurality of partial broadcast data blocks to the plurality of basic processing circuits by multiple times.
In the apparatus provided in the first aspect, the basic processing circuit is specifically configured to perform an inner product processing on the partial broadcast data block and the basic data block in a fixed-point data type once to obtain an inner product processing result, accumulate the inner product processing result to obtain a partial operation result, and send the partial operation result to the main processing circuit.
In the apparatus provided in the first aspect, the basic processing circuit is specifically configured to multiplex n times the partial broadcast data block to perform an operation of integrating the partial broadcast data block with the n basic data blocks to obtain n partial processing results, accumulate the n partial processing results respectively to obtain n partial operation results, and send the n partial operation results to the main processing circuit, where n is an integer greater than or equal to 2.
In an apparatus provided in the first aspect, the main processing circuit includes: a master register or on-master cache circuit;
the base processing circuit includes: basic registers or basic on-chip cache circuits.
In an apparatus provided in the first aspect, the main processing circuit includes: the vector arithmetic circuit, the arithmetic logic unit circuit, the accumulator circuit, the matrix transposition circuit, the direct memory access circuit, the data type arithmetic circuit or the data rearrangement circuit or any combination thereof.
In the apparatus provided in the first aspect, the main processing circuit is configured to obtain a data block to be calculated and an operation instruction, and divide the data block to be calculated into a distribution data block and a broadcast data block according to the operation instruction; splitting the distribution data block to obtain a plurality of basic data blocks, distributing the plurality of basic data blocks to the at least one basic processing circuit, and broadcasting the broadcast data block to the at least one basic processing circuit;
the basic processing circuit is used for converting the basic data block and the broadcast data block into a fixed-point type data block, executing inner product operation according to the fixed-point type data block to obtain an operation result, converting the operation result into floating-point data and then sending the floating-point data to the main processing circuit;
and the main processing circuit is used for processing the operation result to obtain the data block to be calculated and an instruction result of the operation instruction.
In the apparatus provided in the first aspect, the branch processing circuit includes a plurality of branch processing circuits, the main processing circuit is connected with the plurality of branch processing circuits respectively, and each branch processing circuit is connected with at least one basic processing circuit.
In the apparatus provided in the first aspect, the data is: one or any combination of vectors, matrices, three-dimensional data blocks, four-dimensional data blocks, and n-dimensional data blocks.
In the apparatus provided in the first aspect, if the operation instruction is a multiplication instruction, the main processing circuit determines that the multiplier data block is a broadcast data block and the multiplicand data block is a distribution data block;
if the operation instruction is a convolution instruction, the main processing circuit determines that the input data block is a broadcast data block and the convolution kernel is a distribution data block.
In a method provided in a sixth aspect, the operation of the neural network comprises: one or any combination of convolution operation, matrix multiplication matrix operation, matrix multiplication vector operation, partial execution operation, full connection operation, GEMM operation, GEMV operation and activation operation.
Referring to fig. 1a, fig. 1a is a schematic structural diagram of an integrated circuit chip device, as shown in fig. 1a, the chip device includes: main processing circuitry, basic processing circuitry, and branch processing circuitry (optional). Wherein,
the main processing circuit may include a register and/or an on-chip cache circuit, and may further include a control circuit, a vector operator circuit, an ALU (arithmetic and logic unit) circuit, an accumulator circuit, a DMA (Direct memory access) circuit, and other circuits, such as a conversion circuit (e.g., a matrix transpose circuit), a data rearrangement circuit, an activation circuit, and the like;
optionally, the main processing circuit may include: the data type conversion operation circuit may be configured to convert the received or transmitted data from floating point type data to fixed point type data, or may be configured to convert the fixed point type data to floating point type data in practical applications. The present invention is not limited to the specific form of the data type conversion operation circuit.
The main processing circuit further includes a data transmitting circuit, a data receiving circuit or an interface, the data transmitting circuit may integrate the data distributing circuit and the data broadcasting circuit, and certainly in practical application, the data distributing circuit and the data broadcasting circuit may also be separately configured; in practical applications, the data transmitting circuit and the data receiving circuit may be integrated together to form a data transmitting/receiving circuit. For broadcast data, i.e. data that needs to be sent to each of the basic processing circuits. For the distribution data, i.e. the data that needs to be selectively sent to part of the basic processing circuits, the specific selection mode can be specifically determined by the main processing circuit according to the load and the calculation mode. For the broadcast transmission mode, broadcast data is transmitted to each base processing circuit in a broadcast form. (in practical applications, broadcast data is transmitted to each basic processing circuit by one-time broadcasting, or broadcast data is transmitted to each basic processing circuit by multiple-time broadcasting, and the specific embodiments of the present invention do not limit the number of times of broadcasting), the distribution transmission method is to selectively transmit the distribution data to a part of the basic processing circuits.
When data distribution is realized, the control circuit of the main processing circuit transmits data to part or all of the basic processing circuits (the data may be the same or different, specifically, if the data is transmitted in a distribution mode, the data received by each basic processing circuit receiving the data may be different, and certainly, the data received by some basic processing circuits may be the same;
specifically, when data is broadcast, the control circuit of the main processing circuit transmits data to part or all of the basic processing circuits, and each basic processing circuit receiving data can receive the same data.
Optionally, the vector operator circuit of the main processing circuit may perform vector operations, including but not limited to: two vectors are added, subtracted, multiplied, divided, the vectors are added, subtracted, multiplied, divided with a constant, or any operation is performed on each element in the vector. The continuous operation may be, for example, addition, subtraction, multiplication, division, activation, accumulation, and the like of the vector and the constant.
Each base processing circuit may include a base register and/or a base on-chip cache circuit; each base processing circuit may further include: an inner product operator circuit, a vector operator circuit, an accumulator circuit, or the like, in any combination. The inner product operator circuit, the vector operator circuit, and the accumulator circuit may be integrated circuits, or the inner product operator circuit, the vector operator circuit, and the accumulator circuit may be circuits provided separately.
The chip device may optionally further include one or more branch processing circuits, for example, when the branch processing circuit is provided, the main processing circuit is connected to the branch processing circuit, the branch processing circuit is connected to the basic processing circuit, the inner product operator circuit of the basic processing circuit is configured to perform inner product operation between data blocks, the control circuit of the main processing circuit controls the data receiving circuit or the data transmitting circuit to receive and transmit external data, and controls the data transmitting circuit to distribute the external data to the branch processing circuit, and the branch processing circuit is configured to receive and transmit data from the main processing circuit or the basic processing circuit. The structure shown in fig. 1a is suitable for the computation of complex data, because the number of units connected to the main processing circuit is limited, so that a branch processing circuit needs to be added between the main processing circuit and the basic processing circuit to realize the access of more basic processing circuits, thereby realizing the computation of complex data blocks. The connection structure of the branch processing circuit and the basic processing circuit may be arbitrary and is not limited to the H-type structure of fig. 1 a. Optionally, the main processing circuit to the basic processing circuit is a broadcast or distributed structure, and the basic processing circuit to the main processing circuit is a gather structure. Broadcast, distribution and collection are defined as follows, for a distribution or broadcast configuration, the number of basic processing circuits is greater than that of the main processing circuits, i.e. 1 main processing circuit corresponds to a plurality of basic processing circuits, i.e. a configuration for broadcasting or distribution from the main processing circuit to the plurality of basic processing circuits, whereas a configuration for collection from the plurality of basic processing circuits to the main processing circuit may be provided.
And the basic processing circuit receives data distributed or broadcasted by the main processing circuit, stores the data into an on-chip cache of the basic processing circuit, can perform operation to generate a result, and can send the data to the main processing circuit.
The data involved in the basic processing circuit can be data of any data type, can be data represented by floating point numbers with any bit width, and can also be data represented by fixed point numbers with any bit width; all the arithmetic circuits and the storage circuits may be arithmetic circuits and storage circuits of any data types that can be processed, and may be arithmetic circuits and storage circuits of floating point numbers of any bit width, or arithmetic circuits and storage circuits of fixed point numbers of any bit width.
Optionally, each basic processing circuit may include a data type conversion operation circuit, or a part of the basic processing circuits may be configured with the data type conversion operation circuit; the data type conversion arithmetic circuit may be configured to convert received or transmitted data from floating point type data to fixed point type data, and may also convert fixed point type data to floating point type data. The present invention is not limited to the specific form of the data type conversion operation circuit.
Optionally, the vector operator circuit of the basic processing circuit may perform vector operation on the two vectors after the data type conversion, and certainly in practical application, the inner product operator circuit of the basic processing circuit may perform inner product operation on the two vectors after the data type conversion, and the accumulator circuit may also accumulate the result of the inner product operation.
In one alternative, the two vectors may be stored in on-chip caches and/or registers, and the underlying processing circuitry may fetch the two vectors to perform the operation as needed for the actual computation. This operation includes, but is not limited to: inner product operations, multiplication operations, addition operations, or other operations.
In one alternative, the result of the inner product operation may be accumulated onto an on-chip cache and/or register; the alternative scheme has the advantages of reducing the data transmission quantity between the basic processing circuit and the main processing circuit, improving the operation efficiency and reducing the data transmission power consumption.
In one alternative, the result of the inner product operation is not accumulated and is directly transmitted as a result; the technical scheme has the advantages that the internal operation amount of the basic processing circuit is reduced, and the operation efficiency of the basic processing circuit is improved.
In an alternative, each basic processing circuit can execute inner product operations of a plurality of groups of two vectors, and can also respectively accumulate the results of the inner product operations of the plurality of groups;
in one alternative, multiple sets of two vector data may be stored in on-chip caches and/or registers;
in one alternative, the results of multiple sets of inner product operations may be accumulated in an on-chip cache and/or a register, respectively;
in one alternative, the results of the inner product operations in each group can be directly transmitted as results without accumulation;
in one alternative, each base processing circuit may perform an inner product operation of the same vector with multiple vectors (a "one-to-many" inner product, i.e., one vector of two vectors of each group of inner products is shared), and accumulate the inner product results corresponding to each vector separately. According to the technical scheme, the same set of weight can be used for calculating different input data for multiple times, data multiplexing is increased, the data transmission quantity of data in a basic processing circuit is reduced, the calculation efficiency is improved, and the power consumption is reduced.
Specifically, in the data used to compute the inner product, the data sources of the vector shared by the groups and the other vector of each group (i.e., the vector that differs between each group) may differ:
in one alternative, the sets of shared vectors are broadcast or distributed from the main processing circuit or the branch processing circuit when calculating the inner product;
in one alternative, the sets of shared vectors come from an on-chip cache when computing the inner product;
in one alternative, the sets of shared vectors come from registers when computing the inner product;
in one alternative, in calculating the inner product, the other unshared vector of each group is broadcast or distributed from the main processing circuit or the branch processing circuit;
in one alternative, in computing the inner product, the other unshared vector of each group is from the slave on-chip cache;
in one alternative, the other unshared vector of each group comes from a register when calculating the inner product;
in one alternative, when performing inner product operation of multiple groups, each group of shared vectors keeps any number of parts in an on-chip cache and/or a register of the basic processing circuit;
in one alternative, the shared vector may be reserved one for each set of inner products;
in one alternative, the shared vector may be reserved only one copy;
specifically, the results of the multiple sets of inner product operations may be accumulated in an on-chip cache and/or a register, respectively;
specifically, the result of each group of inner product operations can be directly transmitted as a result without accumulation;
referring to FIG. 1a, the architecture includes a main processing circuit (which can perform vector operations) and multiple basic processing circuits (which can perform inner product operations). The benefits of such a combination are: the device can not only use the basic processing circuit to execute matrix and vector multiplication operation, but also use the main processing circuit to execute other arbitrary vector operation, so that the device can complete more operations more quickly under the configuration of limited hardware circuit, thereby reducing the times of data transmission with the outside of the device, improving the calculation efficiency and reducing the power consumption. In addition, the chip can be provided with a data type conversion operation circuit on the basic processing circuit and/or the main processing circuit, so that floating point type data can be converted into fixed point type data when the neural network calculation is carried out, and fixed point type data can also be converted into floating point type data, and the chip can dynamically distribute the data types to the circuits according to the operation amount (namely load amount) of each circuit (mainly the main processing circuit and the basic processing circuit), so that complex programs of data calculation can be reduced, power consumption can be reduced, and conversion of dynamically distributed data types can be realized without influencing the calculation efficiency of the chip. The manner of this assignment includes, but is not limited to: load balancing, load minimum distribution, and the like.
A schematic structural diagram of the fixed-point type data is shown in fig. 1d, as shown in fig. 1d, which is an expression method of the fixed-point type data, for a computing system, the storage Bit number of 1 floating-point data is 32 bits, and for the fixed-point data, especially for the representation of the data by using the floating-point type data as shown in fig. 1d, the storage Bit number of 1 fixed-point data can be less than 16 bits, so that for this conversion, the transmission overhead between the calculators can be greatly reduced, in addition, for the calculators, the space for storing the data with fewer bits is also smaller, i.e., the storage overhead is smaller, the calculation amount is also reduced, i.e., the calculation overhead is reduced, so that the calculation overhead and the storage overhead can be reduced, but for the conversion of the data type, a part of overhead is also required, hereinafter referred to as the conversion overhead for short, the calculation amount is large, the conversion cost of data with large data storage capacity can be almost ignored relative to the subsequent calculation cost, storage cost and transmission cost, so for data with large calculation capacity and large data storage capacity, the technical scheme of converting the data type into the fixed point type data is adopted in the disclosure, otherwise, for data with small calculation capacity and small data storage capacity, the calculation cost, the storage cost and the transmission cost are relatively small, at the moment, if the fixed point data is used, the precision of the fixed point data is slightly lower than that of floating point data, on the premise of smaller calculation capacity, the calculation precision needs to be ensured, so the fixed point type data is converted into the floating point data, namely, the purpose of improving the calculation precision is achieved by increasing smaller cost.
Referring to the apparatus shown in FIG. 1b, the apparatus shown in FIG. 1b is a computing apparatus without branch processing circuit, such as the apparatus shown in FIG. 1b, which comprises: a main processing circuit and N basic processing circuits, where the main processing circuit (a specific structure is shown in fig. 1 c) and the N basic processing circuits may be directly or indirectly connected, for example, in an indirect connection manner, an optional scheme may include, as shown in fig. 1a, N/4 branch processing circuits, each branch processing circuit is connected to 4 basic processing circuits, and for the circuits included in the main processing circuit and the N basic processing circuits, reference may be made to the description shown in fig. 1a, which is not described herein again, where it is to be noted that the basic processing circuits may also be disposed in the branch processing circuits, and in addition, the number of the basic processing circuits connected to each branch processing circuit may also be not limited to 4, and a manufacturer may configure the basic processing circuits according to actual needs. The main processing circuit and/or the N basic processing circuits may each include a data type conversion operation circuit, specifically, the main processing circuit may include a data type operation circuit, the N basic processing circuits or a part thereof may include a data type conversion circuit, or the main processing circuit and the N basic processing circuits or a part thereof may both include. The main processing circuit may dynamically allocate an operation entity of the data type conversion step according to the neural network computation instruction, specifically, the main processing circuit may determine whether to perform the data type conversion step on the received data according to its own load, specifically, a value of the load may be set to a plurality of intervals, each interval corresponds to an execution subject allocated to the data type conversion step, for example, taking 3 intervals as an example, a load value of interval 1 is low, the data type conversion step may be individually performed by the main processing circuit, a load value of interval 2 is located between interval 1 and interval 3, the data type conversion step may be performed by the main processing circuit or N basic processing circuits together, a load value of interval 3 is high, and the data type conversion step may be performed by N basic processing circuits. In this regard, the execution may be performed in an explicit manner, for example, the main processing circuit may be configured with a special indication or instruction, and when the basic processing circuit receives the special indication or instruction, the data type conversion step is determined to be executed, for example, when the basic processing circuit does not receive the special indication or instruction, the data type conversion step is determined not to be executed. As another example, this may be performed in an implied manner, e.g., where the underlying processing circuitry receives data of a data type that is a floating point type and determines that an inner product operation needs to be performed, converts the data type to a fixed point type of data.
In practical applications, the forward operation may perform matrix multiplication, convolution, activation, transformation, and other operations according to different input data, and all the operations may be implemented by the apparatus shown in fig. 1 a.
The data conversion arithmetic circuit of the main processing circuit converts the type of the data and transmits the converted data to the basic processing circuit for operation by the control circuit, for example, the data conversion arithmetic circuit of the main processing circuit can convert a floating point number into a fixed point number with lower bit width and then transmit the fixed point number to the basic processing circuit.
If the data received by the basic processing circuit is floating point data, the basic processing circuit can receive the data and then perform data type conversion by the data conversion operation circuit, and then perform calculation.
For example, the floating point number operation result calculated by the basic processing circuit can be converted into a fixed point number with low bit width and then transmitted to the main processing circuit, so that the data bit width in the transmission process is reduced, the efficiency is higher, and the power consumption is saved.
The main processing circuit transmits data to be calculated to all or a part of basic processing circuits; taking the matrix multiplied by the vector calculation as an example, the control circuit of the main processing circuit may split each column of matrix data into one basic data, for example, an m × n matrix, and may split the matrix data into n vectors of m rows, and the control circuit of the main processing circuit distributes the split n vectors of m rows to a plurality of basic processing circuits. For vectors, the control circuitry of the main processing circuitry may broadcast the vector as a whole to each of the base processing circuitry. If the value of m is relatively large, the control circuit may first split the m × n matrix into x × n vectors, taking x as an example, 2, specifically, 2n vectors, each vector including m/2 rows, that is, each vector in n m rows is equally split into 2 vectors, taking the first row as an example, if the first vector of the n m rows is 1000 rows, then equally split into 2 vectors may be that the first 500 rows are combined into the first vector, the last 500 rows are combined into the second vector, and the control circuit broadcasts the 2 vectors to the plurality of basic processing circuits through 2 broadcasts.
The data transmission mode can be broadcasting or distribution, or any other possible transmission mode;
after receiving the data, the basic processing circuit executes operation to obtain an operation result;
the basic processing circuit transmits the operation result back to the main processing circuit;
the operation result may be an intermediate operation result or a final operation result.
The operation of multiplying the vector by the matrix is completed by using the device shown in FIG. 1 a;
(the matrix multiplication vector can be that each row in the matrix is respectively subjected to inner product operation with the vector, and the results are arranged into a vector according to the sequence of the corresponding rows.)
The following describes the operation of multiplying a matrix S of size M rows and L columns by a vector P of length L, as shown in fig. 2a below, (each row in the matrix S is the same length as the vector P, and the data in them are in one-to-one correspondence by position) the neural network computing device has K basic processing circuits:
referring to fig. 2, fig. 2 provides a method for implementing matrix multiplication vector, which may specifically include:
step S201, a data conversion operation circuit of a main processing circuit converts each row of data in a matrix S into fixed-point type data, a control circuit of the main processing circuit distributes the data to one of K basic processing circuits, and the basic processing circuits store the received distributed data in an on-chip cache and/or a register of the basic processing circuits;
in an alternative, if the number M < ═ K of rows of the matrix S, the control circuit of the main processing circuit distributes one row of the matrix S to the K basic processing circuits, respectively;
in an alternative, the control circuit of the main processing circuit distributes data of one or more rows of the S matrix to each of the elementary processing circuits, respectively, if the number of rows M > K of the matrix S.
The set of rows in S distributed to the ith basic processing circuit is Ai, and there are Mi rows in total, as fig. 2c shows the calculations to be performed on the ith basic processing circuit.
In one alternative, in each base processing circuit, e.g., the ith base processing circuit, the received dispatch data, e.g., the matrix Ai, may be stored in a register and/or on-chip cache of the ith base processing circuit; the method has the advantages of reducing the data transmission quantity of the subsequent distribution data, improving the calculation efficiency and reducing the power consumption.
Step S202, a data type operation circuit of a main processing circuit converts the vector P into fixed point type data, and a control circuit of the main processing circuit transmits all parts in the fixed point type vector P to K basic processing circuits in a broadcasting mode;
in an alternative, the control circuit of the main processing circuit may broadcast each part of the vector P only once to the register or on-chip buffer of each basic processing circuit, and the ith basic processing circuit may fully multiplex the data of the vector P obtained this time, and perform the inner product operation corresponding to each row in the matrix Ai. The method has the advantages of reducing the data transmission quantity of repeated transmission of the vector P from the main processing circuit to the basic processing circuit, improving the execution efficiency and reducing the transmission power consumption.
In an alternative, the control circuit of the main processing circuit may broadcast each part of the vector P to the register or on-chip cache of each basic processing circuit for multiple times, and the ith basic processing circuit does not multiplex the data of the vector P obtained each time, and completes the inner product operation corresponding to each row in the matrix Ai for multiple times; the method has the advantages of reducing the data transmission quantity of the vector P of single transmission in the basic processing circuit, reducing the capacity of the cache and/or the register of the basic processing circuit, improving the execution efficiency, reducing the transmission power consumption and reducing the cost.
In an alternative, the control circuit of the main processing circuit may broadcast each part of the vector P to the register or on-chip cache of each basic processing circuit for multiple times, and the ith basic processing circuit performs partial multiplexing on the data of the vector P obtained each time, and completes the inner product operation corresponding to each row in the matrix Ai; the method has the advantages of reducing the data transmission quantity from the main processing circuit to the basic processing circuit, reducing the data transmission quantity in the basic processing circuit, improving the execution efficiency and reducing the transmission power consumption.
Step S203, calculating the inner product of the matrix S and the data of the vector P by an inner product arithmetic circuit of K basic processing circuits, for example, the ith basic processing circuit, calculating the inner product of the data of the matrix Ai and the data of the vector P;
and S204, accumulating the results of the inner product operation by the accumulator circuits of the K basic processing circuits to obtain accumulated results, and transmitting the accumulated results back to the main processing circuit in a fixed-point type mode.
In an alternative, the partial sums (i.e., a portion of the accumulated result, e.g., F1G 1+ F2G 2+ F3G 3+ F4G 4+ F5G 5, then the partial sums may be the values of F1G 1+ F2G 2+ F3G 3) resulting from each inner product operation performed by the basic processing circuit may be transmitted back to the main processing circuit for accumulation; the method has the advantages of reducing the internal operation amount of the basic processing circuit and improving the operation efficiency of the basic processing circuit.
In an alternative, the partial sum obtained by the inner product operation executed by the basic processing circuit each time can be stored in a register and/or an on-chip cache of the basic processing circuit, and the partial sum is transmitted back to the main processing circuit after the accumulation is finished; the method has the advantages of reducing the data transmission quantity between the basic processing circuit and the main processing circuit, improving the operation efficiency and reducing the data transmission power consumption.
In an alternative, the partial sum obtained by the inner product operation executed by the basic processing circuit each time is stored in a register and/or an on-chip cache of the basic processing circuit for accumulation in partial cases, and is transmitted to the main processing circuit for accumulation in partial cases, and is transmitted back to the main processing circuit after the accumulation is finished; the method has the advantages of reducing the data transmission quantity between the basic processing circuit and the main processing circuit, improving the operation efficiency, reducing the data transmission power consumption, reducing the operation quantity in the basic processing circuit and improving the operation efficiency of the basic processing circuit.
Referring to FIG. 2b, the matrix multiplication operation is performed using the apparatus shown in FIG. 1 a;
the following describes the operation of calculating the multiplication of a matrix S of size M rows and L columns and a matrix P of size L rows and N columns, (each row in the matrix S being the same length as each column of the matrix P, as shown in fig. 2 d) the neural network computing device possesses K basic processing circuits:
step S201b, the control circuit of the main processing circuit distributes each line of data in the matrix S to one of the K basic processing circuits, and the basic processing circuits store the received data in the on-chip cache and/or the register;
in one alternative, if the number of rows M < ═ K of S, the control circuit of the main processing circuit distributes one row of the S matrix to the M basic processing circuits, respectively;
in an alternative, the control circuit of the main processing circuit distributes data of one or more rows in the S matrix to each of the elementary processing circuits, respectively, if the number of rows M > K of S.
In S, Mi rows are distributed to the ith basic processing circuit, and the set of Mi rows is called Ai, as shown in fig. 2e, which represents the calculation to be performed on the ith basic processing circuit.
In one alternative, in each base processing circuit, for example, in the ith base processing circuit:
the received matrix Ai distributed by the main processing circuit stores the matrix Ai in an ith basic processing circuit register and/or an on-chip cache; the method has the advantages of reducing the subsequent data transmission quantity, improving the calculation efficiency and reducing the power consumption.
Step S202b, the control circuit of the main processing circuit transmits each part in the matrix P to each basic processing circuit in a broadcast mode;
in an alternative scheme, each part in the matrix P may be broadcasted to the register or on-chip cache of each basic processing circuit only once, and the ith basic processing circuit multiplexes the data of the matrix P obtained this time sufficiently to complete the inner product operation corresponding to each row in the matrix Ai; the multiplexing in this embodiment may be specifically that the basic processing circuit is repeatedly used in the calculation, for example, the multiplexing of the data of the matrix P may be that the data of the matrix P is used multiple times.
In an alternative, the control circuit of the main processing circuit may broadcast each part of the matrix P to the register or on-chip cache of each basic processing circuit for multiple times, and the ith basic processing circuit does not multiplex the data of the matrix P obtained each time, and completes the inner product operation corresponding to each row in the matrix Ai for multiple times;
in an alternative, the control circuit of the main processing circuit may broadcast each part of the matrix P to the register or on-chip cache of each basic processing circuit for multiple times, and the ith basic processing circuit performs partial multiplexing on the data of the matrix P obtained each time, and completes the inner product operation corresponding to each row in the matrix Ai;
in one alternative, each basic processing circuit, for example the ith basic processing circuit, calculates the inner product of the data of matrix Ai and the data of matrix P;
in step S203b, the accumulator circuit of each basic processing circuit accumulates the result of the inner product operation and transmits it back to the main processing circuit.
In one alternative, the base processing circuit may transmit the partial sums obtained by performing the inner product operation each time back to the main processing circuit for accumulation;
in an alternative, the partial sum obtained by the inner product operation executed by the basic processing circuit each time can be stored in a register and/or an on-chip cache of the basic processing circuit, and the partial sum is transmitted back to the main processing circuit after the accumulation is finished;
in an alternative, the partial sum obtained by the inner product operation performed by the basic processing circuit each time may be stored in a register and/or an on-chip buffer of the basic processing circuit in some cases for accumulation, and transmitted to the main processing circuit for accumulation in some cases, and transmitted back to the main processing circuit after the accumulation is finished.
Referring to FIG. 3a, a full join operation is performed using the apparatus shown in FIG. 1 a:
if the input data of the fully-connected layer is a vector (namely the input of the neural network is the case of a single sample), taking the weight matrix of the fully-connected layer as a matrix S and the input vector as a vector P, and performing the matrix multiplication vector operation as shown in FIG. 2 according to the first using method of the device;
if the input data of the fully connected layer is a matrix (i.e. the input of the neural network is the case of multiple samples as the batch), then the weight matrix of the fully connected layer is used as the matrix S and the input vector is used as the matrix P, or the weight matrix of the fully connected layer is used as the matrix P and the input vector is used as the matrix S, and the execution operation of the matrix multiplication matrix shown in fig. 2c is performed according to the device;
referring to FIG. 3b, the convolution operation is performed using the apparatus shown in FIG. 1 a:
for a convolution layer, recording the number of convolution kernels as M;
step S301, the control circuit of the main processing circuit distributes the weight of each convolution kernel in the convolution layer weight to one of K basic processing circuits and stores the weight in an on-chip cache and/or a register of the basic processing circuits;
in an alternative scheme, if the number M < ═ K of convolution kernels, the control circuit of the main processing circuit distributes the weight of one convolution kernel to each of the M basic processing circuits;
in one alternative, the control circuit of the main processing circuit distributes the weight of one or more convolution kernels to each of the base processing circuits, respectively, if the number of convolution kernels, M > K.
There are a total of Mi convolution kernels distributed to the ith base processing circuit, and the set of these convolution kernel weights is called Ai.
In one alternative, in each base processing circuit, for example, in the ith base processing circuit:
storing the received convolution kernel weight Ai distributed by the main processing circuit in a register and/or an on-chip cache of the main processing circuit;
step S302, the control circuit of the main processing circuit transmits each part in the input data P to each basic processing circuit in a broadcasting mode;
in an alternative, the control circuit of the main processing circuit may broadcast each part of the input data P to the register or on-chip cache of each basic processing circuit only once, and the ith basic processing circuit fully multiplexes the data of the input data P obtained this time, and completes the inner product operation corresponding to each convolution kernel in Ai;
in an alternative, the control circuit of the main processing circuit may broadcast each part of the input data P to the register or on-chip cache of each basic processing circuit for multiple times, and the ith basic processing circuit does not multiplex the data of the input data P obtained each time, and completes the inner product operation corresponding to each convolution kernel in Ai in multiple times;
in an alternative, the control circuit of the main processing circuit may broadcast each part of the input data P to the register or on-chip cache of each basic processing circuit for multiple times, and the ith basic processing circuit performs partial multiplexing on the data of the input data P obtained each time, and completes the inner product operation corresponding to each convolution kernel in Ai;
step S303, each basic processing circuit calculates a data inner product of the convolution kernel and the input data P, for example, the ith basic processing circuit calculates an inner product of each convolution kernel of Ai and the data of the input data P;
step S304, the accumulator circuit of each basic processing circuit accumulates the result of the inner product operation and transmits it back to the main processing circuit:
in one alternative, the base processing circuitry may be configured to transmit the partial sum resulting from each inner product operation back to the main processing circuitry for accumulation;
in an alternative, the basic processing circuit may also store the partial sum obtained by the inner product operation performed each time in a register and/or an on-chip cache of the basic processing circuit, and transmit the partial sum back to the main processing circuit after the accumulation is finished;
in an alternative, the basic processing circuit may also store the partial sum obtained by the inner product operation performed each time in a register and/or an on-chip cache of the basic processing circuit for accumulation in some cases, transmit the partial sum to the main processing circuit for accumulation in some cases, and transmit the partial sum back to the main processing circuit after the accumulation is finished;
the method for updating the weight using the device shown in FIG. 1 a:
the weight updating function in the neural network training process is realized by utilizing a vector arithmetic unit circuit of the main processing circuit, and specifically, the weight updating refers to a method for updating the weight by using the gradient of the weight.
In an alternative scheme, a vector operator circuit of the main processing circuit is used for performing addition and subtraction operation on the two vectors of the weight and the weight gradient to obtain an operation result, and the operation result is the updated weight.
In an alternative scheme, a vector operator circuit of the main processing circuit multiplies or divides the weight and the gradient of the weight by a number to obtain a middle weight and a gradient value of the middle weight, and the vector operator circuit performs addition and subtraction operation on the middle weight and the gradient value of the middle weight to obtain an operation result, wherein the operation result is the updated weight.
In an alternative scheme, a group of momentum can be calculated by using the gradient of the weight, and then the updated weight is obtained by performing addition and subtraction calculation by using the momentum and the weight;
method for implementing inverse operation of full connection layer using device as shown in FIG. 1a
The backward operation of the fully-connected layer can be divided into two parts, as shown in fig. 4a below, and the solid arrow indicates the forward calculation process of the fully-connected layer, and as shown in fig. 4b, indicates the backward calculation process of the fully-connected layer.
The inverse operation of the fully-connected layer shown in fig. 4a and 4b can be performed by using the apparatus shown in fig. 1a and the matrix-by-matrix method shown in fig. 2 b;
the apparatus shown in FIG. 1a is used to implement the inverse operation of the convolutional layer;
the convolution layer inversion can be divided into two parts, as shown in FIG. 4a, where the solid arrows represent the forward calculation of the convolution layer, and FIG. 4b, which represents the reverse calculation of the convolution layer.
The convolution layer shown in FIG. 4b can be inverted by the method shown in FIG. 3b using the apparatus shown in FIG. 1 a.
Method for realizing BLAS (basic Linear Algebra Subprograms) function by using device shown in figure 1a
The GEMM calculation means: the operation of matrix-matrix multiplication in the BLAS library. The general representation of this operation is: c ═ alpha _ op (S) op (P) + beta _ C, where S and P are two input matrices, C is an output matrix, alpha and beta are scalars, op represents some operation on matrix S or P, and there are some additional integers as parameters to account for the width and height of matrix S and P;
the step of using the apparatus of fig. 1a to implement GEMM computation comprises:
the data type conversion operation circuit of the main processing circuit can carry out data type conversion on the matrix S and the matrix P;
the conversion circuit of the main processing circuit carries out respective corresponding op operations on the input matrix S and the matrix P;
in one alternative, the op may be a transpose operation of the matrix; the matrix transposition operation may be implemented using a matrix transposition circuit of the main processing circuit;
in an alternative, after the OP operation of the matrix S and the matrix P is performed, the data type conversion operation may be performed by the data conversion operation circuit of the main processing circuit, that is, the data conversion operation circuit converts the data types of OP (S) and OP (P) from floating point type data to fixed point type data, and then performs the matrix multiplication operation as shown in fig. 2 b.
In one alternative, an op of a certain matrix may be empty, and op operations are not performed;
performing a matrix multiplication between op (S) and op (P) by using the calculation method of the device shown in FIG. 1a using the matrix multiplication matrix as described in FIG. 2 b;
multiplying each value in the result of op(s) op (p) by alpha using the arithmetic logic unit of the main processing circuit;
in one alternative, the multiply by alpha operation is not performed with alpha 1;
realizing beta C operation by using an arithmetic logic unit of the main processing circuit;
in one alternative, in the case where beta is 1, the operation of multiplying by beta is not performed;
and (3) utilizing a vector arithmetic circuit of the main processing circuit to realize the step of adding corresponding positions between the matrix alpha (op)(s) op (P) and beta (C) to obtain a GEMM calculation result.
In one alternative, this is not done in the case of beta of 0;
the GEMV calculation means: the operation of matrix-vector multiplication in the BLAS library. The general representation of this operation is: c ═ alpha _ op (S) _ P + beta _ C, where S is the input matrix, P is the vector of inputs, C is the output vector, alpha and beta are scalars, and op represents some operation on the matrix S;
the steps for achieving the GEMV calculation using the apparatus of fig. 1a are:
the data type conversion operation circuit of the main processing circuit can carry out data type conversion on the input matrix S and the matrix P;
the conversion circuit of the main processing circuit performs corresponding op operation on the input matrix S;
in one alternative, the op may be a transpose operation of the matrix; the conversion circuit of the main processing circuit is used for realizing the matrix transposition operation;
in an alternative, the op of a certain matrix may be empty, and the transpose operation is not performed;
performing matrix-vector multiplication between a matrix op (S) and a vector P by using the method for calculating the matrix multiplied vector in the figure 2a by using the device shown in the figure 1 a;
multiplying each value in the result of op(s) P by alpha using an arithmetic logic unit of the main processing circuit;
in one alternative, the multiply by alpha operation is not performed with alpha 1;
realizing beta C operation by using an arithmetic logic unit of the main processing circuit;
in one alternative, in the case where beta is 1, the operation of multiplying by beta is not performed;
and the step of adding corresponding positions between the matrixes alpha _ op, (S) P and beta _ C is realized by utilizing a vector arithmetic circuit of the main processing circuit to obtain a GEMV result.
In one alternative, in the case where beta is 0, the step operation of addition is not performed;
method for implementing an activation function using a device as in fig. 1a
Inputting a vector by using an activation circuit of a main processing circuit, and calculating an activation vector of the vector;
in an alternative scheme, the main processing circuit activation circuit calculates a value output to a corresponding position of the output vector by each value in the input vector through an activation function (the input of the activation function is a value, and the output of the activation function is also a value);
in one alternative, the activation function may be: y ═ max (m, x), where x is the input value, y is the output value, and m is a constant;
in one alternative, the activation function may be: y ═ tanh (x), where x is the input value and y is the output value;
in one alternative, the activation function may be: y is sigmoid (x), where x is the input value and y is the output value;
in one alternative, the activation function may be a piecewise linear function;
in one alternative, the activation function may be any function that inputs a number and outputs a number.
In one alternative, the sources of the input vector are (including but not limited to):
a source of data external to the device;
in one alternative, the input data comes from the result of matrix multiplication vector operation performed by the device;
in one alternative, the input data comes from the device to perform matrix multiplication operation;
the main processing circuit of the device calculates the result;
in one alternative, the input data is from the calculation results after the device main processing circuit implements biasing.
It should be noted that the activation operation may be implemented by an arithmetic logic circuit and an accumulator circuit in the main processing circuit, or may be implemented by adding a separate activation circuit to the main processing circuit.
The biasing operation is implemented using the apparatus as in fig. 1 a:
the function of adding two vectors or two matrixes can be realized by utilizing a vector arithmetic circuit of the main processing circuit;
the function of adding a vector to each row, or to each column, of a matrix can be implemented using the vector operator circuit of the main processing circuit.
In one alternative, the matrix may be derived from the result of the device performing a matrix-by-matrix operation;
in one alternative, the matrix may be derived from the result of the device performing a matrix multiply vector operation;
in one alternative, the matrix may be from data received externally by the main processing circuitry of the device.
In one alternative, the vector may be from data received externally by the main processing circuitry of the device.
Including but not limited to the above data sources.
The data type conversion is implemented using the apparatus as in fig. 1 a:
the data type conversion operation circuit of the main processing circuit is used for realizing the conversion of the data type;
in one alternative, the data type conversion of a set of data is implemented using a data type conversion arithmetic circuit of the main processing circuit;
in one alternative, the form of data type conversion includes, but is not limited to: the number of floating point is converted into a fixed point number, the number of fixed point is converted into a floating point number, and the like;
the invention also provides a chip comprising a computing device, the computing device comprising:
the data processing system comprises a main processing circuit, wherein the data involved in the main processing circuit can be data of any data type, and in an alternative scheme, the data can be represented by floating point numbers with any bit width or fixed point numbers with any bit width; all the arithmetic circuits and the storage circuits can be arithmetic circuits and storage circuits of any data types, and in an alternative, the arithmetic circuits and the storage circuits can be floating point arithmetic circuits and storage circuits of any bit width, and can also be fixed point arithmetic circuits and storage circuits of any bit width.
In one alternative, the main processing circuit includes a data type conversion arithmetic circuit;
in one alternative, the main processing circuit includes a vector operation unit that performs data type conversion;
specifically, the system comprises a data input interface for receiving input data;
in one alternative, the source of the received data may be: part or all of a basic processing circuit outside the neural network operation circuit device or the neural network operation circuit device;
in one alternative, there may be a plurality of the data input interfaces; specifically, a data output interface that outputs data may be included;
in one alternative, the destination of the output data may be: a part or all of a basic processing circuit outside the neural network operation device or the neural network operation circuit device;
in one alternative, the number of the data output interfaces may be plural;
in one alternative, the main processing circuitry comprises on-chip caches and/or registers;
in an alternative, the main processing circuit comprises an arithmetic unit which can execute data arithmetic;
in one alternative, an arithmetic operation unit is included in the main processing circuit;
in an alternative, the main processing circuit comprises a vector operation unit which can simultaneously perform operation on a group of data; in particular, the arithmetic operations and/or vector operations may be any type of operations, including but not limited to: two numbers are added, subtracted, multiplied, divided, one number is added, subtracted, multiplied, divided with a constant, an exponential operation, a power operation, a logarithmic operation are performed on one number, and various nonlinear operations, a comparison operation, a logical operation, etc. are performed on two numbers. Two vectors are added, subtracted, multiplied, divided, each element in one vector is added, subtracted, multiplied, divided with a constant, exponential, logarithmic, and various nonlinear operations are performed on each element in one vector, comparison operations, logical operations, and the like are performed on each two corresponding elements in one vector.
In one alternative, the main processing circuit includes a data rearranging unit for transferring data to the base processing circuit in a certain order or rearranging data in place in a certain order;
in one alternative, the order in which the data is arranged includes: carrying out dimension sequence transformation on a multi-dimensional data block; the order of the data arrangement may further include: a block of data is partitioned for transmission to different underlying processing circuits.
The computing device also includes a plurality of basic processing circuits: each basic processing circuit is used for calculating the inner product of two vectors, and the calculation method is that the basic processing circuit receives two groups of numbers, correspondingly multiplies elements in the two groups of numbers, and accumulates the multiplication results; the result of the inner product is transmitted, where it is possible to transmit it to other basic processing circuits, depending on the position of the basic processing circuit, or directly to the main processing circuit.
The data involved in the basic processing circuit can be data of any data type, and in an alternative scheme, the data can be represented by floating point numbers with any bit width or fixed point numbers with any bit width; all the arithmetic circuits and the storage circuits can be arithmetic circuits and storage circuits of any data types, and in an alternative, the arithmetic circuits and the storage circuits can be floating point arithmetic circuits and storage circuits of any bit width, and can also be fixed point arithmetic circuits and storage circuits of any bit width.
In one alternative, the base processing circuitry includes data type conversion arithmetic circuitry;
in one alternative, the base processing circuit includes a vector operation unit that performs data type conversion;
specifically, the memory unit comprises an on-chip cache and/or a register;
in particular, one or more data input interfaces to receive data;
in one alternative, two data input interfaces are included, one or more data being respectively available from the two data input interfaces at a time;
in one alternative, the base processing circuit may store the input data received from the data input interface in a register and/or an on-chip cache;
the data input interface may receive data from: other basic processing circuitry and/or main processing circuitry.
A main processing circuit of the neural network arithmetic circuit device;
other basic processing circuits of the neural network operation circuit device (the neural network operation circuit device has a plurality of basic processing circuits);
specifically, one or more data output interfaces for transmitting output data are included;
in one alternative, one or more data may be transmitted out of the data output interface;
specifically, the data transmitted through the data output interface may be: one or any combination of data received from the data input interface, data stored in an on-chip cache and/or register, a multiplier operation result, an accumulator operation result or an inner product operator operation result.
In one alternative, the system comprises three data output interfaces, wherein two of the three data output interfaces correspond to two data input interfaces respectively, a layer above each layer is used for outputting data received from the data input interfaces, and the third data output interface is used for outputting an operation result;
specifically, the destination of the data output interface to transmit data may be: the above data sources and the data destinations herein determine the connection relationships of the underlying processing circuitry in the device.
A main processing circuit of the neural network arithmetic circuit device;
a further basic processing circuit of the neural network arithmetic circuit device, the neural network arithmetic circuit device having a plurality of basic processing circuits;
specifically, an arithmetic operation circuit is included: the arithmetic operation circuit may specifically be: one or more multiplier circuits, one or more accumulator circuits, one or more circuits that perform two sets of inner product operations, or any combination thereof.
In an alternative, a multiplication operation of two numbers can be executed, and the result can be stored in an on-chip cache and/or a register or can be directly added into the register and/or the on-chip cache;
in an alternative, an inner product operation of two groups of data can be executed, and the result can be stored in an on-chip cache and/or a register or directly added into the register and/or the on-chip cache;
in one alternative, an accumulation operation of data may be performed, accumulating the data into an on-chip cache and or register;
specifically, the data accumulated by the accumulator circuit may be: one or any combination of data received from the data input interface, data stored in an on-chip cache and/or register, a multiplier operation result, an accumulator operation result, and an inner product operator operation result.
It should be noted that the "data input interface" and the "data output interface" used in the above description of the basic processing circuit refer to the data input and output interface of each basic processing circuit, not the data input and output interface of the whole device.
The disclosure also discloses a neural network computing device, which includes one or more chips shown in fig. 1a or fig. 1b, and is used for acquiring data to be computed and control information from other processing devices, executing a specified neural network operation, and transmitting the execution result to peripheral equipment through an I/O interface. Peripheral devices such as cameras, displays, mice, keyboards, network cards, wifi interfaces, servers. When more than one chip shown in fig. 1a or fig. 1b is included, the chips shown in fig. 1a or fig. 1b can be linked and transmit data through a specific structure, for example, a PCIE bus interconnects and transmits data to support larger-scale operation of the neural network. At this time, the same control system may be shared, or there may be separate control systems; the memory may be shared or there may be separate memories for each accelerator. In addition, the interconnection mode can be any interconnection topology.
The neural network arithmetic device has high compatibility and can be connected with various types of servers through PCIE interfaces.
Claims (10)
1. An integrated circuit chip apparatus, comprising: a main processing circuit and a plurality of basic processing circuits; the main processing circuit includes: a data type operation circuit for performing conversion between floating point type data and fixed point type data;
the main processing circuit is used for acquiring an input data block, a convolution kernel data block and a convolution instruction, converting the input data block and the convolution kernel data block into a fixed-point type input data block and a fixed-point type convolution kernel data block through the data type operation circuit, dividing the fixed-point type input data block into a broadcast data block according to the convolution instruction, and dividing the fixed-point type convolution kernel data block into a distribution data block; splitting the distribution data block to obtain a plurality of basic data blocks, distributing the plurality of basic data blocks to at least one basic processing circuit in a plurality of basic processing circuits, and broadcasting the broadcast data block to the plurality of basic processing circuits;
the plurality of basic processing circuits are used for executing convolution operation on the broadcast data block and the received basic data block according to the fixed point data type to obtain an operation result and transmitting the operation result to the main processing circuit;
and the main processing circuit is used for processing the operation result to obtain an instruction result of the convolution instruction.
2. The integrated circuit chip arrangement of claim 1,
the plurality of basic processing circuits are specifically configured to perform a plurality of inner product operations on the broadcast data block and the received basic data block in a fixed-point data type to obtain a plurality of inner product results of the fixed-point data type, accumulate the plurality of inner product results to obtain an accumulated result, and transmit the accumulated result serving as an operation result to the main processing circuit;
and the main processing circuit is used for converting the accumulation result of the fixed-point data type into the accumulation result of the floating-point type through the data type operation circuit and sequencing the accumulation result to obtain the instruction result.
3. The integrated circuit chip apparatus of any of claims 1-2, further comprising: branch processing circuitry disposed between the main processing circuitry and the at least one base processing circuitry;
the branch processing circuit is used for forwarding data between the main processing circuit and at least one basic processing circuit.
4. The integrated circuit chip apparatus of any of claims 1-2,
the main processing circuit is specifically configured to broadcast the broadcast data block to the plurality of basic processing circuits at a time;
or the main processing circuit is specifically configured to divide the broadcast data block into a plurality of partial broadcast data blocks, and broadcast the plurality of partial broadcast data blocks to the plurality of basic processing circuits by multiple times.
5. The integrated circuit chip apparatus of claim 4,
the basic processing circuit is specifically configured to perform multiple inner product processing on the partial broadcast data block and the basic data block in a fixed-point data type to obtain multiple inner product processing results, accumulate the multiple inner product processing results to obtain a partial operation result, and send the partial operation result to the main processing circuit.
6. The integrated circuit chip apparatus of claim 5,
the basic processing circuit is specifically configured to multiplex n times that the partial broadcast data block executes an inner product operation between the partial broadcast data block and the n basic data blocks to obtain n groups of inner product operation results, where the n groups of inner product operation results correspond to the n basic data blocks, accumulate each group of inner product operation results in the n groups of inner product operation results to obtain n partial operation results, and send the n partial operation results to the main processing circuit, where n is an integer greater than or equal to 2.
7. The integrated circuit chip apparatus of claim 1,
the plurality of basic processing circuits are symmetrically arranged along the main processing circuit.
8. The integrated circuit chip apparatus of claim 1,
if the basic processing circuits are K basic processing circuits and the number M of the convolution kernels is equal to K, the control circuit of the main processing circuit is used for distributing a weight of the convolution kernel to the M basic processing circuits respectively;
and if the number M of the convolution kernels is larger than K, the control circuit of the main processing circuit is used for distributing the weight values of one or more convolution kernels to each basic processing circuit respectively.
9. The integrated circuit chip apparatus of claim 8,
and the basic processing circuit is used for storing the convolution kernel weight values Ai in a register and/or an on-chip cache of the basic processing circuit, wherein the Ai is a set of a plurality of convolution kernel weight values.
10. A neural network operation device, comprising one or more integrated circuit chip devices as claimed in any one of claims 1 to 9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911401048.2A CN111160543B (en) | 2017-12-14 | 2017-12-14 | Integrated circuit chip device and related products |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711346333.XA CN109961135B (en) | 2017-12-14 | 2017-12-14 | Integrated circuit chip device and related product |
CN201911401048.2A CN111160543B (en) | 2017-12-14 | 2017-12-14 | Integrated circuit chip device and related products |
Related Parent Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711346333.XA Division CN109961135B (en) | 2017-12-14 | 2017-12-14 | Integrated circuit chip device and related product |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111160543A true CN111160543A (en) | 2020-05-15 |
CN111160543B CN111160543B (en) | 2023-08-29 |
Family
ID=67018606
Family Applications (4)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711346333.XA Active CN109961135B (en) | 2017-12-14 | 2017-12-14 | Integrated circuit chip device and related product |
CN201911401048.2A Active CN111160543B (en) | 2017-12-14 | 2017-12-14 | Integrated circuit chip device and related products |
CN201911401049.7A Active CN111091189B (en) | 2017-12-14 | 2017-12-14 | Integrated circuit chip device and related products |
CN201911163257.8A Active CN111105024B (en) | 2017-12-14 | 2017-12-14 | Neural network processor board card and related products |
Family Applications Before (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711346333.XA Active CN109961135B (en) | 2017-12-14 | 2017-12-14 | Integrated circuit chip device and related product |
Family Applications After (2)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911401049.7A Active CN111091189B (en) | 2017-12-14 | 2017-12-14 | Integrated circuit chip device and related products |
CN201911163257.8A Active CN111105024B (en) | 2017-12-14 | 2017-12-14 | Neural network processor board card and related products |
Country Status (2)
Country | Link |
---|---|
CN (4) | CN109961135B (en) |
TW (1) | TWI793224B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109977071A (en) * | 2017-12-27 | 2019-07-05 | 北京中科寒武纪科技有限公司 | Neural network processor board and Related product |
CN109978130A (en) * | 2017-12-28 | 2019-07-05 | 北京中科寒武纪科技有限公司 | Integrated circuit chip device and Related product |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH05346914A (en) * | 1992-06-16 | 1993-12-27 | Matsushita Electron Corp | Neuro processor |
US5583964A (en) * | 1994-05-02 | 1996-12-10 | Motorola, Inc. | Computer utilizing neural network and method of using same |
CN1570847A (en) * | 2003-07-23 | 2005-01-26 | 联发科技股份有限公司 | Digital signal processor applying skip type floating number operational method |
WO2005111843A2 (en) * | 2004-05-11 | 2005-11-24 | Massively Parallel Technologies, Inc. | Methods for parallel processing communication |
WO2017038104A1 (en) * | 2015-09-03 | 2017-03-09 | 株式会社Preferred Networks | Installation device and installation method |
CN107239829A (en) * | 2016-08-12 | 2017-10-10 | 北京深鉴科技有限公司 | A kind of method of optimized artificial neural network |
WO2017177446A1 (en) * | 2016-04-15 | 2017-10-19 | 北京中科寒武纪科技有限公司 | Discrete data representation-supporting apparatus and method for back-training of artificial neural network |
CN107329734A (en) * | 2016-04-29 | 2017-11-07 | 北京中科寒武纪科技有限公司 | A kind of apparatus and method for performing convolutional neural networks forward operation |
Family Cites Families (20)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP0334624A3 (en) * | 1988-03-23 | 1993-03-31 | Du Pont Pixel Systems Limited | Microcoded computer system |
JP3271186B2 (en) * | 1989-10-06 | 2002-04-02 | ソニー株式会社 | Learning processing device |
US5590356A (en) * | 1994-08-23 | 1996-12-31 | Massachusetts Institute Of Technology | Mesh parallel computer architecture apparatus and associated methods |
JP3790307B2 (en) * | 1996-10-16 | 2006-06-28 | 株式会社ルネサステクノロジ | Data processor and data processing system |
JP2969115B1 (en) * | 1998-11-25 | 1999-11-02 | 株式会社日立製作所 | Semiconductor device |
JP3889195B2 (en) * | 1999-02-03 | 2007-03-07 | 株式会社東芝 | Image processing apparatus, image processing system, and image processing method |
GB2369899A (en) * | 2000-07-20 | 2002-06-12 | Volodya Vovk | Data labelling device and method thereof |
US7571303B2 (en) * | 2002-10-16 | 2009-08-04 | Akya (Holdings) Limited | Reconfigurable integrated circuit |
US10572824B2 (en) * | 2003-05-23 | 2020-02-25 | Ip Reservoir, Llc | System and method for low latency multi-functional pipeline with correlation logic and selectively activated/deactivated pipelined data processing engines |
CN101424645B (en) * | 2008-11-20 | 2011-04-20 | 上海交通大学 | Soldered ball surface defect detection device and method based on machine vision |
JP5423110B2 (en) * | 2009-04-09 | 2014-02-19 | セイコーエプソン株式会社 | Information processing apparatus, arithmetic processing method, and electronic apparatus |
FR3011659B1 (en) * | 2013-10-04 | 2015-10-16 | Commissariat Energie Atomique | ELECTRONIC CIRCUIT, PARTICULARLY ABLE TO IMPLEMENTATION OF A NETWORK OF NEURONS, AND NEURONAL SYSTEM |
US20160026912A1 (en) * | 2014-07-22 | 2016-01-28 | Intel Corporation | Weight-shifting mechanism for convolutional neural networks |
CN104572011B (en) * | 2014-12-22 | 2018-07-31 | 上海交通大学 | Universal matrix fixed-point multiplication device based on FPGA and its computational methods |
US9886418B2 (en) * | 2015-04-28 | 2018-02-06 | Intel Corporation | Matrix operands for linear algebra operations |
CN105843775B (en) * | 2016-04-06 | 2018-12-04 | 中国科学院计算技术研究所 | On piece data divide reading/writing method, system and its apparatus |
CN109934331B (en) * | 2016-04-29 | 2020-06-19 | 中科寒武纪科技股份有限公司 | Apparatus and method for performing artificial neural network forward operations |
CN106126481B (en) * | 2016-06-29 | 2019-04-12 | 华为技术有限公司 | A kind of computing system and electronic equipment |
CN106447034B (en) * | 2016-10-27 | 2019-07-30 | 中国科学院计算技术研究所 | A kind of neural network processor based on data compression, design method, chip |
CN106502626A (en) * | 2016-11-03 | 2017-03-15 | 北京百度网讯科技有限公司 | Data processing method and device |
-
2017
- 2017-12-14 CN CN201711346333.XA patent/CN109961135B/en active Active
- 2017-12-14 CN CN201911401048.2A patent/CN111160543B/en active Active
- 2017-12-14 CN CN201911401049.7A patent/CN111091189B/en active Active
- 2017-12-14 CN CN201911163257.8A patent/CN111105024B/en active Active
-
2018
- 2018-12-07 TW TW107144033A patent/TWI793224B/en active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH05346914A (en) * | 1992-06-16 | 1993-12-27 | Matsushita Electron Corp | Neuro processor |
US5583964A (en) * | 1994-05-02 | 1996-12-10 | Motorola, Inc. | Computer utilizing neural network and method of using same |
CN1570847A (en) * | 2003-07-23 | 2005-01-26 | 联发科技股份有限公司 | Digital signal processor applying skip type floating number operational method |
WO2005111843A2 (en) * | 2004-05-11 | 2005-11-24 | Massively Parallel Technologies, Inc. | Methods for parallel processing communication |
WO2017038104A1 (en) * | 2015-09-03 | 2017-03-09 | 株式会社Preferred Networks | Installation device and installation method |
WO2017177446A1 (en) * | 2016-04-15 | 2017-10-19 | 北京中科寒武纪科技有限公司 | Discrete data representation-supporting apparatus and method for back-training of artificial neural network |
CN107329734A (en) * | 2016-04-29 | 2017-11-07 | 北京中科寒武纪科技有限公司 | A kind of apparatus and method for performing convolutional neural networks forward operation |
CN107239829A (en) * | 2016-08-12 | 2017-10-10 | 北京深鉴科技有限公司 | A kind of method of optimized artificial neural network |
Also Published As
Publication number | Publication date |
---|---|
CN111091189B (en) | 2023-08-29 |
TWI793224B (en) | 2023-02-21 |
CN111091189A (en) | 2020-05-01 |
CN111160543B (en) | 2023-08-29 |
CN111105024B (en) | 2024-03-01 |
CN111105024A (en) | 2020-05-05 |
TW201931219A (en) | 2019-08-01 |
CN109961135A (en) | 2019-07-02 |
CN109961135B (en) | 2020-06-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109729734B (en) | Chip device and related product | |
CN111126588B (en) | Integrated circuit chip device and related products | |
CN109993301B (en) | Neural network training device and related product | |
CN111160542B (en) | Integrated circuit chip device and related products | |
CN109993291B (en) | Integrated circuit chip device and related product | |
CN111160543B (en) | Integrated circuit chip device and related products | |
CN109615061B (en) | Convolution operation method and device | |
CN109993292B (en) | Integrated circuit chip device and related product | |
CN110197268B (en) | Integrated circuit chip device and related product | |
CN109993284B (en) | Integrated circuit chip device and related product | |
CN110197272B (en) | Integrated circuit chip device and related product | |
CN110197266B (en) | Integrated circuit chip device and related product | |
CN109615062B (en) | Convolution operation method and device | |
CN110197273B (en) | Integrated circuit chip device and related product | |
CN117688995A (en) | Convolution operation accelerator and related method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |