JP2021043495A - Information processing program and information processing method - Google Patents
Information processing program and information processing method Download PDFInfo
- Publication number
- JP2021043495A JP2021043495A JP2019162722A JP2019162722A JP2021043495A JP 2021043495 A JP2021043495 A JP 2021043495A JP 2019162722 A JP2019162722 A JP 2019162722A JP 2019162722 A JP2019162722 A JP 2019162722A JP 2021043495 A JP2021043495 A JP 2021043495A
- Authority
- JP
- Japan
- Prior art keywords
- memory
- size
- memory area
- data
- learning
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Landscapes
- Memory System (AREA)
Abstract
【課題】任意のバッチサイズを指定してニューラルネットワークの学習を実行する。【解決手段】情報処理プログラムは、ニューラルネットワークの学習対象の層の学習に使用する学習データのサイズと入力されたバッチサイズとに基づいて、処理するバッチサイズが異なる複数の処理命令の中からプロセッサに実行させる処理命令を選択し、学習データのサイズと選択した処理命令で指定されるバッチサイズとに基づいて、学習対象の層の学習に使用するメモリサイズを算出し、学習データを保持するメモリの第1のメモリ領域のメモリサイズが、算出したメモリサイズと一致しない場合、算出したメモリサイズを有する第2のメモリ領域をメモリに確保して学習データを転送し、第2のメモリ領域に転送した学習データを使用して、選択した処理命令をプロセッサに実行させる、処理を情報処理装置に実行させる。【選択図】図9PROBLEM TO BE SOLVED: To execute training of a neural network by designating an arbitrary batch size. An information processing program is a processor from a plurality of processing instructions having different batch sizes to be processed based on the size of training data used for training the layer to be trained in a neural network and the input batch size. Selects the processing instruction to be executed, calculates the memory size used for training the layer to be trained based on the size of the training data and the batch size specified by the selected processing instruction, and holds the training data. If the memory size of the first memory area does not match the calculated memory size, a second memory area having the calculated memory size is secured in the memory, the training data is transferred, and the data is transferred to the second memory area. Using the learned data, the processor is made to execute the selected processing instruction, and the information processing device is made to execute the processing. [Selection diagram] FIG. 9
Description
本発明は、情報処理プログラムおよび情報処理方法に関する。 The present invention relates to an information processing program and an information processing method.
ディープラーニングでは、数十万から数百万以上の学習データを使用して、ディープニューラルネットワークの各層のパラメータを適切な値に変更していく。ディープラーニングの計算では、積和演算が多用されるため、積和演算の実行効率を向上することでディープラーニングの計算時間は早くなる。 In deep learning, hundreds of thousands to millions or more of training data are used to change the parameters of each layer of the deep neural network to appropriate values. Since the product-sum calculation is often used in the deep learning calculation, the calculation time of the deep learning is shortened by improving the execution efficiency of the product-sum calculation.
このため、CPU(Central Processing Unit)に比べて積和演算の実行効率が高いGPU(Graphics Processing Unit)が、ディープラーニングに広く使われている。また、ディープラーニングの産業利用が広まるにつれて、ディープラーニングの演算に特化したディープラーニング用の専用プロセッサが開発されている。 For this reason, GPUs (Graphics Processing Units), which have higher execution efficiency of multiply-accumulate operations than CPUs (Central Processing Units), are widely used for deep learning. In addition, as the industrial use of deep learning has become widespread, dedicated processors for deep learning have been developed that specialize in deep learning calculations.
例えば、ディープラーニングに使用されるプロセッサは、演算器を含む複数の演算コアと、各演算コアで使用される固有メモリと、所定数の演算コアで共有される共有メモリと、演算コアによる演算の実行を制御する制御部とを有し、メインメモリに接続される。そして、各演算コアは、制御部による制御に基づいて、メインメモリから固有メモリまたは共有メモリに転送されるデータの演算を実行する。 For example, a processor used for deep learning includes a plurality of arithmetic cores including an arithmetic unit, a unique memory used by each arithmetic core, a shared memory shared by a predetermined number of arithmetic cores, and an arithmetic core. It has a control unit that controls execution and is connected to the main memory. Then, each arithmetic core executes an arithmetic of data transferred from the main memory to the private memory or the shared memory based on the control by the control unit.
例えば、プロセッサで処理するデータブロックには、データブロックの分割に関する割当属性と、データブロックを分割したサブブロックとともに転送する周辺データを示す余白属性と、サブブロック間の依存関係を示す依存属性とが設定される。そして、制御部は、演算コアで順次実行されるプログラムである第1および第2のカーネルの割当属性が一致する場合、第1のカーネルの実行結果をローカルメモリからグローバルメモリに転送せずに第2のカーネルで使用させることで、処理効率を向上させる。この際、制御部は、第1のカーネルで使用するデータブロックの余白属性および依存属性に、第2のカーネルで使用するデータブロックに設定された余白属性および依存属性をそれぞれ論理和加算する(例えば、特許文献1参照)。 For example, the data block processed by the processor has an allocation attribute related to the division of the data block, a margin attribute indicating the peripheral data to be transferred together with the divided subblocks of the data block, and a dependency attribute indicating the dependency between the subblocks. Set. Then, when the allocation attributes of the first and second kernels, which are programs executed sequentially in the arithmetic core, match, the control unit does not transfer the execution result of the first kernel from the local memory to the global memory. By using it in the kernel of 2, the processing efficiency is improved. At this time, the control unit logically adds the margin attributes and the dependency attributes set in the data block used in the second kernel to the margin attributes and the dependency attributes of the data block used in the first kernel (for example). , Patent Document 1).
また、固有メモリに対応して設けられるメモリ制御回路に、共有メモリ間でのデータの転送機能を設けることで、演算コアで共通に使用される画像データをメインメモリにアクセスすることなく読み出せるため、処理効率が向上する(例えば、特許文献2参照)。 In addition, by providing a data transfer function between shared memories in the memory control circuit provided corresponding to the unique memory, the image data commonly used in the arithmetic core can be read without accessing the main memory. , Processing efficiency is improved (see, for example, Patent Document 2).
例えば、ディープニューラルネットワークに含まれる層は、畳み込み層、プーリング層、全結合層または出力層等があり、層の種類は限られており、各層での処理内容とは限られている。このため、各層の処理内容に応じて演算器が実行する演算命令を組み合わせた処理命令が用意される場合がある。 For example, the layers included in the deep neural network include a convolution layer, a pooling layer, a fully connected layer, an output layer, and the like, and the types of layers are limited, and the processing contents of each layer are limited. Therefore, a processing instruction that combines arithmetic instructions executed by the arithmetic unit may be prepared according to the processing content of each layer.
また、ディープラーニングでは、バッチに含まれる学習データを複数に分割してミニバッチを作成し、ミニバッチ単位で学習を実行することが多い。このため、ディープニューラルネットワークに学習データを与える回数であるバッチサイズを特定した複数の処理命令を用意することで、ディープラーニングの演算効率は向上する。 Further, in deep learning, learning data included in a batch is often divided into a plurality of parts to create a mini-batch, and learning is executed in units of mini-batch. Therefore, the calculation efficiency of deep learning is improved by preparing a plurality of processing instructions that specify the batch size, which is the number of times that training data is given to the deep neural network.
しかしながら、この場合、処理命令で指定されるバッチサイズ以外のバッチサイズをユーザが指定した場合、エラーが発生して処理命令が実行されない不具合が発生する。処理命令で指定されるバッチサイズをユーザに公開する場合、エラーの発生は抑止できるが、ユーザは任意のバッチサイズを選択できないため、学習の自由度が狭まってしまう。一方、ユーザが指定可能な全てのバッチサイズに対応する多数の処理命令を用意することは現実的でない。 However, in this case, if the user specifies a batch size other than the batch size specified by the processing instruction, an error occurs and the processing instruction is not executed. When the batch size specified by the processing instruction is disclosed to the user, the occurrence of an error can be suppressed, but since the user cannot select an arbitrary batch size, the degree of freedom in learning is narrowed. On the other hand, it is not realistic to prepare a large number of processing instructions corresponding to all batch sizes that can be specified by the user.
1つの側面では、本発明は、任意のバッチサイズを指定してニューラルネットワークの学習を実行することを目的とする。 In one aspect, the present invention aims to perform neural network learning by specifying an arbitrary batch size.
一つの観点によれば、情報処理プログラムは、演算器と該演算器で使用するデータを保持するメモリとを含む1以上の演算部を有するプロセッサが実行する複数の層を含むニューラルネットワークの学習を制御する情報処理プログラムであって、学習対象の層の学習に使用する学習データのサイズと入力されたバッチサイズとに基づいて、処理するバッチサイズが異なる複数の処理命令の中から前記プロセッサに実行させる処理命令を選択し、前記学習データのサイズと選択した処理命令で指定されるバッチサイズとに基づいて、学習対象の層の学習に使用するメモリサイズを算出し、前記学習データを保持する前記メモリの第1のメモリ領域のメモリサイズが、算出したメモリサイズと一致しない場合、前記算出したメモリサイズを有する第2のメモリ領域を前記メモリに確保して前記学習データを転送し、前記第2のメモリ領域に転送した前記学習データを使用して、前記選択した処理命令を前記プロセッサに実行させる、処理を情報処理装置に実行させる。 According to one aspect, the information processing program learns a neural network including multiple layers executed by a processor having one or more arithmetic units including an arithmetic unit and a memory for holding data used in the arithmetic unit. An information processing program to be controlled, which is executed by the processor from a plurality of processing instructions having different batch sizes to be processed based on the size of training data used for learning the layer to be learned and the input batch size. The processing instruction to be processed is selected, the memory size used for learning the layer to be learned is calculated based on the size of the training data and the batch size specified by the selected processing instruction, and the training data is held. When the memory size of the first memory area of the memory does not match the calculated memory size, a second memory area having the calculated memory size is secured in the memory, the learning data is transferred, and the second memory area is transferred. Using the learning data transferred to the memory area of the above, the processor is made to execute the selected processing instruction, and the information processing apparatus is made to execute the processing.
1つの側面では、本発明は、任意のバッチサイズを指定してニューラルネットワークの学習を実行することができる。 In one aspect, the present invention allows the training of neural networks to be performed by specifying any batch size.
以下、図面を用いて実施形態が説明される。 Hereinafter, embodiments will be described with reference to the drawings.
図1は、一実施形態における情報処理装置の一例を示す。図1に示す情報処理装置100は、例えば、サーバであり、ホストCPU200、ホストメモリ300、I/O(Input/Output)コントローラ220およびディープラーニング(DL)用のプロセッサ500を有する。ホストCPU200は、バスを介してホストメモリ300に接続され、I/Oコントローラ220を介してプロセッサ500に接続される。例えば、ホストCPU200、ホストメモリ300、I/Oコントローラ220およびプロセッサ500は、システム基板に搭載される。例えば、ホストメモリ300は、システム基板に搭載されるメモリモジュールである。
FIG. 1 shows an example of an information processing device according to an embodiment. The
ホストCPU200は、ホストメモリ300に格納された各種プログラムを実行することで、情報処理装置100の全体の動作を制御するとともに、プロセッサ500の動作を制御し、学習データを用いてニューラルネットワークの学習を実行する。各種プログラムにはオペレーティングシステムも含まれる。
The
なお、情報処理装置100は、システム基板に接続される図示しない入力装置(キーボードやマウス)、出力装置(モニタやプリンタ)および外部記憶装置(HDD(Hard Disk Drive)やSDD(Solid State Drive))を有してもよい。また、情報処理装置100Aは、イントラネットやインターネット等のネットワークに接続されてもよく、ネットワークを介して複数の情報処理装置100Aが相互に接続されてもよい。
The
ホストメモリ300には、ユーザ定義ファイル310と、ニューラルネットワーク(NN)に演算を実行させるためのホストプログラム400とが格納される。ユーザ定義ファイル310は、ニューラルネットワークを定義した構成情報を含むファイル311と、学習データのファイル312とを含む。ファイル311、312は、ユーザにより準備される。以下では、ファイル311に含まれるニューラルネットワークの構成情報をニューラルネットワーク311とも称し、ファイル312に含まれる学習データを学習データ312とも称する。特に断らない限り、学習データ312は、ニューラルネットワークに含まれる複数の層のうち、学習対象の層の学習に使用される学習データを示す。
The
ホストプログラム400は、ホストCPU200に実行されることで、選択部401、算出部402、判定部403、転送部404および処理命令実行部405として機能する。ホストプログラム400に含まれる処理命令のファイル406は、プロセッサ500が実行する複数の処理命令を含んでおり、ニューラルネットワーク311の学習の実行時にプロセッサ500に転送され、プロセッサ500により実行される。例えば、処理命令は、ニューラルネットワークに含まれる畳み込み層の演算を実行する畳み込み演算用の処理命令、プーリング層の演算を実行するプーリング演算用の処理命令、加算命令および行列積演算命令等を含む。
When executed by the
プロセッサ500は、複数の演算器520とメモリ530とを各々含む複数の演算コア510を有する。メモリ530は、メモリ530とともに演算コア510に搭載される演算器520のみに使用される。演算コア510は、演算部の一例である。演算コア510は、ホストCPU200からの指示に基づいて、処理命令を並列に実行する。なお、各メモリ530は、各演算コア510に専用に使用されるメモリとして、各演算コア510の外部に設けられてもよい。複数の演算器520は、積和演算器、加算器または行列積演算器等である。
The
ホストCPU200が、ホストプログラム400を実行してニューラルネットワークの学習を実行する場合、選択部401、算出部402、判定部403、転送部404および処理命令実行部405は、次のように機能する。以下では、ニューラルネットワークの層毎の学習について説明するが、各層の学習を順次実行することで、ニューラルネットワークの学習を実行することができる。また、ニューラルネットワークの入力側の層から学習を順次実行することで、順伝播処理を実行することができ、ニューラルネットワークの出力側の層から学習を順次実行することで、逆伝播処理を実行することができる。
When the
選択部401は、ニューラルネットワークにおいて、学習対象の層の学習に使用する学習データのサイズをユーザ定義ファイル310から取得する。選択部401は、取得した学習データのサイズと、情報処理装置100に入力されたバッチサイズとに基づいて、ファイル406内の複数の処理命令の中からプロセッサ500に実行させる処理命令を選択する。図5で説明するように、バッチサイズが異なる複数の処理命令が、演算の種類(畳み込み演算やプーリング演算等)毎に用意され、ファイル406に予め格納される。例えば、情報処理装置100に入力されるバッチサイズは、ユーザにより指定される任意のバッチサイズである。
The
算出部402は、選択部401が取得した学習対象の層の学習データのサイズと、選択部401が選択した処理命令で指定されるバッチサイズとに基づいて、学習対象の層の学習に使用するメモリ530のメモリサイズを算出する。ここで、処理命令で指定されるバッチサイズは、処理命令毎に処理する固定のバッチサイズであり、情報処理装置100に入力されたユーザ指定のバッチサイズが、処理命令で指定されるバッチサイズと一致するとは限らない。
The
学習対象の層の学習を開始する前に、演算コア510のメモリ530には、層への入力データおよび層からの出力データを格納するメモリ領域(第1のメモリ領域)が割り当てられる。また、入力データ用のメモリ領域には、学習に使用する入力データ(学習デーが)が格納される。なお、2層目以降の層では、1つ前の層の演算により出力された出力データが学習対象の層の入力データとしてメモリ領域(第1のメモリ領域)に保持される。
Before starting the learning of the layer to be learned, the
判定部403は、学習データを保持するメモリ530の第1のメモリ領域のメモリサイズが、算出部402が算出したメモリサイズと一致するか否かを判定する。すなわち、判定部403は、学習データのサイズとユーザ指定のバッチサイズとにから求まるメモリサイズと、学習データのサイズと処理命令に依存するバッチサイズとから求まるメモリサイズとの一致/不一致を判定する。
The
メモリサイズが一致する場合、第1のメモリ領域に保持された学習データ(入力データ)を使用して学習を実行できるが、メモリサイズが一致しない場合、演算実行時にエラーが発生するため、学習を実行できない。なお、判定部403は、ニューラルネットワークの各層に対して入力または出力されるテンソルデータ毎にメモリサイズの一致/不一致を判定する。
If the memory sizes match, learning can be executed using the learning data (input data) held in the first memory area, but if the memory sizes do not match, an error will occur during calculation execution, so learning will be performed. Cannot be executed. The
転送部404は、判定部403がメモリサイズの不一致を判定した場合、不一致を判定したテンソルデータに対応して算出部402が算出したメモリサイズのメモリ領域(第2のメモリ領域)をメモリ530に新たに確保する。転送部404は、新たに確保した第2のメモリ領域に、学習対象の層で学習する学習データ(入力データ)を転送する。新たに確保した第2のメモリ領域に学習データが転送された場合、第1のメモリ領域に保持された学習データは、使用禁止または無効にされ、あるいは破棄される。
When the
そして、処理命令実行部405は、有効なメモリ領域(第1のメモリ領域または第2のメモリ領域)に保持された学習データを使用して、選択部401が選択した処理命令をプロセッサ500に実行させることで、ニューラルネットワークの学習を実行する。
Then, the processing
この実施形態では、情報処理装置100に入力されたバッチサイズが、学習を実行する処理命令で指定されるバッチサイズと異なる場合にも、処理命令の実行に使用するメモリサイズに合わせてメモリ領域を確保することができる。この結果、任意のバッチサイズが情報処理装置100に入力された場合にも、エラーを発生させることなく学習を実行することができる。
In this embodiment, even when the batch size input to the
図2は、図1の情報処理装置100がニューラルネットワークの学習を実行する場合の動作の一例を示す。図2に示す動作は、ホストCPU200がホストプログラム400を実行することにより実現される。すなわち、図2は、情報処理プログラムおよび情報処理方法の一例を示す。
FIG. 2 shows an example of the operation when the
例えば、図2に示す動作は、ニューラルネットワークの学習を実行する指示を情報処理装置100が受けたことに基づいて開始される。なお、図2に示す動作は、順伝播処理および逆伝播処理において、ニューラルネットワークに含まれる複数の層の各々に対応して実行される。
For example, the operation shown in FIG. 2 is started based on the fact that the
まず、ステップS1において、選択部401は、学習データのサイズと、情報処理装置100に入力されたバッチサイズとに基づいて、複数の処理命令の中からプロセッサ500に実行させる処理命令を選択する。
First, in step S1, the
次に、ステップS2において、算出部402は、学習データのサイズと、選択部401が選択した処理命令で指定されるバッチサイズとに基づいて、学習に使用するメモリ530のメモリサイズを算出する。
Next, in step S2, the
次に、ステップS3において、判定部403は、学習データを保持するメモリ530の第1のメモリ領域のメモリサイズが、算出部402が算出したメモリサイズと一致するか否かを判定する。メモリサイズが一致する場合、処理はステップS5に移行され、メモリサイズが一致しない場合、処理はステップS4に移行される。
Next, in step S3, the
ステップS4において、転送部404は、算出部402が算出したメモリサイズのメモリ領域(第2のメモリ領域)をメモリ530に新たに確保し、確保した第2のメモリ領域に、学習データを転送し、処理をステップS5に移行する。
In step S4, the
ステップS5において、処理命令実行部405は、有効なメモリ領域(第1のメモリ領域または第2のメモリ領域)に保持された学習データを使用して、選択部401が選択した処理命令をプロセッサ500に実行させる。そして、プロセッサ500が処理命令で指示される演算を実行することで、ニューラルネットワークにおける学習対象の層の学習が実行される。
In step S5, the processing
以上、図1および図2に示す実施形態では、情報処理装置100に入力されたバッチサイズが、学習を実行する処理命令で指定されるバッチサイズと異なる場合にも、処理命令の実行に使用するメモリサイズに合わせてメモリ領域を確保することができる。この結果、任意のバッチサイズが指定された場合にも、エラーを発生させることなく学習を実行することができる。
As described above, in the embodiment shown in FIGS. 1 and 2, even when the batch size input to the
図3は、別の実施形態における情報処理装置の一例を示す。図1と同様の要素については、同じ符号を付し、詳細な説明は省略する。図3に示す情報処理装置100Aは、例えば、サーバであり、図1の情報処理装置100と同様の構成を有する。
FIG. 3 shows an example of an information processing device according to another embodiment. The same elements as those in FIG. 1 are designated by the same reference numerals, and detailed description thereof will be omitted. The
ホストメモリ300には、ユーザ定義ファイル310と、ニューラルネットワーク(NN)に演算を実行させるためのホストプログラム400Aが格納される。ユーザ定義ファイル310は、図1と同様に、ニューラルネットワークを定義した構成情報を含むファイル311と、学習データのファイル312とを含む。
The
ホストプログラム400Aは、ホストCPU200に実行されることで、演算種決定部411、データサイズ変更部412、変換/転送指示部414、情報管理部421および処理命令実行部432として機能する。演算種決定部411、データサイズ変更部412、変換/転送指示部414、情報管理部421および処理命令実行部432の機能については、図8に示す動作フローで説明する。
When executed by the
例えば、ホストプログラム400Aに含まれる処理命令のファイル423は、プロセッサ500が実行する複数の処理命令を含んでおり、ニューラルネットワーク311の学習の実行時にプロセッサ500に転送され、プロセッサ500により実行される。各処理命令は、プロセッサ500の演算器520が実行する演算命令列を含む。処理命令の種類については、図5で説明する。
For example, the
図4は、ディープニューラルネットワークの概要を示す。図4に示すディープニューラルネットワークは、複数組の畳み込み層/プーリング層と、全結合層とを隠れ層に含むが、他の層を含んでもよい。 FIG. 4 shows an outline of a deep neural network. The deep neural network shown in FIG. 4 includes a plurality of sets of convolution layers / pooling layers and a fully connected layer as hidden layers, but may include other layers.
情報処理装置100Aは、例えば、ミニバッチに含まれる複数の学習データ(入力データ)の各々を入力層に入力し、畳み込み層、プーリング層等の演算を順次実行することで、演算により得られる情報を入力側から出力側に順次伝える順伝播処理を実行する。なお、例えば、畳み込み層は、前の層からのデータ(出力データ)と、学習データとして予め準備された重みデータとが畳み込み演算され、演算により得られた出力データが次の層の入力データとして出力される。
The
ミニバッチによる順伝播処理の実行後、出力データと正解データとの差分(例えば、誤差の二乗和)を小さくするための逆伝播処理が実行される。そして、逆伝播処理の実行に基づいて重み等のパラメータが更新される。複数のミニバッチにおいて、順伝播処理、逆伝播処理およびパラメータの更新処理を実行することで、徐々に正解率が上がっていき、ディープニューラルネットワークが最適化される。順伝播処理および逆伝播処理における各層の演算は、演算コア510が処理命令を実行することで行われる。
After executing the forward propagation process by the mini-batch, the back propagation process for reducing the difference between the output data and the correct answer data (for example, the sum of squares of the errors) is executed. Then, parameters such as weights are updated based on the execution of the back propagation process. By executing forward propagation processing, back propagation processing, and parameter update processing in a plurality of mini-batch, the correct answer rate is gradually increased, and the deep neural network is optimized. The operations of each layer in the forward propagation process and the back propagation process are performed by the
図5は、図3の演算コア510が実行可能な処理命令の仕様情報の一例を示す。この実施形態では、演算の種類毎に1つまたは複数の処理命令が予め準備され、処理命令としてホストメモリ300のファイル423に保持される。なお、図5では、入力データは2つあり(入力1と入力2)、出力データは1つあるとする(出力1)が、入力データと出力データの数は、図5に示す例に限定されない。また、プロセッサ500が実行可能な処理の種類と処理命令の数は、図5に限定されない。
FIG. 5 shows an example of specification information of a processing instruction that can be executed by the
順伝播処理では、各層において、入力層側から入力データが与えられ、出力層側から演算結果が出力される。逆伝播処理では、出力層側(順伝播処理での出力側)から入力が与えられ、入力層側(順伝播処理での入力側)から演算結果が出力される。 In the forward propagation process, input data is given from the input layer side in each layer, and the calculation result is output from the output layer side. In the back propagation process, an input is given from the output layer side (output side in the forward propagation process), and the calculation result is output from the input layer side (input side in the forward propagation process).
例えば、畳み込み演算では、4種類の処理命令Conv1、Conv2、Conv3、Conv4が使用可能である。処理命令Conv1−Conv4は、対応バッチ数と、入力1、入力2、出力1の配置パターン(分散型またはコピー型)とにより使い分けられる。
For example, in the convolution operation, four types of processing instructions Conv1, Conv2, Conv3, and Conv4 can be used. The processing instructions Conv1-Conv4 are used properly according to the number of corresponding batches and the arrangement pattern (distributed type or copy type) of the
要素毎の加算では、1種類の処理命令Add1が使用可能である。処理命令Add1は、任意のバッチ数で使用可能であり、入力1、入力2、出力1のデータ配置は、全て分散型である。
One type of processing instruction Add1 can be used for element-by-element addition. The processing instruction Add1 can be used in any number of batches, and the data arrangements of the
行列積では、2種類の処理命令Gemm1、Gemm2が使用可能である。処理命令Gemm1、Gemm2は、任意のバッチ数で使用可能であり、入力1/入力2の一方が分散型、入力1/入力2の他方がコピー型であり、出力1は分散型である。
In matrix multiplication, two types of processing instructions Gemm1 and Gemm2 can be used. The processing instructions Gemm1 and Gemm2 can be used in any number of batches, one of the
図6は、図3の情報処理装置において、ニューラルネットワークの各層の学習に使用される入出力データのデータ構造と、処理命令に関係するデータ構造との一例を示す説明図である。図6は、入力テンソルデータが2つで、出力テンソルデータが1つの層の入出力データのデータ構造を示す。 FIG. 6 is an explanatory diagram showing an example of a data structure of input / output data used for learning each layer of the neural network and a data structure related to a processing instruction in the information processing apparatus of FIG. FIG. 6 shows a data structure of input / output data in a layer having two input tensor data and one output tensor data.
入出力データのデータ構造は、ニューラルネットワークの各層に対して入力または出力されるテンソルデータ毎に定められる。各テンソルデータは、各層に対して入力または出力される入出力データ以外に、各次元の要素数と、メモリサイズと、配置パターンとの情報を有する。例えば、画像認識用のニューラルネットワークの学習において、入力画像データの次元は、バッチサイズN、色C、横の画素数W、縦の画素数Hの4つであり、次元毎に要素数が設定される。一例として、各次元の要素数が、バッチサイズN=32、色C=3(カラー画像)、画素数W=10、画素数H=10であり、データが単精度(4バイト)の浮動小数点数であるとする。 The data structure of the input / output data is determined for each tensor data input or output for each layer of the neural network. Each tensor data has information on the number of elements in each dimension, the memory size, and the arrangement pattern, in addition to the input / output data input or output to each layer. For example, in learning a neural network for image recognition, there are four dimensions of input image data: batch size N, color C, number of horizontal pixels W, and number of vertical pixels H, and the number of elements is set for each dimension. Will be done. As an example, the number of elements in each dimension is batch size N = 32, color C = 3 (color image), number of pixels W = 10, number of pixels H = 10, and the data is single precision (4 bytes) floating point. Suppose it is a number.
この場合、テンソルデータサイズは、38400バイトとなり、テンソルデータを格納するメモリ530のメモリ領域のメモリサイズは38400バイト以上に設定される。各テンソルデータサイズは、各次元の要素数の積と1データ当たりのバイト数とを乗じることで算出される。配置パターンは、各テンソルデータを複数のメモリ530に分散して格納する分散型と、各テンソルデータを複数のメモリ530にそれぞれ格納するコピー型とのいずれかである。配置パターンの例は、図7で説明する。
In this case, the tensor data size is 38,400 bytes, and the memory size of the memory area of the
入力テンソルデータの数および出力テンソルデータの数は、演算の種類によって決まる。処理命令に関するデータ構造は、処理命令で使用するメモリサイズと、処理命令で使用する配置パターンとを有する。処理命令で使用するメモリサイズは、処理命令で指定されるバッチサイズと、学習対象の層の学習に使用するデータのサイズとに基づいて設定される。なお、処理命令による処理では、1つ以上のテンソルデータが入力されると、1つ以上のテンソルデータが出力される。 The number of input tensor data and the number of output tensor data are determined by the type of operation. The data structure related to the processing instruction has a memory size used in the processing instruction and an arrangement pattern used in the processing instruction. The memory size used in the processing instruction is set based on the batch size specified in the processing instruction and the size of the data used for learning the layer to be learned. In the processing by the processing instruction, when one or more tensor data is input, one or more tensor data is output.
図7は、図6の配置パターンの一例を示す。説明を分かりやすくするため、図7に示す例では、テンソルデータがデータD1、D2、D3、D4を含むものとする。配置パターンが分散型の場合、データD1−D4は、各演算コア510のメモリ530に分散して配置される。一方、配置パターンがコピー型の場合、データD1−D4が各演算コア510のメモリ530にそれぞれ配置される。コピー型は、重複型の一例である。
FIG. 7 shows an example of the arrangement pattern of FIG. In the example shown in FIG. 7, it is assumed that the tensor data includes the data D1, D2, D3, and D4 for the sake of clarity. When the arrangement pattern is a distributed type, the data D1-D4 are distributed and arranged in the
図8は、図3の情報処理装置100Aがニューラルネットワークの学習を実行する場合の動作の一例を示す。図6に示す動作は、図3のホストCPU200がホストプログラム400Aを実行することにより実現される。すなわち、図6は、情報処理プログラムおよび情報処理方法の一例を示す。
FIG. 8 shows an example of the operation when the
例えば、図8に示す動作は、ニューラルネットワークの学習を実行する指示を情報処理装置100Aが受けたことに基づいて開始される。なお、図8に示す動作は、順伝播処理および逆伝播処理において、ニューラルネットワークに含まれる複数の層の各々に対応して実行される。
For example, the operation shown in FIG. 8 is started based on the fact that the
まず、ステップS10において、図3の演算種決定部411は、ユーザ定義ファイル310中のニューラルネットワークにおける学習対象の層の構成情報等の仕様に基づいて、演算種を決定する。例えば、学習対象の層が畳み込み層の場合、"畳み込み"が演算種に決定される。演算種は、学習対象の層の学習に使用する演算方式の一例である。
First, in step S10, the calculation
次に、ステップS12において、変換/転送指示部414は、ユーザにより指定されたバッチサイズと、ニューラルネットワークにおける学習対象の層の仕様と、学習データとに基づいて、各メモリ530において、演算に使用するメモリ領域を確保する。ここで、学習対象の層の仕様と学習データとして、入出力データの配置パターン(分散型/コピー型)と、演算に使用するデータサイズとが使用され、メモリ領域(第1のメモリ領域)が確保される。そして、変換/転送指示部414は、配置パターンにしたがって、各メモリ530に確保したメモリ領域に、演算に使用する学習データ(ユーザにより指定されたバッチサイズ分のデータ)を転送する。
Next, in step S12, the conversion /
なお、ニューラルネットワークの学習(順伝播処理または逆伝播処理のいずれか)において、2層目以降の処理では、前の層の演算により得られた出力データが入力データとして使用される。また、前の層の演算により得られた出力データの配置パターンが、演算対象の層の入力データの配置パターンとして使用される。このため、2層目以降の各層の学習では、ステップS12によるメモリ領域の確保とデータ転送は実行されなくてもよい。 In the learning of the neural network (either forward propagation processing or back propagation processing), in the processing of the second and subsequent layers, the output data obtained by the calculation of the previous layer is used as the input data. Further, the arrangement pattern of the output data obtained by the calculation of the previous layer is used as the arrangement pattern of the input data of the layer to be calculated. Therefore, in the learning of each layer after the second layer, it is not necessary to secure the memory area and transfer the data in step S12.
次に、ステップS14において、情報管理部421は、ステップS10で決定した演算種と、ユーザにより指定されたバッチサイズと、演算に使用する学習データのサイズとに基づいて、演算対象の層で実行するための処理命令を選択する。ここで、2層目以降の各層の処理では、前の層の演算により得られた出力データのサイズを含めたメモリサイズに基づいて、処理命令が選択される。
Next, in step S14, the
次に、ステップS16において、情報管理部421は、例えば、図5に示した情報に基づいて、ステップS14で選択した処理命令に対応するデータの配置パターンを求める。また、情報管理部421は、ステップS14で選択した処理命令で指定される処理命令固有のバッチサイズおよび配置パターンと、学習データのサイズとに基づいて、選択した処理命令で使用するメモリサイズとを算出する。
Next, in step S16, the
次に、ステップS20において、データサイズ変更部412は、ステップS16で算出したメモリサイズ(選択した処理命令で指定されるバッチサイズに依存する)と、ステップS12で確保したメモリ領域のメモリサイズとの一致/不一致を判定する。なお、2層目以降の処理では、前の層の演算により得られた出力データのサイズを含めたメモリサイズが、ステップS16で算出したメモリサイズと比較される。メモリサイズが一致する場合、処理はステップS24に移行し、メモリサイズが不一致の場合、処理はステップS22に移行する。
Next, in step S20, the data
ステップS22において、データサイズ変更部412は、ステップS12で確保したメモリ領域(第1のメモリ領域)に代えて、ステップS16で算出したメモリサイズに対応するメモリ領域(第2のメモリ領域)を各メモリ530に新たに確保する。すなわち、データサイズ変更部412は、ステップS12で確保した入出力データのメモリサイズを、処理命令の仕様であるメモリサイズに変更する。データサイズ変更部412は、新たに確保したメモリ領域に、演算に使用する学習データ(ユーザにより指定されたバッチサイズ分のデータ)を転送し、処理をステップS24に移行する。
In step S22, the data
なお、新たに確保したメモリ領域のサイズが、演算に使用する学習データのサイズより大きい場合、データサイズ変更部412は、空きのメモリ領域に処理命令による演算の実行に影響を与えないダミーデータを格納してもよい。なお、ステップS12で確保したメモリ領域に保持されているデータは、使用禁止または無効にされ、あるいは破棄される。
When the size of the newly secured memory area is larger than the size of the learning data used for the calculation, the data
ステップS24において、変換/転送指示部414は、ステップS12で使用したデータの配置パターンと、ステップS16で求めたデータの配置パターンとの一致/不一致を判定する。ここで、配置パターンの一致/不一致は、データの種類毎(図5の入力1、入力2、出力1)に判定される。すなわち、ステップS24、S26は、データの種類毎に判定される。配置パターンが一致する場合、処理はステップS28に移行し、配置パターンが不一致の場合、処理はステップS26に移行する。なお、2層目以降の処理では、前の層の演算により得られた出力データの配置パターンを含めた配置パターンが、ステップS16で求めたデータの配置パターンと比較される。
In step S24, the conversion /
ステップS26において、変換/転送指示部414は、ステップS12で確保したメモリ領域(第1のメモリ領域)に代えて、ステップS16で算出したメモリサイズに対応するメモリ領域(第3のメモリ領域)を各メモリ530に新たに確保する。すなわち、変換/転送指示部414は、ステップS12で確保したメモリ領域に対応する配置パターンを処理命令の仕様である配置パターンに変更する。変換/転送指示部414は、新たに確保したメモリ領域に、演算に使用する学習データ(ユーザにより指定されたバッチサイズ分のデータ)を、ステップS16で求めたデータの配置パターンにしたがって転送し、処理をステップS28に移行する。
In step S26, the conversion /
なお、ステップS22、S26の処理は、同時に実行されてもよい。すなわち、メモリサイズが不一致で、配置パターンも不一致の場合、メモリ領域の確保とデータの転送とは、一度に実行される。 The processes of steps S22 and S26 may be executed at the same time. That is, when the memory sizes do not match and the arrangement patterns do not match, the memory area is secured and the data is transferred at the same time.
ステップS28において、処理命令実行部432は、ステップS14で選択された処理命令を各演算コア510に転送し、各演算コア510に処理命令を実行させ、図6に示す処理を終了する。これにより、ニューラルネットワークの1つの層の学習処理が実行される。
In step S28, the processing
図9は、図3の情報処理装置において、ニューラルネットワークの学習対象の層における学習時の動作の一例を示す。例えば、図9は、画像を認識するニューラルネットワークの学習時の動作の一例を示し、各次元の要素数が、バッチサイズN=32、色C=3、画素数W=10、画素数H=10、データが単精度浮動小数点数(4バイト)であるとする。学習対象の層に入力される入力データ(入力テンソルデータ)のサイズは38400バイトであるとする。また、学習対象の層と、学習対象の層の1つ前の層とにおいて、データの配置パターンは、分散型であるとする。以下では、学習対象の層を対象層とも称し、学習対象の層の1つ前の層を前層とも称する。 FIG. 9 shows an example of the operation during learning in the layer to be learned of the neural network in the information processing apparatus of FIG. For example, FIG. 9 shows an example of an operation during learning of a neural network that recognizes an image, and the number of elements in each dimension is batch size N = 32, color C = 3, number of pixels W = 10, number of pixels H =. 10. Assume that the data is a single precision floating point number (4 bytes). It is assumed that the size of the input data (input tensor data) input to the layer to be learned is 38,400 bytes. Further, it is assumed that the data arrangement pattern is distributed in the layer to be learned and the layer immediately before the layer to be learned. Hereinafter, the layer to be learned is also referred to as a target layer, and the layer immediately preceding the layer to be learned is also referred to as a front layer.
図9(a)では、前の層の出力データ(出力テンソルデータ)は、38400バイト(9600×4)であるため、プロセッサ500は、演算結果である出力データを、9600バイトずつ4つのメモリ530に分散して格納する。
In FIG. 9A, since the output data (output tensor data) of the previous layer is 38400 bytes (9600 × 4), the
対象層において、図8のステップS16で算出されたメモリサイズは38400バイトであり、配置パターンは分散型である。このため、図8のステップS20、S24の判定において、メモリサイズ、配置パターンとも一致し、メモリサイズおよび配置パターンの変更は行われない。 In the target layer, the memory size calculated in step S16 of FIG. 8 is 38,400 bytes, and the arrangement pattern is distributed. Therefore, in the determination in steps S20 and S24 of FIG. 8, the memory size and the arrangement pattern also match, and the memory size and the arrangement pattern are not changed.
そして、プロセッサ500は、メモリ530に格納された前層の演算結果を入力データとして、対象層の学習を実行する。このように、対象層の学習に使用するデータを保持するメモリ領域のメモリサイズと、対象層の学習に使用する処理命令で指定されるバッチサイズに基づき算出されたメモリサイズとが一致する場合、メモリ領域をそのまま使用して処理命令を実行することができる。前層の演算後、対象層の演算を実行するまでにメモリ領域を確保するなどの前処理がないため、学習効率を低下させずに、対象層の学習において処理命令の演算を実行することができる。
Then, the
図9(b)では、前の層の出力データ(出力テンソルデータ)用のメモリ領域のメモリサイズは、メモリ530毎に8400バイトであり、プロセッサ500は、演算結果である出力データを、8400バイトずつ4つのメモリ530に分散して格納する。一方、対象層において、図8のステップS16で算出されたメモリサイズは38400バイト(9600×4)であり、配置パターンは分散型である。対象層の演算を実行する処理命令で使用するメモリ530毎のメモリサイズは9600バイトとなり、図8のステップS20、S24の判定において、配置パターンは一致するが、メモリサイズは不一致となる。
In FIG. 9B, the memory size of the memory area for the output data (output tensor data) of the previous layer is 8400 bytes for each
したがって、図8のステップS22において、データサイズ変更部412は、前層の出力データを保持している第1のメモリ領域に代えて、処理命令の仕様であるメモリサイズに対応する第2のメモリ領域を各メモリ530に新たに確保する。そして、データサイズ変更部412は、新たに確保した第2のメモリ領域に、前層の出力データを転送する。
Therefore, in step S22 of FIG. 8, the data
これにより、対象層での学習において、入力データが格納されているメモリ領域のメモリサイズと、処理命令に対応するメモリサイズとを一致させることができ、プロセッサ500による対象層の学習を正常に実行することができる。
As a result, in the learning in the target layer, the memory size of the memory area in which the input data is stored can be matched with the memory size corresponding to the processing instruction, and the learning of the target layer by the
なお、データの配置パターンがコピー型であり、前層の演算結果である出力データを格納する各メモリ530のメモリ領域のメモリサイズが38400バイトより少ない場合にも、図9(b)と同様の処理が行われる。すなわち、データサイズ変更部412は、前層の出力データを保持しているメモリ領域に代えて、処理命令の仕様であるメモリサイズ(38400バイト)に対応するメモリ領域を各メモリ530に新たに確保する。そして、データサイズ変更部412は、新たに確保したメモリ領域に、前層の出力データ(コピー型)を転送する。
Note that the same as in FIG. 9B even when the data arrangement pattern is a copy type and the memory size of the memory area of each
これにより、対象層での学習において、入力データが格納されているメモリ領域のメモリサイズと、処理命令の仕様であるメモリサイズとが一致させることができ、プロセッサ500による対象層の学習を正常に実行することができる。
As a result, in the learning in the target layer, the memory size of the memory area in which the input data is stored can be matched with the memory size which is the specification of the processing instruction, and the learning of the target layer by the
なお、入力データを保持しているメモリ領域のメモリサイズと、対象層の演算の実行する処理命令の仕様であるメモリサイズとが一致しない場合で、新たなメモリ領域を確保しない場合、対象層の演算の実行時にエラーが発生する。このため、ニューラルネットワークの学習の実行が困難になる。 If the memory size of the memory area that holds the input data does not match the memory size that is the specification of the processing instruction that executes the operation of the target layer, and if a new memory area is not secured, the target layer An error occurs when executing an operation. Therefore, it becomes difficult to execute the learning of the neural network.
図10は、図3の情報処理装置において、ニューラルネットワークの学習対象の層における学習時の動作の別の例を示す。図9と同様の動作については、詳細な説明は省略する。図10は、図9と同様に、画像を認識するニューラルネットワークの学習時の動作の一例を示し、各次元の要素数が、バッチサイズN=32、色C=3、画素数W=10、画素数H=10、データが単精度浮動小数点数であるとする。 FIG. 10 shows another example of the operation during learning in the layer to be learned of the neural network in the information processing apparatus of FIG. A detailed description of the same operation as in FIG. 9 will be omitted. FIG. 10 shows an example of the operation during learning of the neural network that recognizes the image as in FIG. 9, and the number of elements in each dimension is batch size N = 32, color C = 3, number of pixels W = 10, and so on. It is assumed that the number of pixels H = 10 and the data is a single precision floating point number.
対象層のデータの配置パターンは、コピー型であり、対象層に入力される入力データ(テンソルデータ)のサイズは38400バイト(9600×4)であるとする。また、図10(a)では、前層のデータの配置パターンは、コピー型であり、図10(b)では、前層のデータの配置パターンは分散型であるとする。 It is assumed that the data arrangement pattern of the target layer is a copy type, and the size of the input data (tensor data) input to the target layer is 38400 bytes (9600 × 4). Further, in FIG. 10A, it is assumed that the data arrangement pattern of the front layer is a copy type, and in FIG. 10B, the data arrangement pattern of the front layer is a distributed type.
図10(a)では、前層の出力データ(テンソルデータ)は、38400バイト(9600×4)であるため、プロセッサ500は、演算結果である38400バイトの出力データを4つのメモリ530のそれぞれに格納する。対象層において、図8のステップS16で算出されたメモリサイズは38400バイトであり、配置パターンはコピー型である。このため、図8のステップS20、S24の判定において、メモリサイズ、配置パターンとも一致し、メモリサイズおよび配置パターンの変更は行われない。
In FIG. 10A, since the output data (tensor data) of the front layer is 38400 bytes (9600 × 4), the
そして、プロセッサ500は、メモリ530に格納された前層の演算結果を入力データとして、対象層の学習を実行する。このように、対象層の学習に使用するデータを配置パターンと、対象層の学習に使用する処理命令で指定される配置パターンとが一致し、メモリサイズが一致する場合、メモリ領域をそのまま使用して処理命令を実行することができる。図9(a)と同様に、前層の演算後、対象層の演算を実行するまでにメモリ領域を確保するなどの前処理がないため、学習効率を低下させずに、対象層の学習において処理命令の演算を実行することができる。
Then, the
図10(b)では、前の層の出力データ(テンソルデータ)用のメモリ領域は分散型として確保されており、メモリサイズは、メモリ530毎に9600バイトである。プロセッサ500は、前の層の出力データ(9600バイト)を、各メモリ530に分散して格納する。このため、図8のステップS20、S24の判定において、メモリサイズおよび配置パターンとも一致しない。
In FIG. 10B, the memory area for the output data (tensor data) of the previous layer is secured as a distributed type, and the memory size is 9600 bytes for each
このため、図8のステップS22、S26において、処理命令の仕様であるメモリサイズと配置パターン(コピー型)に対応するメモリ領域(第3のメモリ領域)が各メモリ530に新たに確保される。そして、新たに確保した第3のメモリ領域に、前層の出力データがコピー型で転送される。
Therefore, in steps S22 and S26 of FIG. 8, a memory area (third memory area) corresponding to the memory size and the arrangement pattern (copy type), which are the specifications of the processing instruction, is newly secured in each
これにより、対象層での学習で、入力データが格納されているメモリ領域のメモリサイズ/配置パターンと、処理命令に対応するメモリサイズ/配置パターンとをそれぞれ一致させることができ、プロセッサ500による対象層の学習を正常に実行することができる。なお、前層の出力データがコピー型であり、処理命令の仕様が分散型の場合にも、分散型に対応するメモリサイズの第3のメモリ領域を新たに確保し、データを分散型として転送することで、図10(b)と同様の処理を実施することができる。
As a result, the memory size / allocation pattern of the memory area in which the input data is stored can be matched with the memory size / allocation pattern corresponding to the processing instruction by learning in the target layer, and the target by the
なお、例えば、前層の出力データの配置パターンが分散型であり、対象層の入力データの配置パターンがコピー型である場合、各演算コア510での演算に使用するデータが不足するため、対象層の演算の実行時にエラーが発生する。このため、ニューラルネットワークの学習の実行が困難になる。
For example, when the arrangement pattern of the output data of the previous layer is a distributed type and the arrangement pattern of the input data of the target layer is a copy type, the data used for the calculation in each
以上、図3から図10に示す実施形態においても、図1および図2に示す実施形態と同様の効果を得ることができる。例えば、学習データを保持するメモリ領域のメモリサイズと、処理命令で指定されるバッチサイズに基づき算出されるメモリサイズとが不一致の場合、処理命令に対応するメモリサイズの新たなメモリ領域を確保して学習データを転送する。これにより、入力データが格納されているメモリ領域のメモリサイズと、処理命令に対応するメモリサイズとを一致させることができ、任意のバッチサイズが指定された場合にも、エラーを発生させることなく学習を実行することができる。 As described above, even in the embodiments shown in FIGS. 3 to 10, the same effects as those in the embodiments shown in FIGS. 1 and 2 can be obtained. For example, if the memory size of the memory area that holds the training data and the memory size calculated based on the batch size specified by the processing instruction do not match, a new memory area of the memory size corresponding to the processing instruction is secured. And transfer the training data. As a result, the memory size of the memory area where the input data is stored can be matched with the memory size corresponding to the processing instruction, and even if an arbitrary batch size is specified, an error does not occur. You can perform learning.
さらに、図3から図10に示す実施形態では、学習データと処理命令との配置パターンが不一致の場合に、新たなメモリ領域を確保して学習データを処理命令で指定される配置パターンに合わせて新たなメモリ領域に転送する。これにより、入力データが格納されているメモリ領域のメモリサイズ/配置パターンと、処理命令の仕様であるメモリサイズ/配置パターンとをそれぞれ一致させることができ、プロセッサ500による対象層の学習を正常に実行することができる。
Further, in the embodiment shown in FIGS. 3 to 10, when the arrangement patterns of the learning data and the processing instruction do not match, a new memory area is secured and the learning data is matched with the arrangement pattern specified by the processing instruction. Transfer to a new memory area. As a result, the memory size / allocation pattern of the memory area in which the input data is stored can be matched with the memory size / allocation pattern which is the specification of the processing instruction, and the learning of the target layer by the
対象層の学習に使用するデータを保持するメモリ領域のメモリサイズと、対象層の学習に使用する処理命令で指定されるバッチサイズに基づいて算出されたメモリサイズとが一致する場合、メモリ領域をそのまま使用して処理命令を実行することができる。また、対象層の学習に使用するデータを配置パターンと、対象層の学習に使用する処理命令で指定される配置パターンとが一致し、メモリサイズが一致する場合、メモリ領域をそのまま使用して処理命令を実行することができる。これらの場合、前層の演算後、対象層の演算を実行するまでにメモリ領域を確保するなどの前処理がないため、学習効率を低下させずに、対象層の学習において処理命令の演算を実行することができる。 If the memory size of the memory area that holds the data used for learning the target layer matches the memory size calculated based on the batch size specified by the processing instruction used for learning the target layer, the memory area is selected. The processing instruction can be executed by using it as it is. If the data used for learning the target layer matches the placement pattern specified by the processing instruction used for learning the target layer and the memory size matches, the memory area is used as it is for processing. Instructions can be executed. In these cases, since there is no preprocessing such as securing a memory area after the operation of the previous layer and before the operation of the target layer is executed, the operation of the processing instruction is performed in the learning of the target layer without lowering the learning efficiency. Can be executed.
この結果、任意のバッチサイズが指定された場合にも、エラーを発生させることなく学習を実行することができる。 As a result, even if an arbitrary batch size is specified, learning can be executed without causing an error.
図11は、別の実施形態における情報処理装置の一例を示す。図1および図3と同様の要素については、詳細な説明は省略する。図11に示す情報処理装置100Bは、例えば、サーバであり、図1と同様に、ホストCPU200、ホストメモリ300、I/Oコントローラ220およびプロセッサ500を有する。ホストCPU200は、ホストメモリ300に格納された各種プログラムを実行することで、情報処理装置100Bの全体の動作を制御するとともに、プロセッサ500の動作を制御し、学習データを用いてニューラルネットワークの学習を実行する。なお、図11のホストメモリ300には、図3のホストプログラム400Aの代わりにホストプログラム400Bが格納される。
FIG. 11 shows an example of an information processing apparatus according to another embodiment. Detailed description of the same elements as those in FIGS. 1 and 3 will be omitted. The
ニューラルネットワークに演算を実行させるためのホストプログラム400Bは、ディープラーニング(DL)用のフレームワーク410、ディープニューラルネットワーク(DNN)のライブラリ420およびランタイムライブラリ430を有する。
The
DLフレームワーク410は、演算種決定部411、データサイズ変更部412、問い合わせ部413、変換/転送指示部414および実行指示部415を有する。演算種決定部411、データサイズ変更部412および変換/転送指示部414の機能は、図3に示した演算種決定部411、データサイズ変更部412および変換/転送指示部414の機能とそれぞれ同様である。問い合わせ部413および実行指示部415の機能は、図12で説明する。
The
DNNライブラリ420は、情報管理部421、演算処理予測部422および処理命令が格納されたファイル423を有する。情報管理部421の機能は、図3に示した情報管理部421の機能と同様である。演算処理予測部422の機能は、図12および図13で説明する。
The
ランタイムライブラリ430は、変換/転送実行部431および処理命令実行部432を有する。ランタイムライブラリ430は、プロセッサ500に演算を実行させるためのインタフェースであり、プロセッサ500の仕様に合わせて設計され、例えば、複数の演算コア510に演算を並列に実行させる制御を実行する。変換/転送実行部431および処理命令実行部432の機能は、図12で説明する。
The
図12は、図11のホストCPU200がホストプログラム400Bを実行することで実現される機能の一例を示す。以下では、複数の層を有するディープニューラルネットワークにおいて、学習対象の層である対象層の学習を実行する場合の動作について説明する。なお、上述した実施形態で説明した機能および動作と同様の機能および動作については、詳細な説明は省略する。
FIG. 12 shows an example of the function realized by the
DLフレームワーク410は、対象層の学習を実行する指示を受けた場合、演算種決定部411に演算種を決定させる。この後、変換/転送指示部414は、ユーザにより指定されたバッチサイズと、入出力データのサイズおよび配置パターン等に基づいて、演算に使用するメモリ領域を各メモリ530に確保する指示をランタイムライブラリ430に発行する。入出力データのサイズおよび配置パターン等は、ユーザ定義ファイル310に格納されたニューラルネットワークの仕様と学習データとに基づいて求められる。
When the
また、変換/転送指示部414は、各メモリ530に確保したメモリ領域に、演算に使用する学習データを転送する指示をランタイムライブラリ430に発行する。なお、上述した実施形態と同様に、対象層の前の層である前層の出力データが対象層の入力データとしてメモリ530に保持されている場合、変換/転送指示部414は、メモリ領域の確保と学習データの転送指示を発行せず、データの転送指示を発行しない。
Further, the conversion /
ランタイムライブラリ430の変換/転送実行部431は、変換/転送指示部414からのメモリ領域の確保の指示に基づいて、メモリ530のメモリ領域を確保し、完了通知をDLフレームワーク410に発行する。また、変換/転送実行部431は、変換/転送指示部414からのデータ転送指示に基づいて、確保したメモリ領域に学習データを転送し、完了通知をDLフレームワーク410に発行する。
The conversion /
問い合わせ部413は、DNNライブラリ420の情報管理部421に、演算種とユーザにより指定されたバッチサイズとを通知し、対象層の学習に使用する処理命令を問い合わせる。また、問い合わせ部413は、情報管理部421に各次元の要素数を通知し、対象層の学習に使用する処理命令で使用するメモリサイズを問い合わせる。さらに、問い合わせ部413は、ランタイムライブラリ430に確保させたメモリ領域のメモリサイズと配置パターンとを演算処理予測部422に通知し、演算をより高速に実行できる演算方法を問い合わせる。
The
情報管理部421は、図5に示した各処理命令の仕様情報を保持しており、対象層の学習に適した処理命令を検索して問い合わせ部413に応答する。この際、情報管理部421は、検索で見つけた処理命令の対応バッチ数とテンソルデータ毎のデータの配置パターンを問い合わせ部413に通知する。また、情報管理部421は、問い合わせ部413から通知されたバッチサイズと各次元の要素数とに基づいて、検索で見つけた処理命令による対象層の学習(演算)の実行に使用するメモリサイズを算出する。そして、情報管理部421は、算出したメモリサイズを問い合わせ部413に通知する。
The
演算処理予測部422は、問い合わせ部413からの問い合わせに基づいて、演算をより高速に実行できる演算方法を問い合わせ部413に通知する。演算処理予測部422は、メモリサイズと配置パターンとを変更せずに処理命令を実行する場合と、メモリサイズおよび配置パターンの一方または両方を変更して処理命令を実行する場合のいずれが、演算効率が高いかを問い合わせ部413に通知する。演算処理予測部422の機能については、図13で説明する。
The arithmetic
問い合わせ部413は、情報管理部421から通知された処理命令を保持する。また、問い合わせ部413は、メモリサイズまたは配置パターンを変更したほうが、演算効率が高いことを演算処理予測部422から通知された場合、メモリサイズまたは配置パターンの変更を実行する。すなわち、処理命令に対応するメモリサイズとメモリ領域のメモリサイズとの一致/不一致を判定し、処理命令で指定される配置パターンとメモリ領域に保持されたデータの配置パターンとの一致/不一致とを判定し、判定結果に応じた処理を実行する。
The
一方、問い合わせ部413は、メモリサイズまたは配置パターンを変更しないほうが、演算効率が高いことを演算処理予測部422から通知された場合、メモリサイズの一致/不一致の判定および配置パターンの一致/不一致の判定を実行しない。この場合、DLフレームワーク410は、現在のメモリ領域に保持されたデータを使用して、演算コア510に処理命令の演算を実行させる。
On the other hand, when the calculation
問い合わせ部413は、情報管理部421から通知されたメモリサイズが、各メモリ530に確保されているメモリ領域のメモリサイズと一致するか否かを、配置パターンを考慮して判定する。問い合わせ部413は、メモリサイズが不一致の場合、メモリサイズの変更をデータサイズ変更部412に指示する。
The
また、問い合わせ部413は、情報管理部421から通知された配置パターンが、メモリ領域への学習データの転送時に使用した配置パターンと一致するか否かを判定する。問い合わせ部413は、配置パターンが不一致の場合、情報管理部421から通知された配置パターンでメモリ領域を新たに確保する指示をデータサイズ変更部412に発行する。さらに、問い合わせ部413は、メモリサイズが不一致の場合、または、配置パターンが不一致の場合、新たに確保したメモリ領域に対象層の学習で使用する学習データを転送する指示を変換/転送指示部414に発行する。
Further, the
データサイズ変更部412は、問い合わせ部413からの指示に基づいて、情報管理部421から通知されたメモリサイズのメモリ領域を各メモリ530に確保する指示をランタイムライブラリ430に発行する。ランタイムライブラリ430は、データサイズ変更部412からの指示に基づいて、各メモリ530に新たなメモリ領域を確保し、完了通知をデータサイズ変更部412に発行する。
Based on the instruction from the
変換/転送指示部414は、問い合わせ部413からの指示に基づいて、対象層の学習で使用する学習データを新たに確保したメモリ領域に転送する指示をランタイムライブラリ430の変換/転送実行部431に発行する。変換/転送実行部431は、変換/転送指示部414からの指示に基づいて、ユーザ定義ファイル310から新たに確保したメモリ領域に学習データを転送し、完了通知を変換/転送指示部414に発行する。
Based on the instruction from the
対象層の学習に使用する学習データが配置パターンにしたがってメモリ530に保持されている場合、DLフレームワーク410の実行指示部415は、処理命令を指定して、処理命令の実行をDNNライブラリ420に指示する。DNNライブラリ420は、実行指示部415からの指示に基づいて、ランタイムライブラリ430の処理命令実行部432に処理命令の実行を指示する。そして、処理命令実行部432は、対象層の学習用の演算を実行させる演算コア510のメモリ530に処理命令を転送し、演算コア510に処理命令を実行させる。これにより、対象層の学習が実行される。
When the learning data used for learning the target layer is held in the
図13は、メモリ530に確保したメモリ領域のメモリサイズおよび配置パターンと、学習対象の層の学習で使用する処理命令に対応するメモリサイズおよび配置パターンとの関係を示す。図11および図12の演算処理予測部422は、図13に示す関係に基づいて、メモリサイズおよび配置パターンを変更せずに処理命令を実行可能か判断し、演算効率がより高い演算方法を決定する。
FIG. 13 shows the relationship between the memory size and the allocation pattern of the memory area secured in the
対象層の学習で使用する処理命令は、DLフレームワーク410からの問い合わせに基づいて、DNNライブラリ420の情報管理部421が選択した処理命令である。メモリ530に確保したメモリ領域は、ユーザ定義ファイル310に格納されたニューラルネットワークの仕様と学習データとに基づいて、配置パターンを考慮して算出されたメモリサイズを有する。なお、対象層が2層目以降の場合、メモリ領域のメモリサイズと配置パターンとは、前層の学習により得られた出力データを保持するメモリ領域のメモリサイズと配置パターンでもよい。
The processing instruction used in the learning of the target layer is a processing instruction selected by the
メモリサイズおよび配置パターンの両方が、既に確保されているメモリ領域と、処理命令に対応するメモリサイズおよび配置パターンとで一致する場合、メモリサイズおよび配置パターンを変更することなく演算が可能である(演算可能なパターン1、2)。
If both the memory size and the allocation pattern match the already allocated memory area and the memory size and allocation pattern corresponding to the processing instruction, the operation can be performed without changing the memory size and the allocation pattern ().
メモリ領域のメモリサイズが処理命令に対応するメモリサイズより大きい場合、処理命令を複数回実行することで、確保したメモリ領域のメモリサイズを変更することなく演算の実行が可能である(演算可能なパターン4、5、6)。但し、処理命令を複数回実行するため、演算時間は、処理命令の実行回数に依存して増加する。この際、メモリ領域のうち、学習に使用する有効なデータを保持していない領域のデータは、意味のないデータであるため、演算結果である出力データは次の学習に使用されない。
When the memory size of the memory area is larger than the memory size corresponding to the processing instruction, the operation can be executed without changing the memory size of the secured memory area by executing the processing instruction multiple times (calculation is possible).
なお、メモリ領域のメモリサイズが処理命令に対応するメモリサイズより大きい場合、メモリ領域のメモリサイズを処理命令に対応するメモリサイズに合わせて再確保し、再確保したメモリ領域にデータを転送した後、演算が実行されてもよい。但し、この場合、メモリ領域を再確保する時間と、再確保したメモリ領域にデータを転送する時間が、処理命令の実行時間とは別に掛かる。 If the memory size of the memory area is larger than the memory size corresponding to the processing instruction, the memory size of the memory area is re-allocated according to the memory size corresponding to the processing instruction, and the data is transferred to the re-allocated memory area. , The operation may be performed. However, in this case, the time for reallocating the memory area and the time for transferring the data to the re-allocated memory area are different from the execution time of the processing instruction.
メモリ領域の配置パターンがコピー型で、処理命令で指定される配置パターンが分散型の場合、分散型での処理命令の演算を複数回実行することで、配置パターンを変更することなく演算の実行が可能である(演算可能なパターン3、6)。例えば、図7に示したように、4つの演算コア510で4つのデータD1−D4を演算する場合、コピー型で配置したデータを分散型の処理命令で実行する場合、演算時間は4倍掛かる。
When the memory area allocation pattern is copy type and the allocation pattern specified by the processing instruction is distributed, the operation can be executed without changing the allocation pattern by executing the operation of the distributed processing instruction multiple times. Is possible (
既に確保されているメモリ領域と、処理命令で指定される配置パターンとが互いに異なる場合、処理命令で指定される配置パターンに合わせたメモリサイズのメモリ領域を再確保し、再確保したメモリ領域にデータを転送した後、演算が実行されてもよい。但し、この場合、メモリ領域を再確保する時間と、再確保したメモリ領域にデータを転送する時間が、処理命令の実行時間とは別に掛かる。 If the already allocated memory area and the allocation pattern specified by the processing instruction are different from each other, the memory area of the memory size corresponding to the allocation pattern specified by the processing instruction is re-allocated and the re-allocated memory area is used. After transferring the data, the operation may be performed. However, in this case, the time for reallocating the memory area and the time for transferring the data to the re-allocated memory area are different from the execution time of the processing instruction.
なお、既に確保されているメモリ領域のメモリサイズが処理命令に対応するメモリサイズより小さい場合、処理命令の実行によりエラーが発生するため、処理命令に対応するメモリサイズに合わせたメモリ領域が再確保される。また、既に確保されたメモリ領域が保持する学習データの配置パターンが分散型で、処理命令で指定される配置パターンがコピー型の場合、演算が正しく実行されないため、処理命令で指定される配置パターンに合わせたメモリサイズのメモリ領域が再確保される。 If the memory size of the memory area already reserved is smaller than the memory size corresponding to the processing instruction, an error occurs due to the execution of the processing instruction, so the memory area corresponding to the memory size corresponding to the processing instruction is re-allocated. Will be done. Also, if the placement pattern of the learning data held by the memory area already secured is distributed and the placement pattern specified by the processing instruction is copy type, the operation will not be executed correctly, so the placement pattern specified by the processing instruction will not be executed correctly. The memory area of the memory size according to is re-allocated.
以上より、演算効率を向上するため、演算可能なパターン3−6については、処理命令を複数回実行する場合の演算時間と、メモリ領域を再確保してデータを転送した後、処理命令を実行する場合の演算時間とのどちらが早いかが判定される。例えば、判定には式(1)に示す条件が使用される。
(メモリサイズを変更しない場合の演算時間)<(メモリサイズの変更とデータの転送とに掛かる時間)+(演算時間) ‥(1)
例えば、演算処理予測部422は、式(1)に示す条件を満足する場合、メモリサイズおよび配置パターンを変更せずに演算を実行するほうが、メモリサイズおよび配置パターンを変更して演算を実行するよりも演算効率が高いと判断する。また、演算処理予測部422は、式(1)に示す条件を満足しない場合、メモリサイズおよび配置パターンを変更して演算を実行するほうが、メモリサイズおよび配置パターンを変更せずに演算を実行するよりも演算効率が高いと判断する。
From the above, in order to improve the calculation efficiency, for the pattern 3-6 that can be calculated, the calculation time when the processing instruction is executed multiple times and the processing instruction are executed after reallocating the memory area and transferring the data. It is determined which is faster than the calculation time when the operation is performed. For example, the condition shown in the equation (1) is used for the determination.
(Calculation time when the memory size is not changed) <(Time required for changing the memory size and transferring data) + (Calculation time) ‥ (1)
For example, when the arithmetic
図14は、図11の情報処理装置100Bがニューラルネットワークの学習を実行する場合の動作の一例を示す。図14に示す動作は、ホストCPU200がホストプログラム400Bを実行することにより実現される。すなわち、図14は、情報処理プログラムおよび情報処理方法の一例を示す。図8と同様の動作および図12で説明した動作については、詳細な説明は省略する。
FIG. 14 shows an example of the operation when the
図14では、図8のステップS16とステップS20の間にステップS17およびステップS18が挿入される。ステップS10、S12、S14、S16、S20、S22、S24、S26、S28の動作は、図8と同様である。 In FIG. 14, steps S17 and S18 are inserted between steps S16 and S20 of FIG. The operations of steps S10, S12, S14, S16, S20, S22, S24, S26, and S28 are the same as those in FIG.
ステップS17において、演算処理予測部422は、ステップS16で選択された処理命令に対応するメモリサイズおよび配置パターンと、ステップS12で確保されたメモリサイズおよび配置パターンとを比較する。そして、演算処理予測部422は、メモリサイズおよび配置パターンが図13に示した演算可能なパターンであるか否かを判定する。メモリサイズおよび配置パターンを変更せずに演算可能な場合、処理はステップS18に移行される。メモリサイズおよび配置パターンを変更せずに演算可能でない場合、演算処理予測部422は、メモリ領域を再確保して再確保したメモリ領域に学習データを転送するほうが、演算効率が高い旨を問い合わせ部413に通知する。そして、処理はステップS20に移行される。
In step S17, the arithmetic
ステップS18において、演算処理予測部422は、メモリ領域のメモリサイズと配置パターンを変更する場合と変更しない場合との演算効率を、例えば、式(1)の条件を用いて比較する。演算処理予測部422は、式(1)の条件を満足する場合、メモリサイズ(配置パターン)を変更しないほうが、演算効率が高いと判断し、処理をステップS28に移行する。演算処理予測部422は、式(1)の条件を満足しない場合、メモリサイズ(配置パターン)を変更するほうが、演算効率が高いと判断し、処理をステップS20に移行する。
In step S18, the arithmetic
このように、メモリサイズまたは配置パターンが一致しない場合にも、メモリサイズを変更せずに演算を実行でき、かつ、メモリサイズを変更するよりも演算効率が高い場合、メモリサイズを変更せずに演算を実行することで、学習時間を短縮することができる。また、式(1)を用いて、演算効率が高い演算方法を容易に判定することができる。 In this way, even if the memory size or arrangement pattern does not match, if the calculation can be executed without changing the memory size and the calculation efficiency is higher than changing the memory size, the memory size is not changed. By executing the calculation, the learning time can be shortened. Moreover, the calculation method having high calculation efficiency can be easily determined by using the equation (1).
以上、図11から図14に示す実施形態においても、図1から図10に示す実施形態と同様の効果を得ることができる。例えば、学習データを保持するメモリ領域のメモリサイズと、処理命令に対応して算出されるメモリサイズとが不一致の場合、処理命令に合わせて新たなメモリ領域を確保することで、プロセッサ500による対象層の学習を正常に実行することができる。また、学習データと処理命令との配置パターンが不一致の場合、処理命令の配置パターンに合わせて新たなメモリ領域を確保することで、プロセッサ500による対象層の学習を正常に実行することができる。これにより、任意のバッチサイズが指定された場合にも、エラーを発生させることなく学習を実行することができる。
As described above, even in the embodiments shown in FIGS. 11 to 14, the same effects as those in the embodiments shown in FIGS. 1 to 10 can be obtained. For example, when the memory size of the memory area for holding the training data and the memory size calculated in response to the processing instruction do not match, the
さらに、図11から図14に示す実施形態では、予め確保されたメモリ領域のメモリサイズと、処理命令に対応するメモリサイズとが異なる場合、メモリサイズを変更せずに演算可能を判定する。そして、メモリサイズを変更せずに演算可能な場合、演算効率が高い演算方法を判定し、判定結果に基づいて演算を実行する。また、予め確保されたメモリ領域が保持する学習データの配置パターンと、処理命令で指定される配置パターンとが異なる場合、メモリサイズおよび配置パターンを変更せずに演算可能を判定する。そして、メモリサイズおよび配置パターンを変更せずに演算可能な場合、演算効率が高い演算方法を判定し、判定結果に基づいて演算を実行する。これにより、演算効率が高い演算方法で学習を実行することができ、ニューラルネットワークの学習時間を短縮することができる。 Further, in the embodiment shown in FIGS. 11 to 14, when the memory size of the memory area secured in advance and the memory size corresponding to the processing instruction are different, it is determined that the calculation is possible without changing the memory size. Then, when the calculation can be performed without changing the memory size, the calculation method having high calculation efficiency is determined, and the calculation is executed based on the determination result. Further, when the arrangement pattern of the learning data held in the memory area secured in advance and the arrangement pattern specified by the processing instruction are different, it is determined that the calculation is possible without changing the memory size and the arrangement pattern. Then, when the calculation can be performed without changing the memory size and the arrangement pattern, the calculation method having high calculation efficiency is determined, and the calculation is executed based on the determination result. As a result, learning can be executed by a calculation method with high calculation efficiency, and the learning time of the neural network can be shortened.
図15は、別の実施形態における情報処理装置において、処理命令を実行する一例を示す。図15に示す情報処理装置100Cの構成は、図11に示す情報処理装置100Bの構成と同様である。
FIG. 15 shows an example of executing a processing instruction in the information processing apparatus according to another embodiment. The configuration of the information processing device 100C shown in FIG. 15 is the same as the configuration of the
図15では、ユーザ定義ファイル310に格納されるニューラルネットワークの規模と学習データ量とが、図11に示す情報処理装置100Bにより学習するニューラルネットワークの規模と学習データ量よりもいずれも小さい。このため、1つの演算コア510によりニューラルネットワークの学習が実行可能である。この場合、複数の演算コア510による並列演算を実行しないことで、複数の演算コア510を動作させる場合に比べて、プロセッサ500の消費電力を削減することができる。
In FIG. 15, the scale of the neural network and the amount of training data stored in the user-defined
情報処理装置100Cによるニューラルネットワークの学習は、図14と同様に実行される。但し、1つの演算コア510により学習を実行する場合、学習に使用する全てのデータは1つのメモリ530に格納されるため、配置パターンを考慮しなくてよい。このため、情報処理装置100Cでは図14のステップS24、S26の処理は省略され、図14のステップS17では、メモリ領域のメモリサイズが処理命令に対応するメモリサイズ以上の場合、演算可能と判定される。
The learning of the neural network by the information processing apparatus 100C is executed in the same manner as in FIG. However, when learning is executed by one
なお、図1に示す情報処理装置100または図3に示す情報処理装置100Aにおいて、情報処理装置100Cと同様に、1つの演算コア510によりニューラルネットワークの学習を実行してもよい。この場合、情報処理装置100、100Aは、1つの演算コア510を演算対象として、図2に示す動作または図8に示す動作を実行する。但し、1つの演算コア510により学習を実行する場合、配置パターンを考慮しなくてよいため、図8のステップS24、S26の処理は省略される。
In the
以上、この実施形態においても、図1から図14に示す実施形態と同様の効果を得ることができる。 As described above, also in this embodiment, the same effect as that of the embodiment shown in FIGS. 1 to 14 can be obtained.
図16は、さらなる別の実施形態における情報処理装置において、処理命令を実行する一例を示す。図15に示す情報処理装置100Dの構成は、図11に示す情報処理装置100Bの構成と同様である。
FIG. 16 shows an example of executing a processing instruction in the information processing apparatus according to still another embodiment. The configuration of the information processing device 100D shown in FIG. 15 is the same as the configuration of the
図16では、複数のユーザ定義ファイル310(1、2、3)に構成情報が格納される複数のニューラルネットワークの学習が並列して実行される。すなわち、各ユーザ定義ファイル310に格納されるニューラルネットワークの規模と学習データ量とは、図11に示す情報処理装置100Bにより学習するニューラルネットワークの規模と学習データ量よりもいずれも小さい。
In FIG. 16, learning of a plurality of neural networks in which configuration information is stored in a plurality of user-defined files 310 (1, 2, 3) is executed in parallel. That is, the scale of the neural network and the amount of training data stored in each user-defined
ユーザ定義ファイル1のニューラルネットワークの学習は、2つの演算コア510により、図14と同様に実行される。ユーザ定義ファイル2、3のニューラルネットワークの各々の学習は、1つの演算コア510により、図15に示した実施形態と同様に実行される。例えば、DLフレームワーク410、DNNライブラリ420およびランタイムライブラリ430を含む400B(図11)は、ユーザ毎に設けられる。
The learning of the neural network of the user-defined
なお、図1に示す情報処理装置100または図3に示す情報処理装置100Aにおいて、情報処理装置100Dと同様に、複数のユーザのニューラルネットワークの学習を並列に実行してもよい。この場合、情報処理装置100、100Aは、ユーザ毎に図2に示す動作または図8に示す動作を実行する。但し、1つの演算コア510により学習を実行する場合、配置パターンを考慮しなくてよいため、図8のステップS24、S26の処理は省略される。
In the
以上、この実施形態において、図1から図14に示す実施形態と同様の効果を得ることができる。 As described above, in this embodiment, the same effect as that of the embodiment shown in FIGS. 1 to 14 can be obtained.
以上の図1から図16に示す実施形態に関し、さらに以下の付記を開示する。
(付記1)
演算器と該演算器で使用するデータを保持するメモリとを含む1以上の演算部を有するプロセッサが実行する複数の層を含むニューラルネットワークの学習を制御する情報処理プログラムであって、
学習対象の層の学習に使用する学習データのサイズと入力されたバッチサイズとに基づいて、処理するバッチサイズが異なる複数の処理命令の中から前記プロセッサに実行させる処理命令を選択し、
前記学習データのサイズと選択した処理命令で指定されるバッチサイズとに基づいて、学習対象の層の学習に使用するメモリサイズを算出し、
前記学習データを保持する前記メモリの第1のメモリ領域のメモリサイズが、算出したメモリサイズと一致しない場合、前記算出したメモリサイズを有する第2のメモリ領域を前記メモリに確保して前記学習データを転送し、前記第2のメモリ領域に転送した前記学習データを使用して、前記選択した処理命令を前記プロセッサに実行させる、処理を情報処理装置に実行させる情報処理プログラム。
(付記2)
前記学習データを前記メモリに配置する配置パターンとして、前記学習データを複数の前記演算部の前記メモリに分散して配置する分散型と、前記学習データを複数の前記演算部の前記メモリに重複して配置する重複型とを有し、
前記第1のメモリ領域に保持された前記学習データの配置パターンが、前記選択した処理命令で使用する配置パターンと一致しない場合、第3のメモリ領域を前記メモリに確保し、前記選択した処理命令で使用する配置パターンで前記第3のメモリ領域に前記学習データを転送し、前記第3のメモリ領域に転送した前記学習データを使用して前記選択した処理命令を前記プロセッサに実行させる処理を情報処理装置に実行させる、付記1に記載の情報処理プログラム。
(付記3)
前記第1のメモリ領域のメモリサイズが、前記算出したメモリサイズと一致する場合、前記第1のメモリ領域に保持された前記学習データを使用して前記選択した処理命令を前記プロセッサに実行させる処理を情報処理装置に実行させる付記1または付記2に記載の情報処理プログラム。
(付記4)
前記第1のメモリ領域に保持された前記学習データの配置パターンが、前記選択した処理命令で使用する配置パターンと一致し、かつ、前記第1のメモリ領域のメモリサイズが、前記算出したメモリサイズと一致する場合、前記第1のメモリ領域に保持された前記学習データを使用して前記選択した処理命令を前記プロセッサに実行させる処理を情報処理装置に実行させる付記1または付記2に記載の情報処理プログラム。
(付記5)
前記第1のメモリ領域のメモリサイズが、前記算出したメモリサイズより大きい場合、前記第1のメモリ領域に保持された前記学習データを使用して前記選択した処理命令を実行する場合と、前記第2のメモリ領域を確保し前記学習データを転送して前記選択した処理命令を実行する場合との演算効率を算出し、
演算効率が高い方で、前記選択した処理命令を前記プロセッサに実行させる処理を情報処理装置に実行させる、付記1ないし付記4のいずれか1項に記載の情報処理プログラム。
(付記6)
前記第1のメモリ領域に前記重複型で前記学習データが保持され、前記選択した処理命令のデータの配置パターンが前記分散型である場合、前記第1のメモリ領域に保持された前記学習データを使用して前記選択した処理命令を実行する場合と、前記第3のメモリ領域を確保して前記分散型で前記学習データを転送して前記選択した処理命令を実行する場合との演算効率を算出し、
演算効率の高い方で、前記選択した処理命令を前記プロセッサに実行させる処理を情報処理装置に実行させる、付記2に記載の情報処理プログラム。
(付記7)
前記演算効率は、前記第1のメモリ領域に保持された前記学習データを使用して前記選択した処理命令を実行する場合の演算時間、または、新たにメモリ領域を確保して前記学習データを転送する時間と、新たに確保したメモリ領域に保持された前記学習データを使用して前記選択した処理命令を実行する場合の演算時間との和で示される、付記5または付記6に記載の情報処理プログラム。
(付記8)
メモリサイズの一致/不一致を、学習対象の層に入力される入力テンソルデータと学習対象の層から出力される出力テンソルデータ毎に判定する、付記1ないし付記7のいずれか1項に記載の情報処理プログラム。
(付記9)
配置パターンの一致/不一致を、学習対象の層に入力される入力テンソルデータと学習対象の層から出力される出力テンソルデータ毎に判定する、付記2ないし付記8のいずれか1項に記載の情報処理プログラム。
(付記10)
前記ニューラルネットワークの構成情報に基づいて、学習対象の層の学習に使用する演算方式を選択し、
前記プロセッサに実行させる処理命令を、決定した演算方式に対応する前記複数の処理命令の中から選択する、付記1ないし付記9のいずれか1項に記載の情報処理プログラム。
(付記11)
演算器と該演算器で使用するデータを保持するメモリとを含む1以上の演算部を有するプロセッサが実行する複数の層を含むニューラルネットワークの学習を制御する情報処理方法であって、
学習対象の層の学習に使用する学習データのサイズと入力されたバッチサイズとに基づいて、処理するバッチサイズが異なる複数の処理命令の中から前記プロセッサに実行させる処理命令を選択し、
前記学習データのサイズと選択した処理命令で指定されるバッチサイズとに基づいて、学習対象の層の学習に使用するメモリサイズを算出し、
前記学習データを保持する前記メモリの第1のメモリ領域のメモリサイズが、算出したメモリサイズと一致しない場合、前記算出したメモリサイズを有する第2のメモリ領域を前記メモリに確保して前記学習データを転送し、前記第2のメモリ領域に転送した前記学習データを使用して、前記選択した処理命令を前記プロセッサに実行させる、処理を情報処理装置に実行させる情報処理方法。
The following additional notes will be further disclosed with respect to the embodiments shown in FIGS. 1 to 16 described above.
(Appendix 1)
An information processing program that controls learning of a neural network including a plurality of layers executed by a processor having one or more arithmetic units including an arithmetic unit and a memory for holding data used in the arithmetic unit.
Based on the size of the training data used for learning the layer to be learned and the input batch size, a processing instruction to be executed by the processor is selected from a plurality of processing instructions having different batch sizes to be processed.
Based on the size of the training data and the batch size specified by the selected processing instruction, the memory size used for training the layer to be trained is calculated.
When the memory size of the first memory area of the memory that holds the training data does not match the calculated memory size, a second memory area having the calculated memory size is secured in the memory and the training data. An information processing program that causes an information processing apparatus to execute processing by causing the processor to execute the selected processing instruction using the learning data transferred to the second memory area.
(Appendix 2)
As an arrangement pattern for arranging the learning data in the memory, a distributed type in which the learning data is distributed and arranged in the memories of a plurality of the calculation units, and a distribution type in which the learning data is distributed and arranged in the memories of the plurality of calculation units are duplicated. Has a duplicate type to be placed
When the arrangement pattern of the training data held in the first memory area does not match the arrangement pattern used in the selected processing instruction, a third memory area is secured in the memory and the selected processing instruction is used. Information processing that transfers the training data to the third memory area in the arrangement pattern used in the above-mentioned third memory area, and causes the processor to execute the selected processing instruction using the learning data transferred to the third memory area. The information processing program according to
(Appendix 3)
When the memory size of the first memory area matches the calculated memory size, a process of causing the processor to execute the selected processing instruction using the learning data held in the first memory area. The information processing program according to
(Appendix 4)
The arrangement pattern of the training data held in the first memory area matches the arrangement pattern used in the selected processing instruction, and the memory size of the first memory area is the calculated memory size. If the information matches, the information according to
(Appendix 5)
When the memory size of the first memory area is larger than the calculated memory size, the learning data held in the first memory area is used to execute the selected processing instruction, and the first. The calculation efficiency of the case where the memory area of 2 is secured, the learning data is transferred, and the selected processing instruction is executed is calculated.
The information processing program according to any one of
(Appendix 6)
When the learning data is held in the first memory area in the duplicate type and the data arrangement pattern of the selected processing instruction is the distributed type, the learning data held in the first memory area is stored. Calculates the calculation efficiency between the case where the selected processing instruction is executed by using the third memory area and the case where the learning data is transferred in the distributed type and the selected processing instruction is executed. And
The information processing program according to
(Appendix 7)
The calculation efficiency is the calculation time when the selected processing instruction is executed using the learning data held in the first memory area, or the learning data is transferred by securing a new memory area. The information processing according to
(Appendix 8)
The information according to any one of
(Appendix 9)
The information according to any one of
(Appendix 10)
Based on the configuration information of the neural network, the calculation method used for learning the layer to be learned is selected.
The information processing program according to any one of
(Appendix 11)
An information processing method that controls learning of a neural network including a plurality of layers executed by a processor having one or more arithmetic units including an arithmetic unit and a memory for holding data used in the arithmetic unit.
Based on the size of the training data used for learning the layer to be learned and the input batch size, a processing instruction to be executed by the processor is selected from a plurality of processing instructions having different batch sizes to be processed.
Based on the size of the training data and the batch size specified by the selected processing instruction, the memory size used for training the layer to be trained is calculated.
When the memory size of the first memory area of the memory that holds the training data does not match the calculated memory size, a second memory area having the calculated memory size is secured in the memory and the training data. An information processing method for causing an information processing apparatus to execute processing by causing the processor to execute the selected processing instruction by using the learning data transferred to the second memory area.
以上の詳細な説明により、実施形態の特徴点および利点は明らかになるであろう。これは、特許請求の範囲がその精神および権利範囲を逸脱しない範囲で前述のような実施形態の特徴点および利点にまで及ぶことを意図するものである。また、当該技術分野において通常の知識を有する者であれば、あらゆる改良および変更に容易に想到できるはずである。したがって、発明性を有する実施形態の範囲を前述したものに限定する意図はなく、実施形態に開示された範囲に含まれる適当な改良物および均等物に拠ることも可能である。 The above detailed description will clarify the features and advantages of the embodiments. It is intended that the claims extend to the features and advantages of the embodiments as described above, without departing from their spirit and scope of rights. Also, anyone with ordinary knowledge in the art should be able to easily come up with any improvements or changes. Therefore, there is no intention to limit the scope of the embodiments having invention to those described above, and it is possible to rely on suitable improvements and equivalents included in the scope disclosed in the embodiments.
100、100A、100B、100C、100D 情報処理装置
200 ホストCPU
220 I/Oコントローラ
300 ホストメモリ
310 ユーザ定義ファイル
311 ニューラルネットワーク
312 学習データ
400、400A、400B ホストプログラム
410 DLフレームワーク
411 演算種決定部
412 データサイズ変更部
413 問い合わせ部
414 変換/転送指示部
415 実行指示部
420 DNNライブラリ
421 情報管理部
422 演算処理予測部
423 処理命令
430 ランタイムライブラリ
431 変換/転送実行部
432 処理命令実行部
500 プロセッサ
510 演算コア
520 演算器
530 メモリ
100, 100A, 100B, 100C, 100D
220 I /
Claims (8)
学習対象の層の学習に使用する学習データのサイズと入力されたバッチサイズとに基づいて、処理するバッチサイズが異なる複数の処理命令の中から前記プロセッサに実行させる処理命令を選択し、
前記学習データのサイズと選択した処理命令で指定されるバッチサイズとに基づいて、学習対象の層の学習に使用するメモリサイズを算出し、
前記学習データを保持する前記メモリの第1のメモリ領域のメモリサイズが、算出したメモリサイズと一致しない場合、前記算出したメモリサイズを有する第2のメモリ領域を前記メモリに確保して前記学習データを転送し、前記第2のメモリ領域に転送した前記学習データを使用して、前記選択した処理命令を前記プロセッサに実行させる、処理を情報処理装置に実行させる情報処理プログラム。 An information processing program that controls learning of a neural network including a plurality of layers executed by a processor having one or more arithmetic units including an arithmetic unit and a memory for holding data used in the arithmetic unit.
Based on the size of the training data used for learning the layer to be learned and the input batch size, a processing instruction to be executed by the processor is selected from a plurality of processing instructions having different batch sizes to be processed.
Based on the size of the training data and the batch size specified by the selected processing instruction, the memory size used for training the layer to be trained is calculated.
When the memory size of the first memory area of the memory that holds the training data does not match the calculated memory size, a second memory area having the calculated memory size is secured in the memory and the training data. An information processing program that causes an information processing apparatus to execute processing by causing the processor to execute the selected processing instruction using the learning data transferred to the second memory area.
前記第1のメモリ領域に保持された前記学習データの配置パターンが、前記選択した処理命令で使用する配置パターンと一致しない場合、第3のメモリ領域を前記メモリに確保し、前記選択した処理命令で使用する配置パターンで前記第3のメモリ領域に前記学習データを転送し、前記第3のメモリ領域に転送した前記学習データを使用して前記選択した処理命令を前記プロセッサに実行させる処理を情報処理装置に実行させる、請求項1に記載の情報処理プログラム。 As an arrangement pattern for arranging the learning data in the memory, a distributed type in which the learning data is distributed and arranged in the memories of a plurality of the calculation units and a distribution type in which the learning data is distributed and arranged in the memories of the plurality of calculation units are duplicated. Has a duplicate type to be placed
When the arrangement pattern of the training data held in the first memory area does not match the arrangement pattern used in the selected processing instruction, a third memory area is secured in the memory and the selected processing instruction is used. Information processing that transfers the training data to the third memory area in the arrangement pattern used in the above-mentioned third memory area, and causes the processor to execute the selected processing instruction using the learning data transferred to the third memory area. The information processing program according to claim 1, which is executed by a processing device.
演算効率が高い方で、前記選択した処理命令を前記プロセッサに実行させる処理を情報処理装置に実行させる、請求項1ないし請求項4のいずれか1項に記載の情報処理プログラム。 When the memory size of the first memory area is larger than the calculated memory size, the learning data held in the first memory area is used to execute the selected processing instruction, and the first. The calculation efficiency of the case where the memory area of 2 is secured, the learning data is transferred, and the selected processing instruction is executed is calculated.
The information processing program according to any one of claims 1 to 4, wherein the information processing apparatus is made to execute a process of causing the processor to execute the selected processing instruction with higher calculation efficiency.
演算効率の高い方で、前記選択した処理命令を前記プロセッサに実行させる処理を情報処理装置に実行させる、請求項2に記載の情報処理プログラム。 When the learning data is held in the first memory area in the duplicate type and the data arrangement pattern of the selected processing instruction is the distributed type, the learning data held in the first memory area is stored. Calculates the calculation efficiency between the case where the selected processing instruction is executed by using the third memory area and the case where the learning data is transferred in the distributed type and the selected processing instruction is executed. And
The information processing program according to claim 2, wherein the information processing apparatus causes the information processing apparatus to execute a process of causing the processor to execute the selected processing instruction with higher calculation efficiency.
学習対象の層の学習に使用する学習データのサイズと入力されたバッチサイズとに基づいて、処理するバッチサイズが異なる複数の処理命令の中から前記プロセッサに実行させる処理命令を選択し、
前記学習データのサイズと選択した処理命令で指定されるバッチサイズとに基づいて、学習対象の層の学習に使用するメモリサイズを算出し、
前記学習データを保持する前記メモリの第1のメモリ領域のメモリサイズが、算出したメモリサイズと一致しない場合、前記算出したメモリサイズを有する第2のメモリ領域を前記メモリに確保して前記学習データを転送し、前記第2のメモリ領域に転送した前記学習データを使用して、前記選択した処理命令を前記プロセッサに実行させる、処理を情報処理装置に実行させる情報処理方法。 An information processing method that controls learning of a neural network including a plurality of layers executed by a processor having one or more arithmetic units including an arithmetic unit and a memory for holding data used in the arithmetic unit.
Based on the size of the training data used for learning the layer to be learned and the input batch size, a processing instruction to be executed by the processor is selected from a plurality of processing instructions having different batch sizes to be processed.
Based on the size of the training data and the batch size specified by the selected processing instruction, the memory size used for training the layer to be trained is calculated.
When the memory size of the first memory area of the memory that holds the training data does not match the calculated memory size, a second memory area having the calculated memory size is secured in the memory and the training data. An information processing method for causing an information processing apparatus to execute processing by causing the processor to execute the selected processing instruction by using the learning data transferred to the second memory area.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2019162722A JP7251416B2 (en) | 2019-09-06 | 2019-09-06 | Information processing program and information processing method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2019162722A JP7251416B2 (en) | 2019-09-06 | 2019-09-06 | Information processing program and information processing method |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2021043495A true JP2021043495A (en) | 2021-03-18 |
JP7251416B2 JP7251416B2 (en) | 2023-04-04 |
Family
ID=74864064
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2019162722A Active JP7251416B2 (en) | 2019-09-06 | 2019-09-06 | Information processing program and information processing method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP7251416B2 (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2022187708A (en) * | 2021-06-08 | 2022-12-20 | パナソニックIpマネジメント株式会社 | LEARNING DEVICE, LEARNING METHOD, AND PROGRAM |
WO2023022321A1 (en) * | 2021-08-17 | 2023-02-23 | 삼성전자 주식회사 | Distributed learning server and distributed learning method |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2007334636A (en) * | 2006-06-15 | 2007-12-27 | Fujitsu Ltd | Software update processing program and update processing apparatus |
WO2008139265A2 (en) * | 2006-12-05 | 2008-11-20 | Essilor International (Compagnie Generale D'optique) | Lens ordering and delivery system for head mounted display |
JP2015149038A (en) * | 2014-02-10 | 2015-08-20 | ルネサスエレクトロニクス株式会社 | ARITHMETIC CONTROL DEVICE, ARITHMETIC CONTROL METHOD, PROGRAM, AND OpenCL DEVICE |
JP2018018451A (en) * | 2016-07-29 | 2018-02-01 | 富士通株式会社 | Machine learning method, machine learning program, and information processing apparatus |
-
2019
- 2019-09-06 JP JP2019162722A patent/JP7251416B2/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2007334636A (en) * | 2006-06-15 | 2007-12-27 | Fujitsu Ltd | Software update processing program and update processing apparatus |
WO2008139265A2 (en) * | 2006-12-05 | 2008-11-20 | Essilor International (Compagnie Generale D'optique) | Lens ordering and delivery system for head mounted display |
JP2015149038A (en) * | 2014-02-10 | 2015-08-20 | ルネサスエレクトロニクス株式会社 | ARITHMETIC CONTROL DEVICE, ARITHMETIC CONTROL METHOD, PROGRAM, AND OpenCL DEVICE |
JP2018018451A (en) * | 2016-07-29 | 2018-02-01 | 富士通株式会社 | Machine learning method, machine learning program, and information processing apparatus |
Non-Patent Citations (1)
Title |
---|
本田巧ほか: "大規模GPUクラスタにおけるResNet−50/ImageNet学習の高速化", 情報処理学会研究報告 ハイパフォーマンスコンピューティング, vol. Vol.2019-HPC-170, No.6, JPN6021007792, 17 July 2019 (2019-07-17), JP, ISSN: 0004995017 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2022187708A (en) * | 2021-06-08 | 2022-12-20 | パナソニックIpマネジメント株式会社 | LEARNING DEVICE, LEARNING METHOD, AND PROGRAM |
WO2023022321A1 (en) * | 2021-08-17 | 2023-02-23 | 삼성전자 주식회사 | Distributed learning server and distributed learning method |
Also Published As
Publication number | Publication date |
---|---|
JP7251416B2 (en) | 2023-04-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20210264220A1 (en) | Method and system for updating embedding tables for machine learning models | |
US12169677B2 (en) | Standard cell layout generation with applied artificial intelligence | |
US8099584B2 (en) | Methods for scalably exploiting parallelism in a parallel processing system | |
CN110674936A (en) | A neural network processing method, device, computer equipment and storage medium | |
JP2021507383A (en) | Integrated memory structure for neural network processors | |
WO2019001418A1 (en) | Data sharing system and data sharing method therefor | |
CN116070557A (en) | Data path circuit design using reinforcement learning | |
US20200117701A1 (en) | Computation device, computation method, and program | |
EP2738675B1 (en) | System and method for efficient resource management of a signal flow programmed digital signal processor code | |
CN118626415B (en) | Model optimization method and related device | |
JP7251416B2 (en) | Information processing program and information processing method | |
CN114968559A (en) | LSF-based method for multi-host multi-GPU distributed arrangement of deep learning model | |
JP2025138911A (en) | Processing method and computing system | |
KR20240050389A (en) | Neural network architecture for group convolution implementation | |
Zhang et al. | Advancing MoE Efficiency: A Collaboration-Constrained Routing (C2R) Strategy for Better Expert Parallelism Design | |
EP2069958A2 (en) | Multiprocessor architecture with hierarchical processor organization | |
WO2024145354A1 (en) | Dynamic control of work scheduling | |
JP2023024960A (en) | Optimization of memory usage for efficiently executing neural network | |
CN116187155A (en) | Computing device and method for generating optimal input data | |
Wang et al. | TMAC: Training-targeted Mapping and Architecture Co-exploration for Wafer-scale Chips | |
TWI659324B (en) | Method and system for generating circuit planning results | |
CN119003135B (en) | Cloud task model method of high-precision artificial neural network optimization algorithm | |
EP4202774A1 (en) | Runtime predictors for neural network computation reduction | |
US11568021B2 (en) | Vector-vector multiplication techniques for processing systems | |
US20250190518A1 (en) | Grouped convolution processing optimization device and grouped convolution processing optimization method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20220517 |
|
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: 20230221 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20230222 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20230306 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 7251416 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |