[go: up one dir, main page]

JP2024118195A - Neural network circuit and neural network operation method - Google Patents

Neural network circuit and neural network operation method Download PDF

Info

Publication number
JP2024118195A
JP2024118195A JP2023024486A JP2023024486A JP2024118195A JP 2024118195 A JP2024118195 A JP 2024118195A JP 2023024486 A JP2023024486 A JP 2023024486A JP 2023024486 A JP2023024486 A JP 2023024486A JP 2024118195 A JP2024118195 A JP 2024118195A
Authority
JP
Japan
Prior art keywords
circuit
instruction
memory
neural network
quantization
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.)
Pending
Application number
JP2023024486A
Other languages
Japanese (ja)
Inventor
賢治 渡邊
Kenji Watanabe
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Leap Mind Inc
Original Assignee
Leap Mind Inc
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Leap Mind Inc filed Critical Leap Mind Inc
Priority to JP2023024486A priority Critical patent/JP2024118195A/en
Publication of JP2024118195A publication Critical patent/JP2024118195A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Complex Calculations (AREA)

Abstract

To provide a high-performance neural network circuit that can be incorporated into embedded devices such as IoT devices, and a neural network operation method.SOLUTION: A neural network circuit includes: a neural network operation core having a convolution operation circuit that performs a convolution operation based on a first instruction command; an instruction providing unit having an instruction memory that stores the first instruction command and providing the first instruction command to the convolution operation circuit; and a DMA controller transferring data between the neural network operation core and an external memory.SELECTED DRAWING: Figure 20

Description

本発明は、ニューラルネットワーク回路およびニューラルネットワーク演算方法に関する。 The present invention relates to a neural network circuit and a neural network calculation method.

近年、畳み込みニューラルネットワーク(Convolutional Neural Network:CNN)が画像認識等のモデルとして用いられている。畳み込みニューラルネットワークは、畳み込み層やプーリング層を有する多層構造であり、畳み込み演算等の多数の演算を必要とする。畳み込みニューラルネットワークによる演算を高速化する演算手法が様々考案されている(特許文献1など)。 In recent years, convolutional neural networks (CNNs) have been used as models for image recognition and the like. Convolutional neural networks have a multi-layer structure with convolutional layers and pooling layers, and require a large number of calculations, including convolutional calculations. Various calculation methods have been devised to speed up calculations using convolutional neural networks (e.g., Patent Document 1).

特開2018-077829号公報JP 2018-077829 A

一方で、IoT機器などの組み込み機器においても畳み込みニューラルネットワークを利用した画像認識等を実現することが望まれている。組み込み機器においては、特許文献1等に記載された大規模な専用回路を組み込むことは難しい。また、CPUやメモリ等のハードウェアリソースが限られた組み込み機器においては、畳み込みニューラルネットワークの十分な演算性能をソフトウェアのみにより実現することは難しい。 On the other hand, there is a demand for implementing image recognition and the like using convolutional neural networks in embedded devices such as IoT devices. It is difficult to incorporate large-scale dedicated circuits such as those described in Patent Document 1 into embedded devices. Also, in embedded devices with limited hardware resources such as CPU and memory, it is difficult to achieve sufficient computing performance of convolutional neural networks using software alone.

上記事情を踏まえ、本発明は、IoT機器などの組み込み機器に組み込み可能かつ高性能なニューラルネットワーク回路およびニューラルネットワーク演算方法を提供することを目的とする。 In light of the above, the present invention aims to provide a high-performance neural network circuit and neural network calculation method that can be incorporated into embedded devices such as IoT devices.

上記課題を解決するために、この発明は以下の手段を提案している。
本発明の第一の態様に係るニューラルネットワーク回路は、第一命令コマンドに基づいて畳み込み演算を実行する畳み込み演算回路を有するニューラルネットワーク演算コアと、前記第一命令コマンドを格納する命令メモリを有し、前記畳み込み演算回路に前記第一命令コマンドを提供する命令提供ユニットと、前記ニューラルネットワーク演算コアと外部メモリとの間でデータを転送するDMAコントローラと、を備える。
In order to solve the above problems, the present invention proposes the following means.
A neural network circuit according to a first aspect of the present invention comprises a neural network calculation core having a convolution calculation circuit that performs a convolution calculation based on a first instruction command, an instruction providing unit having an instruction memory that stores the first instruction command and that provides the first instruction command to the convolution calculation circuit, and a DMA controller that transfers data between the neural network calculation core and an external memory.

本発明の第二の態様に係るニューラルネットワーク演算方法は、第一命令コマンドに基づいて畳み込み演算を実行する畳み込み演算回路と、前記第一命令コマンドを格納する命令メモリを有する命令提供ユニットと、を用いるニューラルネットワーク演算方法であって、前記命令メモリに前記第一命令コマンドを格納する第一工程と、前記第一工程が完了した後において、前記命令メモリに格納された前記第一命令コマンドを前記畳み込み演算回路に提供する第二工程と、を備える。 The neural network calculation method according to the second aspect of the present invention is a neural network calculation method using a convolution calculation circuit that executes a convolution calculation based on a first command and an instruction providing unit having an instruction memory that stores the first command, and includes a first step of storing the first command in the instruction memory, and a second step of providing the first command stored in the instruction memory to the convolution calculation circuit after the first step is completed.

本発明のニューラルネットワーク回路およびニューラルネットワーク演算方法は、IoT機器などの組み込み機器に組み込み可能かつ高性能である。 The neural network circuit and neural network calculation method of the present invention can be incorporated into embedded devices such as IoT devices and has high performance.

畳み込みニューラルネットワークを示す図である。FIG. 1 illustrates a convolutional neural network. 畳み込み層が行う畳み込み演算を説明する図である。FIG. 2 is a diagram for explaining a convolution operation performed by a convolution layer. 畳み込み演算のデータの展開を説明する図である。FIG. 13 is a diagram for explaining data expansion in a convolution operation. 第一実施形態に係るニューラルネットワーク回路の全体構成を示す図である。1 is a diagram showing an overall configuration of a neural network circuit according to a first embodiment; NN演算コアの全体構成を示す図である。FIG. 2 is a diagram showing the overall configuration of an NN processing core. 同NN演算コアの動作例を示すタイミングチャートである。4 is a timing chart showing an example of the operation of the NN processing core. 同NN演算コアの他の動作例を示すタイミングチャートである。13 is a timing chart showing another example of the operation of the NN processing core. NN演算マルチコアを示す図である。FIG. 1 illustrates an NN calculation multi-core. 同ニューラルネットワーク回路のDMACの内部ブロック図である。FIG. 2 is an internal block diagram of the DMAC of the neural network circuit. 同DMACの制御回路のステート遷移図である。FIG. 2 is a state transition diagram of a control circuit of the DMAC. 同ニューラルネットワーク回路の畳み込み演算回路の内部ブロック図である。FIG. 2 is an internal block diagram of a convolution operation circuit of the neural network circuit. 同畳み込み演算回路の乗算器の内部ブロック図である。FIG. 2 is an internal block diagram of a multiplier in the convolution operation circuit. 同乗算器の積和演算ユニットの内部ブロック図である。FIG. 2 is an internal block diagram of a multiply-and-accumulate unit of the multiplier. 同畳み込み演算回路のアキュムレータ回路の内部ブロック図である。FIG. 2 is an internal block diagram of an accumulator circuit of the convolution operation circuit. 同アキュムレータ回路のアキュムレータユニットの内部ブロック図である。FIG. 2 is an internal block diagram of an accumulator unit of the accumulator circuit. 同畳み込み演算回路の命令デコンプレッサの内部ブロック図である。FIG. 2 is an internal block diagram of an instruction decompressor of the convolution operation circuit. 同量子化演算回路のベクトル演算回路と量子化回路の内部ブロック図である。FIG. 2 is an internal block diagram of a vector operation circuit and a quantization circuit of the quantization operation circuit. 演算ユニットのブロック図である。FIG. 2 is a block diagram of a computing unit. 同量子化回路のベクトル量子化ユニットの内部ブロック図である。FIG. 2 is an internal block diagram of a vector quantization unit of the quantization circuit. 同ニューラルネットワーク回路の命令供給ユニットのブロック図である。FIG. 2 is a block diagram of an instruction supply unit of the neural network circuit. 同命令供給ユニット命令メモリのメモリマップを示す図である。FIG. 2 is a diagram showing a memory map of the instruction memory of the instruction supply unit; 同ニューラルネットワーク回路の制御フローチャートである。4 is a control flowchart of the neural network circuit.

(第一実施形態)
本発明の第一実施形態について、図1から図22を参照して説明する。
図1は、畳み込みニューラルネットワーク200(以下、「CNN200」という)を示す図である。第一実施形態に係るニューラルネットワーク回路100(以下、「NN回路100」という)が行う演算は、推論時に使用する学習済みのCNN200の少なくとも一部である。
First Embodiment
A first embodiment of the present invention will be described with reference to FIGS.
1 is a diagram showing a convolutional neural network 200 (hereinafter, referred to as "CNN 200"). The calculations performed by a neural network circuit 100 (hereinafter, referred to as "NN circuit 100") according to the first embodiment are at least a part of the trained CNN 200 used during inference.

[CNN200]
CNN200は、畳み込み演算を行う畳み込み層210と、量子化演算を行う量子化演算層220と、出力層230と、を含む多層構造のネットワークである。CNN200の少なくとも一部において、畳み込み層210と量子化演算層220とが交互に連結されている。CNN200は、画像認識や動画認識に広く使われるモデルである。CNN200は、全結合層などの他の機能を有する層(レイヤ)をさらに有してもよい。
[CNN200]
The CNN 200 is a multi-layer network including a convolution layer 210 that performs a convolution operation, a quantization operation layer 220 that performs a quantization operation, and an output layer 230. In at least a part of the CNN 200, the convolution layer 210 and the quantization operation layer 220 are alternately connected. The CNN 200 is a model that is widely used for image recognition and video recognition. The CNN 200 may further include a layer having other functions, such as a fully connected layer.

図2は、畳み込み層210が行う畳み込み演算を説明する図である。
畳み込み層210は、入力データaに対して重みwを用いた畳み込み演算を行う。畳み込み層210は、入力データaと重みwとを入力とする積和演算を行う。
FIG. 2 is a diagram illustrating the convolution operation performed by the convolution layer 210.
The convolution layer 210 performs a convolution operation on the input data a using a weight w. The convolution layer 210 performs a multiply-and-accumulate operation on the input data a and the weight w.

畳み込み層210への入力データa(アクティベーションデータ、特徴マップともいう)は、画像データ等の多次元データである。本実施形態において、入力データaは、要素(x,y,c)からなる3次元テンソルである。CNN200の畳み込み層210は、低ビットの入力データaに対して畳み込み演算を行う。本実施形態において、入力データaの要素は、2ビットの符号なし整数(0,1,2,3)である。入力データaの要素は、例えば、4ビットや8ビット符号なし整数でもよい。 The input data a (also called activation data or feature map) to the convolutional layer 210 is multidimensional data such as image data. In this embodiment, the input data a is a three-dimensional tensor consisting of elements (x, y, c). The convolutional layer 210 of the CNN 200 performs a convolution operation on the low-bit input data a. In this embodiment, the elements of the input data a are 2-bit unsigned integers (0, 1, 2, 3). The elements of the input data a may be, for example, 4-bit or 8-bit unsigned integers.

CNN200に入力される入力データが、例えば32ビットの浮動小数点型など、畳み込み層210への入力データaと形式が異なる場合、CNN200は畳み込み層210の前に型変換や量子化を行う入力層をさらに有してもよい。 If the input data input to CNN 200 has a different format from the input data a to convolutional layer 210, such as a 32-bit floating-point type, CNN 200 may further have an input layer that performs type conversion and quantization before convolutional layer 210.

畳み込み層210の重みw(フィルタ、カーネルともいう)は、学習可能なパラメータである要素を有する多次元データである。本実施形態において、重みwは、要素(i,j,c,d)からなる4次元テンソルである。重みwは、要素(i,j,c)からなる3次元テンソル(以降、「重みwo」という)をd個有している。学習済みのCNN200における重みwは、学習済みのデータである。CNN200の畳み込み層210は、低ビットの重みwを用いて畳み込み演算を行う。本実施形態において、重みwの要素は、1ビットの符号付整数(0,1)であり、値「0」は+1を表し、値「1」は-1を表す。 The weights w (also called filters or kernels) of the convolutional layer 210 are multidimensional data having elements that are learnable parameters. In this embodiment, the weights w are four-dimensional tensors consisting of elements (i, j, c, d). The weights w have d three-dimensional tensors (hereinafter referred to as "weights wo") consisting of elements (i, j, c). The weights w in the trained CNN 200 are trained data. The convolutional layer 210 of the CNN 200 performs convolution operations using low-bit weights w. In this embodiment, the elements of the weights w are one-bit signed integers (0, 1), with the value "0" representing +1 and the value "1" representing -1.

畳み込み層210は、式1に示す畳み込み演算を行い、出力データfを出力する。式1において、sはストライドを示す。図2において点線で示された領域は、入力データaに対して重みwoが適用される領域ao(以降、「適用領域ao」という)の一つを示している。適用領域aoの要素は、(x+i,y+j,c)で表される。 The convolution layer 210 performs the convolution operation shown in Equation 1 and outputs output data f. In Equation 1, s indicates the stride. The area indicated by the dotted line in FIG. 2 indicates one of the areas ao (hereinafter referred to as the "application area ao") where the weight wo is applied to the input data a. The elements of the application area ao are represented by (x+i, y+j, c).

Figure 2024118195000002
Figure 2024118195000002

量子化演算層220は、畳み込み層210が出力する畳み込み演算の出力に対して量子化などを実施する。量子化演算層220は、プーリング層221と、Batch Normalization層222と、活性化関数層223と、量子化層224と、を有する。 The quantization operation layer 220 performs quantization and other operations on the output of the convolution operation output by the convolution layer 210. The quantization operation layer 220 has a pooling layer 221, a batch normalization layer 222, an activation function layer 223, and a quantization layer 224.

プーリング層221は、畳み込み層210が出力する畳み込み演算の出力データfに対して平均プーリング(式2)やMAXプーリング(式3)などの演算を実施して、畳み込み層210の出力データfを圧縮する。式2および式3において、uは入力テンソルを示し、vは出力テンソルを示し、Tはプーリング領域の大きさを示す。式3において、maxはTに含まれるiとjの組み合わせに対するuの最大値を出力する関数である。 The pooling layer 221 compresses the output data f of the convolutional operation output by the convolutional layer 210 by performing calculations such as average pooling (Equation 2) and MAX pooling (Equation 3). In Equations 2 and 3, u represents the input tensor, v represents the output tensor, and T represents the size of the pooling region. In Equation 3, max is a function that outputs the maximum value of u for the combination of i and j included in T.

Figure 2024118195000003
Figure 2024118195000003

Figure 2024118195000004
Figure 2024118195000004

Batch Normalization層222は、量子化演算層220やプーリング層221の出力データに対して、例えば式4に示すような演算によりデータ分布の正規化を行う。式4において、uは入力テンソルを示し、vは出力テンソルを示し、αはスケールを示し、βはバイアスを示す。学習済みのCNN200において、αおよびβは学習済みの定数ベクトルである。 The batch normalization layer 222 normalizes the data distribution of the output data of the quantization operation layer 220 and the pooling layer 221, for example, by performing an operation as shown in Equation 4. In Equation 4, u represents the input tensor, v represents the output tensor, α represents the scale, and β represents the bias. In the trained CNN 200, α and β are trained constant vectors.

Figure 2024118195000005
Figure 2024118195000005

活性化関数層223は、量子化演算層220やプーリング層221やBatch Normalization層222の出力に対してReLU(式5)などの活性化関数の演算を行う。式5において、uは入力テンソルであり、vは出力テンソルである。式5において、maxは引数のうち最も大きい数値を出力する関数である。 The activation function layer 223 calculates an activation function such as ReLU (Equation 5) on the output of the quantization operation layer 220, the pooling layer 221, and the batch normalization layer 222. In Equation 5, u is an input tensor and v is an output tensor. In Equation 5, max is a function that outputs the largest numerical value among the arguments.

Figure 2024118195000006
Figure 2024118195000006

