JPWO2017056427A1 - Program rewriting device, method and storage medium - Google Patents
Program rewriting device, method and storage medium Download PDFInfo
- Publication number
- JPWO2017056427A1 JPWO2017056427A1 JP2017542715A JP2017542715A JPWO2017056427A1 JP WO2017056427 A1 JPWO2017056427 A1 JP WO2017056427A1 JP 2017542715 A JP2017542715 A JP 2017542715A JP 2017542715 A JP2017542715 A JP 2017542715A JP WO2017056427 A1 JPWO2017056427 A1 JP WO2017056427A1
- Authority
- JP
- Japan
- Prior art keywords
- program
- accelerator
- target process
- offload target
- code fragment
- 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
Links
Images
Landscapes
- Devices For Executing Special Programs (AREA)
Abstract
本発明は、プロセッサおよびアクセラレータを含むコンピュータシステムに実行させるプログラムにおいて、アクセラレータに対して効率的にデータを供給するようプログラムを書き換える技術を提供する。プログラム解析部11は、プロセッサおよびアクセラレータを含むコンピュータシステムに実行させるプログラムにおいてオフロード対象処理を特定する。高位合成部12は、オフロード対象処理をアクセラレータ上に実装する演算装置の設計内容情報を生成するとともに演算装置の構造情報を生成する。プログラムコード片生成部13は、構造情報に基づいて、演算装置に対して同時に供給する入力データの組をメモリ上の連続領域に配置し連続領域を用いてオフロード対象処理を呼び出す処理を記述したプログラムコード片を生成する。プログラム書換部14は、プログラムにおけるオフロード対象処理の呼び出し箇所に、プログラムコード片を埋め込む。The present invention provides a technique for rewriting a program to be efficiently supplied to an accelerator in a program to be executed by a computer system including a processor and an accelerator. The program analysis unit 11 specifies an offload target process in a program to be executed by a computer system including a processor and an accelerator. The high-level synthesis unit 12 generates design content information of the arithmetic device that implements the offload target process on the accelerator and generates structure information of the arithmetic device. Based on the structure information, the program code fragment generation unit 13 describes a process of placing a set of input data to be simultaneously supplied to the arithmetic device in a continuous area on the memory and calling the offload target process using the continuous area. Generate a piece of program code. The program rewriting unit 14 embeds a piece of program code at the location where the offload target process is called in the program.
Description
本発明は、プロセッサおよびアクセラレータを含むコンピュータシステムに実行させるプログラムを書き換える技術に関する。 The present invention relates to a technique for rewriting a program to be executed by a computer system including a processor and an accelerator.
プロセッサおよびアクセラレータを含むコンピュータシステムが知られている。このようなコンピュータシステムに実行させるプログラムを記載する際には、アクセラレータに割り当てる処理を決める必要がある。例えば、特許文献1には、アクセラレータに割り当てる関数を実行時に動的に決定する技術が記載されている。以降、アクセラレータに処理を割り当てることを、オフロードするとも記載する。
Computer systems that include a processor and an accelerator are known. When describing a program to be executed by such a computer system, it is necessary to decide a process to be assigned to an accelerator. For example,
ここで、オフロードされた処理が実装されたアクセラレータには、効率的に入力データが供給されることが求められる。例えば、オフロードされた処理がパイプライン演算器として実装される場合、パイプライン演算器に対して、毎サイクル入力データが供給されることが望ましい。この場合、パイプライン演算のそれぞれのステージにおいて必要となる入力データが、パイプライン演算器に対して同時に供給される必要がある。つまり、パイプライン演算器に対しては、同じ組の入力データ群を、パイプライン演算器の構造に応じた異なるタイミングで供給する必要がある。そのために、多段のパイプラインレジスタを追加して入力データを遅延させることが考えられる。しかしながら、多段のパイプラインレジスタは、大きな回路面積を消費するため受け入れられない。 Here, it is required that the input data is efficiently supplied to the accelerator in which the offloaded processing is mounted. For example, when an offloaded process is implemented as a pipeline computing unit, it is desirable to supply input data for each cycle to the pipeline computing unit. In this case, input data required in each stage of the pipeline operation needs to be simultaneously supplied to the pipeline operation unit. That is, it is necessary to supply the same set of input data groups to the pipeline arithmetic unit at different timings according to the structure of the pipeline arithmetic unit. Therefore, it is conceivable to delay input data by adding a multi-stage pipeline register. However, multistage pipeline registers are not acceptable because they consume a large circuit area.
このように、オフロードされた処理が実装されたアクセラレータは、あるサイクルにおいて、異なる組の複数個の入力データを必要とする。ところが、通常のメモリシステムでは、あるサイクルに要求できるアドレスは1種類である。メモリバス幅が広ければ、連続領域に配置された複数個の入力データを一度に読み込むことは可能である。しかしながら、非連続な領域に配置された複数個の入力データを一度に読み込むことはできない。したがって、オフロードされた処理が実装されたアクセラレータが、あるサイクルにおいて必要とする複数個の入力データを効率的に読み込むためには、それらの入力データが連続領域に配置されている必要がある。 As described above, an accelerator in which offloaded processing is implemented requires a plurality of different sets of input data in a certain cycle. However, in a normal memory system, one type of address can be requested in a certain cycle. If the memory bus width is wide, it is possible to read a plurality of input data arranged in the continuous area at a time. However, a plurality of input data arranged in non-contiguous areas cannot be read at a time. Therefore, in order for an accelerator equipped with an offloaded process to efficiently read a plurality of input data required in a certain cycle, the input data needs to be arranged in a continuous area.
このように、オフロードされる処理が実装されたアクセラレータに対して入力データを効率的に供給するためには、各入力データの必要なタイミングを考慮して異なる組の複数個の入力データを、連続領域に配置するプログラムを記述する必要がある。しかし、そのようなプログラムを記述することは、プログラマにとって困難かつ非効率的である。 As described above, in order to efficiently supply input data to an accelerator in which processing to be offloaded is implemented, a plurality of different sets of input data are considered in consideration of the necessary timing of each input data. It is necessary to write a program to be placed in a continuous area. However, writing such a program is difficult and inefficient for programmers.
特許文献1には、アクセラレータにオフロードする処理を実行時に動的に決めることについては記載されているものの、アクセラレータに対して入力データを効率的に供給することについては記載がない。 Japanese Patent Application Laid-Open No. 2004-228867 describes that the process of offloading to an accelerator is dynamically determined at the time of execution, but does not describe efficiently supplying input data to the accelerator.
本発明は、上述の課題を解決するためになされたものである。すなわち、本発明は、プロセッサおよびアクセラレータを含むコンピュータシステムに実行させるプログラムにおいて、アクセラレータに対して効率的にデータを供給するようプログラムを書き換える技術を提供することを目的とする。 The present invention has been made to solve the above-described problems. That is, an object of the present invention is to provide a technique for rewriting a program to efficiently supply data to an accelerator in a program executed by a computer system including a processor and an accelerator.
上記目的を達成するために、本発明のプログラム書換装置は、プロセッサおよびアクセラレータを含むコンピュータシステムに実行させるプログラムにおいて、前記アクセラレータにオフロードされる処理(オフロード対象処理)を特定するプログラム解析手段と、前記オフロード対象処理を前記アクセラレータ上に実装する演算装置の設計内容を表す設計内容情報を生成し、生成した設計内容情報に基づいて、前記演算装置の構造を表す構造情報を生成する高位合成手段と、前記構造情報に基づいて、前記演算装置に対して同時に供給する入力データの組を読み込んでメモリ上の連続領域に配置するとともに前記連続領域を用いて前記オフロード対象処理を呼び出す処理を記述したプログラムコード片を生成するプログラムコード片生成手段と、前記プログラムにおける前記オフロード対象処理の呼び出し箇所に、前記プログラムコード片を埋め込むプログラム書換手段と、を備える。 In order to achieve the above object, a program rewriting apparatus according to the present invention includes a program analysis unit for specifying a process (offload target process) to be offloaded to an accelerator in a program to be executed by a computer system including a processor and an accelerator. High-level synthesis that generates design content information representing the design content of an arithmetic device that implements the offload target process on the accelerator, and generates structure information that represents the structure of the arithmetic device based on the generated design content information And a process of reading a set of input data to be simultaneously supplied to the arithmetic unit based on the structure information and placing the set in a continuous area on a memory and calling the offload target process using the continuous area Program code fragment generator that generates the described program code fragment If, on the call point of the offload target process in the program, and a program rewrite means for embedding the program code fragment.
また、本発明の方法は、コンピュータ装置が、プロセッサおよびアクセラレータを含むコンピュータシステムに実行させるプログラムにおいて、前記アクセラレータにオフロードされる処理(オフロード対象処理)を特定し、前記オフロード対象処理を前記アクセラレータ上に実装する演算装置の設計内容を表す設計内容情報を生成し、生成した設計内容情報に基づいて、前記演算装置の構造を表す構造情報を生成し、前記構造情報に基づいて、前記演算装置に対して同時に供給する入力データの組を読み込んでメモリ上の連続領域に配置するとともに前記連続領域を用いて前記オフロード対象処理を呼び出す処理を記述したプログラムコード片を生成し、前記プログラムにおける前記オフロード対象処理の呼び出し箇所に、前記プログラムコード片を埋め込む。 Further, the method of the present invention specifies a process (offload target process) to be offloaded to the accelerator in a program that is executed by a computer system including a processor and an accelerator. Generates design content information representing the design content of the arithmetic device mounted on the accelerator, generates structure information representing the structure of the arithmetic device based on the generated design content information, and performs the computation based on the structure information. A program code fragment describing a process for reading a set of input data to be simultaneously supplied to the apparatus and arranging the read data in a continuous area on the memory and calling the offload target process using the continuous area is generated in the program. The program at the location where the offload target process is called Embed the over-de-piece.
また、本発明の記憶媒体は、プロセッサおよびアクセラレータを含むコンピュータシステムに実行させるプログラムにおいて、前記アクセラレータにオフロードされる処理(オフロード対象処理)を特定するプログラム解析ステップと、前記オフロード対象処理を前記アクセラレータ上に実装する演算装置の設計内容を表す設計内容情報を生成し、生成した設計内容情報に基づいて、前記演算装置の構造を表す構造情報を生成する高位合成ステップと、前記構造情報に基づいて、前記演算装置に対して同時に供給する入力データの組を読み込んでメモリ上の連続領域に配置するとともに前記連続領域を用いて前記オフロード対象処理を呼び出す処理を記述したプログラムコード片を生成するプログラムコード片生成ステップと、前記プログラムにおける前記オフロード対象処理の呼び出し箇所に、前記プログラムコード片を埋め込むプログラム書換ステップと、をコンピュータ装置に実行させるプログラムを記憶している。 The storage medium of the present invention includes a program analysis step for specifying a process (offload target process) to be offloaded to the accelerator in a program executed by a computer system including a processor and an accelerator, and the offload target process. A high-level synthesis step for generating design content information representing the design content of the arithmetic device mounted on the accelerator, and generating structure information representing the structure of the arithmetic device based on the generated design content information, Based on this, a set of input data to be simultaneously supplied to the arithmetic device is read and arranged in a continuous area on the memory, and a program code fragment describing a process for calling the offload target process using the continuous area is generated. A program code fragment generation step, and the program Wherein the call point offload target process, and stores a program to be executed and the program rewriting step of embedding the program code fragments, to the computer system in.
本発明は、プロセッサおよびアクセラレータを含むコンピュータシステムに実行させるプログラムにおいて、アクセラレータに対して効率的にデータを供給するようプログラムを書き換える技術を提供することができる。 The present invention can provide a technique for rewriting a program to be efficiently supplied to an accelerator in a program executed by a computer system including a processor and an accelerator.
以下、本発明の実施の形態について、図面を参照して詳細に説明する。 Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
本発明の実施の形態としてのプログラム書換装置1の機能ブロック構成を図1に示す。図1において、プログラム書換装置1は、プログラム解析部11と、高位合成部12と、プログラムコード片生成部13と、プログラム書換部14とを備える。
FIG. 1 shows a functional block configuration of a
ここで、プログラム書換装置1は、図2に示すようなハードウェア要素によって構成可能である。図2において、プログラム書換装置1は、CPU(Central Processing Unit)1001およびメモリ1002を含む。メモリ1002は、RAM(Random Access Memory)、ROM(Read Only Memory)、補助記憶装置(ハードディスク等)等によって構成される。この場合、プログラム書換装置1の各機能ブロックは、メモリ1002に格納されるコンピュータ・プログラムを読み込んで実行するとともに他の各部を制御するCPU1001によって構成される。なお、プログラム書換装置1およびその各機能ブロックのハードウェア構成は、上述の構成に限定されない。
Here, the
プログラム解析部11は、プロセッサおよびアクセラレータを含むコンピュータシステムに実行させるプログラムにおいて、アクセラレータにオフロードされる処理(オフロード対象処理)を特定する。例えば、プログラム解析部11は、入力として、プログラムを表す情報と、そのうちオフロード対象処理を指定する情報とを取得することにより、オフロード対象処理を特定してもよい。また、例えば、プログラム解析部11は、入力としてプログラムを表す情報を取得し、そのうちオフロード対象処理を決定する公知の技術を用いて、オフロード対象処理を特定してもよい。
The
高位合成部12は、オフロード対象処理をアクセラレータ上に実装する演算装置の設計内容を表す設計内容情報を生成する。設計内容情報は、例えば、RTL(Register Transfer Level)記述であってもよい。また、高位合成部12は、生成した設計内容情報に基づいて、演算装置の構造を表す構造情報を生成する。構造情報には、例えば、各入力端子の遅延に関する情報が含まれていてもよい。
The high-
プログラムコード片生成部13は、演算装置の構造情報に基づいて、プログラムコード片を生成する。プログラムコード片は、アクセラレータ上に実装される演算装置に対して同時に供給する入力データの組をメモリ1002上の連続領域に配置する処理の記述と、その連続領域を用いてオフロード対象処理を呼び出す処理の記述とを含む。例えば、構造情報に各入力端子の遅延に関する情報が含まれる場合、プログラムコード片生成部13は、各入力端子について遅延を考慮することにより同時に供給する入力データの組を読み込み、読み込んだ入力データの組を連続領域に配置する処理を記述する。また、プログラムコード片生成部13は、オフロード対象処理の呼び出し文として、上述の連続領域を示す情報を引数とする呼び出し文を記述する。
The program code
プログラム書換部14は、プログラムにおけるオフロード対象処理の呼び出し箇所に、上述のプログラムコード片を埋め込む。具体的には、プログラム書換部14は、プログラムにおけるオフロード対象処理以外の部分について、オフロード対象処理の呼び出し文を含む箇所を、上述のプログラムコード片に置換したプログラムを、出力してもよい。
The
以上のように構成されたプログラム書換装置1の動作を図3に示す。
The operation of the
図3において、まず、プログラム解析部11は、プロセッサおよびアクセラレータを含むコンピュータシステムに実行させるプログラムを取得する。そして、プログラム解析部11は、取得したプログラムにおいて、オフロード対象処理を特定する(ステップS1)。
In FIG. 3, first, the
例えば、前述のように、プログラム解析部11は、オフロード対象処理を指定する情報を、プログラムとともに入力として取得してもよい。
For example, as described above, the
次に、高位合成部12は、オフロード対象処理をアクセラレータ上に実装する演算装置に関して、設計内容情報を生成する(ステップS2)。
Next, the high-
次に、高位合成部12は、設計内容情報に基づいて、演算装置の構造を表す構造情報を生成する(ステップS3)。
Next, the high-
次に、プログラムコード片生成部13は、構造情報に基づいて、プログラムコード片を生成する(ステップS4)。
Next, the program code
前述したように、プログラムコード片は、演算装置に対して同時に供給する入力データの組をメモリ1002上の連続領域に配置する処理の記述と、その連続領域を用いてオフロード対象処理を呼び出す処理の記述とを含む。
As described above, the program code fragment is a description of a process for arranging a set of input data to be simultaneously supplied to the arithmetic device in a continuous area on the
次に、プログラム書換部14は、プログラムにおけるオフロード対象処理の呼び出し箇所に、上述のプログラムコード片を埋め込む(ステップS5)。
Next, the
前述したように、プログラム書換部14は、プログラムにおけるオフロード対象処理以外の部分について、オフロード対象処理の呼び出し文を含む箇所を、上述のプログラムコード片に置換したプログラムを、出力してもよい。
As described above, the
以上で、プログラム書換装置1は、動作を終了する。
Thus, the
このようにして、プログラム書換装置1は、ステップS1で取得したプログラムに対して、ステップS2で生成した設計内容情報と、ステップS5で書き換えたオフロード対象処理以外の部分のプログラムとを出力する。
In this way, the
次に、プログラム書換装置1の動作を具体例で示す。この例では、オフロード対象処理は、アクセラレータ上に、パイプライン演算器として実装されるものとする。
Next, the operation of the
まず、ステップS1において、プログラム解析部11は、図4に示す入力プログラムを表す情報と、オフロード対象処理を指定する情報とを取得する。この例では、入力プログラム中には、「funcA」および「main」という2つの関数が含まれている。また、プログラム解析部11は、オフロード対象処理を指定する情報として、関数名「funcA」を取得したものとする。
First, in step S1, the
そして、この具体例では、このステップにおいて、プログラム解析部11は、取得した入力プログラムを、オフロード対象プログラムと、オフロードの対象でないオフロード非対象プログラムとに分けて出力する。
In this specific example, in this step, the
具体例におけるステップS1でのプログラム解析部11の動作の詳細を図5に示す。
FIG. 5 shows details of the operation of the
図5において、プログラム解析部11は、入力プログラムの構造解析を行い、関数名シンボルを抽出する(ステップS11)。ここでは、「funcA」および「main」が抽出される。
In FIG. 5, the
次に、プログラム解析部11は、抽出した関数名シンボルのうち、オフロード対象処理を指定する情報と一致する関数名シンボルを検索する(ステップS12)。ここでは、「funcA」が検出される。
Next, the
次に、プログラム解析部11は、検出した関数名シンボルに対応する範囲のプログラムを、オフロード対象プログラムとして出力する(ステップS13)。
Next, the
次に、プログラム解析部11は、オフロード対象処理を指定する情報「funcA」と一致しない関数名シンボルに対応する範囲のプログラムを、オフロード非対象プログラムとして出力する(ステップS14)。
Next, the
以上で、具体例でのステップS1の動作の詳細な説明を終了する。 Above, detailed description of operation | movement of step S1 in a specific example is complete | finished.
これにより、図4に示すように、オフロード対象プログラムとしては、関数funcAの中身が出力される。また、オフロード非対象プログラムとしては、関数mainの中身が出力される。 As a result, as shown in FIG. 4, the contents of the function funcA are output as the offload target program. The contents of the function main are output as the offload non-target program.
次に、ステップS2〜S3において、高位合成部12は、オフロード対象プログラムに基づいて、パイプライン演算器のRTL記述を出力する。また、高位合成部12は、パイプライン演算器の各入力端子について、最も前段の入力端子からのサイクル数(遅延数)を表す情報を、構造情報として生成する。
Next, in steps S2 to S3, the high-
具体例におけるステップS2〜S3での高位合成部12の動作の詳細を図6に示す。
Details of the operation of the high-
図6において、高位合成部12は、オフロード対象プログラムの高位合成を行い、パイプライン演算器の構造を生成する(ステップS21)。
In FIG. 6, the high-
この例では、図4に示したように、オフロード対象プログラムは、4つの入力a,b,c,dに対し、(((a*b)+c)*d)の計算を行い、計算結果を出力するプログラムである。そこで、高位合成部12は、このようなオフロード対象プログラムを実装するパイプライン演算器の構造として、図7に示す構造を生成する。このパイプライン演算器は、最初のパイプライン・ステージ(ステージ1)で、入力aおよびbの乗算を行う。乗算の遅延が2サイクルとすると、ステージ3で乗算結果が出力される。そして、このパイプライン演算器は、ステージ3で、ステージ1の乗算結果と入力cとの加算を行う。加算の遅延が2サイクルとすると、ステージ5で加算結果が出力される。そして、このパイプライン演算器は、ステージ5で、ステージ3の加算結果と入力dとの乗算を行う。乗算結果は、ステージ7で出力される。
In this example, as shown in FIG. 4, the offload target program calculates (((a * b) + c) * d) for the four inputs a, b, c, and d, and the calculation result Is a program that outputs Therefore, the high-
次に、高位合成部12は、生成された構造を、RTL記述に変換し、出力する(ステップS22)。
Next, the high-
ここでは、図7に示したパイプライン演算器の構造に対して、図8に示すような、Verilog−RTL記述が出力されたものとする。なお、図8において、MULTIPLIERは、乗算器を表す。また、ADDERは、加算器を表す。 Here, it is assumed that a Verilog-RTL description as shown in FIG. 8 is output to the structure of the pipeline arithmetic unit shown in FIG. In FIG. 8, MULTIPLIER represents a multiplier. ADDER represents an adder.
次に、高位合成部12は、生成された構造中のそれぞれの入力端子について、最も前段の入力端子からのサイクル数(遅延数)を求め、構造情報として出力する(ステップS23)。
Next, for each input terminal in the generated structure, the high-
ここでは、図7に示したパイプライン演算器の構造に対して、図9に示すような構造情報が出力される。図9の例では、構造情報は、入力データおよび遅延数の組で表される。例えば、入力aは、ステージ1で入力される。入力aの遅延数は、最も前段のステージであるステージ1との差であるので、1−1=0となる。入力bの遅延数は、入力aと同様に0となる。入力cは、ステージ3で入力される。したがって、入力cの遅延数は、3−1=2である。また、入力dは、ステージ5で入力される。したがって、入力dの遅延数は、5−1=4である。
Here, structure information as shown in FIG. 9 is output for the structure of the pipeline arithmetic unit shown in FIG. In the example of FIG. 9, the structure information is represented by a set of input data and a delay number. For example, input a is input at
以上で、具体例でのステップS2〜S3の動作の詳細な説明を終了する。 Above, detailed description of operation | movement of step S2-S3 in a specific example is complete | finished.
次に、ステップS4において、プログラムコード片生成部13は、パイプライン演算器の構造情報を参照することにより、遅延数に応じた各入力データを組にして連続領域に配置する記述と、連続領域を用いてオフロード対象処理を呼び出す処理とを記述する。
Next, in step S4, the program code
具体例におけるステップS4でのプログラムコード片生成部13の動作の詳細を図10に示す。
Details of the operation of the program code
図10では、プログラムコード片生成部13は、オフロード対象処理の呼び出し文における各引数について、以下のステップS31〜S32の処理を実行する。ここでは、各引数を、argj(j=0〜M、Mは0以上の整数)とする。この例では、arg0が「A+i」、arg1が「B+i」、arg2が「C+i」、arg3が「D+i」にそれぞれ相当する。なお、この例では、M=3である。
In FIG. 10, the program code
ここでは、まず、プログラムコード片生成部13は、構造情報を参照することにより、argjに対応する遅延数djを検索する(ステップS31)。
Here, first, the program code
例えば、図9を参照すると、arg0に対応する遅延数d0としては、0が検索される。 For example, referring to FIG. 9, 0 is retrieved as the delay number d0 corresponding to arg0.
次に、プログラムコード片生成部13は、連続領域に、遅延数に応じた引数を配置する記述として、「pack[j]=*(argj+Z−dj);」という文を生成する(ステップS32)。
Next, the program code
ここで、Zは、パイプライン演算器の入力から出力までの遅延数を表す。図7を参照すると、この具体例では、Z=6である。例えば、arg0に対応するコード片は「pack[0]=*(A+i+6);」となる。そして、プログラムコード片生成部13は、この引数について生成した記述を、プログラムコード片とする。もし、それまでに他の引数について生成されたプログラムコード片があれば、プログラムコード片生成部13は、この引数について生成した記述を、それまでのプログラムコード片に追加する。
Here, Z represents the number of delays from the input to the output of the pipeline arithmetic unit. Referring to FIG. 7, in this specific example, Z = 6. For example, the code fragment corresponding to arg0 is “pack [0] = * (A + i + 6);”. Then, the program code
全ての引数についてステップS31〜S32が完了すると、図11に示すように、遅延数に応じた引数の組を、連続領域に配置するプログラムコード片901が生成される。
When steps S31 to S32 are completed for all the arguments, as shown in FIG. 11, a
次に、プログラムコード片生成部13は、連続領域を表す「pack」を用いてオフロード対象処理を呼び出す記述を生成する(ステップS33)。これにより、図11に示すように、オフロード対象処理の呼び出し文となるプログラムコード片902が出力される。
Next, the program code
次に、プログラムコード片生成部13は、遅延数に応じた引数の組を連続領域に配置してオフロード対象処理を呼び出す処理のプロローグおよびエピローグとなるプログラムコード片を生成する(ステップS34)。
Next, the program code
ここで、プロローグおよびエピローグとなるプログラムコード片について説明する。そのために、まず、図7に示したパイプライン演算器に対して、同時に供給する引数の組合せについて説明する。同時に供給する引数の組合せは、各引数の遅延数を考慮すると、図12に示す通りとなる。図12では、各行が、同時に供給する引数の組合せを表す。また、図12において、「出力」の列は、各行の組合せの引数が入力されたサイクルでパイプライン演算器から出力される情報を表す。このとき、パイプライン演算器に最初に入力を行ってからZサイクル目までの期間801は、引数の一部が不要またはパイプライン演算器からの出力がないため、上述のプログラムコード片901および902を適用できない。また、パイプライン演算器から最後の出力があるまでのZサイクルの期間803は、引数の一部または全部が不要であるため、上述のプログラムコード片901および902を適用できない。つまり、上述のプログラムコード片901および902を適用可能である期間は、Z+1サイクル目からNサイクル目までの期間802となる。そこで、プログラムコード片生成部13は、図13に示すように、期間801について、プロローグとなるプログラムコード片903を生成する。また、プログラムコード片生成部13は、期間803について、エピローグとなるプログラムコード片904を生成する。なお、プログラムコード片生成部13は、必要に応じて連続領域を宣言する記述を、プログラムコード片に付加しておく。図11、図13の例では、プロローグとなるプログラムコード片903の先頭に、連続領域packの宣言文が付加されている。
Here, a program code fragment that becomes a prologue and an epilogue will be described. For this purpose, first, a description will be given of combinations of arguments supplied simultaneously to the pipeline arithmetic unit shown in FIG. The combination of arguments supplied at the same time is as shown in FIG. 12 in consideration of the delay number of each argument. In FIG. 12, each row represents a combination of arguments supplied simultaneously. In FIG. 12, the column “output” represents information output from the pipeline computing unit in the cycle in which the argument of the combination of each row is input. At this time, in the
以上で、具体例でのステップS4の動作の詳細な説明を終了する。 Above, detailed description of operation | movement of step S4 in a specific example is complete | finished.
次に、ステップS5において、プログラム書換部14は、オフロード非対象プログラムにおけるオフロード対象処理の呼び出し箇所に、上述のプログラムコード片901〜904を埋め込んで出力する。出力プログラムは、図14に示す通りとなる。この具体例では、プログラム書換部14は、図4に示したオフロード対象プログラムにおける呼び出し文「R[i]=funcA(A+i,B+i,C+i,D+i)」の直前に、図11に示したプログラムコード片901を挿入している。また、プログラム書換部14は、図4に示したオフロード対象プログラムにおける呼び出し文「R[i]=funcA(A+i,B+i,C+i,D+i)」を、図11に示したプログラムコード片902に置換している。また、プログラムコード片901および902の繰り返し処理の繰り返し回数を、N−Z回に変更している。そして、プログラム書換部14は、プログラムコード片901および902の繰り返し処理の前後に、プログラムコード片903および904をそれぞれ挿入している。なお、図14では、プログラムコード片903および904の詳細を省略している。
Next, in step S5, the
このようにして、この具体例では、プログラム書換装置1は、図4の入力プログラムに対して、図8のRTL記述と、図14の出力プログラムとを出力する。
In this way, in this specific example, the
以上で、具体例の説明を終了する。 This is the end of the description of the specific example.
次に、本発明の実施の形態の効果について述べる。 Next, effects of the embodiment of the present invention will be described.
本実施の形態としてのプログラム書換装置は、プロセッサおよびアクセラレータを含むコンピュータシステムに実行させるプログラムにおいて、アクセラレータに対して効率的にデータを供給するようプログラムを書き換えることができる。 The program rewriting apparatus according to the present embodiment can rewrite a program to efficiently supply data to an accelerator in a program executed by a computer system including a processor and an accelerator.
その理由について説明する。本実施の形態では、プログラム解析部が、プロセッサおよびアクセラレータを含むコンピュータシステムに実行させるプログラムにおいて、オフロード対象処理を特定する。そして、高位合成部が、オフロード対象処理をアクセラレータ上に実装する演算装置の設計内容を表す設計内容情報を生成する。また、高位合成部が、生成した設計内容情報に基づいて、演算装置の構造を表す構造情報を生成する。そして、プログラムコード片生成部が、演算装置の構造情報に基づいて、プログラムコード片を生成する。プログラムコード片には、演算装置に対して同時に供給する入力データの組をメモリ上の連続領域に配置する処理の記述と、連続領域を用いてオフロード対象処理を呼び出す処理の記述とが含まれる。そして、プログラム書換部が、プログラムにおけるオフロード対象処理の呼び出し箇所に、プログラムコード片を埋め込むからである。 The reason will be described. In the present embodiment, the program analysis unit specifies an offload target process in a program to be executed by a computer system including a processor and an accelerator. Then, the high-level synthesis unit generates design content information representing the design content of the arithmetic device that mounts the offload target process on the accelerator. Further, the high-level synthesis unit generates structure information representing the structure of the arithmetic device based on the generated design content information. Then, the program code fragment generation unit generates a program code fragment based on the structure information of the arithmetic device. The program code fragment includes a description of a process for arranging a set of input data to be simultaneously supplied to the arithmetic device in a continuous area on the memory and a description of a process for calling an offload target process using the continuous area. . This is because the program rewriting unit embeds a piece of program code in the calling location of the offload target process in the program.
これにより、本実施の形態を用いて書き換えたプログラムを、プロセッサおよびアクセラレータを含むコンピュータシステムに実行させると、非連続な領域に配置されていた異なる組の入力データを、アクセラレータに対して同時刻に効率よく供給することができる。 As a result, when the computer system including the processor and the accelerator is executed with the program rewritten using the present embodiment, different sets of input data arranged in non-contiguous areas are sent to the accelerator at the same time. It can be supplied efficiently.
ここで、本実施の形態により書き換えられたプログラムが、元のプログラムと比較して、アクセラレータによる入力データの読み込み速度を短縮する効果について、具体例を用いて説明する。 Here, the effect that the program rewritten according to the present embodiment reduces the input data reading speed by the accelerator as compared with the original program will be described using a specific example.
例えば、プログラム中のオフロード非対象処理において、オフロード対象処理を呼び出す際に、非連続な領域に配置された4個の4バイトデータを引数として渡すことを考えるここでは、オフロード対象処理は、パイプライン演算器として実装されているものとする。 For example, in the offload non-target process in the program, when calling the offload target process, consider passing four 4-byte data arranged in a non-contiguous area as an argument. Here, the offload target process is Suppose that it is implemented as a pipeline computing unit.
まず、プロセッサと、アクセラレータ上のパイプライン演算器との速度差を考える。プロセッサが3GHzで動作し、アクセラレータ上のパイプライン演算器が100MHzで動作すると、速度差は約30倍である。また、プロセッサは、1サイクルに1個の4バイトデータをロードできるものとする。また、アクセラレータは、1サイクルに1個の4バイトデータをロードできるものとする。 First, consider the speed difference between the processor and the pipeline computing unit on the accelerator. If the processor operates at 3 GHz and the pipeline calculator on the accelerator operates at 100 MHz, the speed difference is about 30 times. Further, it is assumed that the processor can load one 4-byte data in one cycle. Further, it is assumed that the accelerator can load one 4-byte data in one cycle.
書換前の元のプログラムは、同時刻に必要となる異なる組の4個の入力データを連続領域に配置しないでアクセラレータに供給する。この場合、プロセッサからアクセラレータへのアドレス送付は、4サイクル(1サイクル×4個)を必要とする。また、送付されたアドレスが非連続であるため、それぞれのアドレスに対応するデータのアクセラレータによるロードは、4サイクル(1サイクル×4個)を必要とする。ここで、アクセラレータの4サイクルは、プロセッサとの速度差30倍を勘案すると、プロセッサのサイクル換算では120サイクルに相当する。すなわち、この場合、異なる組の4個の入力データの読み込みは、プロセッサのサイクル換算で、合計4+120=124サイクルを必要とする。 The original program before rewriting supplies different sets of four input data required at the same time to the accelerator without arranging them in the continuous area. In this case, sending an address from the processor to the accelerator requires 4 cycles (1 cycle × 4). Since the sent addresses are non-consecutive, loading of data corresponding to each address by the accelerator requires 4 cycles (1 cycle × 4). Here, the four cycles of the accelerator correspond to 120 cycles in terms of the processor cycle in consideration of a speed difference of 30 times from the processor. In other words, in this case, reading of four sets of input data from different sets requires a total of 4 + 120 = 124 cycles in terms of processor cycles.
一方、本実施の形態により書き換えられたプログラムは、同時刻に必要となる異なる組の4個の入力データを連続領域に配置してからアクセラレータに供給する。この場合、プロセッサによる入力データの収集は、4サイクル(1サイクル×4個)を必要とする。次に、収集した入力データの連続領域への書込みは、4サイクル(1サイクル×4個)を必要とする。そして、プロセッサからアクセラレータへのアドレス送付は、1サイクル(1サイクル×1個)を必要とする。また、送付されたアドレスの示す連続領域に4個のデータが配置されているため、そのアドレスに対応するデータのアクセラレータによるロードは、1サイクル(1サイクル×1個)で完了する。ここで、アクセラレータの1サイクルは、プロセッサとの速度差30倍を勘案すると、プロセッサのサイクル換算で30サイクルに相当する。すなわち、本実施の形態では、異なる組の4個の入力データの読み込みは、プロセッサのサイクル換算で、合計4+4+1+30=39サイクルを必要とする。 On the other hand, the program rewritten in accordance with the present embodiment supplies different sets of four input data required at the same time to the accelerator after arranging them in the continuous area. In this case, the collection of input data by the processor requires 4 cycles (1 cycle × 4). Next, the writing of the collected input data to the continuous area requires 4 cycles (1 cycle × 4). The address transmission from the processor to the accelerator requires one cycle (1 cycle × 1). In addition, since four pieces of data are arranged in the continuous area indicated by the sent address, loading of data corresponding to the address by the accelerator is completed in one cycle (1 cycle × 1). Here, one cycle of the accelerator corresponds to 30 cycles in terms of the processor cycle in consideration of a speed difference of 30 times from the processor. That is, in the present embodiment, reading of four different sets of input data requires a total of 4 + 4 + 1 + 30 = 39 cycles in terms of processor cycles.
このように、本実施の形態により書き換えられたプログラムは、元のプログラムと比較して、124÷39=約3.2倍高速に、アクセラレータに入力データを読み込ませることができる。 Thus, the program rewritten according to the present embodiment can cause the accelerator to read input data at 124 ÷ 39 = about 3.2 times faster than the original program.
なお、本発明の実施の形態において、アクセラレータとしては、例えば、FPGA(field-programmable gate array)や、GPU(Graphics Processing Unit)が適用可能であるが、これらに限らない。 In the embodiment of the present invention, for example, a field-programmable gate array (FPGA) or a graphics processing unit (GPU) is applicable as an accelerator, but is not limited thereto.
また、本発明の実施の形態において、オフロードされる処理がアクセラレータ上にパイプライン演算器として実装される例について説明したが、オフロードされる処理を実装する演算装置は、パイプライン演算器に限らない。 In the embodiment of the present invention, the example in which the offloaded process is implemented as a pipeline arithmetic unit on the accelerator has been described. However, the arithmetic unit that implements the offloaded process is included in the pipeline arithmetic unit. Not exclusively.
また、本発明の実施の形態において、高位合成部によって生成される設計内容情報が、VerilogのRTL記述である例を中心に説明したが、これに限らない。設計内容情報は、その他のハードウェア記述言語で記述されていてもよい。 In the embodiment of the present invention, the design content information generated by the high-level synthesis unit has been mainly described as an example of Verilog RTL description. However, the present invention is not limited to this. The design content information may be described in another hardware description language.
また、本発明の実施の形態において、プログラム書換装置の各機能ブロックが、記憶装置またはROMに記憶されたコンピュータ・プログラムを実行するCPUによって実現される例を中心に説明した。これに限らず、各機能ブロックの一部、全部、または、それらの組み合わせが専用のハードウェアにより実現されていてもよい。 Further, in the embodiment of the present invention, the example in which each functional block of the program rewriting device is realized by a CPU that executes a computer program stored in a storage device or ROM has been described. However, the present invention is not limited to this, and some, all, or a combination of each functional block may be realized by dedicated hardware.
また、上述した本発明の各実施の形態において、プログラム書換装置の機能ブロックは、複数の装置に分散されて実現されてもよい。 In each of the above-described embodiments of the present invention, the functional block of the program rewriting device may be distributed and implemented in a plurality of devices.
また、本発明の実施の形態において、各フローチャートを参照して説明したプログラム書換装置の動作を、本発明のコンピュータ・プログラムとしてコンピュータ装置の記憶装置(記憶媒体)に格納しておいてもよい。そして、係るコンピュータ・プログラムを当該CPUが読み出して実行するようにしてもよい。そして、このような場合において、本発明は、係るコンピュータ・プログラムのコードあるいは記憶媒体によって構成される。 In the embodiment of the present invention, the operation of the program rewriting device described with reference to each flowchart may be stored in a storage device (storage medium) of the computer device as the computer program of the present invention. Then, the computer program may be read and executed by the CPU. In such a case, the present invention is constituted by the code of the computer program or a storage medium.
以上、上述した実施形態を模範的な例として本発明を説明した。しかしながら、本発明は、上述した実施形態には限定されない。即ち、本発明は、本発明のスコープ内において、当業者が理解し得る様々な態様を適用することができる。 The present invention has been described above using the above-described embodiment as an exemplary example. However, the present invention is not limited to the above-described embodiment. That is, the present invention can apply various modes that can be understood by those skilled in the art within the scope of the present invention.
この出願は、2015年9月30日に出願された日本出願特願2015−193106を基礎とする優先権を主張し、その開示の全てをここに取り込む。 This application claims the priority on the basis of Japanese application Japanese Patent Application No. 2015-193106 for which it applied on September 30, 2015, and takes in those the indications of all here.
1 プログラム書換装置
11 プログラム解析部
12 高位合成部
13 プログラムコード片生成部
14 プログラム書換部
1001 CPU
1002 メモリDESCRIPTION OF
1002 memory
Claims (5)
前記オフロード対象処理を前記アクセラレータ上に実装する演算装置の設計内容を表す設計内容情報を生成し、生成した設計内容情報に基づいて、前記演算装置の構造を表す構造情報を生成する高位合成手段と、
前記構造情報に基づいて、前記演算装置に対して同時に供給する入力データの組を読み込んでメモリ上の連続領域に配置するとともに前記連続領域を用いて前記オフロード対象処理を呼び出す処理を記述したプログラムコード片を生成するプログラムコード片生成手段と、
前記プログラムにおける前記オフロード対象処理の呼び出し箇所に、前記プログラムコード片を埋め込むプログラム書換手段と、
を備えたプログラム書換装置。In a program to be executed by a computer system including a processor and an accelerator, program analysis means for specifying a process (offload target process) to be offloaded to the accelerator;
High-level synthesis means for generating design content information representing the design content of an arithmetic device for mounting the offload target process on the accelerator, and generating structure information representing the structure of the arithmetic device based on the generated design content information When,
A program describing a process of reading a set of input data to be simultaneously supplied to the arithmetic unit based on the structure information, placing the input data in a continuous area on a memory, and calling the offload target process using the continuous area Program code fragment generating means for generating a code fragment;
Program rewriting means for embedding the program code fragment in the call location of the offload target process in the program,
A program rewriting device comprising:
前記プログラムコード片生成手段は、前記遅延数に応じた前記各入力データを組にして前記連続領域に配置する処理の記述を、前記プログラムコード片に含めることを特徴とする請求項1に記載のプログラム書換装置。The high-level synthesis means generates, as the structure information, information including the number of cycles (the number of delays) from the input terminal in the previous stage for each input terminal of the arithmetic device,
2. The program code fragment generation unit according to claim 1, wherein the program code fragment includes a description of processing for arranging the input data according to the number of delays as a set and arranging the input data in the continuous area. Program rewriting device.
プロセッサおよびアクセラレータを含むコンピュータシステムに実行させるプログラムにおいて、前記アクセラレータにオフロードされる処理(オフロード対象処理)を特定し、
前記オフロード対象処理を前記アクセラレータ上に実装する演算装置の設計内容を表す設計内容情報を生成し、生成した設計内容情報に基づいて、前記演算装置の構造を表す構造情報を生成し、
前記構造情報に基づいて、前記演算装置に対して同時に供給する入力データの組を読み込んでメモリ上の連続領域に配置するとともに前記連続領域を用いて前記オフロード対象処理を呼び出す処理を記述したプログラムコード片を生成し、
前記プログラムにおける前記オフロード対象処理の呼び出し箇所に、前記プログラムコード片を埋め込む方法。Computer equipment
In a program to be executed by a computer system including a processor and an accelerator, a process to be offloaded to the accelerator (offload target process) is specified,
Generate design content information representing the design content of a computing device that implements the offload target process on the accelerator, and generate structure information representing the structure of the computing device based on the generated design content information.
A program describing a process of reading a set of input data to be simultaneously supplied to the arithmetic unit based on the structure information, placing the input data in a continuous area on a memory, and calling the offload target process using the continuous area Generate a piece of code
A method of embedding the program code fragment at a call location of the offload target process in the program.
前記オフロード対象処理を前記アクセラレータ上に実装する演算装置の設計内容を表す設計内容情報を生成し、生成した設計内容情報に基づいて、前記演算装置の構造を表す構造情報を生成する高位合成ステップと、
前記構造情報に基づいて、前記演算装置に対して同時に供給する入力データの組を読み込んでメモリ上の連続領域に配置するとともに前記連続領域を用いて前記オフロード対象処理を呼び出す処理を記述したプログラムコード片を生成するプログラムコード片生成ステップと、
前記プログラムにおける前記オフロード対象処理の呼び出し箇所に、前記プログラムコード片を埋め込むプログラム書換ステップと、
をコンピュータ装置に実行させるプログラムを記憶した記憶媒体。In a program to be executed by a computer system including a processor and an accelerator, a program analysis step for specifying a process (offload target process) to be offloaded to the accelerator;
A high-level synthesis step of generating design content information representing the design content of an arithmetic device that implements the offload target process on the accelerator, and generating structure information representing the structure of the arithmetic device based on the generated design content information When,
A program describing a process of reading a set of input data to be simultaneously supplied to the arithmetic unit based on the structure information, placing the input data in a continuous area on a memory, and calling the offload target process using the continuous area A program code fragment generation step for generating a code fragment;
A program rewriting step of embedding the program code fragment at a call location of the offload target process in the program;
A storage medium storing a program for causing a computer device to execute the program.
Applications Claiming Priority (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2015193106 | 2015-09-30 | ||
JP2015193106 | 2015-09-30 | ||
PCT/JP2016/004193 WO2017056427A1 (en) | 2015-09-30 | 2016-09-14 | Program rewrite device, method, and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
JPWO2017056427A1 true JPWO2017056427A1 (en) | 2018-07-19 |
Family
ID=58423059
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2017542715A Pending JPWO2017056427A1 (en) | 2015-09-30 | 2016-09-14 | Program rewriting device, method and storage medium |
Country Status (2)
Country | Link |
---|---|
JP (1) | JPWO2017056427A1 (en) |
WO (1) | WO2017056427A1 (en) |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH04314133A (en) * | 1991-04-11 | 1992-11-05 | Nec Corp | Information processor |
US5835776A (en) * | 1995-11-17 | 1998-11-10 | Sun Microsystems, Inc. | Method and apparatus for instruction scheduling in an optimizing compiler for minimizing overhead instructions |
JP2003114914A (en) * | 2001-10-04 | 2003-04-18 | Sharp Corp | Software/hardware cooperative design method |
JP2006011840A (en) * | 2004-06-25 | 2006-01-12 | Mitsubishi Electric Corp | Integrated system |
-
2016
- 2016-09-14 JP JP2017542715A patent/JPWO2017056427A1/en active Pending
- 2016-09-14 WO PCT/JP2016/004193 patent/WO2017056427A1/en active Application Filing
Also Published As
Publication number | Publication date |
---|---|
WO2017056427A1 (en) | 2017-04-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
GB2474901A (en) | Multiply-accumulate instruction which adds or subtracts based on a predicate value | |
US20070011664A1 (en) | Device and method for generating an instruction set simulator | |
CN108319559B (en) | Data processing apparatus and method for controlling vector memory access | |
Pham‐Quoc et al. | A high‐performance fpga‐based bwa‐mem dna sequence alignment | |
US8266416B2 (en) | Dynamic reconfiguration supporting method, dynamic reconfiguration supporting apparatus, and dynamic reconfiguration system | |
US7913204B2 (en) | High-level synthesis apparatus, high-level synthesis system and high-level synthesis method | |
JP5440287B2 (en) | Symbolic execution support program, method and apparatus | |
Lang et al. | Dynamic distribution of workload between CPU and GPU for a parallel conjugate gradient method in an adaptive FEM | |
Sidiropoulos et al. | Jitpr: A framework for supporting fast application's implementation onto fpgas | |
US10666255B1 (en) | System and method for compacting X-pessimism fixes for gate-level logic simulation | |
WO2017056427A1 (en) | Program rewrite device, method, and storage medium | |
JP2007080049A (en) | Built-in program generation method, built-in program development system and information table section | |
US10909021B2 (en) | Assistance device, design assistance method, and recording medium storing design assistance program | |
US20140013312A1 (en) | Source level debugging apparatus and method for a reconfigurable processor | |
US20110167417A1 (en) | Programming system in multi-core, and method and program of the same | |
Caffarena et al. | High-level synthesis of multiple word-length DSP algorithms using heterogeneous-resource FPGAs | |
US20070250803A1 (en) | High-level synthesis method and high-level synthesis system | |
Bhimani et al. | Design space exploration of GPU Accelerated cluster systems for optimal data transfer using PCIe bus | |
JP5021584B2 (en) | Microcomputer simulator, simulation method thereof, program, and computer-readable medium | |
CN114041116A (en) | Method and device for optimizing data movement task | |
US11630667B2 (en) | Dedicated vector sub-processor system | |
KR20200026992A (en) | Register-based Complex Number Processing | |
KR20130088285A (en) | Data processing system and method of data simulation | |
JP5755103B2 (en) | Block diagram processing apparatus and block diagram processing method | |
JP5469106B2 (en) | Computer system, test apparatus, test method, and test program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20180319 |