JP2021060748A - Arithmetic processing device and arithmetic processing method - Google Patents

Arithmetic processing device and arithmetic processing method Download PDF

Info

Publication number
JP2021060748A
JP2021060748A JP2019184072A JP2019184072A JP2021060748A JP 2021060748 A JP2021060748 A JP 2021060748A JP 2019184072 A JP2019184072 A JP 2019184072A JP 2019184072 A JP2019184072 A JP 2019184072A JP 2021060748 A JP2021060748 A JP 2021060748A
Authority
JP
Japan
Prior art keywords
size
submatrix
matrix
arithmetic unit
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2019184072A
Other languages
Japanese (ja)
Inventor
能毅 黒川
Yoshiki Kurokawa
能毅 黒川
雄一郎 青木
Yuichiro Aoki
雄一郎 青木
田中 剛
Tsuyoshi Tanaka
剛 田中
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.)
Hitachi Ltd
Original Assignee
Hitachi Ltd
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 Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP2019184072A priority Critical patent/JP2021060748A/en
Publication of JP2021060748A publication Critical patent/JP2021060748A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Complex Calculations (AREA)

Abstract

To accomplish the acceleration of a matrix arithmetic processing.SOLUTION: An arithmetic processing device is accessible to a storage device that stores matrix data, and includes: a deciding unit which increases a partial row size that is a number of rows in a column direction of a partial matrix that is a dividing unit of the matrix data, obtains, when the partial row size after the increase becomes equal to or greater than a number of multiple multipliers, a partial column size that is a number of columns in a row direction of the partial matrix on the basis of the partial row size before the increase and of the number of multiple multipliers, and decides a shape of the partial matrix formed by the partial row size and by the partial column size; the plurality of multipliers; a plurality of adders; and a matrix arithmetic processing unit that executes a product-sum operation on a first partial matrix with the shape decided by the deciding unit among the pieces of first matrix data stored in the storage device, and a second partial matrix with the shape decided by the deciding unit among the pieces of second matrix data stored in the storage device.SELECTED DRAWING: Figure 2

Description

本発明は、行列演算を実行する演算装置および演算方法に関する。 The present invention relates to an arithmetic unit and an arithmetic method for performing matrix operations.

様々なアプリケーションにおいて、計算機上で行列演算の演算が実行されるが、演算量が大きく全体の処理のボトルネックとなる。そこで、従来から様々な方式により、高速化が追求されている。たとえば、特許文献1の情報処理装置は、行列を、行方向の先頭から、行方向にブロックサイズの倍数単位で4個に分割し、4個の第1部分行列を特定する。情報処理装置は、行列のうち4個の第1部分行列以外の領域を4個に分割し、4個の第2部分行列を特定する。情報処理装置は、それぞれの第1部分行列の各要素の値を生成する行列演算と、それぞれの第2部分行列の各要素の値を生成する行列演算とを、それぞれのスレッドに割り当てる。 In various applications, matrix operations are executed on a computer, but the amount of operations is large and becomes a bottleneck in the overall processing. Therefore, high speed has been pursued by various methods. For example, the information processing apparatus of Patent Document 1 divides a matrix into four in the row direction in units of multiples of the block size from the beginning in the row direction, and specifies four first submatrixes. The information processing apparatus divides the area other than the four first sub-matrix of the matrix into four and specifies the four second sub-matrix. The information processing apparatus assigns to each thread a matrix operation that generates a value of each element of each first submatrix and a matrix operation that generates a value of each element of each second submatrix.

特開2018‐197906号公報JP-A-2018-197906

FPGA(Field−Programmable Gate Array)のようなオフロードデバイスは、内部メモリを一定量有し、内部メモリへの高速アクセスにより、プロセッサに替わって高速に演算することで、プロセッサの負荷を低減させる。特許文献1の方式をオフロードデバイスに適用すると、オフロードデバイスの内部メモリは、プロセッサのレジスタよりサイズが大きいため、内部メモリを十分に生かすことができない。 An offload device such as an FPGA (Field-Programmable Gate Array) has a certain amount of internal memory, and high-speed access to the internal memory reduces the load on the processor by performing high-speed calculation instead of the processor. When the method of Patent Document 1 is applied to an offload device, the internal memory of the offload device is larger than the register of the processor, so that the internal memory cannot be fully utilized.

また、FPGAなど論理で構成する場合には、行列の一部分が割り当てられない部分専用の回路を必要とするため、非効率的である。FPGAは、内部メモリを2次元的に行列の一部分に割り当て、その部分の乗算を高速に実行する。ただし、この方式では、元になる行列の行および列のサイズである行列の形状により、演算効率を最高にするための最適な部分行列の形状が異なる。 Further, when it is configured by logic such as FPGA, it is inefficient because a circuit dedicated to a part where a part of the matrix is not allocated is required. The FPGA two-dimensionally allocates internal memory to a part of the matrix and executes multiplication of that part at high speed. However, in this method, the optimum shape of the submatrix for maximizing the calculation efficiency differs depending on the row of the original matrix and the shape of the matrix which is the size of the column.

FPGAが一定の行列サイズに対して乗算を行う場合、事前に部分行列のサイズをチューニングして固定することにより、一定の行列サイズに対して乗算が可能となる。しかしながら、様々なサイズの行列入力が想定される場合、部分行列のサイズを一意に決定することが困難となる。 When the FPGA performs multiplication on a fixed matrix size, it is possible to multiply on a fixed matrix size by tuning and fixing the size of the submatrix in advance. However, when matrix inputs of various sizes are expected, it becomes difficult to uniquely determine the size of the submatrix.

本発明は、行列演算の高速化を図ることを目的とする。 An object of the present invention is to speed up matrix operations.

本願において開示される発明の一側面となる演算装置は、行列データを記憶する記憶デバイスにアクセス可能な演算装置であって、前記行列データの分割単位となる部分行列の行方向の列数である部分列サイズを増加させ、増加後の部分列サイズが複数の乗算器の個数以上となった場合、増加前の前記部分列サイズと前記複数の乗算器の個数とに基づいて、前記部分行列の列方向の行数である部分行サイズを求め、前記部分列サイズと前記部分行サイズとにより構成される前記部分行列の形状を決定する決定部と、前記複数の乗算器と複数の加算器とを有し、前記記憶デバイスに記憶されている第1行列データのうち前記決定部によって決定された形状の第1部分行列と、前記記憶デバイスに記憶されている第2行列データのうち前記決定部によって決定された形状の第2部分行列と、の積和演算を実行する行列演算部と、を有することを特徴とする。 The arithmetic device that is one aspect of the invention disclosed in the present application is an arithmetic device that can access a storage device that stores matrix data, and is the number of columns in the row direction of a submatrix that is a division unit of the matrix data. When the sub-column size is increased and the increased sub-column size is equal to or greater than the number of the plurality of multipliers, the sub-matrix of the sub-matrix is based on the sub-column size before the increase and the number of the plurality of multipliers. A determination unit that obtains a partial row size, which is the number of rows in the column direction, and determines the shape of the submatrix composed of the subcolumn size and the partial row size, and the plurality of multipliers and a plurality of adders. The first matrix data having a shape determined by the determination unit among the first matrix data stored in the storage device, and the determination unit among the second matrix data stored in the storage device. It is characterized by having a second submatrix having a shape determined by the above and a matrix calculation unit that executes a product-sum operation.

本発明の代表的な実施の形態によれば、行列演算の高速化を図ることができる。前述した以外の課題、構成及び効果は、以下の実施例の説明により明らかにされる。 According to a typical embodiment of the present invention, the speed of matrix operation can be increased. Issues, configurations and effects other than those described above will be clarified by the description of the following examples.

図1は、部分行列の形状の決定例を示す説明図である。FIG. 1 is an explanatory diagram showing an example of determining the shape of a submatrix. 図2は、演算装置のハードウェア構成例を示すブロック図である。FIG. 2 is a block diagram showing a hardware configuration example of the arithmetic unit. 図3は、部分行列形状決定回路による部分行列サイズ決定の上位側アルゴリズムを示すフローチャートである。FIG. 3 is a flowchart showing a higher-level algorithm for determining the submatrix size by the submatrix shape determining circuit. 図4は、ステップS303およびS306における部分行列形状決定回路による部分行列サイズ決定アルゴリズムを示すフローチャートである。FIG. 4 is a flowchart showing a submatrix size determination algorithm by the submatrix shape determination circuit in steps S303 and S306. 図5は、センスアンプキャッシュサイズと列サイズと部分列サイズとの関係を示す説明図である。FIG. 5 is an explanatory diagram showing the relationship between the sense amplifier cache size, the column size, and the subsequence size. 図6は、部分行列形状決定回路による部分行列を使用した乗算実行アルゴリズムを示すフローチャートである。FIG. 6 is a flowchart showing a multiplication execution algorithm using a submatrix by the submatrix shape determination circuit. 図7は、部分行列形状決定回路以降の処理例を示す説明図である。FIG. 7 is an explanatory diagram showing a processing example after the submatrix shape determination circuit. 図8は、行列演算アレイの動作例を示す説明図である。FIG. 8 is an explanatory diagram showing an operation example of the matrix operation array. 図9は、レジスタ群の詳細を示すブロック図である。FIG. 9 is a block diagram showing details of the register group. 図10は、制御プログラムによる制御処理例を示すフローチャートである。FIG. 10 is a flowchart showing an example of control processing by the control program. 図11は、ログ出力部の制御処理例を示す説明図である。FIG. 11 is an explanatory diagram showing an example of control processing of the log output unit.

<部分行列形状の決定例>
図1は、部分行列の形状の決定例を示す説明図である。入力行列101は、行方向の列数(COL)102および列方向の行数(ROW)103からなる行列である。オフロードデバイスで行列演算する演算装置が入力行列を取得した場合、行列演算に先立って入力行列101を部分行列に分割する。部分行列は、入力行列101の分割単位となる。
<Example of determining submatrix shape>
FIG. 1 is an explanatory diagram showing an example of determining the shape of a submatrix. The input matrix 101 is a matrix composed of the number of columns (COL) 102 in the row direction and the number of rows (ROW) 103 in the column direction. When the arithmetic unit that performs the matrix operation by the offload device acquires the input matrix, the input matrix 101 is divided into submatrixes prior to the matrix operation. The submatrix is a division unit of the input matrix 101.

ここで、第1部分行列111は、列数(COL)112および行数(ROW)113からなる行列である。一例として、第1部分行列111は、正方行列とする。第2部分行列121は、列数(COL)122および行数(ROW)123からなる行列である。第1部分行列111および第2部分行列121において、列数(COL)112<列数(COL)122、行数(ROW)113>行数(ROW)123とする。 Here, the first submatrix 111 is a matrix composed of the number of columns (COL) 112 and the number of rows (ROW) 113. As an example, the first submatrix 111 is a square matrix. The second submatrix 121 is a matrix composed of the number of columns (COL) 122 and the number of rows (ROW) 123. In the first sub-matrix 111 and the second sub-matrix 121, the number of columns (COL) 112 <the number of columns (COL) 122, the number of rows (ROW) 113> the number of rows (ROW) 123.

第1分割例110は、入力行列101を第1部分行列111によって分割した分割例である。入力行列101第1部分行列111で分割すると、縦V(2個)×横H(4個)で8個の第1部分行列111に分割される。 The first division example 110 is a division example in which the input matrix 101 is divided by the first submatrix 111. When the input matrix 101 is divided by the first submatrix 111, it is divided into eight first submatrix 111 by vertical V (2 pieces) × horizontal H (4 pieces).

第2分割例120は、入力行列101を第2部分行列121によって分割した分割例である。入力行列101第2部分行列121で分割すると、縦V(3個)×横H(2個)で6個の第2部分行列121に分割される。 The second division example 120 is a division example in which the input matrix 101 is divided by the second submatrix 121. When the input matrix 101 is divided by the second submatrix 121, it is divided into six second submatrix 121 by vertical V (3 pieces) × horizontal H (2 pieces).

第1分割例110の分割数は8個であり、第2分割例120の分割数は6個である。演算装置は、部分行列の形状を第2部分行列121に決定することにより、第1部分行列111よりも演算回数を減らすことができ、演算処理の高速化が可能となる。 The number of divisions of the first division example 110 is eight, and the number of divisions of the second division example 120 is six. By determining the shape of the submatrix to be the second submatrix 121, the arithmetic unit can reduce the number of operations as compared with the first submatrix 111, and can speed up the arithmetic processing.

<演算装置のハードウェア構成例>
図2は、演算装置のハードウェア構成例を示すブロック図である。演算装置200は、行列演算を実行する。演算装置200は、プロセッサ201と、メモリ202と、汎用バス203と、FPGA204と、DRAM(Dynamic Random Access Memory)205と、を有する。なお、演算装置200は、少なくとも、FPGA204を有していればよい。
<Hardware configuration example of arithmetic unit>
FIG. 2 is a block diagram showing a hardware configuration example of the arithmetic unit. The arithmetic unit 200 executes a matrix operation. The arithmetic unit 200 includes a processor 201, a memory 202, a general-purpose bus 203, an FPGA 204, and a DRAM (Dynamic Random Access Memory) 205. The arithmetic unit 200 may have at least FPGA 204.