量子化層224は、量子化パラメータに基づいて、プーリング層221や活性化関数層223の出力に対して例えば式6に示すような量子化を行う。式6に示す量子化は、入力テンソルuを2ビットにビット削減している。式6において、q(c)は量子化パラメータのベクトルである。学習済みのCNN200において、q(c)は学習済みの定数ベクトルである。式6における不等号「≦」は「<」であってもよい。 The quantization layer 224 performs quantization on the output of the pooling layer 221 and the activation function layer 223 based on the quantization parameter, for example as shown in Equation 6. The quantization shown in Equation 6 reduces the input tensor u to 2 bits. In Equation 6, q(c) is a vector of quantization parameters. In the trained CNN 200, q(c) is a trained constant vector. The inequality sign "≦" in Equation 6 may be "<".

Figure 2024118195000007
Figure 2024118195000007

出力層230は、恒等関数やソフトマックス関数等によりCNN200の結果を出力する層である。出力層230の前段のレイヤは、畳み込み層210であってもよいし、量子化演算層220であってもよい。 The output layer 230 is a layer that outputs the results of the CNN 200 using an identity function, a softmax function, or the like. The layer preceding the output layer 230 may be the convolution layer 210 or the quantization operation layer 220.

CNN200は、量子化された量子化層224の出力データが、畳み込み層210に入力されるため、量子化を行わない他の畳み込みニューラルネットワークと比較して、畳み込み層210の畳み込み演算の負荷が小さい。 In CNN 200, the quantized output data of quantization layer 224 is input to convolutional layer 210, so the load of the convolution calculation in convolutional layer 210 is smaller than in other convolutional neural networks that do not perform quantization.

[畳み込み演算の分割]
NN回路100は、畳み込み層210の畳み込み演算(式1)の入力データを部分テンソルに分割して演算する。部分テンソルへの分割方法や分割数は特に限定されない。部分テンソルは、例えば、入力データa(x+i,y+j,c)をa(x+i,y+j,co)に分割することにより形成される。なお、NN回路100は、畳み込み層210の畳み込み演算(式1)の入力データを分割せずに演算することもできる。
[Dividing the convolution operation]
The NN circuit 100 divides the input data of the convolution operation (Equation 1) of the convolution layer 210 into partial tensors and performs the operation. The method of division into the partial tensors and the number of divisions are not particularly limited. The partial tensor is formed, for example, by dividing the input data a(x+i, y+j, c) into a(x+i, y+j, co). The NN circuit 100 can also perform the operation without dividing the input data of the convolution operation (Equation 1) of the convolution layer 210.

畳み込み演算の入力データ分割において、式1における変数cは、式7に示すように、サイズBcのブロックで分割される。また、式1における変数dは、式8に示すように、サイズBdのブロックで分割される。式7において、coはオフセットであり、ciは0から(Bc-1)までのインデックスである。式8において、doはオフセットであり、diは0から(Bd-1)までのインデックスである。なお、サイズBcとサイズBdは同じであってもよい。 When dividing input data for a convolution operation, the variable c in Equation 1 is divided into blocks of size Bc, as shown in Equation 7. Furthermore, the variable d in Equation 1 is divided into blocks of size Bd, as shown in Equation 8. In Equation 7, co is an offset, and ci is an index from 0 to (Bc-1). In Equation 8, do is an offset, and di is an index from 0 to (Bd-1). Note that size Bc and size Bd may be the same.

Figure 2024118195000008
Figure 2024118195000008

Figure 2024118195000009
Figure 2024118195000009

式1における入力データa(x+i,y+j,c)は、c軸方向においてサイズBcにより分割され、分割された入力データa(x+i,y+j,co)で表される。以降の説明において、分割された入力データaを「分割入力データa」ともいう。 The input data a(x+i, y+j, c) in Equation 1 is divided in the c-axis direction by size Bc, and is represented as divided input data a(x+i, y+j, co). In the following description, the divided input data a is also referred to as "divided input data a".

式1における重みw(i,j,c,d)は、c軸方向においてサイズBcおよびd軸方向においてサイズBdにより分割され、分割された重みw(i,j,co,do)で表される。以降の説明において、分割された重みwを「分割重みw」ともいう。 The weight w(i, j, c, d) in formula 1 is divided by the size Bc in the c-axis direction and the size Bd in the d-axis direction, and is expressed as the divided weight w(i, j, co, do). In the following explanation, the divided weight w is also referred to as the "divided weight w".

サイズBdにより分割された出力データf(x,y,do)は、式9により求まる。分割された出力データf(x,y,do)を組み合わせることで、最終的な出力データf(x,y,d)を算出できる。 The output data f(x, y, do) divided by size Bd is calculated using Equation 9. The final output data f(x, y, d) can be calculated by combining the divided output data f(x, y, do).

Figure 2024118195000010
Figure 2024118195000010

[畳み込み演算のデータの展開]
NN回路100は、畳み込み層210の畳み込み演算における入力データaおよび重みwを展開して畳み込み演算を行う。
[Expanding data for convolution operations]
The NN circuit 100 performs the convolution operation by expanding the input data a and the weights w in the convolution operation of the convolution layer 210.

図3は、畳み込み演算のデータの展開を説明する図である。
分割入力データa(x+i、y+j、co)は、Bc個の要素を持つベクトルデータに展開される。分割入力データaの要素は、ciでインデックスされる(0≦ci<Bc)。以降の説明において、i,jごとにベクトルデータに展開された分割入力データaを「入力ベクトルA」ともいう。入力ベクトルAは、分割入力データa(x+i、y+j、co×Bc)から分割入力データa(x+i、y+j、co×Bc+(Bc-1))までを要素とする。
FIG. 3 is a diagram for explaining the expansion of data in a convolution operation.
Divided input data a(x+i, y+j, co) is expanded into vector data having Bc elements. The elements of divided input data a are indexed by ci (0≦ci<Bc). In the following explanation, divided input data a expanded into vector data for each i and j is also referred to as "input vector A". Input vector A has elements from divided input data a(x+i, y+j, co×Bc) to divided input data a(x+i, y+j, co×Bc+(Bc-1)).

分割重みw(i,j,co、do)は、Bc×Bd個の要素を持つマトリクスデータに展開される。マトリクスデータに展開された分割重みwの要素は、ciとdiでインデックスされる(0≦di<Bd)。以降の説明において、i,jごとにマトリクスデータに展開された分割重みwを「重みマトリクスW」ともいう。重みマトリクスWは、分割重みw(i,j,co×Bc、do×Bd)から分割重みw(i,j,co×Bc+(Bc-1)、do×Bd+(Bd-1))までを要素とする。 The partitioning weights w(i,j,co,do) are expanded into matrix data with Bc×Bd elements. The elements of the partitioning weights w expanded into the matrix data are indexed by ci and di (0≦di<Bd). In the following explanation, the partitioning weights w expanded into the matrix data for each i and j are also referred to as the "weight matrix W". The weight matrix W has elements from partitioning weights w(i,j,co×Bc,do×Bd) to partitioning weights w(i,j,co×Bc+(Bc-1),do×Bd+(Bd-1)).

入力ベクトルAと重みマトリクスWとを乗算することで、ベクトルデータが算出される。i,j,coごとに算出されたベクトルデータを3次元テンソルに整形することで、出力データf(x,y,do)を得ることができる。このようなデータの展開を行うことで、畳み込み層210の畳み込み演算を、ベクトルデータとマトリクスデータとの乗算により実施できる。 Vector data is calculated by multiplying the input vector A by the weight matrix W. The vector data calculated for each i, j, co is shaped into a three-dimensional tensor to obtain output data f(x, y, do). By expanding the data in this way, the convolution operation of the convolution layer 210 can be performed by multiplying the vector data by the matrix data.

[NN回路100]
図4は、本実施形態に係るNN回路100の全体構成を示す図である。
NN回路100は、DMAコントローラ3(以下、「DMAC3」ともいう)と、コントローラ6と、命令供給ユニット7と、少なくとも一つのニューラルネットワーク演算コア10(以下、「NN演算コア10」ともいう)と、を備える。
[NN circuit 100]
FIG. 4 is a diagram showing the overall configuration of an NN circuit 100 according to this embodiment.
The NN circuit 100 comprises a DMA controller 3 (hereinafter also referred to as "DMAC 3"), a controller 6, an instruction supply unit 7, and at least one neural network calculation core 10 (hereinafter also referred to as "NN calculation core 10").

NN回路100は、複数のNN演算コア10を実装可能である。図4に例示するNN回路100は、NN演算コア10を最大4つまで実装可能である。複数のNN演算コア10は、NN200の少なくとの一部の演算を連携して実行する「ニューラルネットワーク演算マルチコア10M(以下、「NN演算マルチコア10M」ともいう)」を構成する。複数のNN演算コア10は、本実施形態においてデイジーチェーン接続されている。なお、NN回路100に実装可能なNN演算コア10の数は5個以上であってもよい。 The NN circuit 100 can implement multiple NN calculation cores 10. The NN circuit 100 illustrated in FIG. 4 can implement up to four NN calculation cores 10. The multiple NN calculation cores 10 constitute a "neural network calculation multi-core 10M (hereinafter also referred to as "NN calculation multi-core 10M")" that cooperates to execute at least some of the calculations of the NN 200. In this embodiment, the multiple NN calculation cores 10 are daisy-chained. Note that the number of NN calculation cores 10 that can be implemented in the NN circuit 100 may be five or more.

DMAC3は、外部バスEBに接続されており、DRAMなどの外部メモリ120と命令供給ユニット7との間でデータを転送する。また、DMAC3は、DRAMなどの外部メモリ120とNN演算コア10との間でデータを転送する。DMAC3は、複数のNN演算コア10のいずれかに対して外部メモリ120から読み出したデータを転送する。なお、DMAC3は、複数のNN演算コア10に対して外部メモリ120から読み出した同一のデータを転送可能であってもよいし、ブロードキャスト可能であってもよい。 The DMAC3 is connected to the external bus EB, and transfers data between the instruction supply unit 7 and an external memory 120 such as a DRAM. The DMAC3 also transfers data between the external memory 120 such as a DRAM and the NN calculation core 10. The DMAC3 transfers data read from the external memory 120 to any one of the multiple NN calculation cores 10. The DMAC3 may be capable of transferring the same data read from the external memory 120 to multiple NN calculation cores 10, or may be capable of broadcasting the data.

コントローラ6は、外部バスEBに接続されており、外部のホストCPU110のスレーブとして動作する。コントローラ6は、バスブリッジ60と、レジスタ61と、を有する。 The controller 6 is connected to the external bus EB and operates as a slave to the external host CPU 110. The controller 6 has a bus bridge 60 and a register 61.

バスブリッジ60は、外部バスEBから内部バスIBへのバスアクセスを中継する。また、バスブリッジ60は、外部ホストCPU110からレジスタ61への書き込み要求および読み込み要求を中継する。 The bus bridge 60 relays bus access from the external bus EB to the internal bus IB. The bus bridge 60 also relays write and read requests from the external host CPU 110 to the register 61.

レジスタ61は、パラメータレジスタや状態レジスタを有する。パラメータレジスタは、NN回路100の動作を制御するレジスタである。状態レジスタは各モジュールの命令列のポインタ・命令数などを含み、NN回路100の状態を示すレジスタである。また、状態レジスタはセマフォSを含む構成としてよい。外部ホストCPU110は、コントローラ6のバスブリッジ60を経由して、レジスタ61にアクセスできる。 The register 61 has a parameter register and a status register. The parameter register is a register that controls the operation of the NN circuit 100. The status register contains a pointer to the instruction sequence of each module, the number of instructions, etc., and is a register that indicates the status of the NN circuit 100. The status register may also be configured to contain a semaphore S. The external host CPU 110 can access the register 61 via the bus bridge 60 of the controller 6.

コントローラ6は、内部バスIBを介して、NN回路100の各ブロック(DMAC3、命令供給ユニット7、NN演算コア10)と接続されている。外部ホストCPU110は、コントローラ6を経由して、NN回路100の各ブロックに対してアクセスできる。例えば、外部ホストCPU110は、コントローラ6を経由して、NN演算コア10に対する命令を指示することができる。また、各ブロックは、内部バスIBを介して、コントローラ6が有する状態レジスタ(セマフォSを含んでもよい)を更新できる。状態レジスタは、各ブロックと接続された専用配線を介して更新されるように構成されていてもよい。 The controller 6 is connected to each block of the NN circuit 100 (DMAC3, instruction supply unit 7, NN calculation core 10) via the internal bus IB. The external host CPU 110 can access each block of the NN circuit 100 via the controller 6. For example, the external host CPU 110 can issue instructions to the NN calculation core 10 via the controller 6. In addition, each block can update a status register (which may include a semaphore S) held by the controller 6 via the internal bus IB. The status register may be configured to be updated via a dedicated wiring connected to each block.

命令供給ユニット(ISU : Instruction Supply Unit)7は、動作ブロック(DMAC3、NN演算コア10の畳み込み演算回路4および量子化演算回路5)に対する命令コマンドを記憶する。また、命令供給ユニット7は、記憶した命令コマンドを対応するNN回路100の動作ブロック(DMAC3、NN演算コア10の畳み込み演算回路4および量子化演算回路5)に転送する。 The instruction supply unit (ISU) 7 stores instruction commands for the operation blocks (DMAC3, convolution operation circuit 4 of NN operation core 10, and quantization operation circuit 5). The instruction supply unit 7 also transfers the stored instruction commands to the corresponding operation blocks of the NN circuit 100 (DMAC3, convolution operation circuit 4 of NN operation core 10, and quantization operation circuit 5).

[NN回路100:動作モード]
NN回路100は、プリロードモードと、ノーマルモードとの、二つの動作モードを有する。本実施形態において、NN回路100は、プリロードモードとノーマルモードとを排他的に切り替えて動作する。なお、NN回路100は他の動作モードを有してもよい。また、NN回路100の動作モードは、レジスタ61に含まれる「動作モード設定レジスタ」を書き換えることで、切り換え可能であってもよい。
[NN Circuit 100: Operation Mode]
The NN circuit 100 has two operation modes: a preload mode and a normal mode. In this embodiment, the NN circuit 100 operates by switching exclusively between the preload mode and the normal mode. The NN circuit 100 may have other operation modes. The operation mode of the NN circuit 100 may be switchable by rewriting an "operation mode setting register" included in the register 61.

動作モードがプリロードモード(第一モード)であるとき、DMAC3は、外部メモリ120に格納された動作ブロック(DMAC3、NN演算コア10の畳み込み演算回路4および量子化演算回路5)の命令コマンドを命令供給ユニットに転送する。このとき、DMAC3は、外部メモリ120に格納された重みwを重みメモリ41に転送してもよい。また、DMAC3は、外部メモリ120に格納された量子化パラメータqを量子化パラメータメモリ51に転送してもよい。 When the operation mode is the preload mode (first mode), the DMAC3 transfers the instruction commands of the operation blocks (DMAC3, the convolution operation circuit 4 and the quantization operation circuit 5 of the NN operation core 10) stored in the external memory 120 to the instruction supply unit. At this time, the DMAC3 may transfer the weight w stored in the external memory 120 to the weight memory 41. The DMAC3 may also transfer the quantization parameter q stored in the external memory 120 to the quantization parameter memory 51.

動作モードがノーマルモード(第二モード)であるとき、命令供給ユニット7は、格納された動作ブロック(DMAC3、NN演算コア10の畳み込み演算回路4および量子化演算回路5)の命令コマンドを動作ブロック(DMAC3、NN演算コア10の畳み込み演算回路4および量子化演算回路5)に供給する。動作ブロック(DMAC3、NN演算コア10の畳み込み演算回路4および量子化演算回路5)は、供給された命令コマンドを実行する。 When the operation mode is the normal mode (second mode), the instruction supply unit 7 supplies the stored instruction commands of the operation blocks (DMAC3, the convolution operation circuit 4 of the NN arithmetic core 10, and the quantization operation circuit 5) to the operation blocks (DMAC3, the convolution operation circuit 4 of the NN arithmetic core 10, and the quantization operation circuit 5). The operation blocks (DMAC3, the convolution operation circuit 4 of the NN arithmetic core 10, and the quantization operation circuit 5) execute the supplied instruction commands.

