Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP7316073B2 - Arithmetic unit of neural network - Google Patents
[go: Go Back, main page]

JP7316073B2 - Arithmetic unit of neural network - Google Patents

Arithmetic unit of neural network Download PDF

Info

Publication number
JP7316073B2
JP7316073B2 JP2019056641A JP2019056641A JP7316073B2 JP 7316073 B2 JP7316073 B2 JP 7316073B2 JP 2019056641 A JP2019056641 A JP 2019056641A JP 2019056641 A JP2019056641 A JP 2019056641A JP 7316073 B2 JP7316073 B2 JP 7316073B2
Authority
JP
Japan
Prior art keywords
activation function
function
activation
register
neural network
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.)
Active
Application number
JP2019056641A
Other languages
Japanese (ja)
Other versions
JP2020160564A (en
Inventor
一嘉 石渡
亜季 鈴木
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.)
Denso Corp
NSI Texe Inc
Original Assignee
Denso Corp
NSI Texe 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 Denso Corp, NSI Texe Inc filed Critical Denso Corp
Priority to JP2019056641A priority Critical patent/JP7316073B2/en
Priority to PCT/JP2020/013224 priority patent/WO2020196586A1/en
Publication of JP2020160564A publication Critical patent/JP2020160564A/en
Application granted granted Critical
Publication of JP7316073B2 publication Critical patent/JP7316073B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/06Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons
    • G06N3/063Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons using electronic means
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Theoretical Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Artificial Intelligence (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Neurology (AREA)
  • Advance Control (AREA)

Description

本発明は、ニューラルネットワークの演算装置に関する。 The present invention relates to a computation device for neural networks.

従来、ニューラルネットワークの演算装置では、複数の活性化関数が使われることがある(例えば、特許文献1参照)。活性化関数は、例えば、シグモイド関数、Softmax関数、ReLU(Rectified Linear Unit)関数、恒等関数等が使われている。計算量の削減のため、日々新たな活性化関数が考案されている。 2. Description of the Related Art Conventionally, a plurality of activation functions may be used in neural network computing devices (see, for example, Patent Document 1). A sigmoid function, a Softmax function, a ReLU (Rectified Linear Unit) function, an identity function, or the like is used as the activation function, for example. In order to reduce the amount of calculation, new activation functions are devised every day.

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

従来のニューラルネットワークの演算装置では、処理を高速化するために活性化関数に関するプログラム専用のハードウェアを設計し活性化関数をハードウェア化することがあった。この場合、新たな活性化関数への対応が難しくなるという課題があった。 In conventional neural network computing devices, in order to speed up processing, hardware dedicated to programs related to activation functions is sometimes designed and the activation functions are implemented in hardware. In this case, there is a problem that it becomes difficult to deal with the new activation function.

本発明は、活性化関数をハードウェア化して処理を高速化し、かつ適用する活性化関数を容易に変更できるニューラルネットワークの演算装置を提供することを目的とする。 SUMMARY OF THE INVENTION It is an object of the present invention to provide an arithmetic device for a neural network in which an activation function is implemented in hardware to speed up processing and the activation function to be applied can be easily changed.

本開示は上記課題を解決するために以下の技術的手段を採用する。特許請求の範囲及びこの項に記載した括弧内の符号は、ひとつの態様として後述する実施の形態に記載の具体的手段との対応関係を示す一例であって、本発明の技術的範囲を限定するものではない。 The present disclosure employs the following technical means to solve the above problems. The symbols in parentheses described in the claims and this section are an example showing the correspondence relationship with the specific means described in the embodiment described later as one aspect, and limit the technical scope of the present invention. not something to do.

上記目的を達成するために、本発明は、ニューラルネットワークの演算装置(116)であって、複数種類の活性化関数について、前記活性化関数を用いた演算を行う活性化関数回路(208)を有する演算ユニット(206)と、スレッドに対応付けて前記活性化関数の種類の指定を記憶するレジスタ(214)と、を備える。 In order to achieve the above object, the present invention provides a neural network computing device (116) comprising an activation function circuit (208) for performing computations using the activation functions for a plurality of types of activation functions. and a register (214) for storing designation of the activation function type in association with the thread.

本開示によれば、活性化関数をハードウェア化して処理を高速化し、かつ活性化関数の種類をレジスタで指定するので、適用する活性化関数を容易に変更できる。 According to the present disclosure, since the activation function is made into hardware to speed up the processing and the type of the activation function is specified by the register, the activation function to be applied can be easily changed.

本発明の実施の形態に係る演算装置の構成を示すブロック図である。1 is a block diagram showing the configuration of an arithmetic device according to an embodiment of the present invention; FIG. 本発明の実施の形態に係る演算装置が処理するスレッドを説明するための図である。FIG. 4 is a diagram for explaining threads processed by the arithmetic device according to the embodiment of the present invention; 本発明の実施の形態に係るデータフロー型プロセッサの構成を示すブロック図である。1 is a block diagram showing the configuration of a dataflow processor according to an embodiment of the present invention; FIG. 本発明の実施の形態に係るPE(Processing Element)の構成を示すブロック図である。3 is a block diagram showing the configuration of a PE (Processing Element) according to the embodiment of the present invention; FIG. (a)本発明の実施の形態に係る活性化関数としてParametric ReLU関数を指定するアセンブラコードを示す図である。 (b)本発明の実施の形態に係る活性化関数として、Hyperbolic Tangent関数を指定するアセンブラコードを示す図である。(a) is a diagram showing assembler code specifying a Parametric ReLU function as an activation function according to an embodiment of the present invention; (b) A diagram showing an assembler code specifying a Hyperbolic Tangent function as an activation function according to an embodiment of the present invention. (a)本発明の実施の形態に係る活性化関数としてParametric ReLU関数とその微分関数のグラフを示す図である。 (b)本発明の実施の形態に係る活性化関数としてHyperbolic Tangent関数とその微分関数のグラフを示す図である。(a) A diagram showing a graph of a Parametric ReLU function and its differential function as an activation function according to the embodiment of the present invention. (b) A diagram showing a graph of a Hyperbolic Tangent function and its differential function as an activation function according to the embodiment of the present invention.

以下、図面を参照して本発明の実施の形態を説明する。なお、以下に説明する実施の形態は、本発明を実施する場合の一例を示すものであって、本発明を以下に説明する具体的構成に限定するものではない。本発明の実施にあたっては、実施の形態に応じた具体的構成が適宜採用されてよい。 BEST MODE FOR CARRYING OUT THE INVENTION Hereinafter, embodiments of the present invention will be described with reference to the drawings. In addition, the embodiment described below shows an example of the case of carrying out the present invention, and does not limit the present invention to the specific configuration described below. In carrying out the present invention, a specific configuration according to the embodiment may be appropriately employed.

[演算装置10の構成]
図1は、本発明の実施の形態に係る演算装置10の構成を示すブロック図である。演算装置10は、データフロー型プロセッサ100、ホストCPU(Central Processing Unit)200、システムバス300、ROM(Read Only Memory)400、RAM(Random Access Memory)500、外部インターフェイス600、イベントハンドラ700を有する。
[Configuration of computing device 10]
FIG. 1 is a block diagram showing the configuration of an arithmetic device 10 according to an embodiment of the invention. The arithmetic device 10 has a data flow processor 100 , a host CPU (Central Processing Unit) 200 , a system bus 300 , a ROM (Read Only Memory) 400 , a RAM (Random Access Memory) 500 , an external interface 600 and an event handler 700 .

図2は、本発明の実施の形態に係る演算装置10が処理するスレッドを説明するための図である。図2に示すように、プログラムコードは、データと処理とが分割されているグラフ構造を有している。このグラフ構造は、プログラムのタスク並列性、グラフ並列性を保持している。演算装置10は、このグラフ構造のプログラムを分割して得られた多量のスレッドを処理する。 FIG. 2 is a diagram for explaining threads processed by the arithmetic device 10 according to the embodiment of the present invention. As shown in FIG. 2, the program code has a graph structure in which data and processing are separated. This graph structure holds task parallelism and graph parallelism of the program. The arithmetic unit 10 processes a large number of threads obtained by dividing the graph-structured program.

演算装置10が、例えば、畳み込みニューラルネットワーク(Convolutional Neural Network:CNN)における畳み込みやプーリング処理をするとき、データフロー型プロセッサ100に大きな負荷がかかる。演算装置10が、後述する活性化関数モジュール208や活性化関数の微分モジュール210を備え活性化関数のハードウェア化をすることで、このデータフロー型プロセッサ100にかかる大きな負荷を低減できる。 For example, when the arithmetic device 10 performs convolution or pooling processing in a convolutional neural network (CNN), the data flow processor 100 is heavily loaded. The heavy load on the data flow processor 100 can be reduced by providing the arithmetic unit 10 with an activation function module 208 and an activation function differentiation module 210, which will be described later, and implementing the activation functions in hardware.

図1に戻って説明を続ける。データフロー型プロセッサ100には、割込み処理を生成するイベントハンドラ700が接続されており、イベントハンドラ700が生成した割込みをサポートしている。データフロー型プロセッサ100の具体的な構成は、図3を用いて後述する。 Returning to FIG. 1, the description continues. The data flow processor 100 is connected to an event handler 700 that generates interrupt processing, and supports interrupts generated by the event handler 700 . A specific configuration of the data flow processor 100 will be described later with reference to FIG.

ホストCPU200は、演算装置10の中央処理装置(CPU)である。ホストCPU200は、システムバス300を介して、演算装置10の各部と情報の授受が可能である。ホストCPU200が、ROM400又はRAM500に記憶されたプログラムを実行することにより、演算装置10の各部の機能を実現する。 The host CPU 200 is the central processing unit (CPU) of the computing device 10 . The host CPU 200 can exchange information with each unit of the arithmetic device 10 via the system bus 300 . The host CPU 200 implements the functions of each section of the arithmetic device 10 by executing programs stored in the ROM 400 or the RAM 500 .

ROM400は、読み出し専用の不揮発性メモリである。RAM500は、読み書き用の揮発性メモリである。ROM400とRAM500とは、ホストCPU200が演算装置10の各部の機能を実現するためのプログラムを記憶する。ROM400とRAM500とは、データフロー型プロセッサ100の演算結果を記憶してもよい。 The ROM 400 is a read-only non-volatile memory. The RAM 500 is a read/write volatile memory. The ROM 400 and the RAM 500 store programs for the host CPU 200 to implement the functions of the arithmetic unit 10 . The ROM 400 and RAM 500 may store the calculation results of the data flow processor 100 .

外部インターフェイス600は、演算装置10が外部から情報を入力し、又は外部へ情報を出力する入出力装置である。外部インターフェイス600は、例えば、カメラ、超音波センサ等である。 The external interface 600 is an input/output device through which the arithmetic device 10 inputs information from the outside or outputs information to the outside. The external interface 600 is, for example, a camera, an ultrasonic sensor, or the like.

[データフロー型プロセッサ100の構成]
図3は、データフロー型プロセッサ100の構成を示すブロック図である。データフロー型プロセッサ100は、コマンドユニット102と、メモリサブシステム104と、スレッドスケジューラ112と、実行コア114とを有する。
[Configuration of Data Flow Processor 100]
FIG. 3 is a block diagram showing the configuration of the dataflow processor 100. As shown in FIG. The dataflow processor 100 has a command unit 102 , a memory subsystem 104 , a thread scheduler 112 and an execution core 114 .

コマンドユニット102は、データフロー型プロセッサ100の機能の実行を指示する命令部である。コマンドユニット102は、ユーザが設定できるコンフィギュレーション(設定項目)のインターフェイスであるコンフィグインターフェイスと通信してもよい。コマンドユニット102は、データの読み出し命令、書き込み命令、消去命令等のコマンドを一時的に格納するコマンドバッファの機能を有してもよい。 The command unit 102 is an instruction section that instructs execution of functions of the data flow processor 100 . The command unit 102 may communicate with a config interface, which is a user-configurable configuration interface. The command unit 102 may have the function of a command buffer that temporarily stores commands such as data read instructions, write instructions, and erase instructions.

メモリサブシステム104は、RAM500と実行コア114との間に置かれるメモリのシステムである。メモリサブシステム104は、システムバスインターフェイス又はROMインターフェイスと通信してもよい。メモリサブシステム104は、アービタ106、L1キャッシュ108、L2キャッシュ110を有する。 Memory subsystem 104 is a system of memory interposed between RAM 500 and execution core 114 . Memory subsystem 104 may communicate with a system bus interface or a ROM interface. Memory subsystem 104 includes arbiter 106 , L1 cache 108 and L2 cache 110 .

アービタ106は、PE116とL1キャッシュ108との間に配置され、複数のデータアクセス要求が競合したときに、優先度等を用いた予め定められた規則に従って調整する調整装置である。L1キャッシュ108は、RAM500よりも高速に読み書きできるメモリである。L2キャッシュ110は、L1キャッシュの下位にあるRAM500よりも高速に読み書きできるメモリである。 The arbiter 106 is placed between the PE 116 and the L1 cache 108, and is a coordinating device that adjusts according to a predetermined rule using priority or the like when a plurality of data access requests conflict. L1 cache 108 is memory that can be read and written faster than RAM 500 . The L2 cache 110 is memory that can be read and written faster than the RAM 500 below the L1 cache.

スレッドスケジューラ112は、処理すべき優先度にしたがい複数スレッドを実行コア114に割り当てる、スレッドのスケジューラである。 The thread scheduler 112 is a thread scheduler that allocates multiple threads to the execution core 114 according to the priority of processing.

実行コア114は、スレッドの処理を実行する実行部である。実行コア114は、複数の演算器(Processing Element:PE)116を有する。PE116は、スカラ演算するスカラ演算器でもよいし、ベクトル演算するベクトル演算器でもよい。本実施の形態では、PE116は、少なくとも1つはベクトル演算器である。 The execution core 114 is an execution unit that executes thread processing. The execution core 114 has a plurality of processing elements (PE) 116 . The PE 116 may be a scalar operator that performs scalar operations or a vector operator that performs vector operations. In this embodiment, at least one PE 116 is a vector operator.

[PE116の構成]
図4は、本発明の実施の形態に係るPE116の構成を示すブロック図である。PE116は、命令デコーダ・制御部202、汎用レジスタファイル204、演算ユニット206、設定レジスタ212を有する。
[Configuration of PE 116]
FIG. 4 is a block diagram showing the configuration of PE 116 according to the embodiment of the present invention. The PE 116 has an instruction decoder/controller 202 , a general-purpose register file 204 , an arithmetic unit 206 and a setting register 212 .

命令デコーダ・制御部202は、命令をデコードし、各部を制御する命令デコーダ・制御部である。命令デコーダ・制御部202は、汎用レジスタファイル204に対して演算に用いられるレジスタを指定し、設定レジスタ212に対して演算スレッドを指定し、演算ユニット206に対して演算に用いるモジュールを指定する。 The instruction decoder/control unit 202 is an instruction decoder/control unit that decodes instructions and controls each unit. The instruction decoder/control unit 202 designates the registers used for the operation to the general-purpose register file 204, designates the operation thread to the setting register 212, and designates the module to be used for the operation to the operation unit 206. FIG.

演算ユニット206は、入力データに基づいて出力データを生成する演算部である。上述したように、演算ユニット206は、命令デコーダ・制御部202が指定したレジスタの値に対して、命令デコーダ・制御部202が指定したモジュールを使用して演算する。本実施の形態では、演算ユニット206は、ベクトル演算を行う。演算ユニット206は、活性化関数モジュール208と活性化関数の微分モジュール210とを有する。 The arithmetic unit 206 is an arithmetic section that generates output data based on input data. As described above, the arithmetic unit 206 uses the module specified by the instruction decoder/controller 202 to compute the value of the register specified by the instruction decoder/controller 202 . In this embodiment, arithmetic unit 206 performs vector arithmetic. The arithmetic unit 206 has an activation function module 208 and an activation function differentiation module 210 .

活性化関数モジュール208は、活性化関数を演算に適用する活性化関数回路であり、ハードウェアによって構成されている。活性化関数モジュール208は、種類の異なる複数の活性化関数を有する。 The activation function module 208 is an activation function circuit that applies activation functions to operations, and is configured by hardware. The activation function module 208 has multiple activation functions of different types.

活性化関数は、例えば、恒等関数、ステップ関数、線形関数、ソフトプラス関数、シグモイド関数、ハードシグモイド関数、Hyperbolic Tangent関数、ソフトサイン関数、ReLU関数、Leaky ReLU関数、Parametric ReLU関数、Thresholded ReLU関数、eLU(Exponential Linear Units)関数、SeLU(Scaled Exponential Linear Unit)関数、Softmax関数、Gumbel-Softmax関数、Swish関数等がある。図4では、活性化関数モジュール208が、活性化関数A、活性化関数B、活性化関数Cの3つの活性化関数を有する例を挙げた。 Activation functions are e.g. identity function, step function, linear function, soft plus function, sigmoid function, hard sigmoid function, Hyperbolic Tangent function, soft sine function, ReLU function, Leaky ReLU function, Parametric ReLU function, Thresholded ReLU function , eLU (Exponential Linear Units) function, SeLU (Scaled Exponential Linear Unit) function, Softmax function, Gumbel-Softmax function, Swish function, and the like. In FIG. 4, the activation function module 208 has three activation functions, activation function A, activation function B, and activation function C, as an example.

活性化関数の微分モジュール210は、活性化関数の微分を演算に適用する活性化関数の微分関数回路であり、ハードウェアによって構成されている。活性化関数の微分モジュール210は、種類の異なる複数の活性化関数の微分関数を有する。活性化関数の微分モジュール210が演算に適用する複数の活性化関数の微分関数は、例えば、活性化関数モジュール208が記憶する複数の活性化関数を微分した関数である。図4では、活性化関数の微分モジュール210が、活性化関数Aの微分関数、活性化関数Bの微分関数、活性化関数Cの微分関数を有する例を挙げた。 The activation function differentiation module 210 is an activation function differentiation function circuit that applies differentiation of the activation function to computation, and is configured by hardware. The activation function differentiation module 210 has a plurality of activation function differentiation functions of different types. The differentiation functions of the plurality of activation functions that the activation function differentiation module 210 applies to the calculation are, for example, functions obtained by differentiating the plurality of activation functions stored in the activation function module 208 . In FIG. 4, the activation function differentiation module 210 has an activation function A differentiation function, an activation function B differentiation function, and an activation function C differentiation function.

なお、本実施の形態では、演算ユニット206が活性化関数モジュール208と活性化関数の微分モジュール210を有する例を挙げたが、演算ユニット206は、活性化関数モジュール208だけでもよい。 In the present embodiment, an example in which the arithmetic unit 206 has the activation function module 208 and the activation function differentiation module 210 was given, but the arithmetic unit 206 may have only the activation function module 208 .

設定レジスタ212は、活性化関数の種類を指定し、活性化関数の係数を指定するためのデータを記憶するレジスタである。なお、設定レジスタ212としては、プロセッサが対応するスレッドの数分の設定レジスタ212が備えられる。設定レジスタ212は、活性化関数の種類を指定するデータを記憶するレジスタ214を有する。本実施の形態では、活性化関数Aを指定するレジスタ値を「1」、活性化関数Bを指定するレジスタ値を「2」、活性化関数Cを指定するレジスタ値を「3」とする。スレッドに指定されたレジスタ値に対応する活性化関数を、そのスレッドの「デフォルトの活性化関数」という。 The setting register 212 is a register that stores data for designating the type of activation function and designating the coefficient of the activation function. As the setting registers 212, the number of setting registers 212 corresponding to the number of threads corresponding to the processor is provided. The setting register 212 has a register 214 that stores data designating the type of activation function. In this embodiment, the register value specifying activation function A is "1", the register value specifying activation function B is "2", and the register value specifying activation function C is "3". The activation function corresponding to the register values specified for a thread is called the "default activation function" of that thread.

設定レジスタ212は、活性化関数の係数を指定するデータを記憶するレジスタ216を有してもよい。本実施の形態では、設定レジスタ212は、活性化関数の種類と係数とを指定する。 Configuration registers 212 may include registers 216 that store data specifying coefficients of the activation function. In this embodiment, the setting register 212 designates the type and coefficient of the activation function.

命令デコーダ・制御部202は、演算ユニット206に対して、命令コードで活性化関数の種類、およびその係数を指定する。活性化関数の種類の指定は、命令コードの活性化関数の種類を指定するビットにより判別される。命令コードの活性化関数の種類を指定するビットが「0」のときは、活性化関数の種類を指定するレジスタの値によって、該当する活性化関数(すなわち、デフォルトの活性化関数)を実行する。ここで、「0」は、活性化関数A~Cに対応するレジスタ値とは異なる予め定められた値である。一方、命令コードの活性化関数の種類を指定するビットが「1」~「3」のときは、演算ユニット206は、指定された値に該当する活性化関数A~Cのいずれかを実行する。 The instruction decoder/control unit 202 designates the type of activation function and its coefficient with an instruction code to the arithmetic unit 206 . The designation of the type of activation function is determined by the bit that designates the type of activation function in the instruction code. When the bit specifying the type of activation function in the instruction code is "0", the corresponding activation function (that is, the default activation function) is executed according to the value of the register that specifies the type of activation function. . Here, "0" is a predetermined value different from the register values corresponding to the activation functions AC. On the other hand, when the bit specifying the type of activation function of the instruction code is "1" to "3", the arithmetic unit 206 executes one of the activation functions A to C corresponding to the specified value. .

同様に、活性化関数の係数の指定は、命令コードの活性化関数の係数を指定するビットにより判別される。命令コードの活性化関数の種類を指定するビットが「0」のときは、活性化関数の係数を指定するレジスタの値によって、該当する活性化関数の係数(すなわち、デフォルトの活性化関数の係数)を指定する。一方、命令コードの活性化関数の種類を指定するビットが「1」以上のときは、命令コードには、必要に応じて活性化関数の係数が指定されており、演算ユニット206は、指定された値を用いて活性化関数を実行する。 Similarly, the designation of the coefficients of the activation function is determined by the bits of the instruction code that designate the coefficients of the activation function. When the bit specifying the type of activation function in the instruction code is "0", the corresponding activation function coefficient (i.e., the default activation function coefficient ). On the other hand, when the bit specifying the type of activation function in the instruction code is "1" or more, the instruction code specifies the coefficient of the activation function as necessary, and the arithmetic unit 206 Executes the activation function using the value obtained.

上述した活性化関数の種類と係数の指定とを、図5と図6とを用いて説明する。図5(a)は、本発明の実施の形態に係る活性化関数としてParametric ReLU関数を指定するアセンブラコードを示す図である。図6(a)は、本発明の実施の形態に係る活性化関数としてParametric ReLU関数とその微分関数のグラフを示す図である。 The types of activation functions and designation of coefficients described above will be described with reference to FIGS. 5 and 6. FIG. FIG. 5(a) is a diagram showing assembler code specifying a Parametric ReLU function as an activation function according to an embodiment of the present invention. FIG. 6A is a diagram showing graphs of a Parametric ReLU function and its differential function as activation functions according to the embodiment of the present invention.

アセンブラコード(1)302は、活性化関数の種類を指定するデータを記述している。本実施の形態では、アセンブラコード(1)302は、活性化関数の種類を指定する引数が「1」であり、「1」に対応付けられたParametric ReLU関数を指定している。 Assembler code (1) 302 describes data specifying the type of activation function. In this embodiment, the assembler code (1) 302 has "1" as an argument specifying the type of activation function, and specifies the Parametric ReLU function associated with "1".

アセンブラコード(2)304は、活性化関数の種類を指定するレジスタR1に、アセンブラコード(1)302で指定した活性化関数を指定するデータ(actfunc#sel)を設定することを記述している。 The assembler code (2) 304 describes setting data (actfunc#sel) specifying the activation function specified in the assembler code (1) 302 in the register R1 specifying the type of activation function. .

アセンブラコード(3)306は、引数で活性化関数の係数を指定し、活性化関数を演算に適用することを記述している。本実施の形態では、アセンブラコード(3)306は、引数「1」でParametric ReLU関数の係数「1」を指定し、Parametric ReLU関数を演算に適用することを記述している。 Assembler code (3) 306 specifies the coefficients of the activation function as arguments and describes applying the activation function to the operation. In this embodiment, the assembler code (3) 306 specifies the coefficient "1" of the Parametric ReLU function with the argument "1" and describes applying the Parametric ReLU function to the calculation.

アセンブラコード(4)308は、引数で活性化関数の微分関数の係数を指定し、活性化関数の微分関数を演算に適用することを記述している。本実施の形態では、アセンブラコード(4)308は、引数「1」でParametric ReLU関数の微分関数の係数を指定し、Parametric ReLUの微分関数を演算に適用することを記述している。 The assembler code (4) 308 specifies the coefficient of the differential function of the activation function as an argument, and describes applying the differential function of the activation function to the calculation. In this embodiment, the assembler code (4) 308 specifies the coefficient of the differential function of the Parametric ReLU function with the argument "1", and describes applying the differential function of the Parametric ReLU to the calculation.

図5(a)に示すアセンブラコードにより演算に適用されるParametric ReLU関数をグラフにすると、図6(a)に示すように係数a=1のParametric ReLU関数とその微分関数のグラフとなる。 When the Parametric ReLU function applied to the calculation by the assembler code shown in FIG. 5(a) is graphed, it becomes a graph of the Parametric ReLU function with coefficient a=1 and its differential function as shown in FIG. 6(a).

次に、演算に適用する活性化関数をParametric ReLU関数及びその微分関数からHyperbolic Tangent関数及びその微分関数へと変更するアセンブラコードを説明する。図5(b)本発明の実施の形態に係る活性化関数として、Hyperbolic Tangent関数を指定するアセンブラコードを示す図であり、図6(b)本発明の実施の形態に係る活性化関数としてHyperbolic Tangent関数及びその微分関数のグラフを示す図である。 Next, the assembler code for changing the activation function applied to the operation from the Parametric ReLU function and its differential function to the Hyperbolic Tangent function and its differential function will be described. FIG. 5(b) is a diagram showing an assembler code that specifies a Hyperbolic Tangent function as an activation function according to the embodiment of the present invention, and FIG. It is a figure which shows the graph of a tangent function and its derivative function.

図5(b)に示すように、本実施の形態では、アセンブラコード(1)402は、活性化関数の種類を指定する値が「1」から「2」に変更されている。この変更により、値「1」に対応づけられたParametric ReLU関数から値「2」に対応付けられたHyperbolic Tangent関数へと活性化関数及びその微分関数の指定が変更される。 As shown in FIG. 5B, in the assembler code (1) 402 in this embodiment, the value specifying the type of activation function is changed from "1" to "2". This change changes the designation of the activation function and its derivative function from the Parametric ReLU function associated with the value "1" to the Hyperbolic Tangent function associated with the value "2".

アセンブラコード(2)304からアセンブラコード(4)308は、アセンブラコード(2)404からアセンブラコード(4)408と同じアセンブラコードである。このように、他のアセンブラコードは変えずにアセンブラコード(1)402により関数の種類を指定するのみで、演算に適用するデフォルトの活性化関数を変更できる。 Assembler code (2) 304 to assembler code (4) 308 are the same assembler code as assembler code (2) 404 to assembler code (4) 408 . In this way, the default activation function applied to the operation can be changed only by designating the function type by the assembler code (1) 402 without changing other assembler codes.

なお、Hyperbolic Tangent関数は係数がない関数であり係数の指定が不要である。そのため、アセンブラコード(3)406が、引数「1」により関数の係数を指定し、アセンブラコード(4)408が引数「1」により関数の係数を指定しても、いずれも無視される。 Note that the Hyperbolic Tangent function is a function without coefficients and does not require specification of coefficients. Therefore, even if the assembler code (3) 406 specifies the coefficient of the function with the argument "1" and the assembler code (4) 408 specifies the coefficient of the function with the argument "1", both are ignored.

図5(b)に示すアセンブラコードにより適用される活性化関数をグラフにすると図6(b)に示すように係数をもたないHyperbolic Tangent関数及びその微分関数のグラフとなる。 Graphing the activation function applied by the assembler code shown in FIG. 5(b) results in a graph of the Hyperbolic Tangent function without coefficients and its derivative function as shown in FIG. 6(b).

このように、ニューラルネットワークの演算装置10は、活性化関数回路を有する演算ユニット206と、スレッドに対応付けて活性化関数の種類及び係数の指定を記憶する設定レジスタ212とを備えているため、活性化関数をハードウェア化して処理を高速化し、かつ適用する活性化関数を容易に変更できる。 In this way, the neural network arithmetic device 10 includes an arithmetic unit 206 having an activation function circuit, and a setting register 212 that stores designation of the activation function type and coefficient in association with the thread. Activation functions can be implemented in hardware to speed up processing, and activation functions to be applied can be easily changed.

また、ニューラルネットワークの演算装置10は、少なくとも1つの活性化関数回路がベクトル演算を行うため、複数のデータを並列処理できる。 Further, since at least one activation function circuit of the arithmetic device 10 of the neural network performs vector arithmetic, a plurality of data can be processed in parallel.

また、ニューラルネットワークの演算装置10は、演算ユニット206として、複数種類の活性化関数回路とその微分関数回路とを有するため、一つの命令で複数の活性化関数とその微分とを切り替えて利用できる。 In addition, since the arithmetic unit 10 of the neural network has a plurality of types of activation function circuits and their differential function circuits as the arithmetic unit 206, it is possible to switch and use a plurality of activation functions and their differentials with one instruction. .

また、活性化関数の種類と係数とは、設定レジスタ212の値又は命令コードの引数により指定されるため、設定レジスタ212のデフォルト値を変えるだけで異なる活性化関数及びその係数への対応が可能となり、デフォルトの活性化関数を変更するためにROMコードの書き換えを不要若しくは少なくできる。 In addition, since the type of activation function and coefficients are specified by the value of the setting register 212 or the argument of the instruction code, it is possible to deal with different activation functions and their coefficients simply by changing the default value of the setting register 212. Therefore, rewriting of the ROM code to change the default activation function can be eliminated or reduced.

また、活性化関数の種類とその係数との指定は、設定レジスタ212による指定よりも命令コードによる指定を優先できるため、設定レジスタ212による活性化関数の指定を受けたくないスレッドは、命令コードにより活性化関数とその係数とを指定できる。なお、設定レジスタ212による指定よりも命令コードによる指定を優先できる場合でも、命令コードの引数として予め定められた所定値が指定されているときは、設定レジスタ212による活性化関数とその係数との指定を採用できる。 In addition, since the specification of the type of activation function and its coefficients can be specified by the instruction code over the specification by the setting register 212, a thread that does not want to receive the specification of the activation function by the setting register 212 can use the instruction code. An activation function and its coefficients can be specified. Even if the specification by the instruction code can be given priority over the specification by the setting register 212, if a predetermined value is specified as an argument of the instruction code, the activation function by the setting register 212 and its coefficient are specification can be adopted.

[変形例]
本発明の実施の形態では、データフロー型プロセッサ100が用いられているが、データフロー型プロセッサ100に代えてCPU(Central Processing Unit)、GPU(Graphics Processing Unit)等の従来のプロセッサを用いてもよい。
[Modification]
Although the data flow processor 100 is used in the embodiment of the present invention, a conventional processor such as a CPU (Central Processing Unit) or a GPU (Graphics Processing Unit) may be used in place of the data flow processor 100. good.

10・・・演算装置,100・・・データフロー型プロセッサ,
200・・・ホストCPU,300・・・システムバス,400・・・ROM,
500・・・RAM,600・・・外部インターフェイス,
700・・・イベントハンドラ,102・・・コマンドユニット,
104・・・メモリサブシステム,106・・・アービタ,
108・・・L1キャッシュ,110・・・L2キャッシュ,
112・・・スレッドスケジューラ,114・・・実行コア,116・・・PE,
202・・・命令デコーダ・制御部,204・・・汎用レジスタファイル,
206・・・演算ユニット,208・・・活性化関数モジュール,
210・・・活性化関数の微分モジュール,212・・・設定レジスタ,
214・・・活性化関数の種類を指定するレジスタ,
216・・・活性化関数の係数を指定するレジスタ
10... Arithmetic device, 100... Data flow type processor,
200... Host CPU, 300... System bus, 400... ROM,
500...RAM, 600...external interface,
700 event handler, 102 command unit,
104... memory subsystem, 106... arbiter,
108 L1 cache, 110 L2 cache,
112... thread scheduler, 114... execution core, 116... PE,
202... Instruction decoder/control unit, 204... General-purpose register file,
206 operation unit, 208 activation function module,
210 ... differentiation module of activation function, 212 ... setting register,
214... register for designating the type of activation function,
216 ... register for specifying the coefficient of the activation function

Claims (7)

複数種類の活性化関数について、前記活性化関数を用いた演算を行う活性化関数回路(208)を有する演算ユニット(206)と、
スレッドに対応付けて前記活性化関数の種類の指定を記憶するレジスタ(214)と、
を備え
前記演算ユニットに対して送信されるスレッドの命令コードにおいて前記活性化関数の種類が指定されている場合には、前記演算ユニットは、前記レジスタでの指定にかかわらず、前記命令コードで指定された前記活性化関数を用いて演算を行う、
ニューラルネットワークの演算装置(116)。
A calculation unit (206) having an activation function circuit (208) for performing calculations using the activation functions for a plurality of types of activation functions;
a register (214) for storing designation of the type of activation function in association with a thread;
with
When the type of the activation function is specified in the instruction code of the thread sent to the operation unit, the operation unit is activated by the instruction code specified in the instruction code regardless of the specification in the register. performing an operation using the activation function;
A computing unit (116) of a neural network.
前記演算ユニットに対して送信されるスレッドの命令コードにおいて前記活性化関数の種類の指定として予め定められた所定値が指定されている場合、前記演算ユニットは、前記レジスタにて前記スレッドに対応付けて指定された前記活性化関数を用いて演算を行う請求項1に記載のニューラルネットワークの演算装置。 When a predetermined value is specified as the specification of the type of the activation function in the instruction code of the thread sent to the arithmetic unit, the arithmetic unit associates the thread with the register. 2. A computation device for a neural network according to claim 1, wherein computation is performed using the activation function designated by . スレッドに対応付けて前記活性化関数の係数の指定を記憶するレジスタ(216)をさらに備える請求項1又は2に記載のニューラルネットワークの演算装置。 3. The neural network operation device according to claim 1 , further comprising a register (216) for storing the designation of the coefficient of the activation function in association with the thread. 前記演算ユニットに対して送信されるスレッドの命令コードにおいて前記活性化関数の係数の指定として予め定められた所定値が指定されている場合、前記演算ユニットは、前記レジスタにて前記スレッドに対応付けて指定された前記活性化関数の係数を用いて演算を行う請求項に記載のニューラルネットワークの演算装置。 When a predetermined value is specified as a coefficient of the activation function in the instruction code of the thread sent to the arithmetic unit, the arithmetic unit associates the thread with the register. 4. The neural network operation device according to claim 3 , wherein the operation is performed using the coefficients of the activation function designated by . 複数種類の活性化関数について、前記活性化関数を用いた演算を行う活性化関数回路(208)を有する演算ユニット(206)と、
スレッドに対応付けて前記活性化関数の種類の指定を記憶するレジスタ(214)と、
スレッドに対応付けて前記活性化関数の係数の指定を記憶するレジスタ(216)と、
を備え、
前記演算ユニットに対して送信されるスレッドの命令コードにおいて前記活性化関数の係数が指定されている場合には、前記演算ユニットは、前記レジスタでの指定にかかわらず、前記命令コードで指定された前記活性化関数の係数を用いて演算を行うニューラルネットワークの演算装置。
A calculation unit (206) having an activation function circuit (208) for performing calculations using the activation functions for a plurality of types of activation functions;
a register (214) for storing designation of the type of activation function in association with a thread;
a register (216) for storing designation of coefficients of the activation function in association with threads;
with
When the coefficient of the activation function is specified in the instruction code of the thread sent to the operation unit, the operation unit receives the coefficient specified in the instruction code regardless of the specification in the register. A computation device for a neural network , which performs computation using the coefficients of the activation function.
複数種類の前記活性化関数回路のうちの少なくとも1つの前記活性化関数回路は、複数のデータを並行してベクトル演算する請求項1からのいずれかに記載のニューラルネットワークの演算装置。 6. The neural network operation device according to claim 1, wherein at least one of the plurality of types of activation function circuits performs vector operations on a plurality of data in parallel. 前記演算ユニットは、複数種類の前記活性化関数のそれぞれの微分関数を演算する複数種類の活性化関数の微分関数回路(210)をさらに備え、
前記活性化関数と前記活性化関数の微分関数とを用いて演算を行う請求項1からのいずれかに記載のニューラルネットワークの演算装置。
The arithmetic unit further comprises a differential function circuit (210) for a plurality of types of activation functions for computing respective differential functions of the plurality of types of activation functions,
7. The neural network computing device according to claim 1, wherein computation is performed using said activation function and a differential function of said activation function.
JP2019056641A 2019-03-25 2019-03-25 Arithmetic unit of neural network Active JP7316073B2 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2019056641A JP7316073B2 (en) 2019-03-25 2019-03-25 Arithmetic unit of neural network
PCT/JP2020/013224 WO2020196586A1 (en) 2019-03-25 2020-03-25 Neural network computation device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2019056641A JP7316073B2 (en) 2019-03-25 2019-03-25 Arithmetic unit of neural network

Publications (2)

Publication Number Publication Date
JP2020160564A JP2020160564A (en) 2020-10-01
JP7316073B2 true JP7316073B2 (en) 2023-07-27

Family

ID=72609838

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2019056641A Active JP7316073B2 (en) 2019-03-25 2019-03-25 Arithmetic unit of neural network

Country Status (2)

Country Link
JP (1) JP7316073B2 (en)
WO (1) WO2020196586A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020077215A1 (en) * 2018-10-11 2020-04-16 Google Llc Temporal coding in leaky spiking neural networks
JP7699791B2 (en) * 2020-11-24 2025-06-30 公立大学法人会津大学 AI processor
JP6942900B1 (en) * 2021-04-12 2021-09-29 望 窪田 Information processing equipment, information processing methods and programs
JP7801900B2 (en) 2022-01-28 2026-01-19 キヤノン株式会社 Information processing device, imaging device, method, and program
CN115358178B (en) * 2022-08-11 2023-04-07 山东大学 Circuit yield analysis method based on fusion neural network

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011504274A (en) 2007-11-19 2011-02-03 クゥアルコム・インコーポレイテッド Selective exclusion of bus access requests
JP2019003547A (en) 2017-06-19 2019-01-10 株式会社デンソー Method for training artificial neural network circuit, training program, and training device
US20190042922A1 (en) 2018-06-29 2019-02-07 Kamlesh Pillai Deep neural network architecture using piecewise linear approximation

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011504274A (en) 2007-11-19 2011-02-03 クゥアルコム・インコーポレイテッド Selective exclusion of bus access requests
JP2019003547A (en) 2017-06-19 2019-01-10 株式会社デンソー Method for training artificial neural network circuit, training program, and training device
US20190042922A1 (en) 2018-06-29 2019-02-07 Kamlesh Pillai Deep neural network architecture using piecewise linear approximation

Also Published As

Publication number Publication date
WO2020196586A1 (en) 2020-10-01
JP2020160564A (en) 2020-10-01

Similar Documents

Publication Publication Date Title
JP7316073B2 (en) Arithmetic unit of neural network
CN109522254B (en) Arithmetic device and method
KR102413832B1 (en) vector multiply add instruction
US10261796B2 (en) Processor and method for executing in-memory copy instructions indicating on-chip or off-chip memory
CN108780395B (en) Vector prediction instruction
CN109074256B (en) Apparatus and method for managing address conflicts when performing vector operations
CN112199119B (en) Vector operation device
JP6874262B2 (en) Vector operand Bit size control
JP7410186B2 (en) Explicit individual mask register mask operation method in GPU
US11416261B2 (en) Group load register of a graph streaming processor
CN107291666A (en) A kind of data processing method and processing unit
US7529917B2 (en) Method and apparatus for interrupt handling during loop processing in reconfigurable coarse grained array
US20210042123A1 (en) Reducing Operations of Sum-Of-Multiply-Accumulate (SOMAC) Instructions
JP2024523790A5 (en)
CN114218152A (en) Stream processing method, processing circuit and electronic device
KR100206350B1 (en) Central processor
CN103176835A (en) Circuit arrangement for execution planning in a data processing system
JP7490766B2 (en) Arithmetic logic register ordering
KR20200121788A (en) Processor architectures
JP7456437B2 (en) processor and program
KR100974939B1 (en) Dual phase sim processor with variable length instruction set
US20260050571A1 (en) Quantization prediction for block data
US20260086718A1 (en) Systems and methods for providing extended memory access in a parallel processor
US20260003809A1 (en) Preemption of direct memory access processing for context switch
JPS63214804A (en) Processor for plc and plc

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20211029

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20230110

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20230301

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20230620

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20230714

R150 Certificate of patent or registration of utility model

Ref document number: 7316073

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313115

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350