プロセッサ201は、メモリ202およびFPGA204を制御する。たとえば、プロセッサ201は、メモリ202上にある制御プログラム206の命令列を逐次読み出し、制御プログラム206を実行する。プロセッサ201は、制御プログラム206の実行に際し、その処理入力として、メモリ202からデータを読み出し、実行結果をメモリ202に書き出す。また、プロセッサ201は、汎用バス203を経由してFPGA204にアクセスすることで、FPGA204とのデータのやり取りや制御を行う。 Processor 201 controls memory 202 and FPGA 204. For example, the processor 201 sequentially reads the instruction sequence of the control program 206 on the memory 202 and executes the control program 206. When the control program 206 is executed, the processor 201 reads data from the memory 202 as a processing input thereof and writes the execution result to the memory 202. Further, the processor 201 exchanges and controls data with the FPGA 204 by accessing the FPGA 204 via the general-purpose bus 203.

メモリ202は、制御プログラム206と、行列Aデータ207と、行列Bデータ208と、結果Cデータ209と、ログデータ210と、各種データ(不図示)と、を記憶する。制御プログラム206は、演算装置200を制御するためのプログラムであり、プロセッサ201により実行される。行列Aデータ207は、一方の入力行列101を示すデータであり、行列Bデータ208は、他方の入力行列101を示すデータである。行列Aデータ207および行列Bデータ208は、行列演算の実行時に汎用バス203を経由してFPGA204に接続されたDRAM205に転送される。 The memory 202 stores the control program 206, the matrix A data 207, the matrix B data 208, the result C data 209, the log data 210, and various data (not shown). The control program 206 is a program for controlling the arithmetic unit 200, and is executed by the processor 201. The matrix A data 207 is data indicating one input matrix 101, and the matrix B data 208 is data indicating the other input matrix 101. The matrix A data 207 and the matrix B data 208 are transferred to the DRAM 205 connected to the FPGA 204 via the general-purpose bus 203 when the matrix operation is executed.

結果Cデータ209は、行列Aデータ207と行列Bデータ208との乗算結果を示すデータである。結果Cデータ209は、DRAM205からFPGA204および汎用バス203を経由してメモリ202に保存される。ログデータ210は、FPGA204の演算処理のログを示すデータであり、汎用バス203経由でメモリ202に書き出される。汎用バス203は、プロセッサ201とFPGA204とを接続しデータの送受信を行う。 The result C data 209 is data showing the multiplication result of the matrix A data 207 and the matrix B data 208. The result C data 209 is stored in the memory 202 from the DRAM 205 via the FPGA 204 and the general-purpose bus 203. The log data 210 is data indicating a log of arithmetic processing of the FPGA 204, and is written to the memory 202 via the general-purpose bus 203. The general-purpose bus 203 connects the processor 201 and the FPGA 204 to transmit and receive data.

FPGA204は、プログラマブルに論理回路を構成して動作させるオフロードデバイスである。FPGA204は、行列演算を実行する。また、FPGA204は、汎用バス203に接続され、プロセッサ201とデータの送受信を行う。また、FPGA204は、DRAM205へのアクセス機能を有し、DRAM205上へのデータの保存や読み出しを行う。また、FPGA204もDMA機能により汎用バス203を経由してメモリ202にデータを読み書きすることが可能である。 The FPGA 204 is an off-road device that programmablely configures and operates a logic circuit. FPGA 204 performs matrix operations. Further, the FPGA 204 is connected to the general-purpose bus 203 and transmits / receives data to / from the processor 201. The FPGA 204 also has an access function to the DRAM 205, and stores and reads data on the DRAM 205. Further, the FPGA 204 can also read / write data to / from the memory 202 via the general-purpose bus 203 by the DMA function.

FPGA204は、アレイサイズレジスタ211と、センスアンプキャッシュサイズレジスタ212と、スレッショルドレジスタ213と、行列ABサイズレジスタ214と、部分行列形状決定回路215と、加算制御回路216と、リードアドレス生成部217と、読み込みバッファ218と、ゼロ値219と、セレクタ220と、行列演算アレイ221と、ライトアドレス生成部222と、書き出しバッファ223と、DMAC(Direct Memory Access Controller)224と、ログ出力部225と、バス制御部226と、を有する。 The FPGA 204 includes an array size register 211, a sense amplifier cache size register 212, a threshold register 213, a matrix AB size register 214, a submatrix shape determination circuit 215, an addition control circuit 216, a read address generator 217, and the like. Read buffer 218, zero value 219, selector 220, matrix operation array 221, write address generation unit 222, write buffer 223, DMAC (Direct Memory Access Controller) 224, log output unit 225, and bus control. It has a part 226 and.

アレイサイズレジスタ211は、行列演算アレイ221のサイズを保持する。センスアンプキャッシュサイズレジスタ212は、DRAM205に搭載されるセンスアンプのサイズを保持する。スレッショルドレジスタ213は、行列演算における部分行列の形状を決定する際のセンスアンプキャッシュのヒット数をスレッショルドとして保持する。行列ABサイズレジスタ214は、行列Aデータのサイズと行列Bデータのサイズとを、それぞれ行と列に分けて保存する。 The array size register 211 holds the size of the matrix operation array 221. The sense amplifier cache size register 212 holds the size of the sense amplifier mounted on the DRAM 205. The threshold register 213 holds the number of hits of the sense amplifier cache when determining the shape of the submatrix in the matrix operation as the threshold. The matrix AB size register 214 stores the size of the matrix A data and the size of the matrix B data separately in rows and columns, respectively.

部分行列形状決定回路215は、アレイサイズレジスタ211、センスアンプキャッシュサイズレジスタ212、スレッショルドレジスタ213および行列ABサイズレジスタ214に保存されたデータを使用して、行列演算の実行に必要な部分行列のサイズを算出する。この算出値は加算制御回路216に出力され、部分行列の最適なサイズでの計算を実行するために使用される。また、部分行列にマッチしない行列の端数(図1の第1分割例および第2分割例の余白の部分)を生成し、加算制御回路216に出力する。 The submatrix shape determination circuit 215 uses the data stored in the array size register 211, the sense amplifier cache size register 212, the threshold register 213, and the matrix AB size register 214 to determine the size of the submatrix required to perform the matrix operation. Is calculated. This calculated value is output to the addition control circuit 216 and is used to perform the calculation with the optimum size of the submatrix. Further, a fraction of the matrix that does not match the submatrix (the margin portion of the first division example and the second division example in FIG. 1) is generated and output to the addition control circuit 216.

加算制御回路216は、部分行列形状決定回路215から部分行列形状を取得し、行列演算アレイ221を制御する。また、加算制御回路216は、セレクタ220を制御して端数に0を挿入する。リードアドレス生成部217は、DRAM205のリードアドレスを生成し、行列Aデータ207および行列Bデータ208をDRAM205から読み出す。読み出された行列Aデータ207および行列Bデータ208は、読み込みバッファ218に保存される。 The addition control circuit 216 acquires the submatrix shape from the submatrix shape determination circuit 215 and controls the matrix calculation array 221. Further, the addition control circuit 216 controls the selector 220 to insert 0 as a fraction. The read address generation unit 217 generates the read address of the DRAM 205, and reads the matrix A data 207 and the matrix B data 208 from the DRAM 205. The read matrix A data 207 and matrix B data 208 are stored in the read buffer 218.

読み込みバッファ218は、DRAM205から読み出した行列Aデータ207および行列Bデータ208を保存し、セレクタ220経由で行列演算アレイ221に出力する。ゼロ値219219は、行列演算で使用するデータ型に適合したゼロの値を示すデータである。セレクタ220は、加算制御回路216からの選択指示により、読み込みバッファ218から送られてくる行列Aデータ207または行列Bデータ208と、ゼロ値219と、のいずれかを選択して行列演算アレイ221に出力する。 The read buffer 218 stores the matrix A data 207 and the matrix B data 208 read from the DRAM 205, and outputs the matrix A data 207 and the matrix B data 208 to the matrix operation array 221 via the selector 220. The zero value 2192219 is data indicating a zero value suitable for the data type used in the matrix operation. The selector 220 selects either the matrix A data 207 or the matrix B data 208 sent from the read buffer 218 and the zero value 219 according to the selection instruction from the addition control circuit 216 to the matrix operation array 221. Output.

行列演算アレイ221は、セレクタ220からのデータを行列演算、すなわち、積和演算する。このとき、行列演算アレイ221は、加算制御回路216からの制御により、選択した部分行列サイズに合わせた積和演算を実行する。この実行結果は書き出しバッファ223に転送される。 The matrix operation array 221 performs a matrix operation, that is, a product-sum operation on the data from the selector 220. At this time, the matrix operation array 221 executes the product-sum operation according to the selected submatrix size under the control of the addition control circuit 216. This execution result is transferred to the write buffer 223.

ライトアドレス生成部222は、書き出しバッファ223に保存されている結果Cデータ209をDRAM205に書き出すためのアドレスを生成する。書き出しバッファ223は、行列演算アレイ221が生成する結果Cデータ209を保持し、DRAM205へ書き込む。DMAC224は、FPGA204からメモリ202へのデータ送受信を制御する。送受信されるデータには、たとえば、行列Aデータ207、行列Bデータ208、結果Cデータ209、ログデータ210があり、DMAC224は、DRAM205やFPGA204の内部データの送受信を制御する。 The write address generation unit 222 generates an address for writing the result C data 209 stored in the write buffer 223 to the DRAM 205. The write buffer 223 holds the result C data 209 generated by the matrix operation array 221 and writes it to the DRAM 205. The DMAC224 controls data transmission / reception from the FPGA 204 to the memory 202. The data to be transmitted / received includes, for example, matrix A data 207, matrix B data 208, result C data 209, and log data 210, and the DMAC 224 controls the transmission / reception of internal data of the DRAM 205 or FPGA 204.

ログ出力部225は、部分行列形状決定回路215の動作をログとして内部に保存し、DMAC224を使用して、メモリ202内のログデータ210に出力する。バス制御部226は、汎用バス203を制御し、プロセッサ201によるアレイサイズレジスタ211、センスアンプキャッシュサイズレジスタ212、スレッショルドレジスタ213、行列ABサイズレジスタ214への読み書き制御を行う。 The log output unit 225 internally stores the operation of the submatrix shape determination circuit 215 as a log, and outputs the operation to the log data 210 in the memory 202 by using the DMAC224. The bus control unit 226 controls the general-purpose bus 203, and controls reading and writing to the array size register 211, the sense amplifier cache size register 212, the threshold register 213, and the matrix AB size register 214 by the processor 201.

DRAM205は、データを保持し、FPGA204とデータを送受信する記憶デバイスである。DRAM205は、FPGA204に占有して使用される。 The DRAM 205 is a storage device that holds data and transmits / receives data to / from FPGA 204. The DRAM 205 is used exclusively for the FPGA 204.

演算装置200の動作は、以下の通りである。演算装置200は、プロセッサ201に制御プログラム206を実行させる。演算装置200は、制御プログラム206により、アレイサイズレジスタ211、センスアンプキャッシュサイズレジスタ212、スレッショルドレジスタ213、行列ABサイズレジスタ214を設定する。ここで、演算装置200は、FPGA204を起動する。 The operation of the arithmetic unit 200 is as follows. The arithmetic unit 200 causes the processor 201 to execute the control program 206. The arithmetic unit 200 sets the array size register 211, the sense amplifier cache size register 212, the threshold register 213, and the matrix AB size register 214 by the control program 206. Here, the arithmetic unit 200 starts the FPGA 204.

FPGA204は、DMAC224を使用して行列Aデータ207と行列Bデータ208とをDRAM205に転送する。転送されると、部分行列形状決定回路215が起動し、行列Aおよび行列B双方に最適な部分行列サイズを算出する。この算出結果に基づいて、リードアドレス生成部217が、転送されてきたDRAM205上の行列A、行列Bから部分行列サイズの部分を切り出し、読み込みバッファ218に転送する。 The FPGA 204 uses the DMAC224 to transfer the matrix A data 207 and the matrix B data 208 to the DRAM 205. When transferred, the submatrix shape determination circuit 215 is activated to calculate the optimum submatrix size for both the matrix A and the matrix B. Based on this calculation result, the read address generation unit 217 cuts out a submatrix size portion from the transferred matrix A and matrix B on the DRAM 205 and transfers the submatrix size portion to the read buffer 218.