[NN演算コア10]
図5は、NN演算コア10の全体構成を示す図である。
NN演算コア10は、第一メモリ1と、第二メモリ2と、畳み込み演算回路4と、量子化演算回路5と、を備える。NN演算コア10は、第一メモリ1および第二メモリ2を介して、畳み込み演算回路4と量子化演算回路5とがループ状に形成されていることを特徴とする。
[NN calculation core 10]
FIG. 5 is a diagram showing the overall configuration of the NN processing core 10. As shown in FIG.
The NN calculation core 10 includes a first memory 1, a second memory 2, a convolution calculation circuit 4, and a quantization calculation circuit 5. The NN calculation core 10 is characterized in that the convolution calculation circuit 4 and the quantization calculation circuit 5 are formed in a loop shape via the first memory 1 and the second memory 2.

第一メモリ1は、例えばSRAM(Static RAM)などで構成された揮発性のメモリ等の書き換え可能なメモリである。第一メモリ1には、DMAC3や内部バスIBを介してデータの書き込みおよび読み出しが行われる。外部ホストCPU110は、第一メモリ1に対するデータの書き込みや読み出しにより、NN演算コア10に対するデータの入出力を行うことができる。 The first memory 1 is a rewritable memory such as a volatile memory composed of, for example, an SRAM (Static RAM). Data is written to and read from the first memory 1 via the DMAC 3 and the internal bus IB. The external host CPU 110 can input and output data to and from the NN calculation core 10 by writing and reading data to and from the first memory 1.

第一メモリ1は、畳み込み演算回路4の入力ポートと接続されており、畳み込み演算回路4は第一メモリ1からデータを読み出すことができる。また、第一メモリ1は、量子化演算回路5の出力ポートとループ接続(C1)されており、量子化演算回路5は第一メモリ1にデータを書き込むことができる。また、第一メモリ1は、他のNN演算コア10との間のコア間接続(C2)でデータ転送が可能であり、コア間接続(C2)された他のNN演算コア10は第一メモリ1にデータを書き込むことができる。なお、本実施形態において、コア間接続(C2)の一例として、デイジーチェーン接続を用いている。 The first memory 1 is connected to an input port of the convolution calculation circuit 4, and the convolution calculation circuit 4 can read data from the first memory 1. The first memory 1 is also loop-connected (C1) to an output port of the quantization calculation circuit 5, and the quantization calculation circuit 5 can write data to the first memory 1. The first memory 1 can also transfer data via an inter-core connection (C2) between the first memory 1 and another NN calculation core 10, and the other NN calculation core 10 connected to the inter-core connection (C2) can write data to the first memory 1. In this embodiment, a daisy chain connection is used as an example of the inter-core connection (C2).

第二メモリ2は、例えばSRAM(Static RAM)などで構成された揮発性のメモリ等の書き換え可能なメモリである。第二メモリ2には、DMAC3や内部バスIBを介してデータの書き込みおよび読み出しが行われる。外部ホストCPU110は、第二メモリ2に対するデータの書き込みや読み出しにより、NN演算コア10に対するデータの入出力を行うことができる。 The second memory 2 is a rewritable memory such as a volatile memory composed of, for example, an SRAM (Static RAM). Data is written to and read from the second memory 2 via the DMAC 3 and the internal bus IB. The external host CPU 110 can input and output data to and from the NN calculation core 10 by writing and reading data to and from the second memory 2.

第二メモリ2は、量子化演算回路5の入力ポートと接続されており、量子化演算回路5は第二メモリ2からデータを読み出すことができる。また、第二メモリ2は、畳み込み演算回路4の出力ポートと接続されており、畳み込み演算回路4は第二メモリ2にデータを書き込むことができる。 The second memory 2 is connected to an input port of the quantization calculation circuit 5, and the quantization calculation circuit 5 can read data from the second memory 2. In addition, the second memory 2 is connected to an output port of the convolution calculation circuit 4, and the convolution calculation circuit 4 can write data to the second memory 2.

畳み込み演算回路4は、学習済みのCNN200の畳み込み層210における畳み込み演算を行う回路である。畳み込み演算回路4は、第一メモリ1に格納された入力データaを読み出し、入力データaに対して畳み込み演算を実施する。畳み込み演算回路4は、畳み込み演算の出力データf(以降、「畳み込み演算出力データ」ともいう)を第二メモリ2に書き込む。 The convolution operation circuit 4 is a circuit that performs convolution operation in the convolution layer 210 of the trained CNN 200. The convolution operation circuit 4 reads the input data a stored in the first memory 1 and performs a convolution operation on the input data a. The convolution operation circuit 4 writes the output data f of the convolution operation (hereinafter also referred to as "convolution operation output data") to the second memory 2.

量子化演算回路5は、学習済みのCNN200の量子化演算層220における量子化演算の少なくとも一部を行う回路である。量子化演算回路5は、第二メモリ2に格納された畳み込み演算の出力データfを読み出し、畳み込み演算の出力データfに対して量子化演算(プーリング、Batch Normalization、活性化関数、および量子化のうち少なくとも量子化を含む演算)を実施する。 The quantization operation circuit 5 is a circuit that performs at least a part of the quantization operation in the quantization operation layer 220 of the trained CNN 200. The quantization operation circuit 5 reads the output data f of the convolution operation stored in the second memory 2, and performs a quantization operation (an operation including at least quantization among pooling, batch normalization, activation function, and quantization) on the output data f of the convolution operation.

量子化演算回路5は、量子化演算の出力データ(以降、「量子化演算出力データ」ともいう)をループ接続(C1)された第一メモリ1に書き込む。また、量子化演算回路5は、他のNN演算コア10とコア間接続(C2)経由でデータ転送可能であり、量子化演算回路5はコア間接続(C2)された他のNN演算コア10に量子化演算出力データを出力することができる。 The quantization calculation circuit 5 writes the output data of the quantization calculation (hereinafter also referred to as "quantization calculation output data") to the first memory 1 connected in a loop (C1). In addition, the quantization calculation circuit 5 can transfer data to other NN calculation cores 10 via the inter-core connection (C2), and the quantization calculation circuit 5 can output the quantization calculation output data to other NN calculation cores 10 connected in an inter-core connection (C2).

NN演算コア10は、第一メモリ1や第二メモリ2等を有するため、DRAMなどの外部メモリからのDMAC3によるデータ転送において、重複するデータのデータ転送の回数を低減できる。これにより、メモリアクセスにより発生する消費電力または処理負荷を大幅に低減することができる。 The NN calculation core 10 has a first memory 1, a second memory 2, etc., so that the number of times that duplicate data is transferred can be reduced when data is transferred by the DMAC 3 from an external memory such as a DRAM. This makes it possible to significantly reduce the power consumption or processing load caused by memory access.

[NN演算コア10の動作例1]
図6は、NN演算コア10の動作例を示すタイミングチャートである。
DMAC3は、レイヤ1の入力データaを第一メモリ1に格納する。DMAC3は、畳み込み演算回路4が行う畳み込み演算の順序にあわせて、レイヤ1の入力データaを分割して第一メモリ1に転送してもよい。
[Operation Example 1 of the NN calculation core 10]
FIG. 6 is a timing chart showing an example of the operation of the NN processing core 10. In FIG.
The DMAC 3 stores the input data a of the layer 1 in the first memory 1. The DMAC 3 may divide the input data a of the layer 1 and transfer it to the first memory 1 in accordance with the order of the convolution operation performed by the convolution operation circuit 4.

畳み込み演算回路4は、第一メモリ1に格納されたレイヤ1の入力データaを読み出す。畳み込み演算回路4は、レイヤ1の入力データaに対して図1に示すレイヤ1の畳み込み演算を行う。レイヤ1の畳み込み演算の出力データfは、第二メモリ2に格納される。 The convolution operation circuit 4 reads out the input data a of layer 1 stored in the first memory 1. The convolution operation circuit 4 performs the convolution operation of layer 1 shown in FIG. 1 on the input data a of layer 1. The output data f of the convolution operation of layer 1 is stored in the second memory 2.

量子化演算回路5は、第二メモリ2に格納されたレイヤ1の出力データfを読み出す。量子化演算回路5は、レイヤ1の出力データfに対してレイヤ2の量子化演算を行う。レイヤ2の量子化演算の出力データは、第一メモリ1に格納される。 The quantization calculation circuit 5 reads the output data f of layer 1 stored in the second memory 2. The quantization calculation circuit 5 performs a quantization calculation of layer 2 on the output data f of layer 1. The output data of the quantization calculation of layer 2 is stored in the first memory 1.

畳み込み演算回路4は、第一メモリ1に格納されたレイヤ2の量子化演算の出力データを読み出す。畳み込み演算回路4は、レイヤ2の量子化演算の出力データを入力データaとしてレイヤ3の畳み込み演算を行う。レイヤ3の畳み込み演算の出力データfは、第二メモリ2に格納される。 The convolution operation circuit 4 reads the output data of the quantization operation of layer 2 stored in the first memory 1. The convolution operation circuit 4 performs the convolution operation of layer 3 using the output data of the quantization operation of layer 2 as input data a. The output data f of the convolution operation of layer 3 is stored in the second memory 2.

畳み込み演算回路4は、第一メモリ1に格納されたレイヤ2M-2(Mは自然数)の量子化演算の出力データを読み出す。畳み込み演算回路4は、レイヤ2M-2の量子化演算の出力データを入力データaとしてレイヤ2M-1の畳み込み演算を行う。レイヤ2M-1の畳み込み演算の出力データfは、第二メモリ2に格納される。 The convolution operation circuit 4 reads the output data of the quantization operation of layer 2M-2 (M is a natural number) stored in the first memory 1. The convolution operation circuit 4 performs the convolution operation of layer 2M-1 using the output data of the quantization operation of layer 2M-2 as input data a. The output data f of the convolution operation of layer 2M-1 is stored in the second memory 2.

量子化演算回路5は、第二メモリ2に格納されたレイヤ2M-1の出力データfを読み出す。量子化演算回路5は、2M-1レイヤの出力データfに対してレイヤ2Mの量子化演算を行う。レイヤ2Mの量子化演算の出力データは、第一メモリ1に格納される。 The quantization calculation circuit 5 reads the output data f of layer 2M-1 stored in the second memory 2. The quantization calculation circuit 5 performs the quantization calculation of layer 2M on the output data f of the 2M-1 layer. The output data of the quantization calculation of layer 2M is stored in the first memory 1.

畳み込み演算回路4は、第一メモリ1に格納されたレイヤ2Mの量子化演算の出力データを読み出す。畳み込み演算回路4は、レイヤ2Mの量子化演算の出力データを入力データaとしてレイヤ2M+1の畳み込み演算を行う。レイヤ2M+1の畳み込み演算の出力データfは、第二メモリ2に格納される。 The convolution operation circuit 4 reads the output data of the quantization operation of layer 2M stored in the first memory 1. The convolution operation circuit 4 performs a convolution operation of layer 2M+1 using the output data of the quantization operation of layer 2M as input data a. The output data f of the convolution operation of layer 2M+1 is stored in the second memory 2.

畳み込み演算回路4と量子化演算回路5とが交互に演算を行い、図1に示すCNN200の演算を進めていく。NN演算コア10は、畳み込み演算回路4が時分割によりレイヤ2M-1とレイヤ2M+1の畳み込み演算を実施する。また、NN演算コア10は、量子化演算回路5が時分割によりレイヤ2M-2とレイヤ2Mの量子化演算を実施する。そのため、NN演算コア10は、レイヤごとに別々の畳み込み演算回路4と量子化演算回路5を実装する場合と比較して、回路規模が著しく小さい。 The convolution calculation circuit 4 and the quantization calculation circuit 5 alternately perform calculations to advance the calculations of the CNN 200 shown in FIG. 1. In the NN calculation core 10, the convolution calculation circuit 4 performs the convolution calculations of layers 2M-1 and 2M+1 by time division. In the NN calculation core 10, the quantization calculation circuit 5 performs the quantization calculations of layers 2M-2 and 2M by time division. Therefore, the circuit scale of the NN calculation core 10 is significantly smaller than when a separate convolution calculation circuit 4 and quantization calculation circuit 5 are implemented for each layer.

NN演算コア10は、複数のレイヤの多層構造であるCNN200の演算を、ループ状に形成された回路により演算する。NN演算コア10は、ループ状の回路構成により、ハードウェア資源を効率的に利用できる。なお、NN演算コア10は、ループ状に回路を形成するために、各レイヤで変化する畳み込み演算回路4や量子化演算回路5におけるパラメータは適宜更新される。 The NN calculation core 10 performs calculations for the CNN 200, which is a multi-layer structure of multiple layers, using a circuit formed in a loop. The NN calculation core 10 can efficiently use hardware resources due to the loop circuit configuration. Note that, since the NN calculation core 10 forms a circuit in a loop, the parameters in the convolution calculation circuit 4 and the quantization calculation circuit 5, which change in each layer, are updated appropriately.

CNN200の演算にNN演算コア10により実施できない演算が含まれる場合、NN演算コア10は外部ホストCPU110などの外部演算デバイスに中間データを転送する。外部演算デバイスが中間データに対して演算を行った後、外部演算デバイスによる演算結果は第一メモリ1や第二メモリ2に入力される。NN演算コア10は、外部演算デバイスによる演算結果に対する演算を再開する。 If the calculations of CNN 200 include calculations that cannot be performed by NN calculation core 10, NN calculation core 10 transfers intermediate data to an external calculation device such as external host CPU 110. After the external calculation device performs calculations on the intermediate data, the results of the calculations by the external calculation device are input to first memory 1 and second memory 2. NN calculation core 10 resumes calculations on the results of the calculations by the external calculation device.

[NN演算コア10の動作例2]
図7は、NN演算コア10の他の動作例を示すタイミングチャートである。
NN演算コア10は、入力データaを部分テンソルに分割して、時分割により部分テンソルに対する演算を行ってもよい。部分テンソルへの分割方法や分割数は特に限定されない。
[Operation Example 2 of the NN calculation core 10]
FIG. 7 is a timing chart showing another example of the operation of the NN processing core 10. In FIG.
The NN processing core 10 may divide the input data a into partial tensors and perform operations on the partial tensors by time division. The method of division into the partial tensors and the number of divisions are not particularly limited.

図7は、入力データaを二つの部分テンソルに分解した場合の動作例を示している。分解された部分テンソルを、「第一部分テンソルa1」、「第二部分テンソルa2」とする。例えば、レイヤ2M-1の畳み込み演算は、第一部分テンソルa1に対応する畳み込み演算(図7において、「レイヤ2M-1(a1)」と表記)と、第二部分テンソルa2に対応する畳み込み演算(図7において、「レイヤ2M-1(a2)」と表記)と、に分解される。 7 shows an example of an operation when the input data a is decomposed into two partial tensors. The decomposed partial tensors are called "first partial tensor a 1 " and "second partial tensor a 2 ". For example, the convolution operation of layer 2M-1 is decomposed into a convolution operation corresponding to the first partial tensor a 1 (in FIG. 7, indicated as "layer 2M-1 (a 1 )") and a convolution operation corresponding to the second partial tensor a 2 (in FIG. 7, indicated as "layer 2M-1 (a 2 )").

第一部分テンソルa1に対応する畳み込み演算および量子化演算と、第二部分テンソルa2に対応する畳み込み演算および量子化演算とは、図7に示すように、独立して実施することができる。 The convolution and quantization operations corresponding to the first partial tensor a 1 and the convolution and quantization operations corresponding to the second partial tensor a 2 can be performed independently, as shown in FIG.

畳み込み演算回路4は、第一部分テンソルa1に対応するレイヤ2M-1の畳み込み演算(図7において、レイヤ2M-1(a1)で示す演算)を行う。その後、畳み込み演算回路4は、第二部分テンソルaに対応するレイヤ2M-1の畳み込み演算(図7において、レイヤ2M-1(a)で示す演算)を行う。また、量子化演算回路5は、第一部分テンソルa1に対応するレイヤ2Mの量子化演算(図7において、レイヤ2M(a1)で示す演算)を行う。このように、NN演算コア10は、第二部分テンソルaに対応するレイヤ2M-1の畳み込み演算と、第一部分テンソルa1に対応するレイヤ2Mの量子化演算と、を並列に実施できる。 The convolution operation circuit 4 performs a convolution operation of the layer 2M-1 corresponding to the first partial tensor a1 (operation shown by layer 2M-1 ( a1 ) in FIG. 7). After that, the convolution operation circuit 4 performs a convolution operation of the layer 2M-1 corresponding to the second partial tensor a2 (operation shown by layer 2M-1 ( a2 ) in FIG. 7). In addition, the quantization operation circuit 5 performs a quantization operation of the layer 2M corresponding to the first partial tensor a1 (operation shown by layer 2M ( a1 ) in FIG. 7). In this way, the NN operation core 10 can perform the convolution operation of the layer 2M-1 corresponding to the second partial tensor a2 and the quantization operation of the layer 2M corresponding to the first partial tensor a1 in parallel.

