TECHNICAL FIELD
[0001] The present disclosure relates to the field of neural network, and particularly relates
to an integrated circuit chip device.
BACKGROUND
[0002] ANN (Artificial Neural Network) is a research focus emerged in 1980s in the field
of artificial intelligence. ANN abstracts the human brain neuron network in terms
of information processing to establish a simple model, and then builds different networks
with different connection methods. ANN is often referred to as neural network in engineering
and academia. Neural networks are a type of computational model. They are formed by
a large number of interconnecting nodes (or may be referred to as neurons). Existing
neural networks rely on CPU (Central Processing Unit) or GPU (Graphics Processing
Unit) to realize neural network operations which often require a large amount of computations
and cause high power consumption.
SUMMARY
[0003] The present disclosure provides an integrated circuit chip device and a product thereof.
Compared with the existing integrated circuit chip device, the disclosed integrated
circuit chip device and the product thereof can reduce computations and power consumption.
[0004] An aspect provides an integrated circuit chip device including: a main processing
circuit and a plurality of basic processing circuits. The main processing circuit
includes a data type conversion circuit configured to convert data between a floating
point data type and a fixed point data type.
[0005] The main processing circuit is configured to obtain an input data block, a weight
data block, and a multiplication instruction, convert the input data block and the
weight data block to an input data block of the fixed point type and a weight data
block of the fixed point type through the data type conversion circuit, classify the
input data block of the fixed point type into a distribution data block and the weight
data block of the fixed point type into a broadcasting data block according to the
multiplication instruction, partition the distribution data block of the fixed point
type to obtain a plurality of basic data blocks, distribute the plurality of basic
data blocks to at least one basic processing circuit of the plurality of basic processing
circuits, and broadcast the broadcasting data block to the plurality of basic processing
circuits.
[0006] The plurality of basic processing circuits are configured to perform computations
on the broadcasting data block and the basic data blocks of the fixed point type to
obtain computation results, and transfer the computation results to the main processing
circuit.
[0007] The main processing circuit is configured to process the computation results to obtain
an instruction result of the multiplication instruction.
[0008] Optionally, the plurality of basic processing circuits are configured to multiply
the broadcasting data block and the basic data blocks of the fixed point type to obtain
products of the fixed point type, and transfer the products as computation results
to the main processing circuit.
[0009] The main processing circuit is configured to convert the products of the fixed point
type to products of the floating point type through the data type conversion circuit,
accumulate the products of the floating point type to obtain accumulation results,
and sort the accumulation results to obtain the instruction result.
[0010] Optionally, the plurality of basic processing circuits are configured to perform
inner product computations on the broadcasting data block and the basic data blocks
of the fixed point type to obtain inner products of the fixed point type, and transfer
the inner products as computation results to the main processing circuit.
[0011] The main processing circuit is configured to convert the inner products to inner
products of the floating point type through the data type conversion circuit, and
sort the inner products to obtain the instruction result.
[0012] Optionally, the integrated circuit chip device further includes a branch processing
circuit. The branch processing circuit is located between the main processing circuit
and at least one basic processing circuit.
[0013] The branch processing circuit is configured to forward data between the main processing
circuit and at least one basic processing circuit.
[0014] Optionally, the main processing circuit is configured to broadcast the broadcasting
data block as a whole to the plurality of basic processing circuits.
[0015] Optionally, the main processing circuit is configured to partition the broadcasting
data block into a plurality of partial broadcasting data blocks, and sequentially
broadcast the plurality of partial broadcasting data blocks to the plurality of basic
processing circuits.
[0016] Optionally, the basic processing circuits are configured to perform inner product
computations on the partial broadcasting data blocks and the basic data blocks of
the fixed point type to obtain inner product results, and transfer the inner product
results to the main processing circuit.
[0017] Optionally, the basic processing circuits are configured to reuse the partial broadcasting
data blocks for n times, perform n times of inner product computations on the partial
broadcasting data blocks and the n basic data blocks to obtain n partial processing
results, and transfer the n partial processing results to the main processing circuit,
where n is an integer greater than or equal to 2.
BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to illustrate the technical solutions in the examples of the present disclosure
more clearly, the drawings to be used in the description of the examples are briefly
explained below. Obviously, the drawings in the description below are some examples
of the present disclosure. Other drawings can be obtained according to the disclosed
drawings without any creative effort by those skilled in the art.
FIG. 1a is a structural diagram of an integrated circuit chip device.
FIG. 1b is a structural diagram of other integrated circuit chip device.
FIG. 1e is a schematic diagram of a fixed point data type.
FIG. 1f is a structural diagram of an integrated circuit chip device.
FIG. 1g is a structural diagram of another integrated circuit chip device.
FIG. 2a is a schematic diagram showing a method of using a basic processing circuit.
FIG. 2d is a structural diagram of an integrated circuit chip device.
FIG. 2e is a structural diagram of another integrated circuit chip device.
FIG. 2g is a flowchart of a matrix-multiply-vector computation.
FIG. 2h is a flowchart of a matrix-multiply-matrix computation.
FIG. 2i is a schematic diagram showing a matrix Ai being multiplied by a vector B.
FIG. 3 is a structural diagram of a processing device according to the disclosure.
FIG. 4 is another structural diagram of a processing device according to the disclosure.
FIG. 5a is a structural diagram of a neural network processor board card according
to an example of the present disclosure.
FIG. 5b is a structural diagram of a neural network chip package structure according
to an example of the present disclosure.
FIG. 5c is a structural diagram of a neural network chip according to an example of
the present disclosure.
FIG. 6 is a schematic diagram of a neural network chip package structure according
to an example of the present disclosure.
FIG. 6a is a schematic diagram of another neural network chip package structure according
to an example of the present disclosure.
DETAILED DESCRIPTION
[0019] Technical solutions in examples of the present disclosure will be described clearly
and completely hereinafter with reference to the accompanied drawings in the examples
of the present disclosure. Obviously, the examples to be described are merely some
rather than all examples of the present disclosure. All other examples obtained by
those of ordinary skill in the art based on the examples of the present disclosure
without creative efforts shall fall within the protection scope of the present disclosure.
[0020] Terms such as "first", "second", "third", and "fourth" in the specification, the
claims, and the drawings are used for distinguishing different objects rather than
describing a specific order. In addition, terms such as "include", "have", and any
variant thereof are used for indicating non-exclusive inclusion. For instance, a process,
a method, a system, a product, or an equipment including a series of steps or units
is not limited to the listed steps or units, but optionally includes steps or units
that are not listed, or optionally includes other steps or units inherent to the process,
the method, the product, or the equipment.
[0021] Reference to "example" means that a particular feature, a structure, or a characteristic
described in conjunction with the example may be included in at least one example
of the present disclosure. The use of the term in various places in the specification
does not necessarily refer to the same example, nor is it referring independent or
alternative examples that are mutually exclusive with other examples. It is explicitly
and implicitly understood by those skilled in the art that the examples described
in the specification may be combined with other examples.
[0022] FIG. If is a structural diagram of an integrated circuit chip device. The chip device
includes a main processing circuit, basic processing circuits, and branch processing
circuits (optional).
[0023] The main processing circuit may include a register and/or an on-chip caching circuit,
and may further include: a control circuit, a vector computing unit circuit, an ALU
(Arithmetic and Logic Unit) circuit, an accumulator circuit, a DMA (Direct Memory
Access) circuit, and the like. Of course, in a certain application, the main processing
circuit may further include a conversion circuit (
e.g., a matrix transposition circuit), a data rearrangement circuit, an activation circuit,
or the like.
[0024] Optionally, the main processing circuit may include: a data type conversion circuit
configured to convert received or transferred data from floating point data to fixed
point data. Of course, in a certain application, the data type conversion circuit
may also be configured to convert fixed point data into floating point data. The present
disclosure does not restrict a specific form of the data type conversion circuit.
[0025] The main processing circuit may also include a data transfer circuit, a data receiving
circuit or interface. A data distribution circuit and a data broadcasting circuit
may be integrated in the data transfer circuit. In a certain application, the data
distribution circuit and the data broadcasting circuit may be set independently or
may be integrated together to form a data transceiving circuit. Data for broadcasting
refers to data that is to be sent to each basic processing circuit. Data for distribution
refers to data that is to be selectively sent to some basic processing circuits. A
selection method may be determined by the main processing circuit according to its
load and a computation method. A method for broadcasting data refers to transferring
data for broadcasting to each basic processing circuit by broadcasting (in a certain
application, the data for broadcasting may be transferred to each basic processing
circuit by broadcasting for once or a plurality of times, and the times of broadcasting
are not restricted in the example of the present disclosure). A method for distributing
data refers to selectively transferring data for distribution to some basic processing
circuits.
[0026] When distributing data, the control circuit of the main processing circuit transfers
data to some or all of the basic processing circuits. The data may be identical or
different. Specifically, if data is transferred by distributing, data received by
each basic processing circuit may be different. There is also a case where some of
the basic processing circuits receive the same data.
[0027] Specifically, when broadcasting data, the control circuit of the main processing
circuit transfers data to some or all of the basic processing circuits. Each basic
processing circuit may receive the same data.
[0028] Optionally, the vector computing unit circuit of the main processing circuit may
be configured to perform vector computations which include but are not limited to:
addition, subtraction, multiplication, and division between two vectors; addition,
subtraction, multiplication, and division between a vector and a constant; or any
computation performed on each element in a vector. Neural network computations in
series may be addition, subtraction, multiplication, division, activation computation,
accumulation computation, and the like, between a vector and a constant.
[0029] Each basic processing circuit may include a basic register and/or a basic on-chip
caching circuit. Each basic processing circuit may further include one or more of
an inner product computing unit circuit, a vector computing unit circuit, an accumulator
circuit, and the like. The inner product computing unit circuit, the vector computing
unit circuit, and the accumulator circuit may all be integrated circuits, and may
also be circuits that are set independently.
[0030] Optionally, the main processing circuit is configured to obtain an input data block,
a weight data block, and a multiplication instruction, convert the input data block
and the weight data block to an input data block of the fixed point type and a weight
data block of the fixed point type through the data type conversion circuit, classify
the input data block of the fixed point type into a distribution data block and the
weight data block of the fixed point type into a broadcasting data block according
to the multiplication instruction, partition the distribution data block of the fixed
point type to obtain a plurality of basic data blocks, distribute the plurality of
basic data blocks to at least one basic processing circuit of the plurality of basic
processing circuits, and broadcast the broadcasting data block to the plurality of
basic processing circuits.
[0031] The plurality of basic processing circuits are configured to perform computations
on the broadcasting data block and the basic data blocks according to the fixed point
data type to obtain computation results, and transfer the computation results to the
main processing circuit.
[0032] Optionally, the main processing circuit is configured to process the computation
results to obtain an instruction result of the multiplication instruction.
[0033] In an optional example, the chip device may also include one or more branch processing
circuits. If a branch processing circuit is included, the main processing circuit
is connected to the branch processing circuit, and the branch processing circuit is
connected to the basic processing circuits. The inner product computing unit of the
basic processing circuit is configured to perform an inner product computation between
data blocks. The control circuit of the main processing circuit controls the data
receiving circuit or the data transfer circuit to receive or transfer external data,
and control the data transfer circuit to distribute the external data to the branch
processing circuit. The branch processing circuit is configured to receive data from
and transfer data to the main processing circuit or the basic processing circuit.
The structure shown in FIG. If is suitable for complex data computations. This is
due to the fact that a count of units connected to the main processing circuit is
limited, and by adding a branch processing circuit between the main processing circuit
and the basic processing circuits, more basic processing circuits can be included
in the structure. In this way, the device may be able to perform computations of complex
data blocks. A connection structure of the branch processing circuit and the basic
processing circuits may be arbitrary and is not restricted to the H-shape structure
shown in FIG. If. Optionally, a data transfer manner from the main processing circuit
to the basic processing circuits may be broadcasting or distribution, and a data transfer
manner from the basic processing circuits to the main processing circuit may be gathering.
Broadcasting, distribution, and gathering are explained below. A distribution or broadcasting
manner may be adopted when a count of the basic processing circuits is greater than
a count of the main processing circuit. In other words, one main processing circuit
corresponds to a plurality of basic processing circuits. In this case, data is transferred
from the main processing circuit to the plurality of basic processing circuits by
broadcasting or distribution, and may be transferred from the plurality of basic processing
circuits to the main processing circuit by gathering.
[0034] The basic processing circuits are configured to receive data distributed or broadcast
by to the main processing circuit, save the data in the on-chip caches of the basic
processing circuits, perform computations to obtain results, and send data to the
main processing circuit.
[0035] Data involved by the basic processing circuit may be data of any data type, data
represented by a floating point number of any bit width, or data represented by a
fixed point number of any bit width. All computational circuits and storage circuits
that are involved may be computational circuits and storage circuits that are capable
of processing data of any type, computational circuits and storage circuits for a
floating point number of any bit width, or computational circuits and storage circuits
for a fixed point number of any bit width.
[0036] Optionally, each basic processing circuit may include a data type conversion circuit,
or some basic processing circuits may include data type conversion circuits. The data
type conversion circuit may be configured to convert received or transferred data
from floating point data to fixed point data, and may also be configured to convert
fixed point data into floating point data. The present disclosure does not restrict
a specific form of the data type conversion circuit.
[0037] Optionally, the vector computing unit circuit of a basic processing circuit may be
configured to perform a vector computation on two vectors that have been subject to
data type conversion. Of course, in a certain application, the inner product computing
unit circuit of the basic processing circuit may also be configured to perform an
inner product computation on two vectors that have been subject to data type conversion.
The accumulator circuit may also be configured to accumulate results of inner product
computations.
[0038] In an optional example, two vectors may be stored in the on-chip cache and/or the
register. The basic processing circuit may fetch the two vectors to perform a computation
according to computational demands. The computation may include but is not limited
to: an inner product computation, a multiplication computation, an addition computation,
or another computation.
[0039] In an optional example, results of inner product computations may be accumulated
in the on-chip cache and/or the register. Technical effects of this optional example
are as follows: data transferred between the basic processing circuits and the main
processing circuit may be reduced, the computational efficiency may be improved, and
the power consumption of data transfer may be reduced.
[0040] In an optional example, results of inner product computations may be transferred
without being accumulated. Technical effects of this optional example include that
the amount of computations in the basic processing circuits may be reduced and the
computational efficiency of the basic processing circuits may be improved.
[0041] In an optional example, each basic processing circuit may be configured to perform
inner product computations of a plurality of groups of two vectors, and may also be
configured to accumulate results of a plurality of groups of inner product computations
respectively.
[0042] In an optional example, data of the plurality of groups of two vectors may be stored
in the on-chip cache and/or the register.
[0043] In an optional example, the results of a plurality of groups of inner product computations
may be accumulated in the on-chip cache and/or the register respectively.
[0044] In an optional example, results of a plurality of groups of inner product computations
may be transferred without being accumulated.
[0045] In an optional example, each basic processing circuit may be configured to perform
inner product computations between a same vector and a plurality of vectors respectively
(one-to-many inner product, which refers to that for a plurality of groups of vectors,
one vector of the two vectors of each group is shared), and accumulate inner products
corresponding to each of the vectors respectively. By using the technical solution
above, the same set of weights can be used for performing a plurality of computations
on different input data, which may increase data reusing, reduce internal data transfer
of the basic processing circuits, improve computational efficiency, and reduce power
consumption.
[0046] Specifically, regarding data used for computing inner products, a data source of
a shared vector and a data source of the other vector (the different vector in each
group) of each group may be different.
[0047] In an optional example, when computing inner products, the shared vector of each
group may be broadcast or distributed from the main processing circuit or the branch
processing circuit.
[0048] In an optional example, when computing inner products, the shared vector of each
group may be from the on-chip cache.
[0049] In an optional example, when computing inner products, the shared vector of each
group may be from the register.
[0050] In an optional example, when computing inner products, the non-shared vector of each
group may be broadcast or distributed from the main processing circuit or the branch
processing circuit.
[0051] In an optional example, when computing inner products, the non-shared vector of each
group may be from the on-chip cache.
[0052] In an optional example, when computing inner products, the non-shared vector of each
group may be from the register.
[0053] In an optional example, when computing a plurality of groups of inner products, the
shared vector of each group may be saved in any count of copies in the on-chip cache
and/or the register of the basic processing circuit.
[0054] In an optional example, for each groups of inner products, one copy of the shared
vector may be saved correspondingly.
[0055] In an optional example, the shared vector may be saved as one copy only.
[0056] Specifically, results of a plurality of groups of inner product computations may
be accumulated in the on-chip cache and/or the register respectively.
[0057] Specifically, results of the plurality of groups of inner product computations may
be transferred without being accumulated.
[0058] Referring to the structure shown in FIG. If, the structure includes a main processing
circuit (which is capable of performing vector operation) and a plurality of basic
processing circuits (which are capable of performing inner product operation). Technical
effects of the combination are as follows: the device can not only use the basic processing
circuits to perform matrix and vector multiplication, but can also use the main processing
circuit to perform any other vector computations, so that the device can complete
more computations faster with a limited count of hardware circuits. The combination
may reduce a count of times that data is transferred between the external of the device,
improve computational efficiency, and reduce power consumption. Besides, in the chip,
a data type conversion circuit may be arranged in the basic processing circuits and/or
the main processing circuit, so that when a neural network computation is being performed,
floating point data can be converted into fixed point data while fixed point data
can also be converted into floating point data. In addition, the chip may also dynamically
allocate a circuit to perform data type conversion according to the amount of computation
(loads) of each circuit (mainly the main processing circuit and the basic processing
circuits), which may simplify the complex procedures of data computation as well as
reduce power consumption. By dynamically allocating a circuit to convert data type,
the computational efficiency of the chip may not be affected. An allocation method
may include but is not limited to: load balancing, load minimum allocation, and the
like.
[0059] FIG. 1e is a structural diagram of the fixed point data, which shows a method of
representing fixed point data. For a computing system, the storage bit of one set
of floating point data is 32 bits. For fixed point data, particularly a data representation
using the floating point data shown in FIG. 1e, the storage bit of one set of fixed
point data can be reduced to below 16 bits, which may greatly reduce transferring
overhead between computing units during conversion. In addition, for a computing unit,
the storage space of data having fewer bits may be smaller, which in other words,
means that the storage overhead may be less, computations may also be reduced, and
the computational overhead may be reduced. In this case, the fixed point data shown
in FIG. 1e may reduce the computational overhead and storage overhead. However, data
type conversion requires some computational overhead, which will be referred to as
conversion overhead below. For data that requires a large amount of computations and
storage, the conversion overhead is almost negligible compared with subsequent computational
overhead, storage overhead, and transferring overhead. In this case, the present disclosure
adopts a technical solution of converting data into fixed point data for data that
require a large amount of computations and a large amount of storage. On the contrary,
for data that requires a small amount of computations and storage, the data require
less computational overhead, storage overhead, and transferring overhead. Since the
precision of fixed point data is lower than the precision of floating point data,
if fixed point data is used, under the premise that the amount of computations is
relatively small, the fixed point data may be converted to floating point data so
that the precision of computations can be guaranteed. In other words, the precision
of computations may be improved by increasing a small amount of overhead.
[0060] Referring to the device shown in FIG. 1g, the device does not include any branch
processing circuit. The device in FIG. 1g may include a main processing circuit and
N basic processing circuits, where the main processing circuit (whose specific structure
is shown in FIG. 1e) may be connected to the N basic processing circuits directly
or indirectly. If the main processing circuit is connected to the N basic processing
circuits indirectly, an optional connection scheme is shown in FIG. If, where N/4
branch processing circuits may be included, and each branch processing circuit may
be connected to four basic processing circuits respectively. Regarding circuits that
are included in the main processing circuit and the N basic processing circuits, a
description of them can be seen in the description of FIG. If, which is omitted here.
It should be explained that the basic processing circuits may also be arranged inside
the branch processing circuits. Besides, a count of basic processing circuits that
are connected to each branch processing circuit may not be restricted to 4. Manufacturers
can set the count according to actual needs. Each of the main processing circuit and/or
the N basic processing circuits may include a data type conversion circuit. Specifically,
it may be the main processing circuit that includes a data type conversion circuit,
and may also be the N basic processing circuits or some of the basic processing circuits
that include data type conversion circuits, and may further be the main processing
circuit, and the N basic processing circuits or some of the basic processing circuits
that include data type conversion circuits. The main processing circuit may dynamically
allocate an entity to perform a step of data type conversion according to a neural
network computation instruction. Specifically, the main processing circuit may determine
whether to perform the step of data type conversion on received data according to
its loads. Specifically, a value of the loads may be set as a plurality of ranges,
where each range corresponds to an entity that performs the step of data type conversion.
Taking three ranges as an instance, range 1 corresponds to light loads, in this case,
the main processing circuit performs the step of data type conversion alone; range
2 corresponds to loads between range 1 and range 3, in this case, the main processing
circuit or the N basic processing circuits perform the step of data type conversion
together; and range 3 corresponds to heavy loads, in this case, the N basic processing
circuits perform the step of data type conversion. Data type conversion may be performed
explicitly. For instance, the main processing circuit can configure a special indication
or instruction. When the basic processing circuits receive the special indication
or instruction, the basic processing circuit determines to perform the step of data
type conversion. When the basic processing circuit does not receive the special indication
or instruction, the basic processing circuit determines not to perform the step of
data type conversion. Data type conversion may also be performed implicitly. For instance,
when a basic processing circuit receives floating point data and determines that an
inner product computation needs to be performed, the basic processing circuit may
convert the data into fixed point data.
[0061] A method for realizing computations by using the device shown in FIG. If is provided
below. The method may be a neural network computation method of a matrix-multiply-matrix
computation, a matrix-multiply-vector computation, or a vector-multiply-vector computation.
The computations above may all be realized by the device of FIG. If.
[0062] The data type conversion circuit of the main processing circuit first converts the
type of data, then the control circuit transfers the data to the basic processing
circuits for computing. For instance, the data type conversion circuit of the main
processing circuit converts a floating point number to a fixed point number with less
bit width and transfers the fixed point number to the basic processing circuits. Technical
effects of this method are as follows: the bit width of data being transferred may
be reduced, the total count of bits being transferred may be reduced, and the basic
processing circuits may achieve better efficiency with less power consumption when
performing bit width fixed point computations.
[0063] If data received by the basic processing circuits is floating point data, after receiving
the data, the data type conversion circuits first perform data type conversion. Then
the basic processing circuits perform computations. For instance, the basic processing
circuits receive a floating point number transferred from the main processing circuit,
the data type conversion circuit converts the floating point number to a fixed point
number, and then the inner product computing unit circuit, the vector computing unit
circuit, or the accumulator circuit of the basic processing circuit performs computations.
In this way, the computational efficiency may be improved, and the power consumption
may be reduced.
[0064] After the basic processing circuits obtain results by computing, the results may
first be subject to data type conversion and then be transferred to the main processing
circuit. For instance, a computation result which is a floating point number that
is obtained by a basic processing circuit is first converted into a fixed point number
with less bit width. Then the fixed point number is transferred to the main processing
circuit. Technical effects of this method include that the bit width during the transferring
process may be reduced, and better efficiency with less power consumption may be realized.
[0065] The main processing circuit transfers data that is to be computed to all or some
of the basic processing circuits. Taking a matrix-multiply-vector computation as an
instance, the control circuit of the main processing circuit may partition matrix
data, and regard each column as basic data. For instance, an m
∗n matrix can be partitioned into n vectors with m rows, and the control circuit of
the main processing circuit may distribute the n vectors with m rows obtained by partitioning
to the plurality of basic processing circuits. For a vector, the control circuit of
the main processing circuit may broadcast the whole vector to each of the basic processing
circuits. If the value of m is relatively large, the control circuit may first partition
an m
∗n matrix into x
∗n vectors. Taking x=2 as an instance, the matrix may be partitioned into 2n vectors.
Each vector includes m/2 rows. In other words, each vector of n vectors with m rows
is partitioned into 2 vectors evenly. Taking a first row as an instance, if a first
vector of the n vectors with m rows has 1000 rows, a way to partition the first vector
into 2 vectors evenly may be regarding previous 500 rows as a first vector and subsequent
500 rows as a second vector, then the control circuit may broadcast the two vectors
for twice to the plurality of basic processing circuits.
[0066] A method for the data transfer may be broadcasting or distributing, or any other
possible transferring method.
[0067] After receiving data, the basic processing circuits perform computations to obtain
computation results, and transfer the results to the main processing circuit.
[0068] The computation results may be intermediate computation results or final computation
results.
[0069] The device of FIG. If can be used to perform a matrix-multiply-vector computation
(a matrix-multiply-vector computation refers to a computation of obtaining a vector
by performing inner product computations between each row of a matrix and a vector,
then placing the results according to a corresponding order).
[0070] Below is a description of performing multiplication of a matrix S with a size of
M rows and L columns and a vector P with a length of L. As shown in FIG. 2a (each
row of the matrix S is as long as the length of the vector P, and data of them are
in one-to-one correspondence according to positions), the neural network computing
device has K basic processing circuits.
[0071] Referring to FIG. 2g, an implementation method of a matrix-multiply-vector computation
is provided, which includes:
S201, converting, by the data type conversion circuit of the main processing circuit,
data of each row in the matrix S into fixed point data; distributing, by the control
circuit of the main processing circuit, the fixed point data to one of the K basic
processing circuits; and storing, by the basic processing circuits, the received data
in the on-chip caches and/or the registers of the basic processing circuits.
[0072] In an optional example, M is the count of rows of the matrix S. If M<=K, the control
circuit of the main processing circuit distributes a row of data of the matrix S to
the K basic processing circuits respectively.
[0073] In an optional example, M is the count of rows of the matrix S, if M> K, the control
circuit of the main processing circuit distributes data of one or a plurality of rows
of the matrix S to each basic processing circuit respectively.
[0074] A set of rows of the matrix S that are distributed to an i
th basic processing circuit is referred to as Ai, which has Mi rows in total. FIG. 2i
shows a computation to be performed by the i
th basic processing circuit.
[0075] As an optional example, for each basic processing circuit, such as the i
th basic processing circuit, the received data such as a matrix Ai transferred by distributing
may be stored in the register and/or on-chip cache. Technical effects of the example
include that data that is transferred later by means of distributing may be reduced,
the computational efficiency may be improved, and the power consumption may be reduced.
[0076] The method includes: S202, converting, by the data type conversion circuit of the
main processing circuit, the vector P into fixed point data, and broadcasting, by
the control circuit of the main processing circuit, each part of the vector P of a
fixed point type to the K basic processing circuits.
[0077] As an optional example, the control circuit of the main processing circuit may broadcast
each part of the vector P for only once to the register or on-chip cache of each basic
processing circuit. The i
th basic processing circuit may fully reuse data of the vector P which is obtained at
the current time to complete an inner product computation corresponding to each row
of the matrix Ai. Technical effects of the example include that the data of the vector
P which are repeatedly transferred from the main processing circuit to the basic processing
circuits may be reduced, the execution efficiency may be improved, and the power consumption
for transfer may be reduced.
[0078] As an optional example, the control circuit of the main processing circuit may sequentially
broadcast each part of the vector P to the register or on-chip cache of each basic
processing circuit, the i
th basic processing circuit may not reuse data of the vector P which is obtained at
each time, and may complete an inner product computation corresponding to each row
of the matrix Ai at different times. Technical effects of the example include that
the data of the vector P which is transferred at a single time in the basic processing
circuits may be reduced, the capacity of the cache and/or the register of the basic
processing circuits may be reduced, the execution efficiency may be improved, the
power consumption of transferring may be reduced, and the costs may be reduced.
[0079] As an optional example, the control circuit of the main processing circuit may sequentially
broadcast each part of the vector P to the register or on-chip cache of each basic
processing circuit, the i
th basic processing circuit may partly reuse data of the vector P which is obtained
at each time to complete an inner product computation corresponding to each row of
the matrix Ai. Technical effects of the example include that the data transferred
from the main processing circuit to the basic processing circuits may be reduced,
the data that is transferred within the basic processing circuits may be reduced,
the execution efficiency may be improved, and the power consumption of transferring
may be reduced.
[0080] The method includes: S203, computing, by the inner product computing unit circuits
of the K basic processing circuits, an inner product of the matrix S and the vector
P, for instance, computing, by the i
th basic processing circuit, an inner product of the data of matrix Ai and the data
of the vector P; and
S204, accumulating, by the accumulator circuits of the K basic processing circuits,
results of the inner product computation to obtain accumulation results, and transferring
the accumulation results of the fixed point type to the main processing circuit.
[0081] As an optional example, a partial sum obtained from the inner product computation
performed each time by a basic processing circuit may be transferred to the main processing
circuit for accumulating (the partial sum refers to part of the accumulation result,
for instance, if the accumulation result is F1
∗G1+ F2
∗G2+ F3
∗G3+ F4
∗G4+ F5
∗G5, the partial sum may be the value of F1
∗G1+ F2
∗G2+ F3
∗G3). Technical effects of the example include that computations performed in the basic
processing circuit may be reduced, and the computational efficiency of the basic processing
circuits may be improved.
[0082] In an optional example, a partial sum obtained from the inner product computation
performed each time by a basic processing circuits may be stored in the on-chip caching
circuit and/or the register of the basic processing circuit, and transferred to the
main processing circuit after the accumulation finishes. Technical effects of the
example include that data which are transferred between the basic processing circuits
and the main processing circuit may be reduced, the computational efficiency may be
improved, and the power consumption of data transfer may be reduced.
[0083] As an optional example, a partial sum obtained from the inner product computation
performed each time by a basic processing circuits may also, in some cases, be stored
in the on-chip caching circuit and/or the register of the basic processing circuit
for accumulating, and in some cases, be transferred to the main processing circuit
for accumulating, then be transferred to the main processing circuit after the accumulation
finishes. Technical effects of the example include that data transferred between the
basic processing circuits and the main processing circuits may be reduced, the computational
efficiency may be improved, the power consumption of data transfer may be reduced,
computations performed in the basic processing circuits may be reduced, and the computational
efficiency of the basic processing circuits may be improved.
[0084] FIG. 2h is a flowchart of using the device of FIG. If to perform a matrix-multiply-matrix
computation.
[0085] Below is a description of performing multiplication of a matrix S with a size of
M rows and L columns and a matrix P with a size of L rows and N columns (each row
of the matrix S is as long as each column of the matrix P, which is as shown in FIG.
2d), and the neural network computing device has K basic processing circuits.
[0086] The method includes: S201b, distributing, by the control circuit of the main processing
circuit, data of each row in the matrix S to one of the K basic processing circuits;
and storing, by the basic processing circuit, the received data in the on-chip cache
and/or the register.
[0087] In an optional example, M is the count of rows of the matrix S. If M<=K, the control
circuit of the main processing circuit distributes a row of data of the matrix S to
the K basic processing circuits respectively.
[0088] As an optional example, M is the count of rows of the matrix S. If M> K, the control
circuit of the main processing circuit may distribute data of one or a plurality of
rows of the matrix S to each basic processing circuit.
[0089] In a case where Mi rows of the matrix S are distributed to an i
th basic processing circuit, a set of the Mi rows is be referred to as Ai. FIG. 2e shows
a computation to be performed by the i
th basic processing circuit.
[0090] As an optional example, in each of the basic processing circuits, for instance, in
the i
th basic processing circuit:
the matrix Ai distributed by the main processing circuit may be received and stored
in the register and/or on-chip cache of the i
th basic processing circuit. Technical effects of the example include that data that
is transferred later may be reduced, the computational efficiency may be improved,
and the power consumption may be reduced.
[0091] The method includes: S202b, broadcasting, by the control circuit of the main processing
circuit, each part of the matrix P to each basic processing circuit.
[0092] As an optional example, each part of the matrix P may be broadcast for only once
to the register or on-chip cache of each basic processing circuit. The i
th basic processing circuit may fully reuse data of the matrix P which is obtained at
this time to complete an inner product computation corresponding to each row of the
matrix Ai. The "reusing" mentioned in the example may be "repeatedly using data by
the basic processing circuits during computation". For instance, reusing data of the
matrix P may be using the data of the matrix P for a plurality of times.
[0093] As an optional example, the control circuit of the main processing circuit may sequentially
broadcast each part of the matrix P to the register or on-chip cache of each basic
processing circuit. The i
th basic processing circuit may not reuse the data of the matrix P which is obtained
at each time, and may complete an inner product computation corresponding to each
row of the matrix Ai at different times.
[0094] As an optional example, the control circuit of the main processing circuit may sequentially
broadcast each part of the matrix P to the register or on-chip cache of each basic
processing circuit. The i
th basic processing circuit may partially reuse the data of the matrix P which is obtained
at each time to complete an inner product computation corresponding to each row of
the matrix Ai.
[0095] In an optional example, each of the basic processing circuits, for instance, the
i
th basic processing circuit, may compute to obtain an inner product of the data of the
matrix Ai and the matrix P.
[0096] The method may include S203b, accumulating, by the accumulator circuit of each of
the basic processing circuits, results of the inner product computations, and transferring
an accumulation result to the main processing circuit.
[0097] As an optional example, the basic processing circuits may transfer partial sums obtained
from inner product computations to the main processing circuit for accumulating.
[0098] In an optional example, partial sums obtained from the inner product computations
performed by the basic processing circuits may be stored in the on-chip caching circuits
and/or the registers of the basic processing circuits, then be transferred to the
main processing circuit after accumulation finishes.
[0099] As an optional example, partial sums obtained from the inner product computations
performed by the basic processing circuits may also, in some cases, be stored in the
on-chip caching circuits and/or the registers of the basic processing circuits for
accumulating, and in some cases, be transferred to the main processing circuit for
accumulating, then be transferred to the main processing circuit after accumulation
finishes.
[0100] The present disclosure provides a method of using the device of FIG. If to realize
BLAS (Basic Linear Algebra Subprograms) function.
[0101] A GEMM computation refers to a computation of matrix-matrix multiplication in a BLAS
library. A common representation of the computation is C = alpha
∗op(S)
∗op(P) + beta
∗C, where S and P denote two input matrices, C denotes an output matrix, alpha and
beta denote scalars, op denotes an operation performed on the matrix S or P. In addition,
other supporting integers may be used as parameters to explain the width and height
of the matrices S and P.
[0102] A step of using the device of FIG. If to realize the GEMM computation includes:
converting, by the data type conversion circuit of the main processing circuit, the
data type of the matrix S and the matrix P; and
performing, by the conversion circuit of the main processing circuit, corresponding
op operation on the matrix S and the matrix P respectively.
[0103] As an optional example, op may be a matrix transposition operation. The matrix transposition
circuit of the main processing circuit may be used to realize the matrix transposition
operation.
[0104] In an optional example, after the OP operation of the matrix S and the matrix P is
performed, the data type conversion circuit of the main processing circuit may perform
data type conversion operation. In other words, the data type conversion circuit converts
the data types of op(S) and op(P) from floating point data into fixed point data,
then performs a matrix multiplication computation as shown in FIG. 2h.
[0105] In an optional example, op of a matrix may be null, which means the op operation
may not be performed.
[0106] The device of FIG. If and the matrix-multiply-matrix computation method of FIG. 2h
can be used to perform a matrix multiplication computation between op(S) and op(P).
[0107] The arithmetic and logic unit of the main processing circuit may be used to perform
an operation of multiplying each value in a result of op(S)
∗op(P) by alpha.
[0108] As an optional example, in a case where alpha is 1, the operation of multiplying
a value by alpha may not be performed.
[0109] The arithmetic and logic unit of the main processing circuit may be used to realize
a computation of beta
∗C.
[0110] As an optional example, in a case where beta is 1, the operation of multiplying by
beta may not be performed.
[0111] The vector computing unit circuit of the main processing circuit may be used to realize
a step of adding corresponding positions of matrices alpha
∗op(S)
∗op(P) and beta
∗C to obtain a result of the GEMM computation.
[0112] As an optional example, in a case where beta is 0, the operation may not be performed.
[0113] A GEMV computation refers to a computation of matrix-vector multiplication in a BLAS
library. A common representation of the computation is C = alpha
∗op(S)
∗P+ beta
∗C. S is an input matrix, P denotes an input vector, C denotes an output vector, alpha
and beta denote scalars, and op denotes an operation performed on the matrix S.
[0114] A step of using the device of FIG. If to realize the GEMV computation is:
converting, by the data type conversion circuit of the main processing circuit, the
data type of the input matrix S and the input matrix P; and
performing, by the conversion circuit of the main processing circuit, a corresponding
op operation on the matrix S.
[0115] As an optional example, op may be a matrix transposition operation. The conversion
circuit of the main processing circuit may be used to realize the matrix transposition
operation.
[0116] In an optional example, op of a matrix may be null, which means the op operation
may not be performed.
[0117] The device of FIG. If and the matrix-multiply-vector computation method of FIG. 2a
may be used to perform a matrix-vector multiplication computation between the matrix
op(S) and the vector P.
[0118] The arithmetic and logic unit of the main processing circuit may be used to perform
an operation of multiplying each value in a result of op(S)
∗P by alpha.
[0119] As an optional example, in a case where alpha is 1, the operation of multiplying
a value by alpha may not be performed.
[0120] The arithmetic and logic unit of the main processing circuit may be used to realize
a computation of beta
∗C.
[0121] As an optional example, in a case where beta is 1, the operation of multiplying by
beta may not be performed.
[0122] The vector computing unit circuit of the main processing circuit may be used to realize
a step of adding corresponding positions of matrices alpha
∗op(S)
∗P and beta
∗C to obtain a result of GEMV.
[0123] As an optional example, in a case where beta is 0, the operation of adding may not
be performed.
[0124] A method of using the device in FIG. If to realize an activation function is as follows:
inputting a vector by using the activation circuit of the main processing circuit,
and obtaining an activation vector of the vector by computing.
[0125] In an optional example, the activation circuit of the main processing circuit performs
a computation to obtain a numerical value for each value of an input vector according
to an activation function (input of the activation function is a numerical value,
and output is also a numerical value), and outputs the numerical value to a corresponding
position of an output vector.
[0126] In an optional example, the activation function may be: y=max(m, x), where x denotes
an input numerical value, y denotes an output numerical value, and m denotes a constant.
[0127] In an optional example, the activation function may be: y=tanh(x), where x denotes
an input numerical value, and y denotes an output numerical value.
[0128] In an optional example, the activation function may be: y=sigmoid(x), where x denotes
an input numerical value, y denotes an output numerical value.
[0129] In an optional example, the activation function may be a piecewise linear function.
[0130] In an optional example, the activation function may be a function of randomly inputting
a number and outputting a number.
[0131] In an optional example, a source of the input vector may include but is not limited
to:
an external data source of the device.
[0132] In an optional example, the input data may come from a computation result of a matrix-multiply-vector
computation performed by the device.
[0133] In an optional example, the input data may come from a computation result of a matrix-multiply-matrix
computation performed by the device.
[0134] The main processing circuit of the device computes to obtain a result.
[0135] In an optional example, the input data may come from a computation result obtained
after the main processing circuit of the device is biased.
[0136] It should be explained that the activation operation may be realized by the arithmetic
and logic unit and the accumulator circuit of the main processing circuit, and may
also be realized by adding an activation circuit separately to the main processing
circuit.
[0137] The device FIG. If can be used to realize a computation of giving a bias.
[0138] The vector computing unit circuit of the main processing circuit may be used to realize
a function of adding two vectors together or adding two matrices together.
[0139] The vector computing unit circuit of the main processing circuit may also be used
to realize a function of adding a vector to each row of a matrix, or to each column
of a matrix.
[0140] In an optional example, the matrix may be from a result of a matrix-multiply-matrix
computation performed by the device.
[0141] In an optional example, the matrix may be from a result of a matrix-multiply-vector
computation performed by the device.
[0142] In an optional example, the matrix may be from data received from the external by
the main processing circuit of the device.
[0143] In an optional example, the vector may be from data received from the external by
the main processing circuit of the device.
[0144] Data sources of the matrix and/or the vector may include but is not limited to the
above-mentioned data sources.
[0145] The device of FIG. If may be used to realize data type conversion.
[0146] The data type conversion circuit of the main processing circuit may be used to convert
the type of data.
[0147] In an optional example, the data type conversion circuit of the main processing circuit
may be used to convert the type of a group of data.
[0148] In an optional example, a form of data type conversion includes but is not limited
to: converting a floating point number to a fixed point number, converting a fixed
point number to a floating point number, and the like.
[0149] The present disclosure further provides a chip which includes a computing device.
The computing device includes:
a main processing circuit. Data involved by the main processing circuit may be data
of any data type. In an optional example, it may be data represented by a floating
point number of any bit width, or data represented by a fixed point number of any
bit width. All computational circuits and storage circuits that are involved may be
computational circuits and storage circuits that are capable of processing data of
any type. In an optional example, they may be computational circuits and storage circuits
for a floating point number of any bit width, or computational circuits and storage
circuits for a fixed point number of any bit width.
[0150] In an optional example, the main processing circuit includes a data type conversion
circuit.
[0151] In an optional example, the main processing circuit includes a vector computing unit
configured to perform data type conversion.
[0152] Specifically, the main processing circuit includes a data input interface for receiving
input data.
[0153] In an optional example, a source of data may be: the external of the neural network
computational circuit device, or some or all of basic processing circuits of the neural
network computational circuit device.
[0154] In an optional example, the device may include a plurality of data input interfaces,
which may include a data output interface for outputting data.
[0155] In an optional example, the output data may be transferred to: the external of the
neural network computational circuit device, or some or all of the basic processing
circuits of the neural network computational circuit device.
[0156] In an optional example, the device may include a plurality of data output interfaces.
[0157] In an optional example, the main processing circuit may include an on-chip cache
and/or a register.
[0158] In an optional example, the main processing circuit may include a computing unit
configured to perform data computations.
[0159] In an optional example, the main processing circuit may include an arithmetic computing
unit.
[0160] In an optional example, the main processing circuit may include a vector computing
unit configured to perform computations on a group of data simultaneously. Specifically,
the arithmetic computation and/or vector computation may be computations of any type
which may include but are not limited to: addition, subtraction, multiplication, and
division between two numbers; addition, subtraction, multiplication, and division
between a number and a constant; exponential computations, power computations, logarithm
computations, and various nonlinear computations performed on a number; comparison
computations and logical computations performed on two numbers; and the like. The
arithmetic computation and/or vector computation may further be: addition, subtraction,
multiplication, and division between two vectors; addition, subtraction, multiplication,
and division between each element in a vector and a constant; exponential computations,
power computations, logarithm computations, and various nonlinear computations performed
on each element in a vector; comparison computations and logical computations performed
on every two corresponding elements in a vector, and the like.
[0161] In an optional example, the main processing circuit may include a data rearrangement
unit configured to transfer data to the basic processing circuits by following a certain
order, or rearrange data in situ by following a certain order.
[0162] In an optional example, the order for data arrangement may include: changing the
order of dimensions of a multi-dimensional data block. The order for data arrangement
may further include: partitioning a data block and sending the partitioned data block
to different basic processing circuits.
[0163] The computing device may further include a plurality of basic processing circuits.
Each basic processing circuit may be configured to obtain an inner product of two
vectors by computing. A method of computing may be: receiving, by a basic processing
circuit, two groups of numbers, multiplying elements in the two groups of numbers
correspondingly, and accumulating the results of multiplication, and outputting the
result of the inner product. The result may be output according to the position of
the basic processing circuit, may be transferred to another basic processing circuit,
and may also be transferred directly to the main processing circuit.
[0164] Data involved by the basic processing circuits may be data of any data type. In an
optional example, it may be data represented by a floating point number of any bit
width, or data represented by a fixed point number of any bit width. All computational
circuits and storage circuits that are involved may be computational circuits and
storage circuits that are capable of processing data of any type. In an optional example,
they may be computational circuits and storage circuits for a floating point number
of any bit width, or computational circuits and storage circuits for a fixed point
number of any bit width.
[0165] In an optional example, the basic processing circuits may include data type conversion
circuits.
[0166] In an optional example, the basic processing circuits may include vector computing
units configured to perform data type conversion.
[0167] Specifically, the basic processing circuits may include storage units composed of
on-chip caches and/or registers and may include one or more data input interfaces
for receiving data.
[0168] In an optional example, a basic processing circuit may include two data input interfaces,
and can obtain one or a plurality of data from the two data input interfaces respectively
at each time.
[0169] In an optional example, a basic processing circuit may receive input data from the
data input interfaces, and store the input data in the register and/or on-chip cache.
[0170] A source of data received by the data input interfaces may be: other basic processing
circuits and/or the main processing circuit.
[0171] The neural network computational circuit device includes a main processing circuit.
[0172] The neural network computational circuit device includes other basic processing circuits
(the neural network computational circuit device includes a plurality of basic processing
circuits).
[0173] Specifically, the neural network computational circuit device includes one or a plurality
of data output interfaces for transferring output data.
[0174] In an optional example, the neural network computational circuit device may transfer
one or a plurality of data via the data output interface.
[0175] Specifically, data transferred via the data output interface may be one or more of:
data received from the data input interface, data stored in the on-chip cache and/or
the register, a computation result of the multiplier, a computation result of the
accumulator, or a computation result of the inner product computing unit.
[0176] In an optional example, the neural network computational circuit device includes
three data output interfaces. Two of the three data output interfaces correspond to
two data input interfaces. Each layer receives data from a previous layer via the
data input interface. A third data output interface is configured to output computation
results.
[0177] Specifically, regarding where the data is transferred, the above-mentioned data sources
and where the data is transferred together determine connections of the basic processing
circuits in the device.
[0178] The neural network computational circuit device includes a main processing circuit.
[0179] The neural network computational circuit device includes other basic processing circuits.
The neural network computational circuit device includes a plurality of basic processing
circuits.
[0180] Specifically, the neural network computational circuit device includes an arithmetic
computational circuit which may be one or more of: one or a plurality of multiplier
circuits, one or a plurality of accumulator circuits, and one or a plurality of circuits
configured to perform inner product computations of two groups of numbers.
[0181] In an optional example, the device may be configured to perform multiplication of
two numbers. Results of multiplication may be stored in the on-chip cache and/or the
register, and may also be accumulated in the register and/or the on-chip cache.
[0182] In an optional example, the device may be configured to perform inner product computations
of two groups of data. Result of the computations may be stored in the on-chip cache
and/or the register, and may also be accumulated in the register and/or the on-chip
cache.
[0183] In an optional example, the device may be configured to accumulate data. The data
may also be accumulated in the register and/or the on-chip cache.
[0184] Specifically, data accumulated in the accumulator circuit may be one or more of:
data received from the data input interface, data stored in the on-chip cache and/or
the register, a computation result of multiplier, a computation result of accumulator,
or a computation result of inner product computing unit.
[0185] It should be explained that the "data input interface" and "data output interface"
used in the description of the basic processing circuits refer to a data input interface
and a data output interface of each basic processing circuit, rather than a data input
interface and a data output interface of the whole device.
[0186] The present disclosure also provides a processing device which includes the above-mentioned
neural network computing device, a general interconnection interface, and other processing
devices (general-purpose processing devices). The neural network computing device
interacts with other processing devices to perform operations specified by users.
FIG. 3 is a schematic diagram of the processing device.
[0187] Other processing devices include one or more of a general-purpose/special-purpose
processors such as a central processing unit (CPU), a graphics processing unit (GPU),
a neural network processor, and the like. The present disclosure does not restrict
a count of processors included in the other processing devices. Other processing devices
may serve as interfaces that connect the neural network computing device to external
data and control for data moving, and may perform the basic control such as starting
and stopping the neural network computing device. Other processing devices may also
cooperate with the neural network computing device to complete computation tasks.
[0188] The general interconnection interface is configured to transfer data and control
instructions between the neural network computing device and other processing devices.
The neural network computing device may obtain required input data from the other
processing devices and write the data in an on-chip storage device of the neural network
computing device. The neural network computing device may obtain control instructions
from other processing devices, and write the control instructions in an on-chip control
cache of the neural network computing device. The neural network computing device
may further read data stored in a storage module of the neural network computing device
and transfer the data to the other processing device.
[0189] As shown in FIG. 4, optionally, the structure may further include a storage device
configured to store required data of a present computing unit/computing apparatus
or another computing unit, and is particularly suitable for a case where data that
needs to be computed cannot be completely stored in an internal memory of the neural
network computing device or another processing devices.
[0190] The processing device can be used as an SOC (System On Chip) of a device including
a mobile phone, a robot, a drone, a video surveillance device, and the like, which
may effectively reduce the core area of a control component, increase the processing
speed, and reduce the overall power consumption. In this case, a universal interconnection
interface of the combined processing device may be connected to some components of
the device. The some components include webcams, monitors, mice, keyboards, network
cards, and WIFI interfaces.
[0191] The present disclosure provides a neural network processor board card which can be
used in various general-purpose or special-purpose computing system environments or
configurations. For instance, personal computers, server computers, handheld or portable
devices, tablet devices, smart home, home appliances, multiprocessor systems, microprocessor
based systems, robots, programmable consumer electronics, network personal computers,
small computers, large computers, distributed computing environments including any
of the systems or devices above, and the like.
[0192] FIG. 5a is a structural diagram of a neural network processor board card according
to an example of the present disclosure. As shown in FIG. 5c, the neural network processor
board card 10 includes a neural network chip package structure 11, a first electrical
and non-electrical connection device 12, and a first substrate 13.
[0193] The present disclosure does not restrict a specific structure of the neural network
chip package structure 11. Optionally, as shown in FIG. 5b, the neural network chip
package structure 11 includes a neural network chip 111, a second electrical and non-electrical
connection device 112, and a second substrate 113.
[0194] The present disclosure does not restrict a specific form of the neural network chip
111. The neural network chip 111 may include but is not limited to a neural network
wafer integrated with a neural network processor, where the wafer may be made of silicon
material, germanium material, quantum material, or molecular material. The neural
network wafer may be packaged according to a real situation (for example, a harsh
environment) and different application requirements, so that most of the neural network
wafer may be wrapped, and leads on the neural network wafer may be connected to the
outside of the packaging structure through conductors such as gold wire, which can
be used for circuit connection with an outer layer.
[0195] The present disclosure does not restrict a specific structure of the neural network
chip 111. Optionally, the device shown in FIG. 1a and FIG. 1b may be used as reference.
[0196] The present disclosure does not restrict types of the first substrate 13 and the
second substrate 113. The first substrate and the second substrate may be a printed
circuit board (PCB) or a printed wiring board (PWB), and may also be another type
of circuit board. The present disclosure does not restrict the material that the PCB
is made of.
[0197] The second substrate 113 of the present disclosure may be used to bear the neural
network chip 111, and the chip package structure obtained by connecting the neural
network chip 111 and the second substrate 113 through the second electrical and non-electrical
connection device 112 is used for protecting the neural network chip 111, so that
the neural network chip package structure 11 and the first substrate 13 can be further
packaged.
[0198] The present disclosure does not restrict a specific manner for packaging and a corresponding
structure of the manner for packaging of the second electrical and non-electrical
connection device 112. An appropriate package manner can be selected and be subject
to simple improvement according to a certain situation and different application requirements,
such as Flip Chip Ball Grid Array Package (FCBGAP), Low-profile Quad Flat Package
(LQFP), Quad Flat Package with Heat Sink (HQFP), Quad Flat Non-lead Package (QFN),
or a Fine-Pitch Ball Grid Package (FBGA) and other package manners.
[0199] A flip chip may be suitable for a case where the requirement on the area after packaging
is high or an inductor of a conductive wire and a transmission time of a signal are
sensitive. In addition, a package manner of wire bonding may be adopted to reduce
the cost and increase the flexibility of the package structure.
[0200] Ball Grid Array may provide more leads, and the average wire length of the leads
is short, which can transfer signals at high speed, where the package may be replaced
by Pin Grid Array (PGA), Zero Insertion Force (ZIF), Single Edge Contact Connection
(SECC), Land Grid Array (LGA), and the like.
[0201] Optionally, the package manner of Flip Chip Ball Grid Array may be adopted to package
the neural network chip 111 and the second substrate 113. Please refer to FIG. 6 for
a schematic diagram of a package structure of the neural network chip. As shown in
FIG. 6, the neural network chip package structure may include a neural network chip
21, a pad 22, a ball 23, a second substrate 24, a connection point 25 on the second
substrate 24, and a lead 26.
[0202] The pad 22 is connected to the neural network chip 21, and the ball 23 is formed
by welding between the pad 22 and the connection point 25 on the second substrate
24, in this way, the neural network chip 21 and the second substrate 24 is connected,
thereby realizing the package of the neural network chip 21.
[0203] The lead 26 is used to connect an external circuit of the package structure (for
instance, the first substrate 13 on the neural network processor board card 10) for
transferring external data and internal data, which may facilitate data processing
by the neural network chip 21 or a corresponding neural network processor of the neural
network chip 21. A type and quantity of leads are not restricted in the present disclosure.
Different lead types can be selected according to different packaging technologies,
and leads can be arranged according to certain rules.
[0204] Optionally, the neural network chip package structure may further include an insulating
filler disposed in the gap between the pad 22, the ball 23, and the connection point
25 for preventing interference between balls.
[0205] The material of the insulating filler may be silicon nitride, silicon oxide, or silicon
oxynitride; and the interference may include electromagnetic interference, inductance
interference, and the like.
[0206] Optionally, the neural network chip package structure may further include a heat
dissipation device for dissipating heat generated during the operation of the neural
network chip 21. The heat dissipation device may be a piece of metal with good thermal
conductivity, a heat sink, or a radiator such as a fan.
[0207] For instance, as shown in FIG. 6a, the neural network chip package structure 11 may
include: a neural network chip 21, a pad 22, a ball 23, a second substrate 24, a connection
point 25 on the second substrate 24, a lead 26, an insulating filler 27, thermal compound
28, and a fin 29 with metal housing. Among them, the thermal compound 28 and the fin
29 with metal housing are configured to dissipate the heat generated during the operation
of the neural network chip 21.
[0208] Optionally, the neural network chip package structure 11 may further include a reinforcing
structure, which is connected to the pad 22, and is buried in the ball 23 to improve
the connection strength between the ball 23 and the pad 22.
[0209] The reinforcing structure may be a metal wire structure or a columnar structure,
which is not restricted herein.
[0210] A specific form of the first electrical and non-electrical device 12 is not restricted
in the present disclosure. Please refer to the description of the second electrical
and non-electrical device 112. In other words, the neural network chip package structure
may be packaged by welding, or by connecting the second substrate 113 and the first
substrate 13 through a connecting line or by means of plugging, so that the first
substrate 13 or the neural network chip package structure 11 can be replaced conveniently
later.
[0211] Optionally, the first substrate 13 may include a memory unit interface for expanding
storage capacity, such as a Synchronous Dynamic Random Access Memory (SDRAM), and
a Double Date Rate (DDR) SDRAM, and the like. By expanding the memory, the processing
capacity of the neural network processor may be improved.
[0212] The first substrate 13 may further include a Peripheral Component Interconnect-Express
(PCI-E or PCIe) interface, a Small Form-factor Pluggable (SFP) interface, and an Ethernet
interface, a Controller Area Network (CAN) interface, and the like, which can be used
for data transfer between the package structure and external circuits. In this way,
the computational speed may be improved, and the operation may be easier.
[0213] The neural network processor is packaged into a neural network chip 111, the neural
network chip 111 is packaged into a chip package structure 11, and the neural network
chip package structure 11 is packaged into a neural network processor board card 10.
Data interaction with an external circuit (for instance, a computer motherboard) may
be performed through an interface (slot or ferrule) on the board card, that is, the
function of the neural network processor may be implemented by using the neural network
processor board card 10 directly, which may also protect the neural network chip 111.
In addition, other modules may be added to the neural network processor board card
10, which may improve the application range and computational efficiency of the neural
network processor.
[0214] An example of the present disclosure provides an electronic device including the
neural network processor board card 10 or the neural network chip package structure
11.
[0215] The electronic device includes a data processing device, a robot, a computer, a printer,
a scanner, a tablet, a smart terminal, a mobile phone, a traffic recorder, a navigator,
a sensor, a webcam, a server, a camera, a video camera, a projector, a watch, a headphone,
a mobile storage, a wearable device, a vehicle, a household appliance, and/or a medical
equipment.
[0216] The vehicle includes an airplane, a ship, and/or a car. The household electrical
appliance includes a television, an air conditioner, a microwave oven, a refrigerator,
an electric rice cooker, a humidifier, a washing machine, an electric lamp, a gas
cooker, and a range hood. The medical equipment includes a nuclear magnetic resonance
spectrometer, a B-ultrasonic scanner, and/or an electrocardiograph.
[0217] The examples of the present disclosure have been described in detail above. The principles
and implementation manners of the present disclosure have been described with the
examples. The descriptions of the examples are only used for facilitating understanding
of the methods and core ideas of the present disclosure. Persons of ordinary skill
in the art may change the implementation and application scope according to the ideas
of the present disclosure. In summary, the content of this specification should not
be construed as a limitation on the present disclosure.