セレクタ220は、その転送データを行列演算アレイ221に転送し、行列演算アレイ221は部分行列の演算を行い、書き出しバッファ223に結果Cデータ209を書き込む。行列演算アレイ221は、ライトアドレス生成部222で生成されたアドレスに従い、結果Cデータ209をDRAM205に書き込む。すべての行列演算が終了した時点で、FPGA204は、DMAC224により結果Cデータ209をメモリ202に書き込む。また、部分行列形状決定回路215が算出した最適部分行列サイズは、ログ出力部225に送られる。ログ出力部225はログデータ210を生成し、DMAC224を使用してメモリ202に転送される。 The selector 220 transfers the transfer data to the matrix operation array 221, the matrix operation array 221 performs a submatrix operation, and writes the result C data 209 to the write buffer 223. The matrix operation array 221 writes the result C data 209 to the DRAM 205 according to the address generated by the write address generation unit 222. When all the matrix operations are completed, the FPGA 204 writes the result C data 209 to the memory 202 by the DMAC224. Further, the optimum submatrix size calculated by the submatrix shape determination circuit 215 is sent to the log output unit 225. The log output unit 225 generates the log data 210 and transfers it to the memory 202 using the DMAC224.

<部分行列形状決定回路215による部分行列サイズ決定の上位側アルゴリズム>
図3は、部分行列形状決定回路215による部分行列サイズ決定の上位側アルゴリズムを示すフローチャートである。部分行列形状決定回路215は、行列A列サイズを行列ABサイズレジスタ214の列サイズレジスタに設定する(ステップS301)。部分行列形状決定回路215は、行列A行サイズを行列ABサイズレジスタ214の行サイズレジスタに設定する(ステップS302)。
<Upper algorithm for determining submatrix size by submatrix shape determination circuit 215>
FIG. 3 is a flowchart showing a higher-level algorithm for determining the submatrix size by the submatrix shape determining circuit 215. The submatrix shape determination circuit 215 sets the matrix A column size in the column size register of the matrix AB size register 214 (step S301). The submatrix shape determination circuit 215 sets the matrix A row size in the row size register of the matrix AB size register 214 (step S302).

部分行列形状決定回路215は、行列Aの部分行列の列数pCOLおよび行数pROWと、行列Aの横Haおよび縦Vaを決定する(ステップS303)。行列Bの列数pCOLは、行列Aの部分行列における行方向の列の数であり、行列Bの行数pROWは、行列Aの部分行列における列方向の行の数である。行列Aの横Haは、部分行列で分割された行列Aの横H(行方向)における部分行列の数であり、行列Aの縦Vaは、部分行列で分割された行列Aの縦V(列方向)における部分行列の数である。ステップS303の詳細は、図4で後述する。 The submatrix shape determination circuit 215 determines the number of columns pCOL and the number of rows pROW of the submatrix of the matrix A, and the horizontal Ha and vertical Va of the matrix A (step S303). The number of columns pCOL of the matrix B is the number of columns in the row direction in the submatrix of the matrix A, and the number of rows pROW in the matrix B is the number of rows in the column direction in the submatrix of the matrix A. The horizontal Ha of the matrix A is the number of submatrixes in the horizontal H (row direction) of the matrix A divided by the submatrix, and the vertical Va of the matrix A is the vertical V (column) of the matrix A divided by the submatrix. The number of submatrixes in direction). Details of step S303 will be described later in FIG.

部分行列形状決定回路215は、行列B行サイズを行列ABサイズレジスタ214の列サイズレジスタに設定する(ステップS304)。部分行列形状決定回路215は、行列B列サイズを行列ABサイズレジスタ214の行サイズレジスタに設定する(ステップS305)。行列Bは転置されてDAされるため、ステップS304およびS305では、ステップS301およびS302とは異なり、行列Bの行サイズが列サイズレジスタに設定され、行列Bの列サイズが行サイズレジスタに設定される。 The submatrix shape determination circuit 215 sets the matrix B row size in the column size register of the matrix AB size register 214 (step S304). The submatrix shape determination circuit 215 sets the matrix B column size in the row size register of the matrix AB size register 214 (step S305). Since the matrix B is transposed and DA, in steps S304 and S305, unlike steps S301 and S302, the row size of the matrix B is set in the column size register and the column size of the matrix B is set in the row size register. To.

部分行列形状決定回路215は、行列Bの部分行列の列数pCOLおよび行数pROWと、行列Bの横Hbおよび縦Vbを決定する(ステップS306)。行列Bの列数pCOLは、行列Bの部分行列における行方向の列の数であり、行列Bの行数pROWは、行列Bの部分行列における列方向の行の数である。行列Bの横Hbは、部分行列で分割された行列Bの横H(行方向)における部分行列の数であり、行列Bの縦Vbは、部分行列で分割された行列Bの縦V(列方向)における部分行列の数である。ステップS306の詳細は、図4で後述する。 The submatrix shape determination circuit 215 determines the number of columns pCOL and the number of rows pROW of the submatrix of the matrix B, and the horizontal Hb and vertical Vb of the matrix B (step S306). The number of columns pCOL of the matrix B is the number of columns in the row direction in the submatrix of the matrix B, and the number of rows pROW in the matrix B is the number of rows in the column direction in the submatrix of the matrix B. The horizontal Hb of the matrix B is the number of submatrixes in the horizontal H (row direction) of the matrix B divided by the submatrix, and the vertical Vb of the matrix B is the vertical V (column) of the matrix B divided by the submatrix. The number of submatrixes in direction). Details of step S306 will be described later in FIG.

部分行列形状決定回路215は、行列Bの部分行列の列数pCOLと行数pROWとを入れ替え、横Hbと縦Vbとを入れ替える(ステップS307)。部分行列形状決定回路215は、行列Aの部分行列の列数pCOLと行列Bの部分行列の列数pCOLとを比較し、大きい方を部分行列の列数pCOLとして選択する(ステップS308)。 The submatrix shape determination circuit 215 replaces the number of columns pCOL and the number of rows pROW of the submatrix of the matrix B, and replaces the horizontal Hb and the vertical Vb (step S307). The submatrix shape determination circuit 215 compares the number of columns pCOL of the submatrix of the matrix A with the number of columns pCOL of the submatrix of the matrix B, and selects the larger one as the number of columns pCOL of the submatrix (step S308).

部分行列形状決定回路215は、列数pCOLが選択された方の行列(AまたはB)の部分行列の列数pROWを選択する(ステップS309)。部分行列形状決定回路215は、行列Aが選択された場合、ステップS308で選択されたpCOLとステップS309で選択されたpROWとを用いて、横Hbおよび縦Vbを再計算し、行列Bが選択された場合、ステップS308で選択されたpCOLとステップS309で選択されたpROWとを用いて、横Ha、縦Vaを再計算する(ステップS310)。これにより、一連の処理が終了する。 The submatrix shape determination circuit 215 selects the number of columns pROW of the submatrix of the matrix (A or B) for which the number of columns pCOL is selected (step S309). When the matrix A is selected, the submatrix shape determination circuit 215 recalculates the horizontal Hb and the vertical Vb using the pCOL selected in step S308 and the pROW selected in step S309, and the matrix B is selected. If so, the horizontal Ha and vertical Va are recalculated using the pCOL selected in step S308 and the pROW selected in step S309 (step S310). As a result, a series of processes is completed.

<部分行列形状決定回路215の部分行列サイズ決定アルゴリズム>
図4は、ステップS303およびS306における部分行列形状決定回路215による部分行列サイズ決定アルゴリズムを示すフローチャートである。部分行列形状決定回路215は、DRAM205への最小アクセス回数の初期値として、最小アクセス回数が取りうる最大値を設定する(ステップS401)。部分行列形状決定回路215は、部分列サイズに初期値の「1」を設定する(ステップS402)。
<Submatrix size determination algorithm of submatrix shape determination circuit 215>
FIG. 4 is a flowchart showing a submatrix size determination algorithm by the submatrix shape determination circuit 215 in steps S303 and S306. The submatrix shape determination circuit 215 sets the maximum value that the minimum number of accesses can take as the initial value of the minimum number of accesses to the DRAM 205 (step S401). The submatrix shape determination circuit 215 sets the initial value “1” for the subsequence size (step S402).

部分行列形状決定回路215は、部分列サイズを1ビットシフトして、2倍の値とする(ステップS403)。部分行列形状決定回路215は、部分列サイズをアレイサイズレジスタ211の値と比較する(ステップS404)。比較した結果、部分列サイズがアレイサイズ以上になると(ステップS404:Yes)、それ以上の部分列サイズを使用できないため、終了処理(ステップS415〜S418)に移行する。それ以外(ステップS404:No)では、ステップS405に移行する。 The submatrix shape determination circuit 215 shifts the subsequence size by 1 bit to double the value (step S403). The submatrix shape determination circuit 215 compares the subsequence size with the value of the array size register 211 (step S404). As a result of comparison, when the subsequence size becomes equal to or larger than the array size (step S404: Yes), since the subsequence size larger than that cannot be used, the process proceeds to the termination process (steps S415 to S418). Other than that (step S404: No), the process proceeds to step S405.

部分行列形状決定回路215は、センスアンプキャッシュサイズレジスタ212と対象行列の列サイズレジスタと、現在の部分列サイズと、に基づいて、センスアンプキャッシュヒット回数を算出する(ステップS405)。対象行列とは、本フローチャートの処理がステップS303内の処理であれば、行列Aであり、本フローチャートの処理がステップS306内の処理であれば、行列Bである。 The submatrix shape determination circuit 215 calculates the number of sense amplifier cache hits based on the sense amplifier cache size register 212, the column size register of the target matrix, and the current submatrix size (step S405). The target matrix is the matrix A if the processing of this flowchart is the processing in step S303, and the target matrix is the matrix B if the processing of this flowchart is the processing in step S306.

図5は、センスアンプキャッシュサイズと列サイズと部分列サイズとの関係を示す説明図である。部分行列形状決定回路215は、具体的には、たとえば、センスアンプキャッシュサイズレジスタ212の値(センスアンプキャッシュサイズ)を対象行列の列サイズで割り算し、その割り算結果の余りを切り捨てる。そして、部分行列形状決定回路215は、余り切り捨て後の割り算結果と、部分行列の部分列サイズと、を乗算する。部分行列形状決定回路215は、この乗算結果に、同じくセンスアンプキャッシュサイズを列サイズで割り算した余りと、部分列サイズと、の小さい方を加算する。この加算結果がセンスアンプキャッシュヒット回数である。 FIG. 5 is an explanatory diagram showing the relationship between the sense amplifier cache size, the column size, and the subsequence size. Specifically, the submatrix shape determination circuit 215 divides the value of the sense amplifier cache size register 212 (sense amplifier cache size) by the column size of the target matrix, and truncates the remainder of the division result. Then, the submatrix shape determination circuit 215 multiplies the division result after truncation of the remainder and the submatrix size of the submatrix. The submatrix shape determination circuit 215 adds the remainder of the sense amplifier cache size divided by the column size and the submatrix size, whichever is smaller, to the multiplication result. The result of this addition is the number of sense amplifier cache hits.

図4に戻り、部分行列形状決定回路215は、ステップS405で算出したセンスアンプキャッシュヒット回数とスレッショルドレジスタ213の値とを比較する(ステップS406)。キャッシュヒット回数がスレッショルドより小さい場合(ステップS406:No)、この部分列サイズは不適格と判定し、ステップS403に戻る。キャッシュヒット回数がスレッショルド以上の場合(ステップS:Yes)、ステップS407に移行する。 Returning to FIG. 4, the submatrix shape determination circuit 215 compares the number of sense amplifier cache hits calculated in step S405 with the value of the threshold register 213 (step S406). If the number of cache hits is smaller than the threshold (step S406: No), this subsequence size is determined to be ineligible, and the process returns to step S403. If the number of cache hits is greater than or equal to the threshold (step S: Yes), the process proceeds to step S407.

部分行列形状決定回路215は、対象行列の部分行列の列数pCOLを部分列サイズに設定する(ステップS407)。部分行列形状決定回路215は、アレイサイズレジスタ211の値を、ステップS407で設定した列数pCOLで割ることで、対象行列の部分行列の行数pROWを算出する(ステップS408)。 The submatrix shape determination circuit 215 sets the number of columns pCOL of the submatrix of the target matrix to the submatrix size (step S407). The submatrix shape determination circuit 215 calculates the number of rows pROW of the submatrix of the target matrix by dividing the value of the array size register 211 by the number of columns pCOL set in step S407 (step S408).

部分行列形状決定回路215は、横方向の部分行列数である横Hを求める(ステップS409)。具体的には、たとえば、部分行列形状決定回路215は、対象行列の列サイズレジスタの値を列数pCOLで割り算し、切り上げることで、横Hを算出する。 The submatrix shape determination circuit 215 obtains the lateral H, which is the number of submatrixes in the lateral direction (step S409). Specifically, for example, the submatrix shape determination circuit 215 calculates the lateral H by dividing the value of the column size register of the target matrix by the number of columns pCOL and rounding up.

部分行列形状決定回路215は、縦方向の部分行列数である縦Vを求める(ステップS410)。具体的には、たとえば、部分行列形状決定回路215は、対象行列の行サイズレジスタの値を行数pROWで割り算し、切り上げしることで、縦Vを算出する。 The submatrix shape determination circuit 215 obtains the vertical V, which is the number of submatrixes in the vertical direction (step S410). Specifically, for example, the submatrix shape determination circuit 215 calculates the vertical V by dividing the value of the row size register of the target matrix by the number of rows pROW and rounding up.

部分行列形状決定回路215は、ステップS409で算出した横Hと、ステップS410で算出した縦Vとを乗算し、対象行列を覆う部分行列数Nを求める(ステップS411)。部分行列形状決定回路215は、部分行列数Nと最小アクセス回数とを比較する(ステップS412)。部分行列数Nが最小アクセス回数より大きい場合(ステップS412:No)、不適格として、ステップS403に戻る。それ以外の場合(ステップS412:Yes)、現在の部分行列数Nが適格として、ステップS413に移行する。 The submatrix shape determination circuit 215 multiplies the horizontal H calculated in step S409 by the vertical V calculated in step S410 to obtain the number N of submatrix covering the target matrix (step S411). The submatrix shape determination circuit 215 compares the number of submatrix N with the minimum number of accesses (step S412). If the number of submatrix N is larger than the minimum number of accesses (step S412: No), the process returns to step S403 as ineligible. In other cases (step S412: Yes), the current number of submatrix N is qualified and the process proceeds to step S413.

部分行列形状決定回路215は、変数である選択列数pCOLに現在の列数pCOLの値を代入して仮決定値とする(ステップS413)。部分行列形状決定回路215は、最小アクセス回数に現在の部分行列数Nを代入し(ステップS414)、ステップS403に戻る。このループにより、図1に示したように、部分行列として当初、第1部分行列111が選択されるが、最小アクセス数(N=V×H)がより小さくなる第2部分行列121に更新されることになる。 The submatrix shape determination circuit 215 substitutes the value of the current number of columns pCOL into the variable number of selected columns pCOL to obtain a tentative determination value (step S413). The submatrix shape determination circuit 215 substitutes the current number of submatrix N for the minimum number of accesses (step S414), and returns to step S403. By this loop, as shown in FIG. 1, the first submatrix 111 is initially selected as the submatrix, but it is updated to the second submatrix 121 in which the minimum number of accesses (N = V × H) becomes smaller. Will be.

上述したように、ステップS404において、部分列サイズがアレイサイズ以上になると(ステップS404:Yes)、それ以上の部分列サイズを使用できないため、終了処理(ステップS415〜S418)に移行する。終了処理移行時における現在の選択列数pCOLが今回の行列サイズに最適な列数pCOLとなる。 As described above, when the subsequence size becomes equal to or larger than the array size in step S404 (step S404: Yes), since the subsequence size larger than that cannot be used, the process proceeds to the end process (steps S415 to S418). The current number of selected columns pCOL at the time of transition to the end processing is the optimum number of columns pCOL for the current matrix size.

部分行列形状決定回路215は、決定した列数pCOLとして、現在の選択列数pCOLを設定する(ステップS415)。部分行列形状決定回路215は、アレイサイズレジスタ211の値を、ステップS415の列数pCOLで割り算し、行数pROWの値を算出する(ステップS416)。 The submatrix shape determination circuit 215 sets the current number of selected columns pCOL as the determined number of columns pCOL (step S415). The submatrix shape determination circuit 215 divides the value of the array size register 211 by the number of columns pCOL in step S415 to calculate the value of the number of rows pROW (step S416).

部分行列形状決定回路215は、列サイズレジスタの値を、ステップS415の列数pCOLで割り算し、切り上げることで、対象行列の横方向の部分行列数である横Hを算出する(ステップS417)。部分行列形状決定回路215は、行サイズレジスタの値をステップS416の行数pROWで割り算し、切り上げることで、対象行列の縦方向の部分行列数であるVを算出する(ステップS418)。これにより、一連の処理が終了する。 The submatrix shape determination circuit 215 divides the value of the column size register by the number of columns pCOL in step S415 and rounds up to calculate the lateral H, which is the number of submatrixes in the horizontal direction of the target matrix (step S417). The submatrix shape determination circuit 215 divides the value of the row size register by the number of rows pROW in step S416 and rounds up to calculate V, which is the number of submatrixes in the vertical direction of the target matrix (step S418). As a result, a series of processes is completed.

<部分行列形状決定回路215による部分行列を使用した乗算実行アルゴリズム>
図6は、部分行列形状決定回路215による部分行列を使用した乗算実行アルゴリズムを示すフローチャートである。部分行列形状決定回路215は、0埋めを行う領域を指定する数値を算出する(ステップS601)。Caは行列Aの列方向の0埋め範囲の指定値であり、行列ABサイズレジスタ214内のA列サイズレジスタの値をステップS303で決定された行列Aの列数pCOLで割り算した余りが設定される。0埋め範囲の指定値とは、そのときの部分行列がどこまで0埋めとなるかを指定する値である。
<Multiplication execution algorithm using submatrix by submatrix shape determination circuit 215>
FIG. 6 is a flowchart showing a multiplication execution algorithm using a submatrix by the submatrix shape determination circuit 215. The submatrix shape determination circuit 215 calculates a numerical value that specifies a region to be filled with zeros (step S601). Ca is a specified value of the zero-filled range in the column direction of the matrix A, and the remainder obtained by dividing the value of the column A size register in the matrix AB size register 214 by the number of columns pCOL of the matrix A determined in step S303 is set. To. The specified value of the zero-filled range is a value that specifies how far the submatrix at that time is zero-filled.

Raは行列Aの行方向の0埋め範囲の指定値であり、行列ABサイズレジスタ214内のA行サイズレジスタの値をステップS303で決定された行列Aの行数pROWで割り算した余りが設定される。Cbは行列Bの列方向の0埋め範囲の指定値であり、行列ABサイズレジスタ214内のB列サイズレジスタの値をステップS307での入れ替え後の行列Bの列数pCOLで割り算した余りが設定される。Rbは行列Bの行方向の0埋め範囲の指定値であり、行列ABサイズレジスタ214内のB行サイズレジスタの値をステップS307での入れ替え後の行列Bの行数pROWで割り算した余りが設定される。 Ra is a specified value of the 0-filled range in the row direction of the matrix A, and the remainder obtained by dividing the value of the A row size register in the matrix AB size register 214 by the number of rows pROW of the matrix A determined in step S303 is set. To. Cb is a specified value of the 0-filled range in the column direction of the matrix B, and the remainder obtained by dividing the value of the B column size register in the matrix AB size register 214 by the number of columns pCOL of the matrix B after the replacement in step S307 is set. Will be done. Rb is a specified value of the 0-filled range in the row direction of the matrix B, and the remainder obtained by dividing the value of the B row size register in the matrix AB size register 214 by the number of rows pROW of the matrix B after the replacement in step S307 is set. Will be done.

部分行列形状決定回路215は、ループ変数Ar,Bc,Acをすべて0に初期設定する(ステップS602)。部分行列形状決定回路215は、図3および図4の処理で決定した部分行列に該当するデータを行列Aおよび行列Bからそれぞれ読み込み、読み込みバッファ218に転送する(ステップS603)。部分行列形状決定回路215は、ループ変数AcとHa−1とを比較し、同一であれば行列Aの端と判定し(ステップS604:Yes)、ステップS605に移行し、それ以外であれば(ステップS604:No)、ステップS606に移行する。 The submatrix shape determination circuit 215 initially sets all the loop variables Ar, Bc, and Ac to 0 (step S602). The submatrix shape determination circuit 215 reads the data corresponding to the submatrix determined in the processes of FIGS. 3 and 4 from the matrix A and the matrix B, respectively, and transfers the data to the read buffer 218 (step S603). The submatrix shape determination circuit 215 compares the loop variables Ac and Ha-1, determines that they are the ends of the matrix A if they are the same (step S604: Yes), proceeds to step S605, and otherwise (steps to step S605). Step S604: No), the process proceeds to step S606.

部分行列形状決定回路215は、Ca有効フラグをONに設定し、Rb有効フラグをONに設定し(ステップS605)、ステップS606に移行する。これにより、行列Aの列の0埋めパラメータにCaが設定され、行列Bの行の0埋めパラメータにRbが設定されることになる。 The submatrix shape determination circuit 215 sets the Ca valid flag to ON, sets the Rb valid flag to ON (step S605), and proceeds to step S606. As a result, Ca is set in the zero-filled parameter of the column of the matrix A, and Rb is set in the zero-filled parameter of the row of the matrix B.

部分行列形状決定回路215は、ループ変数BcとHb−1とを比較し、同一であれば行列Bの端と判定し(ステップS606:Yes)、ステップS607に移行し、それ以外であれば(ステップS606:No)、ステップS608に移行する。部分行列形状決定回路215は、Cb有効フラグをONに設定し(ステップS607)、ステップS608に移行する。これにより、行列Bの列の0埋めパラメータにCbが設定されることになる。 The submatrix shape determination circuit 215 compares the loop variables Bc and Hb-1, determines that they are the ends of the matrix B if they are the same (step S606: Yes), proceeds to step S607, and otherwise (steps to step S607). Step S606: No), the process proceeds to step S608. The submatrix shape determination circuit 215 sets the Cb valid flag to ON (step S607), and proceeds to step S608. As a result, Cb is set in the zero-filled parameter of the column of the matrix B.

部分行列形状決定回路215は、ループ変数ArとVa−1とを比較し、同一であれば行列Aの端と判定し(ステップS608:Yes)、ステップS609に移行し、それ以外であれば(ステップS608:No)、ステップS610に移行する。部分行列形状決定回路215は、Ra有効フラグをONに設定し(ステップS609)、ステップS610に移行する。これにより、行列Aの行の0埋めパラメータにRaが設定されることになる。 The submatrix shape determination circuit 215 compares the loop variables Ar and Va-1, determines that they are the ends of the matrix A if they are the same (step S608: Yes), proceeds to step S609, and otherwise (steps to step S609). Step S608: No), the process proceeds to step S610. The submatrix shape determination circuit 215 sets the Ra valid flag to ON (step S609), and proceeds to step S610. As a result, Ra is set in the zero-filled parameter of the row of the matrix A.

部分行列形状決定回路215は、部分行列の乗算処理開始の処理を行う(ステップS610)。これにより、行列演算アレイ221が動作し、部分行列分の乗算が行われる。部分行列形状決定回路215は、ループ変数Acの値をインクリメントする(ステップS611)。部分行列形状決定回路215は、ループ変数Acと行列Aの縦Vaとを比較し(ステップS612)、同一であれば(ステップS612:Yes)、ステップS613に移行し、それ以外は(ステップS612:No)、ステップS614に移行する。ステップS613では、部分行列形状決定回路215は、ループ変数Bcの値をインクリメントし、ループ変数Acに0を設定して(ステップS613)、ステップS614に移行する。 The submatrix shape determination circuit 215 performs a process of starting the multiplication process of the submatrix (step S610). As a result, the matrix operation array 221 operates and multiplication for the submatrix is performed. The submatrix shape determination circuit 215 increments the value of the loop variable Ac (step S611). The submatrix shape determination circuit 215 compares the loop variable Ac with the vertical Va of the matrix A (step S612), and if they are the same (step S612: Yes), the process proceeds to step S613, and otherwise (step S612:). No), the process proceeds to step S614. In step S613, the submatrix shape determination circuit 215 increments the value of the loop variable Bc, sets the loop variable Ac to 0 (step S613), and proceeds to step S614.

部分行列形状決定回路215は、ループ変数Bcと行列Bの横Hbとを比較し(ステップS614)、同一であれば(ステップS614:Yes)、ステップS615に移行し、それ以外は(ステップS614:No)、ステップS616に移行する。ステップS615では、部分行列形状決定回路215は、ループ変数Arをインクリメントし、ループ変数Bcに0を設定して(ステップS615)、ステップS616に移行する。 The submatrix shape determination circuit 215 compares the loop variable Bc with the lateral Hb of the matrix B (step S614), and if they are the same (step S614: Yes), the process proceeds to step S615, and otherwise (step S614: No), the process proceeds to step S616. In step S615, the submatrix shape determination circuit 215 increments the loop variable Ar, sets the loop variable Bc to 0 (step S615), and proceeds to step S616.

部分行列形状決定回路215は、ループ変数Arと行列Aの縦Vaとを比較し(ステップS616)、同一であれば(ステップS616:Yes)、全ての処理が終了する。それ以外であれば(ステップS616:No)、ステップS603に戻り、処理が継続する。 The submatrix shape determination circuit 215 compares the loop variable Ar with the vertical Va of the matrix A (step S616), and if they are the same (step S616: Yes), all the processes are completed. Otherwise (step S616: No), the process returns to step S603 and the process continues.