次に、畳み込み演算回路4は、第一部分テンソルa1に対応するレイヤ2M+1の畳み込み演算(図7において、レイヤ2M+1(a1)で示す演算)を行う。また、量子化演算回路5は、第二部分テンソルaに対応するレイヤ2Mの量子化演算(図7において、レイヤ2M(a)で示す演算)を行う。このように、NN演算コア10は、第一部分テンソルa1に対応するレイヤ2M+1の畳み込み演算と、第二部分テンソルaに対応するレイヤ2Mの量子化演算と、を並列に実施できる。 Next, the convolution operation circuit 4 performs a convolution operation of layer 2M+1 corresponding to the first partial tensor a1 (operation shown as layer 2M+1( a1 ) in FIG. 7). Moreover, the quantization operation circuit 5 performs a quantization operation of layer 2M corresponding to the second partial tensor a2 (operation shown as layer 2M( a2 ) in FIG. 7). In this way, the NN operation core 10 can perform the convolution operation of layer 2M+1 corresponding to the first partial tensor a1 and the quantization operation of layer 2M corresponding to the second partial tensor a2 in parallel.

第一部分テンソルa1に対応する畳み込み演算および量子化演算と、第二部分テンソルa2に対応する畳み込み演算および量子化演算とは、独立して実施することができる。そのため、NN演算コア10は、例えば、第一部分テンソルa1に対応するレイヤ2M-1の畳み込み演算と、第二部分テンソルaに対応するレイヤ2M+2の量子化演算と、を並列に実施してもよい。すなわち、NN演算コア10が並列で演算する畳み込み演算と量子化演算は、連続するレイヤの演算に限定されない。 The convolution operation and quantization operation corresponding to the first partial tensor a 1 and the convolution operation and quantization operation corresponding to the second partial tensor a 2 can be performed independently. Therefore, the NN processing core 10 may perform, for example, the convolution operation of the layer 2M-1 corresponding to the first partial tensor a 1 and the quantization operation of the layer 2M+2 corresponding to the second partial tensor a 2 in parallel. In other words, the convolution operation and quantization operation performed in parallel by the NN processing core 10 are not limited to the operations of consecutive layers.

入力データaを部分テンソルに分割することで、NN演算コア10は畳み込み演算回路4と量子化演算回路5とを並列して動作させることができる。その結果、畳み込み演算回路4と量子化演算回路5が待機する時間が削減され、NN演算コア10の演算処理効率が向上する。図7に示す動作例において分割数は2であったが、分割数が2より大きい場合も同様に、NN演算コア10は畳み込み演算回路4と量子化演算回路5とを並列して動作させることができる。 By dividing the input data a into partial tensors, the NN processing core 10 can operate the convolution processing circuit 4 and the quantization processing circuit 5 in parallel. As a result, the waiting time of the convolution processing circuit 4 and the quantization processing circuit 5 is reduced, and the processing efficiency of the NN processing core 10 is improved. In the operation example shown in FIG. 7, the number of divisions is 2, but even if the number of divisions is greater than 2, the NN processing core 10 can similarly operate the convolution processing circuit 4 and the quantization processing circuit 5 in parallel.

例えば、入力データaが「第一部分テンソルa1」、「第二部分テンソルa2」および「第三部分テンソルa」に分割される場合、NN演算コア10は、第二部分テンソルaに対応するレイヤ2M-1の畳み込み演算と、第三部分テンソルaに対応するレイヤ2Mの量子化演算と、を並列に実施してもよい。演算の順序は、第一メモリ1および第二メモリ2における入力データaの格納状況によって適宜変更される。 For example, when the input data a is divided into a "first partial tensor a 1 ", a "second partial tensor a 2 ", and a "third partial tensor a 3 ", the NN processing core 10 may perform in parallel a convolution operation of the layer 2M-1 corresponding to the second partial tensor a 2 and a quantization operation of the layer 2M corresponding to the third partial tensor a 3. The order of the operations is appropriately changed depending on the storage status of the input data a in the first memory 1 and the second memory 2.

なお、部分テンソルに対する演算方法としては、同一レイヤにおける部分テンソルの演算を畳み込み演算回路4または量子化演算回路5で行った後に次のレイヤにおける部分テンソルの演算を行う例(方法1)を示した。例えば、図7に示すように、畳み込み演算回路4において、第一部分テンソルa1および第二部分テンソルaに対応するレイヤ2M-1の畳み込み演算(図7において、レイヤ2M-1(a1)およびレイヤ2M-1(a)で示す演算)を行った後に、第一部分テンソルa1および第二部分テンソルaに対応するレイヤ2M+1の畳み込み演算(図7において、レイヤ2M+1(a1)およびレイヤ2M+1(a)で示す演算)を実施している。 As an example of a method of computing partial tensors, an example (method 1) has been shown in which a partial tensor in the same layer is computed by the convolution computation circuit 4 or the quantization computation circuit 5, and then a partial tensor in the next layer is computed. For example, as shown in FIG. 7, in the convolution computation circuit 4, a convolution computation of layer 2M-1 corresponding to the first partial tensor a1 and the second partial tensor a2 (computations shown by layer 2M-1( a1 ) and layer 2M-1( a2 ) in FIG. 7) is performed, and then a convolution computation of layer 2M+1 corresponding to the first partial tensor a1 and the second partial tensor a2 (computations shown by layer 2M+1( a1 ) and layer 2M+1( a2 ) in FIG. 7).

しかしながら、部分テンソルに対する演算方法はこれに限られない。部分テンソルに対する演算方法は、複数レイヤにおける一部の部分テンソルの演算をした後に残部の部分テンソルの演算を実施する方法でもよい(方法2)。例えば、畳み込み演算回路4において、第一部分テンソルa1に対応するレイヤ2M-1および第一部分テンソルa1に対応するレイヤ2M+1の畳み込み演算を行った後に、第二部分テンソルaに対応するレイヤ2M-1および第二部分テンソルaに対応するレイヤ2M+1の畳み込み演算を実施してもよい。 However, the method of operation on the partial tensors is not limited to this. The method of operation on the partial tensors may be a method of performing an operation on some of the partial tensors in multiple layers and then performing an operation on the remaining partial tensors (method 2). For example, in the convolution operation circuit 4, after performing a convolution operation on the layer 2M-1 corresponding to the first partial tensor a1 and the layer 2M+1 corresponding to the first partial tensor a1 , a convolution operation on the layer 2M-1 corresponding to the second partial tensor a2 and the layer 2M+1 corresponding to the second partial tensor a2 may be performed.

また、部分テンソルに対する演算方法は、方法1と方法2とを組み合わせて部分テンソルを演算する方法でもよい。ただし、方法2を用いる場合は、部分テンソルの演算順序に関する依存関係に従って演算を実施する必要がある。 The method of computing partial tensors may also be a combination of methods 1 and 2. However, when using method 2, the computation must be performed according to the dependencies regarding the computation order of the partial tensors.

[NN演算マルチコア10M]
図8は、NN演算マルチコア10Mを示す図である。
図8に例示するNN演算マルチコア10Mは、デイジーチェーン接続された二つのNN演算コア10を備える。二つのNN演算コア10を区別する場合、二つのNN演算コア10を、「第一NN演算コア10A」と、「第二NN演算コア10B」という。なお、図8において、第一メモリ1は「A」、畳み込み演算回路4は「C」、第二メモリ2は「F」、量子化演算回路5は「Q」として略記されている。
[NN calculation multi-core 10M]
FIG. 8 is a diagram showing the NN computing multi-core 10M.
The NN computing multi-core 10M illustrated in Fig. 8 includes two daisy-chained NN computing cores 10. When distinguishing between the two NN computing cores 10, the two NN computing cores 10 are referred to as a "first NN computing core 10A" and a "second NN computing core 10B." In Fig. 8, the first memory 1 is abbreviated as "A," the convolution computing circuit 4 as "C," the second memory 2 as "F," and the quantization computing circuit 5 as "Q."

具体的には、第一NN演算コア10Aの量子化演算回路5と、第二NN演算コア10Bの第一メモリ1とがデイジーチェーン接続(C2)されている。第一NN演算コア10Aの量子化演算回路5は、ループ接続(C1)された第一NN演算コア10Aの第一メモリ1または/およびデイジーチェーン接続(C2)された第二NN演算コア10Bの第一メモリ1に量子化演算出力データを書き込むことができる。 Specifically, the quantization calculation circuit 5 of the first NN calculation core 10A and the first memory 1 of the second NN calculation core 10B are daisy-chain connected (C2). The quantization calculation circuit 5 of the first NN calculation core 10A can write the quantization calculation output data to the first memory 1 of the first NN calculation core 10A, which is loop-connected (C1), and/or the first memory 1 of the second NN calculation core 10B, which is daisy-chain connected (C2).

具体的には、第二NN演算コア10Bの量子化演算回路5と、第一NN演算コア10Aの第一メモリ1とがデイジーチェーン接続(C2)されている。第二NN演算コア10Bの量子化演算回路5は、ループ接続(C1)された第二NN演算コア10Bの第一メモリ1または/およびデイジーチェーン接続(C2)された第一NN演算コア10Aの第一メモリ1に量子化演算出力データを書き込むことができる。 Specifically, the quantization calculation circuit 5 of the second NN calculation core 10B and the first memory 1 of the first NN calculation core 10A are daisy-chain connected (C2). The quantization calculation circuit 5 of the second NN calculation core 10B can write the quantization calculation output data to the first memory 1 of the second NN calculation core 10B, which is loop-connected (C1), and/or the first memory 1 of the first NN calculation core 10A, which is daisy-chain connected (C2).

NN演算マルチコア10Mが三つ以上のNN演算コア10を備える場合も同様に、複数のNN演算コア10はデイジーチェーン接続される。最終段のNN演算コア10以外のNN演算コア10の量子化演算回路5は、後段のNN演算コア10Bの第一メモリ1とデイジーチェーン接続(C2)される。最終段のNN演算コア10の量子化演算回路5は、最初段のNN演算コア10の第一メモリ1とデイジーチェーン接続(C2)されている。複数のNN演算コア10はデイジーチェーンループ(数珠繋ぎ)状に形成されていることを特徴とする。 Similarly, when the NN calculation multi-core 10M has three or more NN calculation cores 10, the multiple NN calculation cores 10 are connected in a daisy chain. The quantization calculation circuit 5 of the NN calculation cores 10 other than the final stage NN calculation core 10 is daisy chain connected (C2) to the first memory 1 of the subsequent stage NN calculation core 10B. The quantization calculation circuit 5 of the final stage NN calculation core 10 is daisy chain connected (C2) to the first memory 1 of the first stage NN calculation core 10. The multiple NN calculation cores 10 are characterized by being formed in a daisy chain loop (linked together).

一つのNN演算コア10において、第一メモリ(A)1と畳み込み演算回路(C)4と第二メモリ(F)2と量子化演算回路(Q)5とは、ループ状に接続されている。一方、NN演算マルチコア10Mにおいては、第一メモリ(A)1と畳み込み演算回路(C)4と第二メモリ(F)2と量子化演算回路(Q)5とは、第一メモリ(A)1と畳み込み演算回路(C)4と第二メモリ(F)2と量子化演算回路(Q)5とが同じ順番で繰り返し配列するように、デイジーチェーンループ(数珠繋ぎ)状に接続されている。 In one NN calculation core 10, the first memory (A) 1, the convolution calculation circuit (C) 4, the second memory (F) 2, and the quantization calculation circuit (Q) 5 are connected in a loop. On the other hand, in the NN calculation multi-core 10M, the first memory (A) 1, the convolution calculation circuit (C) 4, the second memory (F) 2, and the quantization calculation circuit (Q) 5 are connected in a daisy chain loop (linked together) so that the first memory (A) 1, the convolution calculation circuit (C) 4, the second memory (F) 2, and the quantization calculation circuit (Q) 5 are repeatedly arranged in the same order.

NN演算マルチコア10Mを構成する複数のNN演算コア10は、同一のハードウェア構成でなくてもよい。例えば、第一NN演算コア10Aの第一メモリ1の容量・構成は、第二NN演算コア10Bの第一メモリ1の容量・構成と異なっていてもよい。例えば、第一NN演算コア10Aの量子化演算回路5の構成は、第二NN演算コア10Bの量子化演算回路5の構成と異なっていてもよい。 The multiple NN calculation cores 10 constituting the NN calculation multi-core 10M do not need to have the same hardware configuration. For example, the capacity and configuration of the first memory 1 of the first NN calculation core 10A may be different from the capacity and configuration of the first memory 1 of the second NN calculation core 10B. For example, the configuration of the quantization calculation circuit 5 of the first NN calculation core 10A may be different from the configuration of the quantization calculation circuit 5 of the second NN calculation core 10B.

次に、NN回路100の各構成に関して詳しく説明する。 Next, we will explain each component of the NN circuit 100 in detail.

[DMAC3]
図9は、DMAC3の内部ブロック図である。
DMAC3は、データ転送回路31と、ステートコントローラ32と、プリロード命令ジュネレータ35と、を有する。DMAC3は、データ転送回路31に対する専用のステートコントローラ32を有しており、命令コマンドが入力されると、外部のコントローラを必要とせずにDMAデータ転送を実施できる。
[DMAC3]
FIG. 9 is an internal block diagram of the DMAC3.
The DMAC 3 has a data transfer circuit 31, a state controller 32, and a preload command generator 35. The DMAC 3 has a state controller 32 dedicated to the data transfer circuit 31, and when a command is input, the DMAC 3 can perform DMA data transfer without requiring an external controller.

データ転送回路31は、外部バスEBに接続されており、DRAMなどの外部メモリ120とNN演算コア10との間でデータを転送する。データ転送回路31のDMAチャンネル数は限定されない。例えば、第一NN演算コア10Aと第二NN演算コア10Bのそれぞれに専用のDMAチャンネルを有していてもよい。 The data transfer circuit 31 is connected to the external bus EB, and transfers data between an external memory 120 such as a DRAM and the NN calculation core 10. The number of DMA channels of the data transfer circuit 31 is not limited. For example, the first NN calculation core 10A and the second NN calculation core 10B may each have a dedicated DMA channel.

ステートコントローラ32は、データ転送回路31のステートを制御する。また、ステートコントローラ32は、内部バスIBを介してコントローラ6と接続されている。ステートコントローラ32は、命令キュー33と制御回路34とを有する。 The state controller 32 controls the state of the data transfer circuit 31. The state controller 32 is also connected to the controller 6 via the internal bus IB. The state controller 32 has an instruction queue 33 and a control circuit 34.

命令キュー33は、DMAC3用の命令コマンドC3が格納されるキューであり、例えばFIFOメモリで構成される。命令キュー33には、命令供給ユニット7経由または内部バスIB経由で1つ以上の命令コマンドC3が書き込まれる。 The instruction queue 33 is a queue in which instruction commands C3 for DMAC3 are stored, and is configured, for example, as a FIFO memory. One or more instruction commands C3 are written to the instruction queue 33 via the instruction supply unit 7 or the internal bus IB.

制御回路34は、命令コマンドC3をデコードし、命令コマンドC3に基づいて順次データ転送回路31を制御するステートマシンである。制御回路34は、論理回路により実装されていてもよいし、ソフトウェアによって制御されるCPUによって実装されていてもよい。 The control circuit 34 is a state machine that decodes the instruction command C3 and sequentially controls the data transfer circuit 31 based on the instruction command C3. The control circuit 34 may be implemented by a logic circuit or a CPU controlled by software.

図10は、制御回路34のステート遷移図である。
制御回路34は、命令キュー33に命令コマンドC3が入力されると(Not empty)、アイドルステートST1からデコードステートST2に遷移する。
FIG. 10 is a state transition diagram of the control circuit 34.
When the instruction command C3 is input to the instruction queue 33 (not empty), the control circuit 34 transitions from the idle state ST1 to the decode state ST2.