<部分行列形状決定回路215以降の処理>
図7は、部分行列形状決定回路215以降の処理例を示す説明図である。加算制御回路216は、部分行列形状決定回路215から、Ca、Ra、CbおよびRbの入力を受け付ける。また、加算制御回路216は、部分行列形状決定回路215から、Ca有効フラグ701、Ra有効フラグ702、Cb有効フラグ703およびRb有効フラグ704の入力を受け付ける。これら有効フラグは、そのときの部分行列に0埋めがあるか無いかを示すフラグである。また、加算制御回路216は、部分行列形状決定回路215から、ステップS308で選択された部分行列の列数pCOLと、ステップS309で選択された部分行列の行数pROWの入力を受け付ける。
<Processing after submatrix shape determination circuit 215>
FIG. 7 is an explanatory diagram showing a processing example after the submatrix shape determination circuit 215. The addition control circuit 216 receives inputs of Ca, Ra, Cb and Rb from the submatrix shape determination circuit 215. Further, the addition control circuit 216 receives inputs of the Ca valid flag 701, the Ra valid flag 702, the Cb valid flag 703, and the Rb valid flag 704 from the submatrix shape determination circuit 215. These valid flags are flags indicating whether or not the submatrix at that time has zero padding. Further, the addition control circuit 216 receives input from the submatrix shape determination circuit 215 of the number of columns pCOL of the submatrix selected in step S308 and the number of rows pROW of the submatrix selected in step S309.

読み込みバッファ218は、DRAM205から行列Aデータ207の部分行列であるA00,A01,…を読み込み、行列Bデータ208の部分行列であるB00,B01,…を保持する。部分行列であるA00,A01,…は、部分行列のサイズの数だけ存在する。同様に、部分行列であるB00,B01,…は、部分行列のサイズの数だけ存在する。読み込みバッファ218は、すべての部分行列の各々に対して読み出しポートを持ち、すべての部分行列を一度に読み出せるよう構成されている。 The read buffer 218 reads the submatrix A00, A01, ... Of the matrix A data 207 from the DRAM 205, and holds the submatrix B00, B01, ... Of the matrix B data 208. There are as many submatrixes A00, A01, ... As there are submatrix sizes. Similarly, there are as many submatrixes B00, B01, ... As there are submatrix sizes. The read buffer 218 has a read port for each of all submatrixes and is configured to read all submatrixes at once.

セレクタアレイ705は、複数のセレクタ220を有する。各セレクタ220は、読み込みバッファ218からの部分行列と0値とのいずれかを選択する。セレクタ220は、読み込みバッファ218内の部分行列の個数分存在する。たとえば、各セレクタ220は、加算制御回路216から0埋めの指示があれば0値を選択し、0埋めの指示がなければ読み込みバッファ218からの部分行列を選択する。各セレクタ220は、選択したデータを行列演算アレイ221の乗算器706に出力する。 The selector array 705 has a plurality of selectors 220. Each selector 220 selects either a submatrix from the read buffer 218 or a zero value. There are as many selectors 220 as there are submatrixes in the read buffer 218. For example, each selector 220 selects a 0 value if there is an instruction to fill in 0 from the addition control circuit 216, and selects a submatrix from the read buffer 218 if there is no instruction to fill in 0. Each selector 220 outputs the selected data to the multiplier 706 of the matrix operation array 221.

行列演算アレイ221は、複数の乗算器706と複数の加算器707とにより構成される。乗算器706は、行列演算アレイ221の中で乗算を実行する。行列Aデータ207の部分行列1個および行列Bデータ208の部分行列1個の組み合わせに対して乗算器706は1個存在し、乗算結果を出力する。加算器707は、乗算器706の乗算結果を集計する。複数の加算器707はツリー状に配置される。詳細は図8で説明する。 The matrix operation array 221 is composed of a plurality of multipliers 706 and a plurality of adders 707. The multiplier 706 performs multiplication in the matrix operation array 221. One multiplier 706 exists for a combination of one submatrix of the matrix A data 207 and one submatrix of the matrix B data 208, and outputs the multiplication result. The adder 707 aggregates the multiplication results of the multiplier 706. The plurality of adders 707 are arranged in a tree shape. Details will be described with reference to FIG.

書き出しバッファ223は、行列演算アレイ221からの結果Cデータ209の部分行列C00,C01,C02,C03,…を保持する。セレクタ708は、書き出しバッファ223内に保存されている結果Cデータ209の部分行列を選択してDRAM205に書き出す。 The write buffer 223 holds submatrixes C00, C01, C02, C03, ... Of the result C data 209 from the matrix operation array 221. The selector 708 selects a submatrix of the result C data 209 stored in the write buffer 223 and writes it to the DRAM 205.

部分行列形状決定回路215以降の動作は、以下の通りである。まず、加算制御回路216は、Ca、Ra、CbおよびRbと、Ca有効フラグ701、Ra有効フラグ702、Cb有効フラグ703およびRb有効フラグ704と、列数pCOLおよび行数pROWとを、部分行列形状決定回路215から取得する。加算制御回路216は、取得したデータに基づいて、セレクタアレイ705の各セレクタ220のセレクト値を設定する。 The operation after the submatrix shape determination circuit 215 is as follows. First, the addition control circuit 216 submatrixes Ca, Ra, Cb and Rb, Ca valid flag 701, Ra valid flag 702, Cb valid flag 703 and Rb valid flag 704, and the number of columns pCOL and the number of rows pROW. Obtained from the shape determination circuit 215. The addition control circuit 216 sets the select value of each selector 220 of the selector array 705 based on the acquired data.

つぎに、セレクタアレイ705は、読み込みバッファ218から行列Aの部分行列A00,A01,…および行列Bの部分行列B00,B01,…をすべて読み出す。セレクタアレイ705は、セレクト値に応じて0値または部分行列のいずれかを選択し、選択結果を行列演算アレイ221に出力する。この時点でデータの0埋めが完了する。 Next, the selector array 705 reads all the sub-matrixes A00, A01, ... Of the matrix A and the sub-matrix B00, B01, ... Of the matrix B from the read buffer 218. The selector array 705 selects either a 0 value or a submatrix according to the select value, and outputs the selection result to the matrix operation array 221. At this point, zero padding of the data is completed.

つぎに、行列演算アレイ221は、行列Aの部分行列と行列Bの部分行列とを乗算器706で乗算し、加算器707で加算する。行列演算アレイ221は、加算器707からの出力である結果Cデータ209の部分行列を書き出しバッファ223に書き出す。そして、セレクタ708が選択してDRAM205へ書き出す。 Next, the matrix operation array 221 multiplies the submatrix of the matrix A and the submatrix of the matrix B by the multiplier 706 and adds them by the adder 707. The matrix operation array 221 writes the submatrix of the result C data 209, which is the output from the adder 707, to the write buffer 223. Then, the selector 708 selects and writes to the DRAM 205.

<行列演算アレイ221の動作例>
図8は、行列演算アレイ221の動作例を示す説明図である。図8では、説明の単純化のため、一例として、アレイサイズが16(乗算器706が16個)の場合について説明するが、2のべき乗であれば、アレイサイズは16に限定されない。行列演算アレイ221は、アレイサイズである16組の行列Aと行列Bの要素が並び、これらのペアに対して乗算器706で乗算結果を得る。この後、隣接する乗算結果同士を加算する加算器707のツリーが構成される。行列演算アレイ221は、ツリー状の加算器707の最上位にセレクタ801A〜801Dを有する。
<Operation example of matrix operation array 221>
FIG. 8 is an explanatory diagram showing an operation example of the matrix operation array 221. In FIG. 8, for simplification of the description, a case where the array size is 16 (16 multipliers 706) will be described as an example, but if it is a power of 2, the array size is not limited to 16. In the matrix operation array 221, 16 sets of matrix A and matrix B elements having an array size are arranged, and a multiplier 706 is used to obtain a multiplication result for these pairs. After that, a tree of adder 707 that adds the adjacent multiplication results to each other is constructed. The matrix operation array 221 has selectors 801A to 801D at the uppermost level of the tree-shaped adder 707.

セレクタ801Aは、2個の乗算器706からの乗算結果を加算した加算結果と、4個の乗算器706からの乗算結果を加算した加算結果と、8個の乗算器706からの乗算結果を加算した加算結果と、16個の乗算器706からの乗算結果を加算した加算結果と、を選択的にDRAM205に書き出す。 Selector 801A adds the addition result of adding the multiplication results from the two multipliers 706, the addition result of adding the multiplication results from the four multipliers 706, and the multiplication result from the eight multipliers 706. The added result and the added result obtained by adding the multiplication results from the 16 multipliers 706 are selectively written to the DRAM 205.

セレクタ801Bは、2個の乗算器706からの乗算結果を加算した加算結果と、4個の乗算器706からの乗算結果を加算した加算結果と、8個の乗算器706からの乗算結果を加算した加算結果と、を選択的にDRAM205に書き出す。 Selector 801B adds the addition result of adding the multiplication results from the two multipliers 706, the addition result of adding the multiplication results from the four multipliers 706, and the multiplication result from the eight multipliers 706. The added result and the result of the addition are selectively written to the DRAM 205.

セレクタ801C,801Dは、2個の乗算器706からの乗算結果を加算した加算結果と、4個の乗算器706からの乗算結果を加算した加算結果と、を選択的にDRAM205に書き出す。セレクタ801A〜801Dで選択されない2個の乗算器706からの乗算結果を加算した加算結果は、その加算器707からDRAM205に書き出される。 The selectors 801C and 801D selectively write the addition result obtained by adding the multiplication results from the two multipliers 706 and the addition result obtained by adding the multiplication results from the four multipliers 706 to the DRAM 205. The addition result obtained by adding the multiplication results from the two multipliers 706 not selected by the selectors 801A to 801D is written from the adder 707 to the DRAM 205.

符号816は、ステップS308で選択された部分行列の列数pCOLが16の場合に選択されるデータ範囲であり、符号808は、ステップS308で選択された部分行列の列数pCOLが8の場合に選択されるデータ範囲であり、符号804は、ステップS308で選択された部分行列の列数pCOLが4の場合に選択されるデータ範囲であり、符号802は、ステップS308で選択された部分行列の列数pCOLが2の場合に選択されるデータ範囲である。 Reference numeral 816 is a data range selected when the number of columns pCOL of the submatrix selected in step S308 is 16, and reference numeral 808 is a case where the number of columns pCOL of the submatrix selected in step S308 is 8. Reference numeral 804 is a data range to be selected, reference numeral 804 is a data range selected when the number of columns pCOL of the submatrix selected in step S308 is 4, and reference numeral 802 is a submatrix selected in step S308. This is the data range selected when the number of columns pCOL is 2.

すなわち、セレクタ801A〜801Dは、列数pCOLの値により、加算結果を選択する。このように構成することで、列数pCOLが16の場合には、行列演算アレイ221は、セレクタ801Aにより、4段目の加算器707からの加算結果を出力するよう動作する。また、列数pCOLが8の場合には、行列演算アレイ221は、セレクタ801A,801Bにより、3段目の2個の加算器707からの2個の加算結果を出力するよう動作する。 That is, the selectors 801A to 801D select the addition result according to the value of the number of columns pCOL. With this configuration, when the number of columns pCOL is 16, the matrix operation array 221 operates so as to output the addition result from the fourth-stage adder 707 by the selector 801A. When the number of columns pCOL is 8, the matrix operation array 221 operates so as to output two addition results from the two adders 707 in the third stage by the selectors 801A and 801B.

また、列数pCOLが4の場合には、行列演算アレイ221は、セレクタ801A〜801Dにより、2段目の4個の加算器707からの4個の加算結果を出力するよう動作する。また、列数pCOLが2の場合には、行列演算アレイ221は、セレクタ801A〜801Dにより、1段目の8個の加算器707からの8個の加算結果を出力するよう動作する。 When the number of columns pCOL is 4, the matrix operation array 221 operates so as to output the four addition results from the four adders 707 in the second stage by the selectors 801A to 801D. When the number of columns pCOL is 2, the matrix operation array 221 operates so as to output eight addition results from the eight adders 707 in the first stage by the selectors 801A to 801D.

<レジスタ群の詳細>
図9は、レジスタ群の詳細を示すブロック図である。レジスタ群とは、上述したアレイサイズレジスタ211、センスアンプキャッシュサイズレジスタ212、スレッショルドレジスタ213、行列ABサイズレジスタ214および行列演算開始レジスタ907である。
<Details of register group>
FIG. 9 is a block diagram showing details of the register group. The register group includes the array size register 211, the sense amplifier cache size register 212, the threshold register 213, the matrix AB size register 214, and the matrix operation start register 907 described above.

アドレスデコーダ901は、汎用バス203を経由してプロセッサ201からのアドレスを取得してライトイネーブル信号wenを各レジスタに出力する。データラッチ902は、汎用バス203を経由してプロセッサ201からのデータを取得して、目的のレジスタに書き込まれるまで、データを保持する。 The address decoder 901 acquires the address from the processor 201 via the general-purpose bus 203 and outputs the write enable signal we to each register. The data latch 902 acquires data from the processor 201 via the general-purpose bus 203 and holds the data until it is written to a target register.

具体的には、たとえば、アドレスデコーダ901およびデータラッチ902は、プロセッサ201からのアドレスとデータの対に対して、アドレスに対応するレジスタにデータを書き込む。アドレスデコーダ901がその対応を取るよう動作し、それぞれのレジスタに対する書込みを識別し、それぞれのレジスタにライトイネーブル信号wenを出力する。 Specifically, for example, the address decoder 901 and the data latch 902 write data to the register corresponding to the address for the address-data pair from the processor 201. The address decoder 901 operates to take that correspondence, identifies the write to each register, and outputs a write enable signal we to each register.

行列ABサイズレジスタ214は、行列Aの列サイズを指定する行列A列サイズレジスタ903と、行列Aの行サイズを指定する行列A行サイズレジスタ904と、行列Bの列サイズを指定する行列B列サイズレジスタ905と、行列Bの行サイズを指定する行列B行サイズレジスタ906と、を有する。 The matrix AB size register 214 includes a matrix A column size register 903 that specifies the column size of the matrix A, a matrix A row size register 904 that specifies the row size of the matrix A, and a matrix B column that specifies the column size of the matrix B. It has a size register 905 and a matrix B row size register 906 that specifies the row size of the matrix B.

行列演算開始レジスタ907は、データとして開始値が書き込まれるレジスタである。開始値が書き込まれると、一連の行列演算の実行が開始される。このように構成することで、プロセッサ201から各レジスタにデータを書き込むことが可能となり、プロセッサ201からのFPGA204の制御が可能となる。 The matrix operation start register 907 is a register in which the start value is written as data. When the start value is written, the execution of a series of matrix operations is started. With this configuration, it is possible to write data from the processor 201 to each register, and it is possible to control the FPGA 204 from the processor 201.

<制御プログラム206による制御処理>
図10は、制御プログラム206による制御処理例を示すフローチャートである。プロセッサ201は、アレイサイズレジスタ211にアレイサイズを設定する(ステップS1001)。プロセッサ201は、センスアンプキャッシュサイズレジスタ212にセンスアンプキャッシュサイズを設定する(ステップS1002)。プロセッサ201は、スレッショルドレジスタ213に許容されるセンスアンプキャッシュのヒット回数の下限値を設定する(ステップS1003)。
<Control processing by control program 206>
FIG. 10 is a flowchart showing an example of control processing by the control program 206. The processor 201 sets the array size in the array size register 211 (step S1001). The processor 201 sets the sense amplifier cache size in the sense amplifier cache size register 212 (step S1002). The processor 201 sets the lower limit of the number of hits of the sense amplifier cache allowed in the threshold register 213 (step S1003).

プロセッサ201は、行列演算を使用するメインプログラム(たとえば、ディープラーニング)からの呼び出しを待つ(ステップS1004:No)。呼び出されたときに(ステップS1004:Yes)、ステップS1005に移行する。 Processor 201 waits for a call from a main program (eg, deep learning) that uses matrix operations (step S1004: No). When called (step S1004: Yes), the process proceeds to step S1005.

プロセッサ201は、メインプログラムから指定される行列Aの列サイズを行列A列サイズレジスタ903に設定する(ステップS1005)。プロセッサ201は、メインプログラムから指定される行列Aの行サイズを行列A行サイズレジスタ904に設定する(ステップS1006)。プロセッサ201は、メインプログラムから指定される行列Bの列サイズを行列B列サイズレジスタ905に設定する(ステップS1007)。プロセッサ201は、メインプログラムから指定される行列Bの行サイズを行列B行サイズレジスタ906に設定する(ステップS1008)。 The processor 201 sets the column size of the matrix A specified by the main program in the matrix A column size register 903 (step S1005). The processor 201 sets the row size of the matrix A specified by the main program in the matrix A row size register 904 (step S1006). The processor 201 sets the column size of the matrix B specified by the main program in the matrix B column size register 905 (step S1007). The processor 201 sets the row size of the matrix B specified by the main program in the matrix B row size register 906 (step S1008).

プロセッサ201は、行列Aデータ207のポインタをDMAC224に設定する(ステップS1009)。プロセッサ201は、行列Bデータ208のポインタをDMAC224に設定する(ステップS1010)。プロセッサ201は、行列演算開始レジスタ907に開始値を書き込み、FPGA204に行列演算を開始させる(ステップS1011)。このときまず、DMAC224は行列Aデータ207をDRAM205へ転送する。つぎに、DMAC224は、行列Bデータ208をDRAM205へ転送する。このとき、行列Bデータ208は列と行とを転置して転送される。このあと、部分行列形状決定回路215が起動し、実行され、列数pCOL等の設定が計算される。その設定を使用して行列演算が実行される。 The processor 201 sets the pointer of the matrix A data 207 to the DMAC224 (step S1009). The processor 201 sets the pointer of the matrix B data 208 to the DMAC224 (step S1010). The processor 201 writes a start value in the matrix operation start register 907 and causes the FPGA 204 to start the matrix operation (step S1011). At this time, first, the DMAC 224 transfers the matrix A data 207 to the DRAM 205. Next, the DMAC224 transfers the matrix B data 208 to the DRAM 205. At this time, the matrix B data 208 is transferred by transposing the columns and rows. After that, the submatrix shape determination circuit 215 is started and executed, and the setting of the number of columns pCOL and the like is calculated. Matrix operations are performed using that setting.

プロセッサ201は、FPGA204での行列演算が終了するのを待つ(ステップS1012)。プロセッサ201は、結果Cデータ209のポインタをDMAC224に設定する(ステップS1013)。プロセッサ201は、DMAC224を起動して、DRAM205にある結果Cデータ209をメモリ202に転送する(ステップS1014)。プロセッサ201は、DMA終了を待ち、終了したら、行列演算終了を返す。これで1回の行列演算は終了し、ステップS1004に戻り次の呼び出し待ちに入る。 Processor 201 waits for the matrix operation in FPGA 204 to finish (step S1012). The processor 201 sets the pointer of the result C data 209 to DMAC224 (step S1013). The processor 201 activates the DMAC 224 and transfers the result C data 209 in the DRAM 205 to the memory 202 (step S1014). The processor 201 waits for the end of DMA, and when it finishes, returns the end of the matrix operation. This completes one matrix operation, returns to step S1004, and waits for the next call.

<ログ出力部225の制御処理>
図11は、ログ出力部225の制御処理例を示す説明図である。ログデータ210は、ログ内タイムスタンプ1101と、ログ内行列Aサイズ1102と、ログ内行列Bサイズ1103と、ログ内部分行列サイズ1104と、を含む。ログ内タイムスタンプは、ログを生成した時刻、つまり部分行列サイズが決定された時刻を示す。ログ内行列Aサイズは、部分行列のサイズ決定に使用した行列Aのサイズを示す。ログ内行列Bサイズは、部分行列のサイズ決定に使用した行列Bのサイズを示す。ログ内部分行列サイズは、この時点で決定した部分行列サイズを示す。
<Control processing of log output unit 225>
FIG. 11 is an explanatory diagram showing an example of control processing of the log output unit 225. The log data 210 includes an in-log time stamp 1101, an in-log matrix A size 1102, an in-log matrix B size 1103, and an in-log sub-matrix size 1104. The in-log time stamp indicates the time when the log was generated, that is, the time when the submatrix size was determined. The matrix A size in the log indicates the size of the matrix A used to determine the size of the submatrix. The in-log matrix B size indicates the size of the matrix B used to size the submatrix. The submatrix size in the log indicates the submatrix size determined at this point.

また、ログ出力部225は、ログ生成部1105と、ログ一時保存メモリ1106と、を有する。ログ生成部1105は、部分行列形状決定回路215から必要な情報として、たとえば、行列Aサイズ、行列Bサイズ、および部分行列サイズを取得し、演算装置200から取得する時刻と共に現在のログデータ210を生成し、ログ一時保存メモリ1106に転送する。また、ログ生成部1105は、ログデータ210をメモリ202に転送するためのDMAC224の起動を行う。ログ一時保存メモリ1106は、ログ生成部1105が生成したログデータ210をDMAC224が読み出すまで保存する。 Further, the log output unit 225 has a log generation unit 1105 and a log temporary storage memory 1106. The log generation unit 1105 acquires, for example, the matrix A size, the matrix B size, and the submatrix size as necessary information from the submatrix shape determination circuit 215, and obtains the current log data 210 together with the time acquired from the arithmetic unit 200. Generate and transfer to the log temporary storage memory 1106. Further, the log generation unit 1105 activates the DMAC 224 for transferring the log data 210 to the memory 202. The log temporary storage memory 1106 stores the log data 210 generated by the log generation unit 1105 until the DMAC224 reads it.

ログ出力部225は以下のように動作する。部分行列形状決定回路215が部分行列の形状を決定したタイミングで、ログ生成部1105が、時刻、行列Aサイズ、行列Bサイズ、および部分行列サイズからなるログデータ210を生成し、ログ一時保存メモリ1106に保存する。同時に、ログ生成部1105は、DMAC224を起動し、一時保存されたログデータ210をメモリ202に転送する。これにより、行列演算実行毎に決定される部分行列サイズがどのような行列Aおよび行列Bのサイズから生成されたかが記録される。 The log output unit 225 operates as follows. At the timing when the submatrix shape determination circuit 215 determines the shape of the submatrix, the log generation unit 1105 generates log data 210 composed of time, matrix A size, matrix B size, and submatrix size, and temporarily stores the log. Store in 1106. At the same time, the log generation unit 1105 activates the DMAC 224 and transfers the temporarily saved log data 210 to the memory 202. As a result, it is recorded from what size of matrix A and matrix B the submatrix size determined for each matrix operation execution is generated.

以上のように構成することで、オフロードデバイス上で、最適な部分行列の形状を使用した行列演算が実行され、様々なサイズの行列の乗算を高速に行うことが可能となる。つまり同じ回路構成でより高速に、またより電力効率良く演算を行うことが可能となる。 With the above configuration, matrix operations using the optimum submatrix shape are executed on the offload device, and matrix multiplication of various sizes can be performed at high speed. That is, it is possible to perform calculations at higher speed and with higher power efficiency with the same circuit configuration.

また、上述した演算装置200は、下記(1)〜(11)のように構成することもできる。 Further, the above-mentioned arithmetic unit 200 can also be configured as described in (1) to (11) below.

(1)行列データ(行列Aデータ207、行列Bデータ208)を記憶するDRAM205にアクセス可能な演算装置200は、部分行列形状決定回路215と、行列演算アレイ221と、を有する。 (1) The arithmetic apparatus 200 that can access the DRAM 205 that stores the matrix data (matrix A data 207, matrix B data 208) has a partial matrix shape determination circuit 215 and a matrix arithmetic array 221.

部分行列形状決定回路215は、行列データの分割単位となる部分行列の行方向の列数である部分列サイズを増加させ、増加後の部分列サイズが複数の乗算器706の個数以上となった場合、増加前の部分列サイズと複数の乗算器706の個数(アレイサイズ)とに基づいて、部分行列の列方向の行数である部分行サイズを求め、部分列サイズ(pCOL)と部分行サイズ(pROW)とにより構成される部分行列の形状(pCOL,pROW)を決定する。 The sub-matrix shape determination circuit 215 increases the sub-column size, which is the number of columns in the row direction of the sub-matrix, which is the division unit of the matrix data, and the increased sub-column size becomes equal to or more than the number of the plurality of multipliers 706. In the case, the subsequence size, which is the number of rows in the column direction of the submatrix, is obtained based on the subcolumn size before the increase and the number of the plurality of multipliers 706 (array size), and the subsequence size (pCOL) and the subsequence are obtained. The shape (pCOL, pROW) of the subsequence composed of the size (pROW) is determined.

行列演算アレイ221は、複数の乗算器706と複数の加算器707とを有し、DRAM205に記憶されている行列Aデータ207のうち部分行列形状決定回路215によって決定された形状の第1部分行列(たとえば、A00)と、DRAM205に記憶されている行列Bデータ208のうち部分行列形状決定回路215によって決定された形状の第2部分行列(たとえば、B00)と、の積和演算を実行する。 The matrix calculation array 221 has a plurality of multipliers 706 and a plurality of adders 707, and is a first submatrix having a shape determined by the submatrix shape determination circuit 215 of the matrix A data 207 stored in the DRAM 205. (For example, A00) and the second submatrix (for example, B00) having a shape determined by the submatrix shape determination circuit 215 of the matrix B data 208 stored in the DRAM 205 are subjected to a multiply-accumulate operation.

これにより、行列演算アレイ221は、部分行列の形状により、複数の乗算器706および複数の加算器707の行方向への割り振りと列方向への割り振りの割合に設定することができ、行列演算の高速化を図ることができる。 Thereby, the matrix operation array 221 can be set to the ratio of the allocation in the row direction and the allocation in the column direction of the plurality of multipliers 706 and the plurality of adders 707 according to the shape of the submatrix. The speed can be increased.

(2)上記(1)の演算装置200において、部分行列形状決定回路215は、行列Aデータ207について決定された第1部分行列(たとえば、A00)の部分列サイズと、行列Bデータ208について決定された第2部分行列(たとえば、B00)の部分行サイズと、のうち、大きい方の形状を、部分行列の形状に決定する(S308、S309)。 (2) In the arithmetic unit 200 of the above (1), the submatrix shape determination circuit 215 determines the submatrix size of the first submatrix (for example, A00) determined for the matrix A data 207 and the matrix B data 208. The larger of the submatrix size of the second submatrix (for example, B00) is determined to be the shape of the submatrix (S308, S309).