制御回路34は、デコードステートST2において、命令キュー33から出力される命令コマンドC3をデコードする。また、制御回路34は、コントローラ6のレジスタ61に格納されたセマフォSを読み出し、命令コマンドC3において指示されたデータ転送回路31の動作を実行可能であるかを判定する。実行不能である場合(Not ready)、制御回路34は実行可能となるまで待つ(Wait)。実行可能である場合(ready)、制御回路34はデコードステートST2から実行ステートST3に遷移する。 In the decode state ST2, the control circuit 34 decodes the instruction command C3 output from the instruction queue 33. The control circuit 34 also reads the semaphore S stored in the register 61 of the controller 6 and determines whether the operation of the data transfer circuit 31 instructed in the instruction command C3 can be executed. If it is not executable (Not ready), the control circuit 34 waits until it becomes executable (Wait). If it is executable (Ready), the control circuit 34 transitions from the decode state ST2 to the execution state ST3.

制御回路34は、実行ステートST3において、データ転送回路31を制御して、データ転送回路31に命令コマンドC3において指示された動作を実施させる。制御回路34は、データ転送回路31の動作が終わると、命令キュー33から実行を終えた命令コマンドC3を取り除くとともに、コントローラ6のレジスタ61に格納されたセマフォSを更新する。制御回路34は、命令キュー33に命令がある場合(Not empty)、実行ステートST3からデコードステートST2に遷移する。制御回路34は、命令キュー33に命令がない場合(empty)、実行ステートST3からアイドルステートST1に遷移する。 In the execution state ST3, the control circuit 34 controls the data transfer circuit 31 to cause the data transfer circuit 31 to perform the operation instructed in the instruction command C3. When the operation of the data transfer circuit 31 is completed, the control circuit 34 removes the executed instruction command C3 from the instruction queue 33 and updates the semaphore S stored in the register 61 of the controller 6. If there is an instruction in the instruction queue 33 (Not empty), the control circuit 34 transitions from the execution state ST3 to the decode state ST2. If there is no instruction in the instruction queue 33 (Empty), the control circuit 34 transitions from the execution state ST3 to the idle state ST1.

プリロード命令ジュネレータ35は、コントローラ6のレジスタ61に含まれる「プリロードモードレジスタ」に設定されたデータ転送に関する設定値(転送元アドレス、転送先アドレス、データ転送量)に基づいて、設定されたデータ転送をデータ転送回路31に実行させる命令コマンドC3を生成して命令キュー33に入力する。なお、プリロード命令ジュネレータ35は、DMAC3ではなくコントローラ6に配置されていてもよい。 The preload command generator 35 generates a command C3 for causing the data transfer circuit 31 to execute the set data transfer based on the setting values (source address, destination address, data transfer amount) set in the "preload mode register" included in the register 61 of the controller 6, and inputs the command C3 to the command queue 33. Note that the preload command generator 35 may be located in the controller 6 instead of the DMAC 3.

[DMAC3:プリロードモードにおける動作]
NN回路100の動作モードがプリロードモードであるとき、データ転送回路31は、レジスタ61に含まれるプリロードモードの設定に関するパラメータレジスタ(プリロードモードレジスタ)に基づいて、外部メモリ120から命令供給ユニット7に対するDMA転送(以降、「プリロード」ともいう)を実施する。ステートコントローラ32は、プリロード命令ジュネレータ35が供給した命令コマンドC3に基づいて動作する。
[DMAC3: Operation in Preload Mode]
When the operation mode of the NN circuit 100 is the preload mode, the data transfer circuit 31 performs a DMA transfer (hereinafter also referred to as "preload") from the external memory 120 to the instruction supply unit 7 based on a parameter register (preload mode register) related to the setting of the preload mode included in the register 61. The state controller 32 operates based on the instruction command C3 supplied by the preload instruction generator 35.

[DMAC3:ノーマルモードにおける動作]
NN回路100の動作モードがノーマルモードであるとき、命令供給ユニット7は、命令キュー33に命令コマンドC3を供給する。ステートコントローラ32は、命令供給ユニット7が供給した命令コマンドC3に基づいて動作する。
[DMAC3: Operation in normal mode]
When the operation mode of the NN circuit 100 is the normal mode, the instruction supply unit 7 supplies an instruction command C3 to the instruction queue 33. The state controller 32 operates based on the instruction command C3 supplied by the instruction supply unit 7.

[畳み込み演算回路4]
図11は、畳み込み演算回路4の内部ブロック図である。
畳み込み演算回路4は、重みメモリ41と、乗算器42と、アキュムレータ回路43と、ステートコントローラ44と、を有する。畳み込み演算回路4は、乗算器42およびアキュムレータ回路43に対する専用のステートコントローラ44を有しており、命令コマンドが入力されると、外部のコントローラを必要とせずに畳み込み演算を実施できる。
[Convolution operation circuit 4]
FIG. 11 is an internal block diagram of the convolution circuit 4.
The convolution operation circuit 4 has a weight memory 41, a multiplier 42, an accumulator circuit 43, and a state controller 44. The convolution operation circuit 4 has a state controller 44 dedicated to the multiplier 42 and the accumulator circuit 43, and when an instruction command is input, the convolution operation can be performed without requiring an external controller.

重みメモリ41は、畳み込み演算に用いる重みwが格納されるメモリであり、例えばSRAM(Static RAM)などで構成された揮発性のメモリ等の書き換え可能なメモリである。DMAC3は、DMA転送により、畳み込み演算に必要な重みwを重みメモリ41に書き込む。 The weight memory 41 is a memory in which the weight w used in the convolution calculation is stored, and is a rewritable memory such as a volatile memory composed of, for example, an SRAM (Static RAM). The DMAC3 writes the weight w required for the convolution calculation to the weight memory 41 by DMA transfer.

図12は、乗算器42の内部ブロック図である。
乗算器42は、入力ベクトルAと重みマトリクスWとを乗算する。入力ベクトルAは、上述したように、分割入力データa(x+i、y+j、co)がi、jごとに展開されたBc個の要素を持つベクトルデータである。また、重みマトリクスWは、分割重みw(i,j,co、do)がi、jごとに展開されたBc×Bd個の要素を持つマトリクスデータである。乗算器42は、Bc×Bd個の積和演算ユニット47を有し、入力ベクトルAと重みマトリクスWとを乗算を並列して実施できる。
FIG. 12 is an internal block diagram of the multiplier 42.
The multiplier 42 multiplies the input vector A by the weight matrix W. As described above, the input vector A is vector data having Bc elements in which the divided input data a(x+i, y+j, co) is expanded for each i and j. The weight matrix W is matrix data having Bc×Bd elements in which the divided weights w(i, j, co, do) are expanded for each i and j. The multiplier 42 has Bc×Bd product-sum operation units 47 and can multiply the input vector A by the weight matrix W in parallel.

乗算器42は、乗算に必要な入力ベクトルAと重みマトリクスWを、第一メモリ1および重みメモリ41から読み出して乗算を実施する。乗算器42は、Bd個の積和演算結果O(di)を出力する。 The multiplier 42 reads the input vector A and weight matrix W required for the multiplication from the first memory 1 and the weight memory 41, and performs the multiplication. The multiplier 42 outputs Bd product-sum operation results O(di).

図13は、積和演算ユニット47の内部ブロック図である。
積和演算ユニット47は、入力ベクトルAの要素A(ci)と、重みマトリクスWの要素W(ci,di)との乗算を実施する。また、積和演算ユニット47は、乗算結果と他の積和演算ユニット47の乗算結果S(ci,di)と加算する。積和演算ユニット47は、加算結果S(ci+1,di)を出力する。要素A(ci)は、2ビットの符号なし整数(0,1,2,3)である。要素W(ci,di)は、1ビットの符号付整数(0,1)であり、値「0」は+1を表し、値「1」は-1を表す。
FIG. 13 is an internal block diagram of the product-sum calculation unit 47. As shown in FIG.
The multiply-add unit 47 multiplies an element A(ci) of an input vector A by an element W(ci,di) of a weight matrix W. The multiply-add unit 47 also adds the multiplication result to a multiplication result S(ci,di) of another multiply-add unit 47. The multiply-add unit 47 outputs an addition result S(ci+1,di). The element A(ci) is a 2-bit unsigned integer (0,1,2,3). The element W(ci,di) is a 1-bit signed integer (0,1), where a value "0" represents +1 and a value "1" represents -1.

積和演算ユニット47は、反転器(インバータ)47aと、セレクタ47bと、加算器47cと、を有する。積和演算ユニット47は、乗算器を用いず、反転器47aおよびセレクタ47bのみを用いて乗算を行う。セレクタ47bは、要素W(ci,di)が「0」の場合、要素A(ci)の入力を選択する。セレクタ47bは、要素W(ci,di)が「1」の場合、要素A(ci)を反転器により反転させた補数を選択する。要素W(ci,di)は、加算器47cのCarry-inにも入力される。加算器47cは、要素W(ci,di)が「0」のとき、S(ci,di)に要素A(ci)を加算した値を出力する。加算器47cは、W(ci,di)が「1」のとき、S(ci,di)から要素A(ci)を減算した値を出力する。 The multiply-and-accumulate unit 47 has an inverter 47a, a selector 47b, and an adder 47c. The multiply-and-accumulate unit 47 performs multiplication using only the inverter 47a and the selector 47b, without using a multiplier. When the element W(ci, di) is "0", the selector 47b selects the input of the element A(ci). When the element W(ci, di) is "1", the selector 47b selects the complement of the element A(ci) inverted by the inverter. The element W(ci, di) is also input to the carry-in of the adder 47c. When the element W(ci, di) is "0", the adder 47c outputs the value obtained by adding the element A(ci) to S(ci, di). When W(ci, di) is "1", adder 47c outputs the value obtained by subtracting element A(ci) from S(ci, di).

図14は、アキュムレータ回路43の内部ブロック図である。
アキュムレータ回路43は、乗算器42の積和演算結果O(di)を第二メモリ2にアキュムレートする。アキュムレータ回路43は、Bd個のアキュムレータユニット48を有し、Bd個の積和演算結果O(di)を並列して第二メモリ2にアキュムレートできる。
FIG. 14 is an internal block diagram of the accumulator circuit 43.
The accumulator circuit 43 accumulates the product-sum operation results O(di) of the multiplier 42 in the second memory 2. The accumulator circuit 43 has Bd accumulator units 48 and can accumulate the Bd product-sum operation results O(di) in parallel in the second memory 2.

図15は、アキュムレータユニット48の内部ブロック図である。
アキュムレータユニット48は、加算器48aと、マスク部48bとを有している。加算器48aは、積和演算結果Oの要素O(di)と、第二メモリ2に格納された式1に示す畳み込み演算の途中経過である部分和と、を加算する。加算結果は、要素あたり16ビットである。加算結果は、要素あたり16ビットに限定されず、例えば要素あたり15ビットや17ビットであってもよい。
FIG. 15 is an internal block diagram of the accumulator unit 48.
The accumulator unit 48 has an adder 48a and a mask unit 48b. The adder 48a adds an element O(di) of the sum-of-products operation result O and a partial sum which is an intermediate result of the convolution operation shown in Equation 1 stored in the second memory 2. The sum result is 16 bits per element. The sum result is not limited to 16 bits per element, and may be, for example, 15 bits or 17 bits per element.

加算器48aは、加算結果を第二メモリ2の同一アドレスに書き込む。マスク部48bは、初期化信号clearがアサートされた場合に、第二メモリ2からの出力をマスクし、要素O(di)に対する加算対象をゼロにする。初期化信号clearは、第二メモリ2に途中経過の部分和が格納されていない場合にアサートされる。 The adder 48a writes the result of the addition to the same address in the second memory 2. When the initialization signal clear is asserted, the masking unit 48b masks the output from the second memory 2 and sets the addition target for element O(di) to zero. The initialization signal clear is asserted when no intermediate partial sums are stored in the second memory 2.

乗算器42およびアキュムレータ回路43による畳み込み演算が完了すると、第二メモリ2に、出力データf(x,y,do)が格納される。 When the convolution operation by the multiplier 42 and the accumulator circuit 43 is completed, the output data f(x, y, do) is stored in the second memory 2.

ステートコントローラ44は、乗算器42およびアキュムレータ回路43のステートを制御する。また、ステートコントローラ44は、内部バスIBを介してコントローラ6と接続されている。ステートコントローラ44は、命令キュー45と制御回路46とを有する。 The state controller 44 controls the states of the multiplier 42 and the accumulator circuit 43. The state controller 44 is also connected to the controller 6 via the internal bus IB. The state controller 44 has an instruction queue 45 and a control circuit 46.

命令キュー45は、畳み込み演算回路4用の命令コマンドC4が格納されるキューであり、例えばFIFOメモリで構成される。命令キュー45には、命令供給ユニット7経由または内部バスIB経由で命令コマンドC4が書き込まれる。 The instruction queue 45 is a queue in which the instruction command C4 for the convolution operation circuit 4 is stored, and is configured, for example, as a FIFO memory. The instruction command C4 is written to the instruction queue 45 via the instruction supply unit 7 or the internal bus IB.

制御回路46は、命令コマンドC4をデコードし、命令コマンドC4に基づいて乗算器42およびアキュムレータ回路43を制御するステートマシンである。制御回路46は、DMAC3のステートコントローラ32の制御回路34と同様の構成である。 The control circuit 46 is a state machine that decodes the instruction command C4 and controls the multiplier 42 and the accumulator circuit 43 based on the instruction command C4. The control circuit 46 has a configuration similar to that of the control circuit 34 of the state controller 32 of the DMAC3.

[畳み込み演算回路4:プリロードモードにおける動作]
NN回路100の動作モードがプリロードモードであるとき、ステートコントローラ44は動作しない。プリロードするデータに重みwが含まれる場合、DMAC3は外部メモリ120から読み出した重みwを重みメモリ41に書き込む。
[Convolution Operation Circuit 4: Operation in Preload Mode]
When the operation mode of the NN circuit 100 is the preload mode, the state controller 44 does not operate. When the weight w is included in the data to be preloaded, the DMAC 3 writes the weight w read from the external memory 120 into the weight memory 41.

[畳み込み演算回路4:ノーマルモードにおける動作]
NN回路100の動作モードがノーマルモードであるとき、命令供給ユニット7は、命令キュー45に命令コマンドC4を供給する。ステートコントローラ44は、命令キュー45に格納された命令コマンドC4に基づいて、乗算器42およびアキュムレータ回路43を制御する。
[Convolution Operation Circuit 4: Operation in Normal Mode]
When the operation mode of the NN circuit 100 is the normal mode, the instruction supply unit 7 supplies an instruction command C4 to the instruction queue 45. The state controller 44 controls the multiplier 42 and the accumulator circuit 43 based on the instruction command C4 stored in the instruction queue 45.

[量子化演算回路5]
図16は、量子化演算回路5の内部ブロック図である。
量子化演算回路5は、量子化パラメータメモリ51と、ベクトル演算回路52と、量子化回路53と、ステートコントローラ54と、を有する。量子化演算回路5は、ベクトル演算回路52および量子化回路53に対する専用のステートコントローラ54を有しており、命令コマンドが入力されると、外部のコントローラを必要とせずに量子化演算を実施できる。
[Quantization operation circuit 5]
FIG. 16 is an internal block diagram of the quantization calculation circuit 5.
The quantization calculation circuit 5 has a quantization parameter memory 51, a vector calculation circuit 52, a quantization circuit 53, and a state controller 54. Therefore, when an instruction command is input, the quantization operation can be performed without the need for an external controller.

量子化パラメータメモリ51は、量子化演算に用いる量子化パラメータqが格納されるメモリであり、例えばSRAM(Static RAM)などで構成された揮発性のメモリ等の書き換え可能なメモリである。DMAC3は、DMA転送により、量子化演算に必要な量子化パラメータqを量子化パラメータメモリ51に書き込む。 The quantization parameter memory 51 is a memory in which the quantization parameter q used in the quantization operation is stored, and is a rewritable memory such as a volatile memory composed of, for example, an SRAM (Static RAM). The DMAC3 writes the quantization parameter q required for the quantization operation to the quantization parameter memory 51 by DMA transfer.