これにより、行列Aデータ207および行列Bデータ208に適用可能な共通の部分行列の形状を得ることができる。 Thereby, a common submatrix shape applicable to the matrix A data 207 and the matrix B data 208 can be obtained.

(3)上記(1)の演算装置200において、部分行列形状決定回路215は、部分列サイズと、行列データの行方向の列数である列サイズと、に基づいて、複数の部分行列で行列データを包含する領域の行方向のサイズ(横H)を決定し、部分行サイズと、行列データの列方向の列数である行サイズと、に基づいて、複数の部分行列で行列データを包含する領域の列方向のサイズ(縦V)を決定する。 (3) In the arithmetic unit 200 of the above (1), the submatrix shape determination circuit 215 is a matrix with a plurality of submatrix based on the subcolumn size and the column size which is the number of columns in the row direction of the matrix data. The size of the area containing the data in the row direction (horizontal H) is determined, and the matrix data is included in a plurality of sub-matrix based on the partial row size and the row size which is the number of columns in the column direction of the matrix data. Determine the size (vertical V) of the area to be used in the column direction.

これにより、可能な限り行列データを部分行列で埋めることができ、行列演算回数の低減化を図ることができる。 As a result, the matrix data can be filled with submatrix as much as possible, and the number of matrix operations can be reduced.

(4)上記(3)の演算装置200は、領域のうち部分行列が割り当てられていない範囲に0値を割り当てる加算制御回路216を有し、行列演算アレイ221は、加算制御回路216による0値の割当後に積和演算を実行する。これにより、行列演算に与える悪影響を抑制することができる。 (4) The arithmetic unit 200 of the above (3) has an addition control circuit 216 that allocates a 0 value to a range in which a submatrix is not assigned, and the matrix operation array 221 has a 0 value by the addition control circuit 216. The product-sum operation is executed after the allocation of. As a result, the adverse effect on the matrix operation can be suppressed.

(5)上記(3)の演算装置200は、行列データが入力される都度、列サイズおよび行サイズを設定する行列ABサイズレジスタ214を有し、部分行列形状決定回路215は、行列データが入力される都度、部分行列の形状と、領域の行方向のサイズ(横H)と、領域の列方向のサイズ(縦V)と、を決定する。 (5) The arithmetic unit 200 of the above (3) has a matrix AB size register 214 for setting the column size and the row size each time the matrix data is input, and the submatrix shape determination circuit 215 inputs the matrix data. Each time the submatrix is formed, the shape of the submatrix, the size of the area in the row direction (horizontal H), and the size of the area in the column direction (vertical V) are determined.

これにより、入力行列データごとに、入力行列データの形状に応じて、複数の乗算器706および複数の加算器707の最適な割り振りを行って、行列演算を動的かつ効率的に実行することができる。 As a result, it is possible to perform the matrix operation dynamically and efficiently by optimally allocating the plurality of multipliers 706 and the plurality of adders 707 for each input matrix data according to the shape of the input matrix data. it can.

(6)上記(1)の演算装置200において、部分行列形状決定回路215は、DRAM205が有するセンスアンプのキャッシュサイズと、行列データの行方向の列数である列サイズと、部分列サイズと、に基づいて、センスアンプのキャッシュヒット回数を求め、キャッシュヒット回数がしきい値(スレッショルドレジスタ213の値)以上でない場合、部分列サイズを増加させる(S405、S406:No、S403)。 (6) In the arithmetic unit 200 of the above (1), the submatrix shape determination circuit 215 has a cache size of the sense amplifier of the DRAM 205, a column size which is the number of columns in the row direction of the matrix data, a subcolumn size, and the like. The number of cache hits of the sense amplifier is obtained based on the above, and if the number of cache hits is not equal to or greater than the threshold value (value of threshold register 213), the submatrix size is increased (S405, S406: No, S403).

DRAM205のアクセス時間は条件により変化する。同じセンスアンプキャッシュにある同一行のデータについては、高速にアクセス可能である一方、違う行のデータについては、現在センスアンプキャッシュに存在するデータを書き戻し、対象の行のデータを読み出す処理を行うため、最大で10倍のアクセス時間となる。このように、アクセスパターンによりアクセス時間が大きく異なるため、部分行列の形状の下限値としてキャッシュヒット回数を算出することにより、センスアンプキャッシュサイズに応じて部分行列の形状を変更することができる。 The access time of the DRAM 205 changes depending on the conditions. The data in the same row in the same sense amplifier cache can be accessed at high speed, while the data in different rows is written back to the data currently in the sense amplifier cache and the data in the target row is read out. Therefore, the access time is up to 10 times longer. As described above, since the access time varies greatly depending on the access pattern, the shape of the submatrix can be changed according to the sense amplifier cache size by calculating the number of cache hits as the lower limit of the shape of the submatrix.

(7)上記(6)の演算装置200において、部分行列形状決定回路215は、キャッシュヒット回数がしきい値以上である場合、増加前の部分列サイズ(pCOL)と複数の乗算器706の個数(アレイサイズ)とに基づいて、部分行列の列方向の行数である部分行サイズを求め、部分列サイズ(pCOL)と部分行サイズ(pLOW)とにより部分行列の形状を仮決定し(ステップS407、S408)、仮決定された部分列サイズを増加させ、増加後の部分列サイズが複数の乗算器706の個数(アレイサイズ)以上となった場合、仮決定された部分列サイズ(pCOL)と複数の乗算器706の個数(アレイサイズ)とに基づいて、部分行列の列方向の行数である部分行サイズを求め、部分列サイズと部分行サイズとにより部分行列の形状を決定する(ステップS415、S416)。 (7) In the arithmetic unit 200 of the above (6), when the number of cache hits is equal to or greater than the threshold value, the subsequence shape determination circuit 215 has the subsequence size (pCOL) before the increase and the number of the plurality of multipliers 706. Based on (array size), the subsequence size, which is the number of rows in the column direction of the subsequence, is obtained, and the shape of the subsequence is tentatively determined by the subsequence size (pCOL) and the subsequence size (pLOW) (step). S407, S408), when the tentatively determined subsequence size is increased and the increased subsequence size is equal to or greater than the number (array size) of a plurality of multipliers 706, the tentatively determined subsequence size (pCOL) Based on the above and the number of multipliers 706 (array size), the subsequence size, which is the number of rows in the column direction of the subsequence, is obtained, and the shape of the subsequence is determined by the subsequence size and the subsequence size (). Steps S415 and S416).

これにより、部分行列形状決定回路215は、部分列サイズがアレイサイズ以上になるまで、キャッシュヒット回数がスレッショルド以上でかつDRAM205へのアクセス回数が最小となるような部分列サイズを探索することができる。したがって、行列演算回数の低減化を図ることができる。 As a result, the submatrix shape determination circuit 215 can search for a subsequence size such that the number of cache hits is equal to or greater than the threshold and the number of accesses to the DRAM 205 is minimized until the subsequence size becomes equal to or greater than the array size. .. Therefore, the number of matrix operations can be reduced.

(8)上記(7)の演算装置200において、部分行列形状決定回路215は、部分列サイズと、行列データの行方向の列数である列サイズと、に基づいて、複数の部分行列で行列データを包含する領域の行方向のサイズ(横H)を仮決定し、部分行サイズと、行列データの列方向の列数である行サイズと、に基づいて、複数の部分行列で行列データを包含する領域の列方向のサイズ(縦V)を仮決定し、仮決定された両サイズ(横H、縦V)の乗算結果Nが行列データへの最小アクセス回数以下である場合、最小アクセス回数を乗算結果Nに更新する(ステップS409〜S414)。 (8) In the arithmetic unit 200 of the above (7), the submatrix shape determination circuit 215 is a matrix with a plurality of submatrix based on the subcolumn size and the column size which is the number of columns in the row direction of the matrix data. The size of the area containing the data in the row direction (horizontal H) is tentatively determined, and the matrix data is divided into a plurality of sub-matrix based on the partial row size and the row size which is the number of columns in the column direction of the matrix data. The size of the area to be included in the column direction (vertical V) is tentatively determined, and when the multiplication result N of both tentatively determined sizes (horizontal H and vertical V) is equal to or less than the minimum number of accesses to the matrix data, the minimum number of accesses. Is updated to the multiplication result N (steps S409 to S414).

これにより、部分行列形状決定回路215は、部分列サイズがアレイサイズ以上になるまで、キャッシュヒット回数がスレッショルド以上でかつDRAM205へのアクセス回数が最小となるような領域の行方向のサイズ(横H、縦V)を探索することができる。したがって、行列データのサイズに対して0埋めすべき領域を低減化することができ、DRAM205からの読出し効率の向上を図ることができる。 As a result, the submatrix shape determination circuit 215 has a row size (horizontal H) of the region in which the number of cache hits is equal to or greater than the threshold and the number of accesses to the DRAM 205 is minimized until the subsequence size becomes equal to or greater than the array size. , Vertical V) can be searched. Therefore, the area to be filled with 0 can be reduced with respect to the size of the matrix data, and the reading efficiency from the DRAM 205 can be improved.

(9)上記(1)の演算装置200は、FPGA204である。これにより、プロセッサ201の負荷低減を図ることができる。 (9) The arithmetic unit 200 of the above (1) is FPGA 204. As a result, the load on the processor 201 can be reduced.

(10)上記(1)の演算装置200は、部分行列形状決定回路215および行列演算アレイ221を含むFPGA204と、FPGA204を制御するための制御プログラム206を実行するプロセッサ201と、制御プログラム206と行列演算アレイ221による行列演算結果(結果Cデータ)とを記憶するメモリ202と、を有する。これにより、FPGA204を制御することがかのとなる。 (10) The arithmetic unit 200 of the above (1) includes an FPGA 204 including a submatrix shape determination circuit 215 and a matrix operation array 221, a processor 201 that executes a control program 206 for controlling the FPGA 204, a control program 206, and a matrix. It has a memory 202 for storing a matrix operation result (result C data) by the operation array 221. As a result, the FPGA 204 can be controlled.

(11)上記(10)の演算装置200において、FPGA204は、部分行列形状決定回路215の実行内容を示すログデータ210を生成するログ生成部1105を含み、メモリ202は、ログ生成部1105によって生成されたログデータ210を記憶する。これにより、部分行列形状決定回路215の実行内容を確認することができる。 (11) In the arithmetic unit 200 of the above (10), the FPGA 204 includes a log generation unit 1105 that generates log data 210 indicating the execution contents of the submatrix shape determination circuit 215, and the memory 202 is generated by the log generation unit 1105. The log data 210 that has been created is stored. Thereby, the execution contents of the submatrix shape determination circuit 215 can be confirmed.

なお、本発明は上記した実施例に限定されるものではなく、様々な変形例が含まれる。例えば、上記した実施例は本発明を分かりやすく説明するために詳細に説明したものであり、必ずしも説明したすべての構成を備えるものに限定されるものではない。また、ある実施例の構成の一部を他の実施例の構成に置き換えることが可能であり、また、ある実施例の構成に他の実施例の構成を加えることも可能である。また、各実施例の構成の一部について、他の構成の追加・削除・置換をすることが可能である。 The present invention is not limited to the above-described examples, and includes various modifications. For example, the above-described embodiment has been described in detail in order to explain the present invention in an easy-to-understand manner, and is not necessarily limited to the one including all the configurations described. Further, it is possible to replace a part of the configuration of one embodiment with the configuration of another embodiment, and it is also possible to add the configuration of another embodiment to the configuration of one embodiment. Further, it is possible to add / delete / replace a part of the configuration of each embodiment with another configuration.

また、制御線や情報線は説明上必要と考えられるものを示しており、実装上必要な全ての制御線や情報線を示しているとは限らない。実際には、ほとんど全ての構成が相互に接続されていると考えてよい。 In addition, the control lines and information lines indicate those that are considered necessary for explanation, and do not necessarily indicate all the control lines and information lines necessary for implementation. In practice, it can be considered that almost all configurations are interconnected.

200 演算装置
201 プロセッサ
202 メモリ
205 DRAM
206 制御プログラム
207 行列Aデータ
208 行列Bデータ
209 結果Cデータ
210 ログデータ
211 アレイサイズレジスタ
212 センスアンプキャッシュサイズレジスタ
213 スレッショルドレジスタ
214 行列ABサイズレジスタ
215 部分行列形状決定回路
216 加算制御回路
221 行列演算アレイ
225 ログ出力部
706 乗算器
707 加算器
200 Arithmetic Logic Unit 201 Processor 202 Memory 205 DRAM
206 Control program 207 Matrix A data 208 Matrix B data 209 Result C data 210 Log data 211 Array size register 212 Sense amplifier cache size register 213 Threshold register 214 Matrix AB size register 215 Partial matrix shape determination circuit 216 Adder control circuit 221 Adder operation array 225 Log output unit 706 Multiplier 707 Adder

Claims (12)