図17は、ベクトル演算回路52と量子化回路53の内部ブロック図である。
ベクトル演算回路52は、第二メモリ2に格納された出力データf(x,y,do)に対して演算を行う。ベクトル演算回路52は、Bd個の演算ユニット57を有し、出力データf(x,y,do)に対して並列にSIMD演算を行う。
FIG. 17 is an internal block diagram of the vector calculation circuit 52 and the quantization circuit 53.
The vector operation circuit 52 performs an operation on the output data f(x, y, do) stored in the second memory 2. The vector operation circuit 52 has Bd operation units 57, and performs SIMD operations in parallel on the output data f(x, y, do).

図18は、演算ユニット57のブロック図である。
演算ユニット57は、例えば、ALU57aと、第一セレクタ57bと、第二セレクタ57cと、レジスタ57dと、シフタ57eと、を有する。演算ユニット57は、公知の汎用SIMD演算回路が有する他の演算器等をさらに有してもよい。
FIG. 18 is a block diagram of the arithmetic unit 57.
The arithmetic unit 57 includes, for example, an ALU 57 a, a first selector 57 b, a second selector 57 c, a register 57 d, and a shifter 57 e. The arithmetic unit 57 may further include other arithmetic units included in a known general-purpose SIMD arithmetic circuit.

ベクトル演算回路52は、演算ユニット57が有する演算器等を組み合わせることで、出力データf(x,y,do)に対して、量子化演算層220におけるプーリング層221や、Batch Normalization層222や、活性化関数層223の演算のうち少なくとも一つの演算を行う。 The vector calculation circuit 52 performs at least one of the calculations of the pooling layer 221, the batch normalization layer 222, and the activation function layer 223 in the quantization calculation layer 220 on the output data f(x, y, do) by combining the calculation units and the like contained in the calculation unit 57.

演算ユニット57は、レジスタ57dに格納されたデータと第二メモリ2から読み出した出力データf(x,y,do)の要素f(di)とをALU57aにより加算できる。演算ユニット57は、ALU57aによる加算結果をレジスタ57dに格納できる。演算ユニット57は、第一セレクタ57bの選択によりレジスタ57dに格納されたデータに代えて「0」をALU57aに入力することで加算結果を初期化できる。例えばプーリング領域が2×2である場合、シフタ57eはALU57aの出力を2bit右シフトすることで加算結果の平均値を出力できる。ベクトル演算回路52は、Bd個の演算ユニット57による上記の演算等を繰り返すことで、式2に示す平均プーリングの演算を実施できる。 The arithmetic unit 57 can add the data stored in the register 57d and the element f(di) of the output data f(x, y, do) read from the second memory 2 by the ALU 57a. The arithmetic unit 57 can store the addition result by the ALU 57a in the register 57d. The arithmetic unit 57 can initialize the addition result by inputting "0" to the ALU 57a instead of the data stored in the register 57d by the selection of the first selector 57b. For example, if the pooling area is 2x2, the shifter 57e can output the average value of the addition results by shifting the output of the ALU 57a 2 bits to the right. The vector calculation circuit 52 can perform the average pooling calculation shown in Equation 2 by repeating the above calculations by the Bd arithmetic units 57.

演算ユニット57は、レジスタ57dに格納されたデータと第二メモリ2から読み出した出力データf(x,y,do)の要素f(di)とをALU57aにより比較できる。
演算ユニット57は、ALU57aによる比較結果に応じて第二セレクタ57cを制御して、レジスタ57dに格納されたデータと要素f(di)の大きい方を選択できる。演算ユニット57は、第一セレクタ57bの選択により要素f(di)の取りうる値の最小値をALU57aに入力することで比較対象を最小値に初期化できる。本実施形態において要素f(di)は16bit符号付き整数であるので、要素f(di)の取りうる値の最小値は「0x8000」である。ベクトル演算回路52は、Bd個の演算ユニット57による上記の演算等を繰り返すことで、式3のMAXプーリングの演算を実施できる。なお、MAXプーリングの演算ではシフタ57eは第二セレクタ57cの出力をシフトしない。
The arithmetic unit 57 can compare the data stored in the register 57d with the element f(di) of the output data f(x, y, do) read from the second memory 2 by the ALU 57a.
The arithmetic unit 57 controls the second selector 57c according to the comparison result by the ALU 57a, and can select the larger of the data stored in the register 57d and the element f(di). The arithmetic unit 57 can initialize the comparison target to the minimum value by inputting the minimum value of the possible value of the element f(di) to the ALU 57a by the selection of the first selector 57b. In this embodiment, the element f(di) is a 16-bit signed integer, so the minimum value of the possible value of the element f(di) is "0x8000". The vector calculation circuit 52 can perform the MAX pooling calculation of Equation 3 by repeating the above calculations by the Bd arithmetic units 57. Note that in the MAX pooling calculation, the shifter 57e does not shift the output of the second selector 57c.

演算ユニット57は、レジスタ57dに格納されたデータと第二メモリ2から読み出した出力データf(x,y,do)の要素f(di)とをALU57aにより減算できる。シフタ57eはALU57aの出力を左シフト(すなわち乗算)もしくは右シフト(すなわち除算)できる。ベクトル演算回路52は、Bd個の演算ユニット57による上記の演算等を繰り返すことで、式4のBatch Normalizationの演算を実施できる。 The arithmetic unit 57 can subtract data stored in the register 57d and an element f(di) of the output data f(x, y, do) read from the second memory 2 using the ALU 57a. The shifter 57e can shift the output of the ALU 57a to the left (i.e., multiplication) or to the right (i.e., division). The vector arithmetic circuit 52 can perform the Batch Normalization calculation of Equation 4 by repeating the above calculations by the Bd arithmetic units 57.

演算ユニット57は、第二メモリ2から読み出した出力データf(x,y,do)の要素f(di)と第一セレクタ57bにより選択された「0」とをALU57aにより比較できる。演算ユニット57は、ALU57aによる比較結果に応じて要素f(di)と予めレジスタ57dに格納された定数値「0」のいずれかを選択して出力できる。ベクトル演算回路52は、Bd個の演算ユニット57による上記の演算等を繰り返すことで、式5のReLU演算を実施できる。 The arithmetic unit 57 can compare the element f(di) of the output data f(x, y, do) read from the second memory 2 with the "0" selected by the first selector 57b using the ALU 57a. The arithmetic unit 57 can select and output either the element f(di) or the constant value "0" previously stored in the register 57d, depending on the comparison result by the ALU 57a. The vector calculation circuit 52 can perform the ReLU calculation of Equation 5 by repeating the above calculations by the Bd arithmetic units 57.

ベクトル演算回路52は、平均プーリング、MAXプーリング、Batch Normalization、活性化関数の演算およびこれらの演算の組み合わせを実施できる。ベクトル演算回路52は、汎用SIMD演算を実施できるため、量子化演算層220における演算に必要な他の演算を実施してもよい。また、ベクトル演算回路52は、量子化演算層220における演算以外の演算を実施してもよい。 The vector operation circuit 52 can perform average pooling, MAX pooling, batch normalization, activation function operations, and combinations of these operations. Since the vector operation circuit 52 can perform general-purpose SIMD operations, it may also perform other operations necessary for the operations in the quantization operation layer 220. In addition, the vector operation circuit 52 may also perform operations other than those in the quantization operation layer 220.

なお、量子化演算回路5は、ベクトル演算回路52を有してなくてもよい。量子化演算回路5がベクトル演算回路52を有していない場合、出力データf(x,y,do)は量子化回路53に入力される。 The quantization calculation circuit 5 does not have to have a vector calculation circuit 52. If the quantization calculation circuit 5 does not have a vector calculation circuit 52, the output data f(x, y, do) is input to the quantization circuit 53.

量子化回路53は、ベクトル演算回路52の出力データに対して、量子化を行う。量子化回路53は、図20に示すように、Bd個の量子化ユニット58を有し、ベクトル演算回路52の出力データに対して並列に演算を行う。 The quantization circuit 53 performs quantization on the output data of the vector calculation circuit 52. As shown in FIG. 20, the quantization circuit 53 has Bd quantization units 58, and performs calculations in parallel on the output data of the vector calculation circuit 52.

図19は、量子化ユニット58の内部ブロック図である。
量子化ユニット58は、ベクトル演算回路52の出力データの要素in(di)に対して量子化を行う。量子化ユニット58は、比較器58aと、エンコーダ58bと、を有する。量子化ユニット58はベクトル演算回路52の出力データ(16ビット/要素)に対して、量子化演算層220における量子化層224の演算(式6)を行う。量子化ユニット58は、量子化パラメータメモリ51から必要な量子化パラメータq(th0,th1,th2)を読み出し、比較器58aにより入力in(di)と量子化パラメータqとの比較を行う。量子化ユニット58は、比較器58aによる比較結果をエンコーダ58bにより2ビット/要素に量子化する。式4におけるα(c)とβ(c)は、変数cごとに異なるパラメータであるため、α(c)とβ(c)を反映する量子化パラメータq(th0,th1,th2)はin(di)ごとに異なるパラメータである。
FIG. 19 is an internal block diagram of the quantization unit 58.
The quantization unit 58 quantizes the element in(di) of the output data of the vector operation circuit 52. The quantization unit 58 has a comparator 58a and an encoder 58b. The quantization unit 58 performs the operation (Equation 6) of the quantization layer 224 in the quantization operation layer 220 on the output data (16 bits/element) of the vector operation circuit 52. The quantization unit 58 reads out the necessary quantization parameters q(th0, th1, th2) from the quantization parameter memory 51, and compares the input in(di) with the quantization parameter q by the comparator 58a. The quantization unit 58 quantizes the comparison result by the comparator 58a to 2 bits/element by the encoder 58b. Since α(c) and β(c) in Equation 4 are parameters that differ for each variable c, the quantization parameters q(th0, th1, th2) that reflect α(c) and β(c) are parameters that differ for each in(di).

量子化ユニット58は、入力in(di)を3つの閾値th0,th1,th2と比較することにより、入力in(di)を4領域(例えば、in≦th0,th0<in≦th1,th1<in≦th2,th2<in)に分類し、分類結果を2ビットにエンコードして出力する。量子化ユニット58は、量子化パラメータq(th0,th1,th2)の設定により、量子化と併せてBatch Normalizationや活性化関数の演算を行うこともできる。 The quantization unit 58 classifies the input in (di) into four regions (e.g., in≦th0, th0<in≦th1, th1<in≦th2, th2<in) by comparing the input in (di) with three thresholds th0, th1, and th2, and outputs the classification result by encoding it into two bits. The quantization unit 58 can also perform batch normalization and activation function calculations in addition to quantization by setting the quantization parameter q (th0, th1, th2).

量子化ユニット58は、閾値th0を式4のβ(c)、閾値の差(th1―th0)および(th2―th1)を式4のα(c)として設定して量子化を行うことで、式4に示すBatch Normalizationの演算を量子化と併せて実施できる。(th1―th0)および(th2―th1)を大きくすることでα(c)を小さくできる。(th1―th0)および(th2―th1)を小さくすることで、α(c)を大きくできる。 The quantization unit 58 sets the threshold th0 as β(c) in Equation 4, and the threshold differences (th1-th0) and (th2-th1) as α(c) in Equation 4, and performs quantization, thereby enabling the batch normalization calculation shown in Equation 4 to be performed in conjunction with quantization. By increasing (th1-th0) and (th2-th1), α(c) can be reduced. By decreasing (th1-th0) and (th2-th1), α(c) can be increased.

量子化ユニット58は、入力in(di)の量子化と併せて活性化関数を実施できる。例えば、量子化ユニット58は、in(di)≦th0およびth2<in(di)となる領域では出力値を飽和させる。量子化ユニット58は、出力が非線形とするように量子化パラメータqを設定することで活性化関数の演算を量子化と併せて実施できる。 The quantization unit 58 can perform the activation function in conjunction with the quantization of the input in(di). For example, the quantization unit 58 saturates the output value in the region where in(di)≦th0 and th2<in(di). The quantization unit 58 can perform the calculation of the activation function in conjunction with the quantization by setting the quantization parameter q so that the output is nonlinear.

ステートコントローラ54は、ベクトル演算回路52および量子化回路53のステートを制御する。また、ステートコントローラ54は、内部バスIBを介してコントローラ6と接続されている。ステートコントローラ54は、命令キュー55と制御回路56とを有する。 The state controller 54 controls the states of the vector operation circuit 52 and the quantization circuit 53. The state controller 54 is also connected to the controller 6 via the internal bus IB. The state controller 54 has an instruction queue 55 and a control circuit 56.

命令キュー55は、量子化演算回路5用の命令コマンドC5が格納されるキューであり、例えばFIFOメモリで構成される。命令キュー55には、命令供給ユニット7経由または内部バスIB経由で命令コマンドC5が書き込まれる。 The instruction queue 55 is a queue in which the instruction command C5 for the quantization calculation circuit 5 is stored, and is configured, for example, as a FIFO memory. The instruction command C5 is written to the instruction queue 55 via the instruction supply unit 7 or the internal bus IB.

制御回路56は、命令コマンドC5をデコードし、命令コマンドC5に基づいてベクトル演算回路52および量子化回路53を制御するステートマシンである。制御回路56は、DMAC3のステートコントローラ32の制御回路34と同様の構成である。 The control circuit 56 is a state machine that decodes the instruction command C5 and controls the vector calculation circuit 52 and the quantization circuit 53 based on the instruction command C5. The control circuit 56 has a configuration similar to that of the control circuit 34 of the state controller 32 of the DMAC3.

[量子化演算回路5:プリロードモードにおける動作]
NN回路100の動作モードがプリロードモードであるとき、ステートコントローラ54は動作しない。プリロードするデータに量子パラメータqが含まれる場合、DMAC3は外部メモリ120から読み出した量子パラメータqを量子化パラメータメモリ51に書き込む。
[Quantization Calculation Circuit 5: Operation in Preload Mode]
When the operation mode of the NN circuit 100 is the preload mode, the state controller 54 does not operate. When the quantum parameter q is included in the data to be preloaded, the DMAC 3 writes the quantum parameter q read from the external memory 120 into the quantization parameter memory 51.

[量子化演算回路5:ノーマルモードにおける動作]
NN回路100の動作モードがノーマルモードであるとき、命令供給ユニット7は、命令キュー55に命令コマンドC5を供給する。ステートコントローラ54は、命令キュー55に格納された命令コマンドC5に基づいて、ベクトル演算回路52および量子化回路53を制御する。
[Quantization Calculation Circuit 5: Operation in Normal Mode]
When the operation mode of the NN circuit 100 is the normal mode, the instruction supply unit 7 supplies an instruction command C5 to the instruction queue 55. The state controller 54 controls the vector operation circuit 52 and the quantization circuit 53 based on the instruction command C5 stored in the instruction queue 55.

量子化演算回路5は、Bd個の要素を持つ量子化演算出力データを第一メモリ1に書き込む。なお、BdとBcの好適な関係を式10に示す。式10においてnは整数である。 The quantization calculation circuit 5 writes quantization calculation output data having Bd elements to the first memory 1. The preferred relationship between Bd and Bc is shown in Equation 10. In Equation 10, n is an integer.

Figure 2024118195000011
Figure 2024118195000011

[コントローラ6]
コントローラ6は、外部ホストCPU110から転送される命令コマンドを、内部バスIBを介して、DMAC3、畳み込み演算回路4および量子化演算回路5が有する命令キューに転送する。
[Controller 6]
The controller 6 transfers the instruction command transferred from the external host CPU 110 to the instruction queues of the DMAC 3, the convolution operation circuit 4, and the quantization operation circuit 5 via the internal bus IB.

コントローラ6は、外部バスEBに接続されており、外部ホストCPU110のスレーブとして動作する。コントローラ6は、パラメータレジスタや状態レジスタを含むレジスタ61を有している。パラメータレジスタは、NN回路100の動作を制御するレジスタである。状態レジスタは、セマフォSを含むNN回路100の状態を示すレジスタである。 The controller 6 is connected to the external bus EB and operates as a slave to the external host CPU 110. The controller 6 has registers 61 including a parameter register and a status register. The parameter register is a register that controls the operation of the NN circuit 100. The status register is a register that indicates the status of the NN circuit 100, including the semaphore S.