行列データを記憶する記憶デバイスにアクセス可能な演算装置であって、
前記行列データの分割単位となる部分行列の行方向の列数である部分列サイズを増加させ、増加後の部分列サイズが複数の乗算器の個数以上となった場合、増加前の前記部分列サイズと前記複数の乗算器の個数とに基づいて、前記部分行列の列方向の行数である部分行サイズを求め、前記部分列サイズと前記部分行サイズとにより構成される前記部分行列の形状を決定する決定部と、
前記複数の乗算器と複数の加算器とを有し、前記記憶デバイスに記憶されている第1行列データのうち前記決定部によって決定された形状の第1部分行列と、前記記憶デバイスに記憶されている第2行列データのうち前記決定部によって決定された形状の第2部分行列と、の積和演算を実行する行列演算部と、
を有することを特徴とする演算装置。
An arithmetic unit that can access a storage device that stores matrix data.
When the subcolumn size, which is the number of columns in the row direction of the submatrix that is the division unit of the matrix data, is increased and the subcolumn size after the increase becomes equal to or greater than the number of a plurality of multipliers, the subcolumn before the increase Based on the size and the number of the plurality of multipliers, the partial row size, which is the number of rows in the column direction of the submatrix, is obtained, and the shape of the submatrix composed of the submatrix size and the partial row size. And the decision-making part that decides
The first submatrix having the shape determined by the determination unit among the first matrix data stored in the storage device and having the plurality of multipliers and the plurality of adders, and stored in the storage device. Of the second matrix data, the matrix calculation unit that executes the product-sum operation of the second submatrix of the shape determined by the determination unit, and
An arithmetic unit characterized by having.
請求項1に記載の演算装置であって、
前記決定部は、前記第1行列データについて決定された第1部分行列の部分列サイズと、前記第2行列データについて決定された第2部分行列の部分行サイズと、のうち、大きい方の形状を、前記部分行列の形状に決定する、
ことを特徴とする演算装置。
The arithmetic unit according to claim 1.
The determination unit has the larger shape of the submatrix size of the first submatrix determined for the first matrix data and the submatrix size of the second submatrix determined for the second matrix data. To the shape of the submatrix,
An arithmetic unit characterized by that.
請求項1に記載の演算装置であって、
前記決定部は、前記部分列サイズと、前記行列データの前記行方向の列数である列サイズと、に基づいて、複数の前記部分行列で前記行列データを包含する領域の前記行方向のサイズを決定し、前記部分行サイズと、前記行列データの前記列方向の列数である行サイズと、に基づいて、複数の前記部分行列で前記行列データを包含する領域の前記列方向のサイズを決定する、
ことを特徴とする演算装置。
The arithmetic unit according to claim 1.
Based on the subcolumn size and the column size which is the number of columns in the row direction of the matrix data, the determination unit determines the size of the area including the matrix data in the plurality of the submatrix in the row direction. Based on the partial row size and the row size which is the number of columns of the matrix data in the column direction, the size of the region including the matrix data in the plurality of the sub-matrix is determined in the column direction. decide,
An arithmetic unit characterized by that.
請求項3に記載の演算装置であって、
前記領域のうち前記部分行列が割り当てられていない範囲に0値を割り当てる制御部を有し、
前記行列演算部は、前記制御部による前記0値の割当後に前記積和演算を実行する、
ことを特徴とする演算装置。
The arithmetic unit according to claim 3.
It has a control unit that assigns a 0 value to a range of the area to which the submatrix is not assigned.
The matrix calculation unit executes the product-sum operation after the zero value is assigned by the control unit.
An arithmetic unit characterized by that.
請求項3に記載の演算装置であって、
前記行列データが入力される都度、前記列サイズおよび前記行サイズを設定する設定部を有し、
前記決定部は、前記行列データが入力される都度、前記部分行列の形状と、前記領域の前記行方向のサイズと、前記領域の前記列方向のサイズと、を決定する、
ことを特徴とする演算装置。
The arithmetic unit according to claim 3.
It has a setting unit for setting the column size and the row size each time the matrix data is input.
Each time the matrix data is input, the determination unit determines the shape of the submatrix, the size of the region in the row direction, and the size of the region in the column direction.
An arithmetic unit characterized by that.
請求項1に記載の演算装置であって、
前記決定部は、前記記憶デバイスが有するセンスアンプのキャッシュサイズと、前記行列データの行方向の列数である列サイズと、前記部分列サイズと、に基づいて、前記センスアンプのキャッシュヒット回数を求め、前記キャッシュヒット回数がしきい値以上でない場合、前記部分列サイズを増加させる、
ことを特徴とする演算装置。
The arithmetic unit according to claim 1.
The determination unit determines the number of cache hits of the sense amplifier based on the cache size of the sense amplifier of the storage device, the column size which is the number of columns in the row direction of the matrix data, and the subsequence size. If the number of cache hits is not equal to or greater than the threshold value, the subsequence size is increased.
An arithmetic unit characterized by that.
請求項6に記載の演算装置であって、
前記決定部は、前記キャッシュヒット回数が前記しきい値以上である場合、増加前の前記部分列サイズと前記複数の乗算器の個数とに基づいて、前記部分行列の列方向の行数である部分行サイズを求め、前記部分列サイズと前記部分行サイズとにより前記部分行列の形状を仮決定し、
前記仮決定された部分列サイズを増加させ、増加後の部分列サイズが複数の乗算器の個数以上となった場合、前記仮決定された部分列サイズと前記複数の乗算器の個数とに基づいて、前記部分行列の列方向の行数である部分行サイズを求め、前記部分列サイズと前記部分行サイズとにより前記部分行列の形状を決定する、
ことを特徴とする演算装置。
The arithmetic unit according to claim 6.
When the number of cache hits is equal to or greater than the threshold value, the determination unit is the number of rows in the column direction of the submatrix based on the subsequence size before the increase and the number of the plurality of multipliers. The submatrix size is obtained, and the shape of the submatrix is tentatively determined by the substring size and the submatrix size.
When the tentatively determined subsequence size is increased and the increased subsequence size becomes equal to or greater than the number of a plurality of multipliers, it is based on the tentatively determined subsequence size and the number of the plurality of multipliers. The subsequence size, which is the number of rows in the column direction of the subsequence, is obtained, and the shape of the subsequence is determined by the subsequence size and the subsequence size.
An arithmetic unit characterized by that.
請求項7に記載の演算装置であって、
前記決定部は、前記部分列サイズと、前記行列データの前記行方向の列数である列サイズと、に基づいて、複数の前記部分行列で前記行列データを包含する領域の前記行方向のサイズを仮決定し、前記部分行サイズと、前記行列データの前記列方向の列数である行サイズと、に基づいて、複数の前記部分行列で前記行列データを包含する領域の前記列方向のサイズを仮決定し、前記仮決定された両サイズの乗算結果が前記行列データへの最小アクセス回数以下である場合、前記最小アクセス回数を前記乗算結果に更新する、
ことを特徴とする演算装置。
The arithmetic unit according to claim 7.
The determination unit is based on the subcolumn size and the column size which is the number of columns of the matrix data in the row direction, and the size of the region including the matrix data in the plurality of the submatrix in the row direction. Is tentatively determined, and based on the partial row size and the row size which is the number of columns in the column direction of the matrix data, the size of the region including the matrix data in the plurality of the sub-matrix in the column direction. Is tentatively determined, and when the tentatively determined multiplication result of both sizes is equal to or less than the minimum number of accesses to the matrix data, the minimum number of accesses is updated to the multiplication result.
An arithmetic unit characterized by that.
請求項1に記載の演算装置であって、
前記演算装置は、オフロードデバイスである、
ことを特徴とする演算装置。
The arithmetic unit according to claim 1.
The arithmetic unit is an offload device.
An arithmetic unit characterized by that.
請求項1に記載の演算装置であって、
前記決定部および前記行列演算部を含むオフロードデバイスと、
前記オフロードデバイスを制御するための制御プログラムを実行するプロセッサと、
前記制御プログラムと、前記行列演算部による行列演算結果と、を記憶するメモリと、
を有することを特徴とする演算装置。
The arithmetic unit according to claim 1.
An offload device including the determination unit and the matrix calculation unit, and
A processor that executes a control program for controlling the offload device, and
A memory for storing the control program and the matrix calculation result by the matrix calculation unit, and
An arithmetic unit characterized by having.
請求項10に記載の演算装置であって、
前記オフロードデバイスは、前記決定部の実行内容を示すログデータを生成する生成部を含み、
前記メモリは、前記生成部によって生成されたログデータを記憶する、
ことを特徴とする演算装置。
The arithmetic unit according to claim 10.
The offload device includes a generation unit that generates log data indicating the execution content of the determination unit.
The memory stores log data generated by the generation unit.
An arithmetic unit characterized by that.
行列データを記憶する記憶デバイスにアクセス可能な演算装置が実行する演算方法であって、
前記演算装置は、
前記行列データの分割単位となる部分行列の行方向の列数である部分列サイズを増加させ、増加後の部分列サイズが複数の乗算器の個数以上となった場合、増加前の前記部分列サイズと前記複数の乗算器の個数とに基づいて、前記部分行列の列方向の行数である部分行サイズを求め、前記部分列サイズと前記部分行サイズとにより構成される前記部分行列の形状を決定し、
前記複数の乗算器と複数の加算器とを有し、前記記憶デバイスに記憶されている第1行列データのうち前記決定された形状の第1部分行列と、前記記憶デバイスに記憶されている第2行列データのうち前記決定された形状の第2部分行列と、の積和演算を実行する、
ことを特徴とする演算方法。
An arithmetic method performed by an arithmetic unit that has access to a storage device that stores matrix data.
The arithmetic unit
When the subcolumn size, which is the number of columns in the row direction of the submatrix that is the division unit of the matrix data, is increased and the subcolumn size after the increase becomes equal to or greater than the number of a plurality of multipliers, the subcolumn before the increase Based on the size and the number of the plurality of multipliers, the partial row size, which is the number of rows in the column direction of the submatrix, is obtained, and the shape of the submatrix composed of the submatrix size and the partial row size. Decide,
A first submatrix having the determined shape among the first matrix data stored in the storage device, which has the plurality of multipliers and the plurality of adders, and a first submatrix stored in the storage device. The product-sum operation of the second submatrix of the determined shape of the two matrix data is executed.
A calculation method characterized by that.
JP2019184072A 2019-10-04 2019-10-04 Arithmetic processing device and arithmetic processing method Pending JP2021060748A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2019184072A JP2021060748A (en) 2019-10-04 2019-10-04 Arithmetic processing device and arithmetic processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2019184072A JP2021060748A (en) 2019-10-04 2019-10-04 Arithmetic processing device and arithmetic processing method

Publications (1)

Publication Number Publication Date
JP2021060748A true JP2021060748A (en) 2021-04-15

Family

ID=75380154

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2019184072A Pending JP2021060748A (en) 2019-10-04 2019-10-04 Arithmetic processing device and arithmetic processing method

Country Status (1)

Country Link
JP (1) JP2021060748A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20230072962A (en) * 2021-11-18 2023-05-25 서울대학교산학협력단 Method and apparatus for distributed matrix multiplication baed on frame quantization

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20230072962A (en) * 2021-11-18 2023-05-25 서울대학교산학협력단 Method and apparatus for distributed matrix multiplication baed on frame quantization
KR102621139B1 (en) * 2021-11-18 2024-01-04 서울대학교산학협력단 Method and apparatus for distributed matrix multiplication baed on frame quantization

Similar Documents

Publication Publication Date Title
US6381668B1 (en) Address mapping for system memory
WO2018160773A1 (en) Matrix transfer accelerator system and method
JPS6126712B2 (en)
CN113032007B (en) Data processing method and device
WO2018179044A1 (en) Cache memory and control method therefor
US11620225B1 (en) System and method for mapping memory addresses to locations in set-associative caches
CN112085644A (en) Multi-column data sorting method and device, readable storage medium and electronic equipment
US6684267B2 (en) Direct memory access controller, and direct memory access control method
JP2021060748A (en) Arithmetic processing device and arithmetic processing method
KR100474357B1 (en) A method for memory allocation using multi-level partition
US20080301400A1 (en) Method and Arrangement for Efficiently Accessing Matrix Elements in a Memory
EP4180996A1 (en) Matrix operation method and accelerator
US11816025B2 (en) Hardware acceleration
CN113052292B (en) Convolutional neural network technique method, device and computer readable storage medium
US10325672B2 (en) Memory apparatus having plurality of information storage tables managed by separate virtual regions and control method thereof
US6895488B2 (en) DSP memory bank rotation
JP3336073B2 (en) Memory, data writing method, data reading method
CN113312277B (en) Memory bank address mapping device and method and electronic equipment
JP2001209574A (en) Method for controlling storage device
US11860793B2 (en) Controller, computing system including the same, and method of creating and searching page table entry for the same
US20230307036A1 (en) Storage and Accessing Methods for Parameters in Streaming AI Accelerator Chip
US11734608B2 (en) Address interleaving for machine learning
JP3429880B2 (en) Memory device and memory access method
CN113298243A (en) Data storage management method and device and convolution computing hardware accelerator
US6965985B2 (en) Sign generation bypass path to aligner for reducing signed data load latency