レジスタ61は、プリロードモードの設定に関するパラメータレジスタ(以降、「プリロードモードレジスタ」ともいう)を有する。プリロードモードレジスタは、プリロード起動レジスタと、プリロードの転送元である外部メモリ120の先頭アドレスと、プリロードの転送先のアドレスと、プリロードするデータ転送量と、を含む。プリロードモードレジスタは、データ転送に関する設定値(転送元アドレスと転送先アドレスとデータ転送量との組み合わせ)を複数回分保持できる。プリロードモードレジスタが設定されることで、NN回路100は動作モードをプリロードモードに変更して、プリロードモードの動作を開始する。プリロードモードの動作が完了すると、NN回路100は動作モードをノーマルモードに変更して、ノーマルモードの動作を開始する。NN回路100の動作モードは、プリモードモードの動作が完了してもノーマルモードに自動的に変更されず、レジスタ61に含まれる動作モード設定レジスタが明示的に書き換えられることによって、プリロードモードからノーマルモードに変更されてもよい。 The register 61 has a parameter register (hereinafter, also referred to as a "preload mode register") for setting the preload mode. The preload mode register includes a preload start register, the top address of the external memory 120 which is the source of the preload transfer, the address of the destination of the preload transfer, and the amount of data to be transferred to be preloaded. The preload mode register can hold multiple set values for data transfer (combinations of source address, destination address, and amount of data to be transferred). By setting the preload mode register, the NN circuit 100 changes the operation mode to the preload mode and starts the operation of the preload mode. When the operation of the preload mode is completed, the NN circuit 100 changes the operation mode to the normal mode and starts the operation of the normal mode. The operation mode of the NN circuit 100 is not automatically changed to the normal mode even when the operation of the preload mode is completed, and may be changed from the preload mode to the normal mode by explicitly rewriting the operation mode setting register included in the register 61.

レジスタ61は、命令供給ユニット7による命令供給設定に関するパラメータレジスタ(以降、「命令供給レジスタ」ともいう)を有する。 Register 61 has a parameter register (hereinafter also referred to as the "instruction supply register") related to the instruction supply settings by the instruction supply unit 7.

[命令供給ユニット7]
図20は、命令供給ユニット7のブロック図である。
命令供給ユニット(ISU : Instruction Supply Unit)7は、命令メモリ71と、命令供給回路72と、を有する。命令メモリ71は、DMAC3と畳み込み演算回路4と量子化演算回路5の命令コマンドを格納する。命令供給回路72は、命令メモリ71に格納した命令コマンドをDMAC3と畳み込み演算回路4と量子化演算回路5とに供給する。
[Instruction supply unit 7]
FIG. 20 is a block diagram of the instruction supply unit 7.
The instruction supply unit (ISU) 7 has an instruction memory 71 and an instruction supply circuit 72. The instruction memory 71 stores instruction commands for the DMAC 3, the convolution operation circuit 4, and the quantization operation circuit 5. The instruction supply circuit 72 supplies the instruction commands stored in the instruction memory 71 to the DMAC 3, the convolution operation circuit 4, and the quantization operation circuit 5.

[命令供給ユニット7:プリロードモードにおける動作]
NN回路100の動作モードがプリロードモードであるとき、命令供給回路72は動作しない。DMAC3のデータ転送回路31は、命令コマンドを命令メモリ71に書き込む。
[Instruction supply unit 7: operation in preload mode]
When the operation mode of the NN circuit 100 is the preload mode, the instruction supply circuit 72 does not operate. The data transfer circuit 31 of the DMAC 3 writes an instruction command to the instruction memory 71.

[命令供給ユニット7:ノーマルモードにおける動作]
NN回路100の動作モードがノーマルモードであるとき、命令供給回路72は、命令メモリ71に格納された命令コマンドをDMAC3と畳み込み演算回路4と量子化演算回路5とに供給する。命令供給回路72は、命令キュー33,45,55のフルフラグなどの状態フラグに基づいて、命令キュー33,45,55に対して対応する命令コマンドを随時供給する。
[Instruction supply unit 7: Operation in normal mode]
When the operation mode of the NN circuit 100 is the normal mode, the instruction supply circuit 72 supplies the instruction commands stored in the instruction memory 71 to the DMAC 3, the convolution operation circuit 4, and the quantization operation circuit 5. The instruction supply circuit 72 supplies the corresponding instruction commands to the instruction queues 33, 45, and 55 as needed, based on the status flags such as the full flags of the instruction queues 33, 45, and 55.

図21は、命令メモリ71のメモリマップを示す図である。
命令供給レジスタには、DMAC3に供給する命令コマンドC3が格納されたメモリ領域の先頭アドレスと、畳み込み演算回路4に供給する命令コマンドC4が格納されたメモリ領域の先頭アドレスと、量子化演算回路5に供給する命令コマンドC5が格納されたメモリ領域の先頭アドレスと、が格納される。命令供給回路72は、命令供給レジスタに格納された先頭アドレスに基づいて命令コマンドの供給を実行する。なお、NN演算マルチコア10Mに2以上のNN演算コア10が含まれる場合は、NN演算コア10の畳み込み演算回路4および量子化演算回路5ごとに先頭アドレスが設定される。
FIG. 21 is a diagram showing a memory map of the instruction memory 71. As shown in FIG.
The instruction supply register stores the top address of a memory area in which an instruction command C3 to be supplied to the DMAC3 is stored, the top address of a memory area in which an instruction command C4 to be supplied to the convolution operation circuit 4 is stored, and the top address of a memory area in which an instruction command C5 to be supplied to the quantization operation circuit 5 is stored. The instruction supply circuit 72 executes the supply of an instruction command based on the top address stored in the instruction supply register. Note that, when the NN operation multi-core 10M includes two or more NN operation cores 10, a top address is set for each of the convolution operation circuit 4 and the quantization operation circuit 5 of the NN operation core 10.

例えば、図21に示すメモリマップのように命令コマンドが命令メモリ71に格納されている場合、先頭アドレスがアドレスA1とアドレスA2とアドレスA3から始まるメモリ領域には、第一アプリケーションとは異なる第二アプリケーションが使用する命令コマンドが格納されている。また、先頭アドレスがアドレスA4とアドレスA5とアドレスA6から始まるメモリ領域には、第一アプリケーションとは異なる第二アプリケーションが使用する命令コマンドが格納されている。第一アプリケーションを実行するとき、命令供給レジスタの先頭アドレスには、アドレスA1とアドレスA2とアドレスA3とが設定される。実行するアプリケーションを第一アプリケーションから第二アプリケーションに変更するとき、命令供給レジスタの先頭アドレスには、アドレスA4とアドレスA5とアドレスA6とが設定される。 For example, when the command is stored in the command memory 71 as shown in the memory map in FIG. 21, the command used by the second application different from the first application is stored in the memory area whose top addresses start from addresses A1, A2, and A3. The command used by the second application different from the first application is stored in the memory area whose top addresses start from addresses A4, A5, and A6. When the first application is executed, the top addresses of the command supply register are set to addresses A1, A2, and A3. When the application to be executed is changed from the first application to the second application, the top addresses of the command supply register are set to addresses A4, A5, and A6.

[NN回路100の動作]
次に、NN回路100の動作(ニューラルネットワーク演算方法)を、図22に示すNN回路100の制御フローチャートに沿って説明する。NN回路100は、初期化処理(ステップS100)を実施した後、プリロードモードレジスタの設定に基づいてステップS110を実行する。
[Operation of NN circuit 100]
Next, the operation of the NN circuit 100 (neural network operation method) will be described with reference to the control flow chart of the NN circuit 100 shown in Fig. 22. After performing an initialization process (step S100), the NN circuit 100 executes step S110 based on the setting of the preload mode register.

<ステップS110:プリロードモード(第一モード)>
NN回路100のDMAC3は、ステップS110において、プリロードモードレジスタの設定に基づいてプリロードを実施する(第一工程)。具体的には、DMAC3のデータ転送回路31は、プリロードモードレジスタの設定に基づいて、外部メモリ120から命令供給ユニット7に対する命令コマンドのDMA転送(プリロード)を実施する。プリロードするデータに重みwが含まれる場合、データ転送回路31は重みメモリ41に対する重みwのDMA転送(プリロード)を実施する。プリロードするデータに量子パラメータqが含まれる場合、データ転送回路31は量子化パラメータメモリ51に対する量子パラメータqのDMA転送(プリロード)を実施する。プリロードモードレジスタに設定されたプリロードが完了すると、NN回路100は動作モードをノーマルモードに変更してステップS120を実行する。
<Step S110: Preload Mode (First Mode)>
In step S110, the DMAC3 of the NN circuit 100 performs preloading based on the setting of the preload mode register (first step). Specifically, the data transfer circuit 31 of the DMAC3 performs DMA transfer (preloading) of the instruction command from the external memory 120 to the instruction supply unit 7 based on the setting of the preload mode register. If the data to be preloaded includes a weight w, the data transfer circuit 31 performs DMA transfer (preloading) of the weight w to the weight memory 41. If the data to be preloaded includes a quantum parameter q, the data transfer circuit 31 performs DMA transfer (preloading) of the quantum parameter q to the quantization parameter memory 51. When the preloading set in the preload mode register is completed, the NN circuit 100 changes the operation mode to normal mode and executes step S120.

なお、CNN200に関する演算が大規模であると命令供給ユニット7にデータ転送する命令コマンドが多くなり、プリロードにおけるデータ転送期間や命令メモリ71に必要なメモリ容量が増加する。この場合、NN回路100のDMAC3は、プリロードモードにおいて、命令コマンドを分割して命令メモリ71に転送してもよい。例えば、命令メモリ71が全ての命令コマンドを格納するのに十分なメモリ容量を有している場合、NN回路100のDMAC3は、全ての命令コマンドを命令メモリ71に供給する。そうでない場合、NN回路100のDMAC3は、すべての命令コマンドの転送を行うのではなく、命令メモリ71が格納可能な一部の命令コマンドのみを命令メモリ71に供給してもよい。 When the calculations related to the CNN 200 are large-scale, the number of instruction commands to be transferred to the instruction supply unit 7 increases, and the data transfer period in preload and the memory capacity required for the instruction memory 71 increase. In this case, the DMAC3 of the NN circuit 100 may divide the instruction commands and transfer them to the instruction memory 71 in preload mode. For example, if the instruction memory 71 has sufficient memory capacity to store all the instruction commands, the DMAC3 of the NN circuit 100 supplies all the instruction commands to the instruction memory 71. If not, the DMAC3 of the NN circuit 100 may supply only a portion of the instruction commands that the instruction memory 71 can store to the instruction memory 71, rather than transferring all the instruction commands.

<ステップS120:ノーマルモード(第二モード)>
NN回路100の命令供給ユニット7は、ステップS120において、命令供給レジスタの設定に基づいて命令コマンドの供給を実施する(第二工程)。具体的には、命令供給回路72は、命令メモリ71に格納された命令コマンドC3をDMAC3の命令キュー33に供給し、命令コマンドC4を畳み込み演算回路4の命令キュー45に供給し、命令コマンドC5を量子化演算回路5の命令キュー55に供給する。DMAC3と畳み込み演算回路4と量子化演算回路5とは、供給された命令コマンドに基づいて動作を開始する。命令メモリ71に格納された命令コマンドが全てまたは一部が実行されたとき、NN回路100は次にステップS130を実行する。
<Step S120: Normal Mode (Second Mode)>
In step S120, the instruction supply unit 7 of the NN circuit 100 supplies an instruction command based on the setting of the instruction supply register (second step). Specifically, the instruction supply circuit 72 supplies the instruction command C3 stored in the instruction memory 71 to the instruction queue 33 of the DMAC3, supplies the instruction command C4 to the instruction queue 45 of the convolution operation circuit 4, and supplies the instruction command C5 to the instruction queue 55 of the quantization operation circuit 5. The DMAC3, the convolution operation circuit 4, and the quantization operation circuit 5 start operating based on the supplied instruction commands. When all or part of the instruction commands stored in the instruction memory 71 have been executed, the NN circuit 100 next executes step S130.

<ステップS130>
NN回路100は、ステップS130において、図22に示す制御フローを終了するかを判定する。制御フローを終了しない場合、NN回路100は、再度ステップS120を実行する。なお、NN回路100は、ステップS110から制御フローを再開してもよい。制御を終了する場合、NN回路100は、次にステップS140を実行して制御フローを終了する。
<Step S130>
In step S130, the NN circuit 100 determines whether to end the control flow shown in Fig. 22. If the control flow is not to be ended, the NN circuit 100 executes step S120 again. The NN circuit 100 may resume the control flow from step S110. If the control is to be ended, the NN circuit 100 next executes step S140 to end the control flow.

本実施形態に係るニューラルネットワーク回路100によれば、IoT機器などの組み込み機器に組み込み可能なNN回路100を高性能に動作させることができる。動作モードがプリロードモードであるとき、外部メモリ120から命令コマンドが読み出される。動作モードがノーマルモードであるとき、外部メモリ120とNN演算コア10との間で、命令コマンド以外のデータ(入力データa、重みw、量子化パラメータq、中間データ)のDMA転送が実行される。そのため、外部メモリ120からの命令コマンドの読み出しと、命令コマンド以外のデータのDMA転送とが、同時に発生しない。そのため、NN回路100は、命令コマンドの読み出しと、命令コマンド以外のデータのDMA転送とが同時に発生することによる外部バスEBの帯域圧迫を防げる。 According to the neural network circuit 100 of this embodiment, the NN circuit 100 that can be embedded in an embedded device such as an IoT device can operate with high performance. When the operating mode is the preload mode, an instruction command is read from the external memory 120. When the operating mode is the normal mode, DMA transfer of data other than the instruction command (input data a, weight w, quantization parameter q, intermediate data) is performed between the external memory 120 and the NN calculation core 10. Therefore, the reading of the instruction command from the external memory 120 and the DMA transfer of data other than the instruction command do not occur simultaneously. Therefore, the NN circuit 100 can prevent the bandwidth of the external bus EB from being compressed due to the simultaneous occurrence of the reading of the instruction command and the DMA transfer of data other than the instruction command.

プリロードモードにおける命令メモリ71への命令コマンドの書き込みと、ノーマルモードにおける命令メモリ71からの命令コマンドの読み出しとは、同時に発生しない。そのため、命令メモリ71は、2ポートRAMで実装する必要はない。命令メモリ71は、回路規模が2ポートRAMよりも小さいシングルポートRAMで実装できる。 The writing of command commands to the command memory 71 in the preload mode and the reading of command commands from the command memory 71 in the normal mode do not occur simultaneously. Therefore, the command memory 71 does not need to be implemented as a two-port RAM. The command memory 71 can be implemented as a single-port RAM, which has a smaller circuit scale than a two-port RAM.

プリロードするデータに重みwが含まれる場合、動作モードがプリロードモードであるとき、外部メモリ120から重みwが読み出される。そのため、動作モードがノーマルモードであるとき、外部メモリ120からの重みwの読み出しを省略できる。その結果、動作モードがノーマルモードであるときにおける外部バスEBの帯域をさらに削減できる。また、重みメモリ41も回路規模が2ポートRAMよりも小さいシングルポートRAMで実装できる。 If the data to be preloaded includes a weight w, the weight w is read from the external memory 120 when the operating mode is the preload mode. Therefore, when the operating mode is the normal mode, reading of the weight w from the external memory 120 can be omitted. As a result, the bandwidth of the external bus EB can be further reduced when the operating mode is the normal mode. In addition, the weight memory 41 can also be implemented using a single-port RAM, which has a smaller circuit size than a two-port RAM.

プリロードするデータに量子パラメータqが含まれる場合、動作モードがプリロードモードであるとき、外部メモリ120から量子パラメータqが読み出される。そのため、動作モードがノーマルモードであるとき、外部メモリ120からの量子パラメータqの読み出しを省略できる。その結果、動作モードがノーマルモードであるときにおける外部バスEBの帯域をさらに削減できる。また、量子化パラメータメモリ51も回路規模が2ポートRAMよりも小さいシングルポートRAMで実装できる。 If the data to be preloaded includes a quantum parameter q, the quantum parameter q is read from the external memory 120 when the operating mode is the preload mode. Therefore, when the operating mode is the normal mode, reading of the quantum parameter q from the external memory 120 can be omitted. As a result, the bandwidth of the external bus EB can be further reduced when the operating mode is the normal mode. In addition, the quantization parameter memory 51 can also be implemented using a single-port RAM, which has a smaller circuit scale than a two-port RAM.

以上、本発明の第一実施形態について図面を参照して詳述したが、具体的な構成はこの実施形態に限られるものではなく、本発明の要旨を逸脱しない範囲の設計変更等も含まれる。また、上述の実施形態および変形例において示した構成要素は適宜に組み合わせて構成することが可能である。 The first embodiment of the present invention has been described above in detail with reference to the drawings, but the specific configuration is not limited to this embodiment, and design modifications and the like that do not deviate from the gist of the present invention are also included. In addition, the components shown in the above-mentioned embodiment and modified examples can be appropriately combined to form a configuration.

(変形例1)
上記実施形態の命令供給ユニット7は、一つの命令メモリ71を有していたが、命令メモリ71の態様はこれに限定されない。命令供給ユニット7は、複数の命令メモリを71を有していていもよい。命令供給ユニット7は、例えば、命令コマンドC3を格納する第一命令メモリと、命令コマンドC4を格納する第二命令メモリと、命令コマンドC5を格納する第三命令メモリと、を有してもよい。
(Variation 1)
Although the instruction supply unit 7 in the above embodiment has one instruction memory 71, the form of the instruction memory 71 is not limited to this. The instruction supply unit 7 may have multiple instruction memories 71. The instruction supply unit 7 may have, for example, a first instruction memory that stores an instruction command C3, a second instruction memory that stores an instruction command C4, and a third instruction memory that stores an instruction command C5.

(変形例2)
上記実施形態において、第一メモリ1と第二メモリ2は別のメモリであったが、第一メモリ1と第二メモリ2の態様はこれに限定されない。第一メモリ1と第二メモリ2は、例えば、同一メモリにおける第一メモリ領域と第二メモリ領域であってもよい。
(Variation 2)
In the above embodiment, the first memory 1 and the second memory 2 are separate memories, but the aspects of the first memory 1 and the second memory 2 are not limited to this. The first memory 1 and the second memory 2 may be, for example, a first memory area and a second memory area in the same memory.

(変形例3)
例えば、上記実施形態に記載のNN回路100に入力されるデータは単一の形式に限定されず、静止画像、動画像、音声、文字、数値およびこれらの組み合わせで構成することが可能である。なお、NN回路100に入力されるデータは、NN回路100が設けられるエッジデバイスに搭載され得る、光センサ、温度計、Global Positioning System(GPS)計測器、角速度計測器、風速計などの物理量測定器における測定結果に限られない。周辺機器から有線または無線通信経由で受信する基地局情報、車両・船舶等の情報、天候情報、混雑状況に関する情報などの周辺情報や金融情報や個人情報等の異なる情報を組み合わせてもよい。
(Variation 3)
For example, the data input to the NN circuit 100 described in the above embodiment is not limited to a single format, and can be composed of still images, moving images, sounds, characters, numbers, and combinations of these. The data input to the NN circuit 100 is not limited to the measurement results of physical quantity measuring instruments such as optical sensors, thermometers, Global Positioning System (GPS) measuring instruments, angular velocity measuring instruments, and anemometers that may be mounted on the edge device in which the NN circuit 100 is provided. Different information such as base station information received from peripheral devices via wired or wireless communication, information on vehicles and ships, weather information, congestion information, and other peripheral information, financial information, and personal information may also be combined.

(変形例4)
NN回路100が設けられるエッジデバイスは、バッテリー等で駆動する携帯電話などの通信機器、パーソナルコンピュータなどのスマートデバイス、デジタルカメラ、ゲーム機器、ロボット製品などのモバイル機器を想定するが、これに限られるものではない。Power on Ethernet(PoE)などでの供給可能なピーク電力制限、製品発熱の低減または長時間駆動の要請が高い製品に利用することでも他の先行例にない効果を得ることができる。例えば、車両や船舶などに搭載される車載カメラや、公共施設や路上などに設けられる監視カメラ等に適用することで長時間の撮影を実現できるだけでなく、軽量化や高耐久化にも寄与する。また、テレビやディスプレイ等の表示デバイス、医療カメラや手術ロボット等の医療機器、製造現場や建築現場で使用される作業ロボットなどにも適用することで同様の効果を奏することができる。
(Variation 4)
The edge device in which the NN circuit 100 is provided is assumed to be a communication device such as a mobile phone driven by a battery, a smart device such as a personal computer, a digital camera, a game device, a robot product, and other mobile devices, but is not limited thereto. It can be used in products that have a high demand for limiting the peak power that can be supplied by Power on Ethernet (PoE), reducing heat generation of the product, or long-term operation, to obtain effects not found in other prior art. For example, by applying the circuit to an in-vehicle camera mounted on a vehicle or ship, or a surveillance camera installed in a public facility or on the road, it is possible to realize long-term shooting, and also contributes to weight reduction and high durability. In addition, the circuit can be applied to display devices such as televisions and displays, medical equipment such as medical cameras and surgical robots, and work robots used at manufacturing sites and construction sites to obtain similar effects.

(変形例5)
NN回路100は、NN回路100の一部または全部を一つ以上のプロセッサを用いて実現してもよい。例えば、NN回路100は、入力層または出力層の一部または全部をプロセッサによるソフトウェア処理により実現してもよい。ソフトウェア処理により実現する入力層または出力層の一部は、例えば、データの正規化や変換である。これにより、様々な形式の入力形式または出力形式に対応できる。なお、プロセッサで実行するソフトウェアは、通信手段や外部メディアを用いて書き換え可能に構成してもよい。
(Variation 5)
The NN circuit 100 may be realized in part or in whole by using one or more processors. For example, the NN circuit 100 may realize in part or in whole the input layer or output layer by software processing by a processor. A part of the input layer or output layer realized by software processing is, for example, data normalization or conversion. This makes it possible to support various input formats or output formats. The software executed by the processor may be configured to be rewritable using communication means or external media.

(変形例6)
NN回路100は、CNN200における処理の一部をクラウド上のGraphics Processing Unit(GPU)等を組み合わせることで実現してもよい。NN回路100は、NN回路100が設けられるエッジデバイスで行った処理に加えて、クラウド上でさらに処理を行ったり、クラウド上での処理に加えてエッジデバイス上で処理を行ったりすることで、より複雑な処理を少ないリソースで実現できる。このような構成によれば、NN回路100は、処理分散によりエッジデバイスとクラウドとの間の通信量を低減できる。
(Variation 6)
The NN circuit 100 may realize a part of the processing in the CNN 200 by combining a graphics processing unit (GPU) or the like on the cloud. The NN circuit 100 can realize more complex processing with fewer resources by performing further processing on the cloud in addition to the processing performed on the edge device in which the NN circuit 100 is provided, or by performing processing on the edge device in addition to the processing on the cloud. With such a configuration, the NN circuit 100 can reduce the amount of communication between the edge device and the cloud by distributing processing.

また、本明細書に記載された効果は、あくまで説明的または例示的なものであって限定的ではない。つまり、本開示に係る技術は、上記の効果とともに、または上記の効果に代えて、本明細書の記載から当業者には明らかな他の効果を奏しうる。 Furthermore, the effects described in this specification are merely descriptive or exemplary and are not limiting. In other words, the technology disclosed herein may achieve other effects that are apparent to a person skilled in the art from the description in this specification, in addition to or in place of the above effects.

本発明は、ニューラルネットワークの演算に適用することができる。 The present invention can be applied to neural network calculations.

200 畳み込みニューラルネットワーク
100 ニューラルネットワーク回路(NN回路)
10 ニューラルネットワーク演算コア(NN演算コア)
10A 第一ニューラルネットワーク演算コア(第一NN演算コア)
10B 第二ニューラルネットワーク演算コア(第二NN演算コア)
10M ニューラルネットワーク演算マルチコア(NN演算マルチコア)
1 第一メモリ
2 第二メモリ
3 DMAコントローラ(DMAC)
4 畳み込み演算回路
42 乗算器
43 アキュムレータ回路
5 量子化演算回路
52 ベクトル演算回路
53 量子化回路
6 コントローラ
61 レジスタ
7 命令供給ユニット
71 命令メモリ
72 命令供給回路
C3 命令コマンド(第三命令コマンド)
C4 命令コマンド(第一命令コマンド)
C5 命令コマンド(第二命令コマンド)
200 Convolutional Neural Network 100 Neural Network Circuit (NN Circuit)
10 Neural network calculation core (NN calculation core)
10A First Neural Network Calculation Core (First NN Calculation Core)
10B Second Neural Network Calculation Core (Second NN Calculation Core)
10M Neural network calculation multi-core (NN calculation multi-core)
1 First memory 2 Second memory 3 DMA controller (DMAC)
4 Convolution operation circuit 42 Multiplier 43 Accumulator circuit 5 Quantization operation circuit 52 Vector operation circuit 53 Quantization circuit 6 Controller 61 Register 7 Instruction supply unit 71 Instruction memory 72 Instruction supply circuit C3 Instruction command (third instruction command)
C4 Command (first command)
C5 Command (second command)

Claims (11)

第一命令コマンドに基づいて畳み込み演算を実行する畳み込み演算回路を有するニューラルネットワーク演算コアと、
前記第一命令コマンドを格納する命令メモリを有し、前記畳み込み演算回路に前記第一命令コマンドを提供する命令提供ユニットと、
前記ニューラルネットワーク演算コアと外部メモリとの間でデータを転送するDMAコントローラと、
を備える、
ニューラルネットワーク回路。
a neural network calculation core having a convolution calculation circuit that executes a convolution calculation based on a first instruction command;
an instruction providing unit having an instruction memory for storing the first instruction command and providing the first instruction command to the convolution operation circuit;
a DMA controller for transferring data between the neural network computing core and an external memory;
Equipped with
Neural network circuit.
前記ニューラルネットワーク回路の動作モードが第一モードであるとき、前記DMAコントローラは、前記外部メモリから前記命令メモリに対して前記第一命令コマンドを転送する、
請求項1に記載のニューラルネットワーク回路。
When the operation mode of the neural network circuit is in a first mode, the DMA controller transfers the first instruction command from the external memory to the instruction memory.
2. The neural network circuit of claim 1.
前記ニューラルネットワーク回路の前記動作モードが第二モードであるとき、前記命令提供ユニットは、前記命令メモリに格納された前記第一命令コマンドを前記畳み込み演算回路に供給する、
請求項2に記載のニューラルネットワーク回路。
When the operation mode of the neural network circuit is the second mode, the instruction providing unit supplies the first instruction command stored in the instruction memory to the convolution operation circuit.
3. The neural network circuit of claim 2.
前記ニューラルネットワーク演算コアは、第二命令コマンドに基づいて前記畳み込み演算回路の畳み込み演算出力データに対して量子化演算を行う量子化演算回路をさらに備え、
前記命令メモリは、前記第二命令コマンドを格納し、
前記ニューラルネットワーク回路の動作モードが前記第一モードであるとき、前記DMAコントローラは、前記外部メモリから前記命令メモリに対して前記第二命令コマンドを転送する、
請求項2に記載のニューラルネットワーク回路。
The neural network operation core further includes a quantization operation circuit that performs a quantization operation on the convolution operation output data of the convolution operation circuit based on a second command;
the instruction memory stores the second instruction command;
when the operation mode of the neural network circuit is the first mode, the DMA controller transfers the second instruction command from the external memory to the instruction memory;
3. The neural network circuit of claim 2.
前記ニューラルネットワーク回路の前記動作モードが第二モードであるとき、前記命令提供ユニットは、前記命令メモリに格納された前記第二命令コマンドを前記量子化演算回路に供給する、
請求項4に記載のニューラルネットワーク回路。
When the operation mode of the neural network circuit is a second mode, the instruction providing unit supplies the second instruction command stored in the instruction memory to the quantization operation circuit.
5. The neural network circuit of claim 4.
前記DMAコントローラは、第三命令コマンドに基づいて前記データを転送し、
前記命令メモリは、前記第三命令コマンドを格納し、
前記ニューラルネットワーク回路の動作モードが前記第一モードであるとき、前記DMAコントローラは、前記外部メモリから前記命令メモリに対して前記第三命令コマンドを転送する、
請求項2に記載のニューラルネットワーク回路。
The DMA controller transfers the data based on a third instruction command;
the instruction memory stores the third instruction command;
when the operation mode of the neural network circuit is the first mode, the DMA controller transfers the third instruction command from the external memory to the instruction memory;
3. The neural network circuit of claim 2.
前記ニューラルネットワーク回路の前記動作モードが第二モードであるとき、前記命令提供ユニットは、前記命令メモリに格納された前記第三命令コマンドを前記DMAコントローラに供給する、
請求項6に記載のニューラルネットワーク回路。
when the operation mode of the neural network circuit is the second mode, the instruction providing unit supplies the third instruction command stored in the instruction memory to the DMA controller;
7. The neural network circuit of claim 6.
前記命令メモリは、シングルポートRAMで実装されている、
請求項1に記載のニューラルネットワーク回路。
The instruction memory is implemented as a single-ported RAM.
2. The neural network circuit of claim 1.
前記命令メモリは、第一アプリケーションに使用する前記第一命令コマンドと、前記第一アプリケーションと異なる第二アプリケーションに使用する前記第一命令コマンドと、を格納する、
請求項1に記載のニューラルネットワーク回路。
the instruction memory stores the first instruction command to be used for a first application and the first instruction command to be used for a second application different from the first application;
2. The neural network circuit of claim 1.
前記ニューラルネットワーク演算コアを複数有し、
前記複数のニューラルネットワーク演算コアは、データ入出力可能に接続されている、
請求項1に記載のニューラルネットワーク回路。
The neural network computing core includes a plurality of the neural network computing cores,
The plurality of neural network calculation cores are connected to each other so as to be capable of inputting and outputting data.
2. The neural network circuit of claim 1.
第一命令コマンドに基づいて畳み込み演算を実行する畳み込み演算回路と、前記第一命令コマンドを格納する命令メモリを有する命令提供ユニットと、を用いるニューラルネットワーク演算方法であって、
前記命令メモリに前記第一命令コマンドを格納する第一工程と、
前記第一工程が完了した後において、前記命令メモリに格納された前記第一命令コマンドを前記畳み込み演算回路に提供する第二工程と、
を備える、
ニューラルネットワーク演算方法。
A neural network operation method using a convolution operation circuit that performs a convolution operation based on a first instruction command, and an instruction providing unit having an instruction memory that stores the first instruction command, comprising:
a first step of storing the first instruction command in the instruction memory;
a second step of providing the first instruction command stored in the instruction memory to the convolution operation circuit after the first step is completed;
Equipped with
Neural network calculation method.
JP2023024486A 2023-02-20 2023-02-20 Neural network circuit and neural network operation method Pending JP2024118195A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2023024486A JP2024118195A (en) 2023-02-20 2023-02-20 Neural network circuit and neural network operation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2023024486A JP2024118195A (en) 2023-02-20 2023-02-20 Neural network circuit and neural network operation method

Publications (1)

Publication Number Publication Date
JP2024118195A true JP2024118195A (en) 2024-08-30

Family

ID=92504093

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2023024486A Pending JP2024118195A (en) 2023-02-20 2023-02-20 Neural network circuit and neural network operation method

Country Status (1)

Country Link
JP (1) JP2024118195A (en)

Similar Documents

Publication Publication Date Title
TWI773245B (en) Neural network circuit, network terminal equipment and neural network operation method
JP2025072666A (en) Neural Network Generator
US12475362B2 (en) Method for controlling neural network circuit
US20240095522A1 (en) Neural network generation device, neural network computing device, edge device, neural network control method, and software generation program
WO2022230906A1 (en) Neural network generation device, neural network computing device, edge device, neural network control method, and software generation program
JP2024118195A (en) Neural network circuit and neural network operation method
JP2025079905A (en) Neural network circuit and neural network operation method
JP2024075106A (en) Neural network circuit and neural network operation method
JP6931252B1 (en) Neural network circuit and neural network circuit control method
JP2025015342A (en) Neural Network Circuit
WO2023139990A1 (en) Neural network circuit and neural network computation method
US20260044723A1 (en) Method for controlling neural network circuit
US20250006230A1 (en) Neural network circuit and neural network circuit control method
JP2022105437A (en) Neural network circuit and neural network operation method
JP2022183833A (en) Neural network circuit and neural network operation method
WO2024038662A1 (en) Neural network training device and neural network training method
JP2025065487A (en) Control device and control method
JP2023154880A (en) Neural network generation method and neural network generation program
JP2022114698A (en) Neural network generator, neural network control method and software generation program

Legal Events

Date Code Title Description
A711 Notification of change in applicant

Free format text: JAPANESE INTERMEDIATE CODE: A711

Effective date: 20250127

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20251112