JP2009199175A - Program dividing device and method thereof - Google Patents
Program dividing device and method thereof Download PDFInfo
- Publication number
- JP2009199175A JP2009199175A JP2008037825A JP2008037825A JP2009199175A JP 2009199175 A JP2009199175 A JP 2009199175A JP 2008037825 A JP2008037825 A JP 2008037825A JP 2008037825 A JP2008037825 A JP 2008037825A JP 2009199175 A JP2009199175 A JP 2009199175A
- Authority
- JP
- Japan
- Prior art keywords
- program
- unit
- end position
- division
- data amount
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Abstract
Description
本発明は、プログラムを分割するためのプログラム分割装置および分割方法に関する。 The present invention relates to a program dividing apparatus and a dividing method for dividing a program.
近年、マルチスレッドを活用したプログラミングが盛んである。マルチスレッドとは、一つのアプリケーションを複数のスレッドに分割し、プロセッサに並行して処理させる手法である。処理時間を非常に短い単位に分割し、複数のスレッドに順番に処理することによって、シングルコアのプロセッサでも複数の処理を同時に行っているようにみせることができる。 In recent years, programming utilizing multi-threading has become popular. Multithreading is a technique in which one application is divided into a plurality of threads and processed in parallel by a processor. By dividing the processing time into very short units and processing them in order to a plurality of threads, it is possible to make a single core processor seem to perform a plurality of processes simultaneously.
ソースプログラムをスレッドに分割して時分割処理する場合、好適に分割しないとリアルタイム性がそこなわれてしまう。また、マルチコアのプロセッサでもコアの数より多いスレッドを同時に処理する場合、同様である。 When the source program is divided into threads and processed in a time-sharing manner, the real-time property is impaired unless it is divided appropriately. The same applies when a multi-core processor simultaneously processes more threads than the number of cores.
回路構成が動的に変更可能なリコンフィギュラブルプロセッサを用いる場合、その分割位置を求めるのに多くの作業量を要する。リコンフィギュラブルプロセッサは、ALU(Arithmetic Logic Unit)と呼ばれる基本演算機能を複数持つ多機能素子を多段に並べたALUアレイを備える。リコンフィギュラブルプロセッサでは、ソースプログラムの記述から、その記述を実行する場合に必要な実行ステップ数を推測することが難しいため、好適な分割位置を簡単に求めることができない。 When a reconfigurable processor whose circuit configuration can be dynamically changed is used, a large amount of work is required to obtain the division position. The reconfigurable processor includes an ALU array in which multi-functional elements having a plurality of basic arithmetic functions called ALU (Arithmetic Logic Unit) are arranged in multiple stages. In a reconfigurable processor, it is difficult to estimate the number of execution steps necessary for executing the description from the description of the source program, and thus a suitable division position cannot be easily obtained.
出願人は、リコンフィギュラブルプロセッサに実行させるべきソースプログラムをトライ&エラーで分割していた。すなわち、ソースプログラムを手作業で分割し、その分割プログラムをコンパイルして実行ステップ数を取得し、その実行ステップ数をもとに次の分割位置を決めるという作業を、取得された実行ステップ数が所定の最大実行ステップ数に収まる最大になるまで繰り返していた。 The applicant divided the source program to be executed by the reconfigurable processor by trial and error. That is, dividing the source program manually, compiling the divided program to obtain the number of execution steps, and determining the next division position based on the number of execution steps, the acquired number of execution steps is The process was repeated until the maximum number of execution steps was reached.
特許文献2は、処理ブロックをGUI操作で組み合わせてプログラミングを行う組み込み用プログラム生成方法を開示する。この方法は、処理ブロックに関するライブラリ情報を基にして、生成されるプログラムが必要とするハードウエア資源データ、プログラム容量、及びサイクル数を算出し、生成されるプログラムが一つのプロセッサの性能を超えるものである場合、並列又は直列に接続される複数のプロセッサに分けてソースプログラムを生成する。
上述したような手作業による分割は煩雑であり、アプリケーションの開発効率を低下させていた。本発明はこうした状況に鑑みなされたものであり、その目的は、簡単にソースプログラムを好適な位置で分割することができるプログラム分割装置および方法を提供することにある。 The manual division as described above is complicated and reduces the development efficiency of the application. The present invention has been made in view of such circumstances, and an object of the present invention is to provide a program dividing apparatus and method capable of easily dividing a source program at a suitable position.
本発明のある態様のプログラム分割装置は、ソースプログラムを分割するプログラム分割装置であって、基準とすべきオブジェクトデータ量を基準データ量として保持するオブジェクトデータ量保持部と、ソースプログラム内から分割開始位置情報を検出する開始位置情報検出部と、開始位置情報検出部により検出された分割開始位置情報で特定される開始位置から始まる分割プログラムの暫定終了位置を定める終了位置設定部と、開始位置と、終了位置設定部により定められる暫定終了位置とで規定される仮分割プログラムをコンパイルするよう所定のコンパイラに指示する変換指示部と、変換指示部による指示に応じた、コンパイラの変換結果に対応するオブジェクトデータ量を取得データ量として取得する変換結果取得部と、オブジェクトデータ量保持部により保持される基準データ量と、変換結果取得部により取得される取得データ量とを比較し、その比較結果に応じて終了位置設定部を制御する制御部と、を備える。制御部は、基準データ量と取得データ量とが一致または近づくように暫定終了位置を変更するよう、終了位置設定部を制御する。 A program dividing apparatus according to an aspect of the present invention is a program dividing apparatus that divides a source program, an object data amount holding unit that holds a reference object data amount as a reference data amount, and a division start from within the source program A start position information detecting unit for detecting position information, an end position setting unit for determining a provisional end position of a divided program starting from a start position specified by the division start position information detected by the start position information detecting unit, and a start position A conversion instruction unit that instructs a predetermined compiler to compile a provisional divided program defined by the provisional end position determined by the end position setting unit, and a conversion result of the compiler according to the instruction by the conversion instruction unit A conversion result acquisition unit that acquires the object data amount as an acquisition data amount; and an object Comprises a reference amount of data held by Todeta amount holding unit, the conversion result is compared with the acquired amount of data acquired by the acquisition unit, and a control unit for controlling the end position setting unit according to the comparison result. The control unit controls the end position setting unit to change the provisional end position so that the reference data amount and the acquired data amount match or approach each other.
本発明のさらに別の態様は、プログラム分割装置である。この装置は、ソースプログラムを分割するプログラム分割装置であって、ソースプログラム内から分割開始位置情報を検出する開始位置情報検出部と、ソースプログラム内から分割終了位置情報を検出する終了位置情報検出部と、開始位置情報検出部により検出された分割開始位置情報で特定される開始位置と、終了位置情報検出部により検出された分割終了位置情報で特定される終了位置とで規定される分割プログラムをコンパイルするよう所定のコンパイラに指示する変換指示部と、変換指示部による指示に応じた、コンパイラの変換結果を取得する変換結果取得部と、を備える。 Yet another embodiment of the present invention is a program dividing device. This apparatus is a program dividing apparatus that divides a source program, and includes a start position information detection unit that detects division start position information from within the source program, and an end position information detection unit that detects division end position information from within the source program. And a division program defined by the start position specified by the division start position information detected by the start position information detection unit and the end position specified by the division end position information detected by the end position information detection unit A conversion instruction unit that instructs a predetermined compiler to compile, and a conversion result acquisition unit that acquires a conversion result of the compiler according to an instruction from the conversion instruction unit.
なお、以上の構成要素の任意の組み合わせ、本発明の表現を方法、装置、システム、記録媒体、コンピュータプログラムなどの間で変換したものもまた、本発明の態様として有効である。 It should be noted that any combination of the above-described constituent elements and a conversion of the expression of the present invention between a method, an apparatus, a system, a recording medium, a computer program, and the like are also effective as an aspect of the present invention.
本発明によれば、簡単にソースプログラムを好適な位置で分割することができる。 According to the present invention, a source program can be easily divided at a suitable position.
図1は、実施の形態1に係る情報処理システム300の構成を示すブロック図である。情報処理システム300は、プログラム分割装置100およびコンパイラ200を備える。プログラム分割装置100は、オブジェクトデータ量保持部10、開始位置情報検出部12、終了位置設定部14、仮分割プログラム登録部16、仮分割プログラム保持部18、変換指示部20、変換結果取得部22および制御部24を含む。
FIG. 1 is a block diagram illustrating a configuration of an
これらの構成は、ハードウェア的には、任意のコンピュータのCPU、メモリ、その他のLSIで実現でき、ソフトウェア的にはメモリにロードされたプログラムなどによって実現されるが、ここではそれらの連携によって実現される機能ブロックを描いている。したがって、これらの機能ブロックがハードウェアのみ、ソフトウェアのみ、またはそれらの組み合わせによっていろいろな形で実現できることは、当業者には理解されるところである。 These configurations can be realized in terms of hardware by a CPU, memory, or other LSI of an arbitrary computer, and in terms of software, they are realized by programs loaded in the memory. Draw functional blocks. Therefore, those skilled in the art will understand that these functional blocks can be realized in various forms by hardware only, software only, or a combination thereof.
オブジェクトデータ量保持部10は、基準とすべきオブジェクトデータ量を基準データ量として保持する。基準とすべきオブジェクトデータ量は、プロセッサの単位時間当たりの実行ステップ数、または使用メモリサイズで規定されるオブジェクトデータ量であってもよい。より具体的には、プロセッサの単位時間当たりに実行可能な最大実行ステップ数、または使用可能な最大メモリ領域であってもよい。
The object data
また、基準とすべきオブジェクトデータ量は、y(yは2以上の整数)個の演算器を含む演算器列で、またはx×y(x、yは2以上の整数)で二次元配置された複数の演算器を含む演算アレイで、m(mは自然数)サイクルに実行可能なステップ数で規定されるオブジェクトデータ量であってもよい。とくに後者は、リコンフィギュラブルプロセッサを用いる場合に適用可能な基準である。この詳細は後述する。 The amount of object data to be used as a reference is an arithmetic unit array including y (y is an integer of 2 or more) arithmetic units, or two-dimensionally arranged in x × y (x and y are integers of 2 or more). Further, it may be an object data amount defined by the number of steps that can be executed in m (m is a natural number) cycles in an arithmetic array including a plurality of arithmetic units. In particular, the latter is a standard that can be applied when a reconfigurable processor is used. Details of this will be described later.
開始位置情報検出部12は、ソースプログラム内から分割開始位置情報を検出する。このソースプログラムはC言語などの高級言語で記述されており、分割を開始すべき位置に分割開始位置情報が付加されている。分割開始位置情報は、プログラムなどによりコメントとして埋め込まれる。また、本プログラム分割装置100が統合開発環境下のGUI操作のツールとして実装される場合、分割開始位置情報をマウス操作などで付加するようにしてもよい。分割開始位置情報は、意味的または機能的にまとまった単位演算処理を記述した部分の、実質的な処理が開始される行に付加されることが多い。この単位演算処理はサブルーチンまたは関数ととらえてもよい。
The start position
終了位置設定部14は、開始位置情報検出部12により検出された分割開始位置情報で特定される開始位置から始まる分割プログラムの暫定終了位置を定める。実施の形態1の基本例では、ソースプログラム内において分割開始位置情報で特定される開始位置に対し、所定の行数進んだ行を暫定終了位置の初期値とする。たとえば、一行進んだ行であってもよい。以下、この暫定終了位置を制御部24からの指示により変更する。なお、この暫定終了位置は上記開始位置を含む単位演算処理の最終行を超えることはない。
The end
仮分割プログラム登録部16は、仮分割プログラム保持部18に仮分割プログラムを登録する。仮分割プログラムを登録する際、開始位置を含む単位演算処理のうち、開始位置と暫定終了位置とで規定された部分以外の記述は削除する。その単位演算処理の前後の記述であって、その仮分割プログラムでは実行されない関数など、不要な記述は、コンパイラ200によりコンパイルされる際に削除されるため、ここで削除する必要はない。ただし、後述するシーケンサの指定など残しておくべき動作補助用コメントは、コンパイラ200に削除されないよう削除禁止の識別情報を付しておく必要がある。
The temporary division
仮分割プログラム登録部16は、暫定終了位置が変更されるたびに仮分割プログラムを登録する。暫定終了位置が変更される場合でも、制御部24から登録する必要がない旨の指示があった場合、登録しない。
The temporary division
仮分割プログラム保持部18は、仮分割プログラム登録部16により登録される仮分割プログラムを保持する。仮分割プログラム登録部16により登録される、すべての仮分割プログラムを保持してもよいし、直近に登録された仮分割プログラムのみを保持し、先に登録された仮分割プログラムは削除してもよい。
The temporary division
変換指示部20は、上記開始位置と、終了位置設定部14により定められる暫定終了位置とで規定される仮分割プログラムをコンパイルするよう所定のコンパイラ200に指示する。コンパイラ200に渡すべきデータは、仮分割プログラム登録部16が仮分割プログラム保持部18に渡すデータと同じでよい。
The
変換指示部20は、暫定終了位置が変更されるたび、仮分割プログラムの変換をコンパイラ200に指示する。暫定終了位置が変更される場合でも、制御部24から、コンパイラ200にコンパイルを指示する必要がない旨の指示があった場合、コンパイラ200に指示しない。
The
変換結果取得部22は、変換指示部20による指示に応じた、コンパイラ200の変換結果に対応するオブジェクトデータ量を取得データ量として取得する。変換結果取得部22は、当該取得データ量を上記基準データ量と同様の形式、たとえばプロセッサの実行ステップ数で取得してもよいし、取得したオブジェクトファイルから実行ステップ数を特定してもよい。
The conversion
制御部24は、オブジェクトデータ量保持部10により保持される基準データ量と、変換結果取得部22により取得される取得データ量とを比較し、その比較結果に応じて終了位置設定部14を制御する。制御部24は、基準データ量と取得データ量とが一致または近づくように暫定終了位置を変更するよう、終了位置設定部14を制御する。例外的に、仮分割プログラムが開始位置を含む単位演算処理のすべてを含み、かつその仮分割プログラムの変換結果であるところの取得データ量が基準データ量より小さい場合、両データ量の差を近づけようとせずに、その仮分割プログラムを正式な分割プログラムとする。
The
以下、より具体的に説明する。制御部24は、取得データ量が基準データ量未満であり、かつ暫定終了位置が、開始位置を含む単位演算処理の最後に到達していないとき、暫定終了位置をn(nは自然数)行、進めるよう終了位置設定部14に指示する。制御部24は、取得データ量が基準データ量を超えたとき、仮分割プログラム保持部18に超える前の最後に登録された仮分割プログラムを正式な分割プログラムとする。制御部24は、取得データ量と基準データ量とが一致したとき、そのときの仮分割プログラムを正式な分割プログラムとする。暫定終了位置が単位演算処理の最後に到達したときも、そのときの仮分割プログラムを正式な分割プログラムとする。
More specific description will be given below. When the acquired data amount is less than the reference data amount and the provisional end position has not reached the end of the unit calculation process including the start position, the
制御部24は、暫定終了位置が、開始位置のネストより下位のネストに到達したとき、変換指示部20に、仮分割プログラムのコンパイルをコンパイラ200に指示しないよう指示し、当該開始位置と同位のネストに到達するまで、当該暫定終了位置を進めるよう終了位置設定部14に指示する。開始位置を含む単位演算処理より下位の単位演算処理内では分割しないため、不要な仮分割プログラムの登録やコンパイルを回避することができる。
When the provisional end position reaches a lower nest than the nest of the start position, the
制御部24は、変換結果取得部22がコンパイラ200からエラーを取得したとき、そのときの仮分割プログラムを仮分割プログラム保持部18に登録しないよう、仮分割プログラム登録部16に指示する。文法的に分割してはいけない位置で分割されている場合、エラーが発生する。たとえば、If..文、elseif..文、else文、などは文法的に文の途中で切ることができない。
When the conversion
コンパイラ200は、変換指示部20から指示された、仮分割プログラムをコンパイルし、その変換結果を変換結果取得部22に渡す。なお、オブジェクトデータ量保持部10に保持されている基準データ量と同様の形式、たとえばプロセッサの実行ステップ数を出力してもよいし、単純にオブジェクトファイルを変換結果取得部22に渡してもい。また、変換中にエラーが発生した場合、その旨を変換結果取得部22に通知する。
The
図2は、実施の形態1に係るプログラム分割装置100の動作例を示すフローチャートである。前提として、単位時間あたりのプロセッサの最大実行ステップ数が基準データ量としてオブジェクトデータ量保持部10に保持されているものとする。また、分割すべきソースプログラムには、その分割開始位置を指定するコメントが埋め込まれているものとする。
FIG. 2 is a flowchart showing an operation example of the
まず、プログラム分割装置100にソースプログラムファイルが読み込まれ(S10)、開始位置情報検出部12は、そのソースプログラムに分割開始位置がコメントとして埋め込まれているか否か調査する(S12)。そのコメントが埋め込まれていなければ(S12のN)、処理不能として終了する。埋め込まれていれば(S12のY)、つぎの処理へ移行する。
First, a source program file is read into the program dividing apparatus 100 (S10), and the start position
開始位置情報検出部12は、当該コメントのある行を分割開始位置に設定し、終了位置設定部14は、その行の次の行を分割すべき暫定終了位置の初期値に設定する(S14)。仮分割プログラム登録部16は、当該コメントのある関数内(以下適宜、エントリ関数という)で、開始位置から暫定終了位置までに関係のないソースプログラムの記述を削除する(S16)。その際、ヘッダファイルから値を呼び出す必要がある変数など、初期値が設定されていない変数に初期値を代入する。
The start position
仮分割プログラム登録部16は、上記記述の削除後のソースプログラムを仮分割プログラムファイルとして、仮分割プログラム保持部18に一時保存する(S18)。この際、この仮分割プログラムの関数名を分割前ソースプログラム内の関数名から、コンパイラ200で使用するパラメータファイルに記述する関数名に変更するとよい。
The temporary division
変換指示部20は当該仮分割プログラムをコンパイラ200にコンパイルさせる(S20)。制御部24は、変換結果取得部22がコンパイラ200からエラー通知を受けたか否か判定する(S22)。受けていない場合(S22のN)、ステップS24に遷移し、受けた場合(S22のY)、ステップS30に遷移する。エラーの発生は、分割できない位置で分割された仮分割プログラムであることを示しており、ステップS24、ステップS26およびステップS28の処理は実行する必要がなく、それらの処理をスキップする。なお、エラーが発生した仮分割プログラムについては、そのファイルを仮分割プログラム保持部18から削除する。
The
ステップS24において、変換結果取得部22は、コンパイラ200から変換結果として実行ステップ数を取得する(S24)。制御部24は、この実行ステップ数が上記基準データ量より小さいか否かを判定する(S26)。実行ステップ数が当該基準データ量より小さい場合(S26のN)、ステップS28に遷移し、実行ステップ数が当該基準データ量以上の場合(S26のY)、ステップS36に遷移する。
In step S24, the conversion
ステップS28において、制御部24は、暫定終了位置が、エントリ関数の最終行を超えたか否か判定する(S28)。エントリ関数の最終行を超えていれば(S28のY)、ステップS38に遷移し、エントリ関数の最終行を超えていなければ(S28のN)、ステップS30に遷移する。
In step S28, the
終了位置設定部14は、制御部24の指示に応じて暫定終了位置を一行分、インクリメントする(S30)。制御部24は、インクリメントされた暫定終了位置が、エントリ関数より下位のネストに入ったか否かを判定する(S32)。たとえば、暫定終了位置がfor文、while文、do while文、などのループ内に入った場合などが該当する。下位のネストに入った場合(S32のY)、ステップS30に遷移し、下位ネストから抜けるまで(S32のN)、暫定終了位置のインクリメントを繰り返す。下位ネストから抜けた場合、または下位ネストに入っていない場合(S32のN)、ステップS34に遷移する。
The end
制御部24は、暫定終了位置が、エントリ関数より上位のネストに入ったか否かを判定する(S34)。上位のネストに入った場合(S34のY)、ステップS38に遷移する。目的とする分割位置に達したため、新たな分割は行わない。上位のネストに入っていない場合(S34のN)、ステップS16に遷移し、新たな分割位置での分割を継続する。
The
ステップS26において、取得された実行ステップ数が当該基準データ量以上の場合(S26のY)、制御部24は、この実行ステップ数が上記基準データ量と一致するか否かを判定する(S36)。一致する場合(S36のY)、仮分割プログラム保持部18に最後に保存された仮分割プログラムを正式な分割プログラムに決定する(S37)。一致しない場合(S36のN)、仮分割プログラム保持部18に前回保存された仮分割プログラムを正式な分割プログラムに決定する(S38)。
In step S26, when the number of execution steps acquired is equal to or larger than the reference data amount (Y in S26), the
制御部24は、ステップS37またはステップS38で決定された分割プログラム内からエントリ関数の前後にある、当該分割プログラムで使用しない関数など、不要な記述を削除し最終的な分割プログラムを分割ソースプログラムファイルとして生成する(S39)。以上で全体処理が終了する。
The
図3は、実施の形態に係る分割プログラムを実行させるべき、リコンフィギュラブル回路50を搭載したプロセッサ500の構成を示す図である。このプロセッサ500は、設定データ保持部30、シーケンサ装置40、リコンフィギュラブル回路50および出力データ保持部60を備える。
FIG. 3 is a diagram illustrating a configuration of a
設定データ保持部30は、リコンフィギュラブル回路50に所期の回路を構成するための設定データを保持し、その設定データをリコンフィギュラブル回路50に供給する。シーケンサ装置40は、設定データ保持部30からリコンフィギュラブル回路50に供給する設定データを選択する。
The setting
リコンフィギュラブル回路50は、機能の変更が可能なALUを複数有する。具体的には、縦方向にx個、横方向にy個のALUが配置されたx×yのALUアレイを備える。ここでは、縦方向に四個、横方向に六個配置されている。ALUアレイに加えて、前段のALU列の出力と後段のALU列の入力との接続関係を設定可能な接続部を備える。各ALUの機能および各ALU間の接続関係は、上記設定データにより設定される。通常、一クロックで一段のALU(y個)が同時に動作する。この一段のALUで実行されるプログラムの分量がスレッドの基本実行単位となる。
The
出力データ保持部60は、リコンフィギュラブル回路50から出力されるデータを保持する。このデータは、外部に出力されることも、リコンフィギュラブル回路50の入力にフィードバックされることも可能である。
The output
上述したように、基準とすべきオブジェクトデータ量としてプロセッサの実行ステップ数を採用することができる。図3に示すような、リコンフィギュラブル構成を備えたプロセッサでは、実行ステップ数をつぎのように規定することができる。まず、横方向にy個配置されたALUアレイ一段の一サイクルで実行可能な処理を、単位実行ステップ数と規定することができる。さらに、縦方向にx個、横方向にy個配置されたALUアレイ全体の一サイクルで実行可能な処理を、単位実行ステップ数と規定することもできる。基準データ量として実行ステップ数がmと設定された場合、ALUアレイの一段または全体をm回使用して実行可能なプログラムの最大量が、分割すべきスレッドの最大量となる。ALUアレイの全体を基準とすると、ALU列の空き時間を抑制し、より無駄のないコマンドの割り当てが可能となる。 As described above, the number of execution steps of the processor can be adopted as the amount of object data to be used as a reference. In a processor having a reconfigurable configuration as shown in FIG. 3, the number of execution steps can be defined as follows. First, a process that can be executed in one cycle of one ALU array arranged in the horizontal direction can be defined as the number of unit execution steps. Furthermore, a process that can be executed in one cycle of the entire ALU array arranged x in the vertical direction and y in the horizontal direction can be defined as the number of unit execution steps. When the number of execution steps is set as m as the reference data amount, the maximum amount of programs that can be executed by using one stage or the entire ALU array m times is the maximum amount of threads to be divided. If the entire ALU array is used as a reference, the free time of the ALU column can be suppressed, and commands can be assigned more efficiently.
図3に示すように、プロセッサ500は出力データ保持部60に出力されたデータがリコンフィギュラブル回路50の初段にフィードバックする構成を持っているため、リコンフィギュラブル回路50を複数サイクル使用する場合でも、その合計の段数をそのまま基準データ量とすることができる。
As shown in FIG. 3, the
以下、実施の形態1に係るプログラム分割装置100を用いたソースプログラムの分割処理と、その処理により分割された分割プログラムを図3に示したプロセッサ500で実行させる処理を実際の具体例を用いて説明する。
Hereinafter, a source program dividing process using the
図4は、実施の形態1に係るプログラム分割装置100で分割すべき、分割開始位置がコメントとして埋め込まれているソースプログラムの第1例を示す。図5は、図4のソースプログラムの仮分割プログラムを示す。図6は、図4のソースプログラムの最終的な分割プログラムを示す。図7は、図4のソースプログラムに対応するデータフローグラフを示す。図8は、図6のソースプログラムに対応するデータフローグラフを示す。
FIG. 4 shows a first example of a source program in which the division start position to be divided by the
ここでのデータフローグラフとは、リコンフィギュラブル回路50の各ALUで実行すべき各演算間の実行順序の依存関係を表現し、入力変数および定数の演算の流れをグラフ形式で示したものである。図7、8のデータフローグラフは、4×6のALUアレイを持つリコンフィギュラブル回路50に実行させるべきデータフローグラフを示す。各データフローグラフ内の、「○」が演算命令(以下適宜、ノードという)、「□」が入力変数または出力変数を示す。ALUアレイの配置構成とデータフローグラフの構成が対応していれば、上記単位実行ステップ数は、データフローグラフの一段(ALUアレイの一段に対応)または一ユニット(ALUアレイ全体に対応する)ととらえることができる。
The data flow graph here represents the dependency of the execution order between the operations to be executed by each ALU of the
以下、この例では4×6のALUアレイで実行可能な処理を単位実行ステップ数とし、上述した基準データ量として実行ステップ数=2が設定されているものとする。
図4のソースプログラムは、配列xの要素0から要素7までに格納された値を順次加算し、その加算後の値に変数z1と変数z2の値を加算する演算処理を実行する。具体的には、変数y=0+1+2+3+4+5+6+7+8+100+200を演算する。
Hereinafter, in this example, it is assumed that the processing that can be executed by the 4 × 6 ALU array is the unit execution step number, and the execution step number = 2 is set as the reference data amount described above.
The source program shown in FIG. 4 executes arithmetic processing for sequentially adding the values stored in
このソースプログラム内には、「_VMSIZE_CHK_START_」というコメントが埋め込まれている。開始位置情報検出部12はこのコメントを検出すると、この行を分割すべき開始位置に設定する。
In this source program, a comment “_VMSIZE_CHK_START_” is embedded. When the start position
図5は、for文の最後で分割された仮分割プログラムを示す。すなわち、変数yに対する変数z1と変数z2の加算は含まれていない。図5では、仮分割プログラム内の関数名を「divide_tmp」にしている。 FIG. 5 shows the temporary division program divided at the end of the for sentence. That is, the addition of the variable z1 and the variable z2 to the variable y is not included. In FIG. 5, the function name in the temporary division program is “divide_tmp”.
図6は、正式に決定された分割プログラムを示す。分割位置が図5の仮分割プログラムと同じであるため、その分割位置が上記基準データ量を満たす、最大の分割位置であったことが分かる。図6では、正式な分割プログラム内の関数名を「Divide_Result」にしている。 FIG. 6 shows an officially determined division program. Since the division position is the same as the provisional division program of FIG. 5, it can be seen that the division position is the maximum division position that satisfies the reference data amount. In FIG. 6, the function name in the formal division program is “Divide_Result”.
図7は、コンパイラ200により図4のソースプログラムが変換されたデータフローグラフである。ノード内の「MOV」はスルー、「+」は加算処理である。ここでは実行ステップ数=3、すなわち最終結果を出力する時点が上記ALUアレイの三サイクル目になるため、基準データ量である実行ステップ数=2の条件を満たしていない。 FIG. 7 is a data flow graph in which the source program of FIG. “MOV” in the node is through, and “+” is addition processing. Here, since the number of execution steps = 3, that is, the time when the final result is output is the third cycle of the ALU array, the condition of the number of execution steps = 2, which is the reference data amount, is not satisfied.
図8は、コンパイラ200により図6のソースプログラムが変換されたデータフローグラフである。ここでは実行ステップ数=2、すなわち最終結果を出力する時点が上記ALUアレイの二サイクル目の最終段になるため、基準データ量である実行ステップ数=2の条件を満たしている。 FIG. 8 is a data flow graph in which the source program of FIG. Here, the number of execution steps = 2, that is, the time when the final result is output is the final stage of the second cycle of the ALU array, so the condition of the number of execution steps = 2, which is the reference data amount, is satisfied.
図9は、実施の形態1に係るプログラム分割装置100で分割すべき、分割開始位置がコメントとして埋め込まれているソースプログラムの第2例を示す。図10は、図9のソースプログラムの仮分割プログラムを示す。図11は、図9のソースプログラムの最終的な分割プログラムを示す。図12は、図9のソースプログラムに対応するデータフローグラフを示す。図13は、図11のソースプログラムに対応するデータフローグラフを示す。
FIG. 9 shows a second example of a source program in which the division start position to be divided by the
以下、この例では4×6のALUアレイで実行可能な処理を単位実行ステップ数とし、上述した基準データ量として実行ステップ数=3が設定されているものとする。
図9のソースプログラムの基本構造は、ヘッダファイルから読み込まれた変数EXT_in1が0より小さいとき、「変数G_aaa」=「変数G_aaa1」+2+3+「変数EXT_in1」+1を演算し、0以上のとき、「変数G_aaa」=「変数G_aaa」+1+1を演算するものである。
Hereinafter, in this example, it is assumed that processing that can be executed by a 4 × 6 ALU array is the number of unit execution steps, and the number of execution steps = 3 is set as the reference data amount described above.
The basic structure of the source program of FIG. 9 is that when the variable EXT_in1 read from the header file is smaller than 0, “variable G_aaa” = “variable G_aaa1” + 2 + 3 + “variable EXT_in1” +1 is calculated. G_aaa ”=“ variable G_aaa ”+ 1 + 1 is calculated.
このソースプログラム内には、「_VMSIZE_CHK_START 」というコメントが埋め込まれている。開始位置情報検出部12はこのコメントを検出すると、この行を分割すべき開始位置に設定する。
A comment “_VMSIZE_CHK_START” is embedded in the source program. When the start position
図10は、2回目に登場するif文の最後で分割された仮分割プログラムを示す。すなわち、3、4回目if文は含まれていない。図11は、正式に決定された分割プログラムを示す。分割位置が図10の仮分割プログラムと同じであるため、その分割位置が上記基準データ量を満たす、最大の分割位置であったことが分かる。図10と図11とを比較すると、図11では、void func3() {G_aaa+=3;}が削除されていることが分かる。この処理は3回目のif文の判断結果により実行される関数であり、分割プログラムに3回目のif文が含まれない以上、不要な記述であり削除される。 FIG. 10 shows a temporary division program that is divided at the end of the “if” sentence that appears for the second time. That is, the third and fourth if statements are not included. FIG. 11 shows an officially determined division program. Since the division position is the same as the temporary division program of FIG. 10, it can be seen that the division position is the maximum division position that satisfies the reference data amount. Comparing FIG. 10 with FIG. 11, it can be seen that void func3 () {G_aaa + = 3;} is deleted in FIG. This process is a function executed based on the determination result of the third if statement, and is an unnecessary description and deleted as long as the third if statement is not included in the divided program.
図12は、コンパイラ200により図9のソースプログラムが変換されたデータフローグラフである。ノード間の実線は実際のデータの流れを示し、点線は制御信号、たとえば条件判定結果の流れを示す。ノード内の「>=」、「!=」は条件判定処理、「merge」は制御信号に応じて入力データを切り替える処理である。たとえば、そのデータフローグラフの二段目の二列に位置するノード内の、「merge」は一段目一列に位置するノードからの制御信号を受けて「1」を取り込むか、変数「G_stage」を取り込むかを決定する。
FIG. 12 is a data flow graph in which the source program of FIG. 9 is converted by the
図12のデータフローグラフでは、実行ステップ数=4、すなわち最終結果を出力する時点が上記ALUアレイの四サイクル目になるため、基準データ量である実行ステップ数=3の条件を満たしていない。 In the data flow graph of FIG. 12, the number of execution steps = 4, that is, the time point when the final result is output is the fourth cycle of the ALU array, so the condition of the number of execution steps = 3, which is the reference data amount, is not satisfied.
図13は、コンパイラ200により図11のソースプログラムが変換されたデータフローグラフである。ここでは実行ステップ数=3、すなわち最終結果を出力する時点が上記ALUアレイの三サイクル目の最終段になるため、基準データ量である実行ステップ数=3の条件を満たしている。
FIG. 13 is a data flow graph in which the source program of FIG. 11 is converted by the
つぎに実施の形態1に係るプログラム分割装置100の変形例について説明する。本変形例は、基本例のように暫定終了位置を順次移動させるのではなく、二分法を用いて暫定終了位置を移動させる。
Next, a modification of the
以下、図1に示した構成要素の、基本例と異なる動作について説明する。
終了位置設定部14は、分割すべきソースプログラム内において、開始位置情報検出部12により検出された分割開始位置情報で特定される開始位置の行と、その開始位置を含む単位演算処理の最終行と、の半分の位置にある行を暫定終了位置の初期値とする。単位演算処理全体の行数が割り切れない場合、小数を切り捨てするか切り上げるかして整数にする。以下、本変形例の他の除算についても同様とする。
Hereinafter, operations different from the basic example of the components shown in FIG. 1 will be described.
The end
制御部24は、取得データ量が基準データ量を超えるとき、初期では、上記開始位置の行から上記最終行までの1/4の行数、二回目以降では、上記暫定終了位置を前回移動した行数の半分の行数、戻すよう終了位置設定部14に指示する。逆に、取得データ量が基準データ量未満のとき、初期では、上記開始位置の行から上記最終行までの1/4の行数、二回目以降では、上記暫定終了位置を前回移動した行数の半分の行数、進めるよう終了位置設定部14に指示する。取得データ量と基準データ量が一致したとき、仮分割プログラム保持部18に最後に登録された仮分割プログラムを正式な分割プログラムとする。上記暫定終了位置が前回移動した行数が一のとき、取得データ量が基準データ量以下である仮分割プログラムのうち、仮分割プログラム保持部18に最後に登録された仮分割プログラムを正式な分割プログラムとする。
When the acquired data amount exceeds the reference data amount, the
制御部24は、取得データ量が基準データ量を超えるときの仮分割プログラムを、仮分割プログラム登録部16に登録しないよう指示してもよいし、または仮分割プログラム保持部18に登録された後に、その仮分割プログラムを仮分割プログラム保持部18内から削除してもよい。
The
図14は、実施の形態1の変形例に係るプログラム分割装置100の動作例を示すフローチャートである。前提として、単位時間あたりのプロセッサの最大実行ステップ数が基準データ量としてオブジェクトデータ量保持部10に保持されているものとする。また、分割すべきソースプログラムには、その分割開始位置を指定するコメントが埋め込まれているものとする。
FIG. 14 is a flowchart showing an operation example of the
まず、プログラム分割装置100にソースプログラムファイルが読み込まれ(S40)、開始位置情報検出部12は、そのソースプログラムに分割開始位置がコメントとして埋め込まれているか否か調査する(S42)。そのコメントが埋め込まれていなければ(S42のN)、処理不能として終了する。埋め込まれていれば(S42のY)、つぎの処理へ移行する。
First, a source program file is read into the program dividing apparatus 100 (S40), and the start position
開始位置情報検出部12は、当該コメントのある行を分割開始位置に設定し、終了位置設定部14は、その行と、その行を含む関数の最終行との半分に位置する行を分割すべき暫定終了位置の初期値に設定する(S44)。仮分割プログラム登録部16は、エントリ関数内で、開始位置から暫定終了位置までに関係のないソースプログラムの記述を削除する(S46)。仮分割プログラム登録部16は、上記記述の削除後のソースプログラムを仮分割プログラムファイルとして、仮分割プログラム保持部18に一時保存する(S48)。
The start position
変換指示部20は当該仮分割プログラムをコンパイラ200にコンパイルさせる(S50)。変換結果取得部22は、コンパイラ200から変換結果として実行ステップ数を取得する(S52)。制御部24は、この実行ステップ数と上記基準データ量とが一致するか否か判定する(S54)。一致する場合(S54のY)、ステップS64に遷移し、一致しない場合(S54のN)、ステップS56に遷移する。
The
ステップS56において、制御部24は、暫定終了位置を二分法によりさらに移動可能か否かを判定する(S56)。前回の移動行数が1行の場合、移動不能となる。移動可能な場合(S56のY)、ステップS58に遷移し、移動不能な場合(S56のN)、ステップS64に遷移する。
In step S56, the
ステップS58において、制御部24は、取得された実行ステップ数が上記基準データ量より大きいか小さいか判定する(S58)。大きい場合(S58のY)、暫定終了位置を二分法により後退させるよう終了位置設定部14に指示する。具体的には、前回移動した行数の半分の行数後退させるよう指示する(S60)。小さい場合(S58のN)、暫定終了位置を二分法により前進させるよう終了位置設定部14に指示する(S62)。具体的には、前回移動した行数の半分の行数前進させるよう指示する。ステップS60またはステップS62の後、ステップS46に遷移し、新たな分割位置での分割を継続する。
In step S58, the
ステップS64において、制御部24は、取得された実行ステップ数が上記基準データ量以上の仮分割プログラムのうち、最後に登録された仮分割プログラムを正式な分割プログラムに決定する(S64)。
In step S64, the
なお、フローチャートには記述しないがこの正式な分割プログラムがコンパイラ200からエラーが通知されたものである場合、この分割プログラムの終了位置を、コンパイルした際にエラーが発生しない位置まで後退させるよう終了位置設定部14に指示し、その位置の仮分割プログラムを正式な分割プログラムに決定する。
Although not described in the flowchart, if this formal divided program is one for which an error has been notified from the
また、上記正式な分割プログラムの終了位置が開始位置のネストより下位のネストに入っている場合、この仮分割プログラムの終了位置を、開始位置のネストと同位になる位置まで後退させるよう終了位置設定部14に指示する。その位置の仮分割プログラムを正式な分割プログラムに決定する。
In addition, if the end position of the formal division program is in a nest lower than the nest of the start position, the end position is set so that the end position of the temporary division program is moved backward to a position that is the same as the nest of the start position. The
制御部24は、当該正式な分割プログラムからエントリ関数の前後にある、当該分割プログラムで使用しない関数など、不要な記述を削除し最終的な分割プログラムを分割ソースプログラムファイルとして生成する(S66)。以上で全体処理が終了する。
The
以上説明したように実施の形態1によれば、基準とすべきオブジェクト量を登録し、かつ分割開始位置を指定するだけで、終了位置はシステムが最適な位置に決定することから、簡単にソースプログラムを好適な位置で分割することができる。リアルタイム性が保証される最大処理量の実行が可能な位置で分割することができる。これにより、複数のスレッドを時分割に処理する場合、各スレッドのリアルタイム性が保証されつつ、全体の処理時間を短縮することができる。よって、マルチスレッドに対応したアプリケーションの開発効率を向上させることができる。とくに、リコンフィギュラブル回路を搭載したプロセッサで実行させることに適した、短いサイクル時間で実行ステップ数を一定の値以下に抑えることを要請されるアプリケーションを開発する場合に有効である。 As described above, according to the first embodiment, the system determines the end position as an optimal position simply by registering the object amount to be used as a reference and specifying the division start position. The program can be divided at a suitable position. It is possible to divide at a position where the maximum processing amount that guarantees real-time performance can be executed. As a result, when a plurality of threads are processed in a time-sharing manner, the entire processing time can be shortened while ensuring the real-time property of each thread. Therefore, it is possible to improve the development efficiency of an application that supports multithreading. In particular, it is effective when developing an application that is required to be executed in a processor equipped with a reconfigurable circuit and that is required to keep the number of execution steps below a certain value in a short cycle time.
また、実際に仮分割プログラムをコンパイルして実行ステップ数を求めることにより、コンパイラによる最適化を反映させた正確な実行ステップ数を求めることができる。ライブラリ情報をもとに予測するだけでは、最適化を反映した正確な実行ステップ数を求めることが困難である。 In addition, by actually compiling the temporary divided program and obtaining the number of execution steps, the accurate number of execution steps reflecting the optimization by the compiler can be obtained. It is difficult to obtain an accurate number of execution steps that reflect optimization simply by making predictions based on library information.
また、最適な終了位置を探索するために二分法を採用すると、最適な終了位置を探索するまでの時間を平準化することができる。なお、制御部24は開始位置を含む単位演算処理の長さに応じて、順次探索を採用するか二分法探索を採用するか決定してもよい。すなわち、所定の行数より短いとき前者を採用し、長いとき後者を採用する。これにより、最適な終了位置までの探索時間をより最適化することができる。
In addition, when the bisection method is employed to search for the optimal end position, the time until the optimal end position is searched can be leveled. The
図15は、実施の形態2に係る情報処理システム300の構成を示すブロック図である。情報処理システム300は、プログラム分割装置100およびコンパイラ200を備える。プログラム分割装置100は、開始位置情報検出部12、終了位置情報検出部15、変換指示部20および変換結果取得部22を備える。
FIG. 15 is a block diagram illustrating a configuration of the
開始位置情報検出部12は、ソースプログラム内から分割開始位置情報を検出する。終了位置情報検出部15は、ソースプログラム内から分割終了位置情報を検出する。このソースプログラム内には、分割開始位置情報と同様に、分割を終了すべき位置に分割開始位置情報が付加されている。
The start position
変換指示部20は、開始位置情報検出部12により検出された分割開始位置情報で特定される開始位置と、終了位置情報検出部により検出された分割終了位置情報で特定される終了位置とで規定される分割プログラムをコンパイルするよう所定のコンパイラ200に指示する。変換結果取得部22は、変換指示部20による指示に応じた、コンパイラ200の変換結果を取得する。ここでは、オブジェクトデータ量およびエラーの有無の、少なくとも一方を取得する。オブジェクトデータ量を実行ステップ数で規定する場合、コンパイラ200からオブジェクトデータ量をプロセッサの実行ステップ数として取得してもよいし、取得したオブジェクトファイルからプロセッサの実行ステップ数をプログラム分割装置100側で求めてもよい。
The
図16は、実施の形態2に係るプログラム分割装置100の動作例を示すフローチャートである。前提として、分割すべきソースプログラムには、その分割開始位置を指定するコメントおよびその分割終了位置を指定するコメントが埋め込まれているものとする。
FIG. 16 is a flowchart showing an operation example of the
まず、プログラム分割装置100にソースプログラムファイルが読み込まれ(S70)、開始位置情報検出部12および終了位置情報検出部15は、そのソースプログラムに分割開始位置および分割終了位置がコメントとしてそれぞれ埋め込まれているか否か調査する(S72)。そのコメントの少なくとも一方が埋め込まれていなければ(S72のN)、処理不能として終了する。両方埋め込まれていれば(S72のY)、つぎの処理へ移行する。
First, a source program file is read into the program dividing apparatus 100 (S70), and the start position
開始位置情報検出部12および終了位置情報検出部15は、それらコメントのあるエントリ関数内で、開始位置から終了位置までに関係のないソースプログラムの記述を削除する(S74)。変換指示部20は、開始位置から終了位置までの分割プログラムをコンパイラ200にコンパイルさせる(S76)。変換結果取得部22は、コンパイラ200からエラー通知を受けたか否か判定する(S78)。受けた場合(S78のY)、実行ステップ数を取得する必要がないため、処理を終了する。受けていない場合(S78のN)、コンパイラ200から実行ステップ数を取得する(S80)。変換結果取得部22は、当該分割プログラムからエントリ関数の前後にある、当該分割プログラムで使用しない関数など、不要な記述を削除し最終的な分割プログラムを分割ソースプログラムファイルとして生成する(S82)。以上で全体処理が終了する。
The start position
図17は、実施の形態2に係るプログラム分割装置100で分割すべき、分割開始位置がコメントとして埋め込まれているソースプログラムを示す。図18は、図17のソースプログラムの最終的な分割プログラムを示す。図19は、図18のソースプログラムに対応するデータフローグラフを示す。
FIG. 17 shows a source program in which the division start position to be divided by the
図17のソースプログラムは、上述した図4のソースプログラムと同様の演算を実行するためのプログラムである。このソースプログラム内には、「_VMSIZE_CHK_START_」および「_VMSIZE_CHK_END_」というコメントが埋め込まれている。開始位置情報検出部12は「_VMSIZE_CHK_START_」を検出すると、この行を分割開始位置に設定する。終了位置情報検出部15は「_VMSIZE_CHK_END_」を検出すると、この行を分割終了位置に設定する。図18では、エントリ関数内にて、範囲指定された演算処理、すなわち「y+=z1」および「y+=z2」以外の記述は不要な記述として削除されている。図19は、コンパイラ200により図18のソースプログラムが変換されたデータフローグラフである。ALUアレイ全体を単位実行ステップ数と規定した場合、実行ステップ数=1となり、ALUアレイの一段を単位実行ステップ数と規定した場合、実行ステップ数=3となる。
The source program of FIG. 17 is a program for executing the same calculation as the source program of FIG. 4 described above. In this source program, comments “_VMSIZE_CHK_START_” and “_VMSIZE_CHK_END_” are embedded. When the start position
以上説明したように実施の形態2によれば、分割開始位置と分割終了位置を指定するだけで、分割しようとしている分割プログラムの、コンパイル後の正確な実行ステップ数を簡単に確認することができる。また、その位置で分割した場合にエラーが発生するか否かも簡単に確認することができる。 As described above, according to the second embodiment, it is possible to easily confirm the exact number of execution steps after compilation of the divided program to be divided simply by specifying the division start position and the division end position. . It is also possible to easily confirm whether or not an error occurs when dividing at that position.
以上、本発明をいくつかの実施形態をもとに説明した。これらの実施の形態は例示であり、それらの各構成要素や各処理プロセスの組合せにいろいろな変形例が可能なこと、またそうした変形例も本発明の範囲にあることは当業者に理解されるところである。 The present invention has been described based on some embodiments. It is understood by those skilled in the art that these embodiments are exemplifications, and that various modifications can be made to combinations of the respective constituent elements and processing processes, and such modifications are also within the scope of the present invention. By the way.
たとえば、上述した実施の形態1では上記基準データ量として実行ステップ数を使用したが(ステップS26などの判定処理)、これに代えてメモリ使用量やメモリアクセス数など、ボトルネックになりうるものを基準データ量として使用してもよい。また、複数の要素に対応する複数の基準データ量を組み合わせて、少なくとも一つの要素がそれに対応する基準データ量を超えるか否かで判断してもよい。 For example, in the above-described first embodiment, the number of execution steps is used as the reference data amount (determination process such as step S26), but instead of this, what may become a bottleneck, such as the amount of memory used or the number of memory accesses, is used. It may be used as a reference data amount. Further, a plurality of reference data amounts corresponding to a plurality of elements may be combined, and determination may be made based on whether or not at least one element exceeds the reference data amount corresponding thereto.
また、図2、図14のフローチャートでは、分割開始位置がコメントとして埋め込まれていなければエラーとして終了した。この点、終了せずに分割開始位置を分割すべきソースプログラムの先頭に設定してもよい。この場合、コメントなどが付されていないことを、分割開始位置を先頭に指定する分割開始位置情報ととらえればよい。 In the flowcharts of FIGS. 2 and 14, if the division start position is not embedded as a comment, the process ends as an error. In this regard, the division start position may be set at the head of the source program to be divided without ending. In this case, the fact that no comment or the like is attached may be regarded as division start position information that designates the division start position at the head.
また、図2のフローチャートでは、暫定終了位置が開始位置より下位のネストに到達した場合、同位のネストに到達するまでコンパイルをスキップしたが、そのネストの関数をインライン展開し、逐次、コンパイルしてもよい。 In the flowchart of FIG. 2, when the temporary end position reaches a nest lower than the start position, compilation is skipped until the nest of the peer is reached. Also good.
10 オブジェクトデータ量保持部、 12 開始位置情報検出部、 14 終了位置設定部、 15 終了位置情報検出部、 16 仮分割プログラム登録部、 18 仮分割プログラム保持部、 20 変換指示部、 22 変換結果取得部、 24 制御部、 30 設定データ保持部、 40 シーケンサ装置、 50 リコンフィギュラブル回路、 60 出力データ保持部、 100 プログラム分割装置、 200 コンパイラ、 300 情報処理システム、 500 プロセッサ。
DESCRIPTION OF
Claims (10)
基準とすべきオブジェクトデータ量を基準データ量として保持するオブジェクトデータ量保持部と、
前記ソースプログラム内から分割開始位置情報を検出する開始位置情報検出部と、
前記開始位置情報検出部により検出された分割開始位置情報で特定される開始位置から始まる分割プログラムの暫定終了位置を定める終了位置設定部と、
前記開始位置と、前記終了位置設定部により定められる暫定終了位置とで規定される仮分割プログラムをコンパイルするよう所定のコンパイラに指示する変換指示部と、
前記変換指示部による指示に応じた、前記コンパイラの変換結果に対応するオブジェクトデータ量を取得データ量として取得する変換結果取得部と、
前記オブジェクトデータ量保持部により保持される基準データ量と、前記変換結果取得部により取得される取得データ量とを比較し、その比較結果に応じて前記終了位置設定部を制御する制御部と、を備え、
前記制御部は、前記基準データ量と前記取得データ量とが一致または近づくように前記暫定終了位置を変更するよう、前記終了位置設定部を制御することを特徴とするプログラム分割装置。 A program dividing device for dividing a source program,
An object data amount holding unit for holding, as a reference data amount, an object data amount to be a reference;
A start position information detecting unit for detecting division start position information from within the source program;
An end position setting unit for determining a provisional end position of a division program starting from a start position specified by the division start position information detected by the start position information detection unit;
A conversion instruction unit for instructing a predetermined compiler to compile the provisional division program defined by the start position and the provisional end position determined by the end position setting unit;
A conversion result acquisition unit that acquires, as an acquisition data amount, an object data amount corresponding to the conversion result of the compiler in response to an instruction from the conversion instruction unit;
A control unit that compares the reference data amount held by the object data amount holding unit with the acquisition data amount acquired by the conversion result acquisition unit, and controls the end position setting unit according to the comparison result; With
The said control part controls the said end position setting part so that the said provisional end position may be changed so that the said reference | standard data amount and the said acquisition data amount may correspond or approach, The program division | segmentation apparatus characterized by the above-mentioned.
前記制御部は、前記取得データ量が前記基準データ量未満であり、かつ前記暫定終了位置が、前記開始位置を含む意味的または機能的にまとまった単位演算処理の最後に到達していないとき、前記暫定終了位置をn(nは自然数)行、進めるよう前記終了位置設定部に指示し、
前記暫定終了位置が前記単位演算処理の最後に到達したとき、そのときの仮分割プログラムを正式な分割プログラムとすることを特徴とする請求項1に記載のプログラム分割装置。 The end position setting unit sets a line advanced by a predetermined number of lines with respect to the start position specified by the division start position information in the source program as an initial value of the provisional end position,
The control unit, when the acquired data amount is less than the reference data amount, and the provisional end position has not reached the end of the semantically or functionally unit operation processing including the start position, Instructing the end position setting unit to advance the provisional end position by n (n is a natural number) lines,
2. The program dividing apparatus according to claim 1, wherein when the provisional end position reaches the end of the unit calculation process, the temporary dividing program at that time is an official dividing program.
前記暫定終了位置が変更されるたび、前記仮分割プログラム保持部に前記仮分割プログラムを登録する仮分割プログラム登録部をさらに備え、
前記変換指示部は、前記暫定終了位置が変更されるたび、前記仮分割プログラムをコンパイルするよう前記コンパイラに指示し、
前記制御部は、前記取得データ量が前記基準データ量を超えたとき、前記仮分割プログラム保持部に超える前の最後に登録された仮分割プログラムを正式な分割プログラムとすることを特徴とする請求項1または2に記載のプログラム分割装置。 A temporary division program holding unit for holding the temporary division program;
A temporary division program registration unit for registering the temporary division program in the temporary division program holding unit each time the provisional end position is changed;
The conversion instruction unit instructs the compiler to compile the temporary divided program every time the temporary end position is changed,
The control unit, when the acquired data amount exceeds the reference data amount, sets the temporary division program registered last before exceeding the temporary division program holding unit as a formal division program. Item 3. The program dividing device according to Item 1 or 2.
前記暫定終了位置が変更されるたび、前記仮分割プログラム保持部に前記仮分割プログラムを登録する仮分割プログラム登録部をさらに備え、
前記終了位置設定部は、前記ソースプログラム内において、前記分割開始位置情報で特定される開始位置の行と、その開始位置を含む意味的または機能的にまとまった単位演算処理の最終行と、の半分の位置にある行を前記暫定終了位置の初期値とし、
前記制御部は、前記取得データ量が前記基準データ量を超えるとき、初期では、前記開始位置の行から前記最終行までの1/4の行数、二回目以降では、前記暫定終了位置を前回移動した行数の半分の行数、戻すよう前記終了位置設定部に指示し、
前記取得データ量が前記基準データ量未満のとき、初期では、前記開始位置の行から前記最終行までの1/4の行数、二回目以降では、前記暫定終了位置を前回移動した行数の半分の行数、進めるよう前記終了位置設定部に指示し、
前記暫定終了位置が前回移動した行数が一のとき、前記取得データ量が前記基準データ量以下である仮分割プログラムのうち、前記仮分割プログラム保持部に最後に登録された仮分割プログラムを正式な分割プログラムとすることを特徴とする請求項1に記載のプログラム分割装置。 A temporary division program holding unit for holding the temporary division program;
A temporary division program registration unit for registering the temporary division program in the temporary division program holding unit each time the provisional end position is changed;
The end position setting unit includes, in the source program, a line of a start position specified by the division start position information and a final line of a unit operation process that is semantically or functionally grouped including the start position. The line at half the position is the initial value of the provisional end position,
When the acquired data amount exceeds the reference data amount, the control unit initially sets a quarter number of lines from the start position line to the last line, and after the second time, sets the provisional end position to the previous time. Instruct the end position setting unit to return the number of lines that is half the number of moved lines,
When the amount of acquired data is less than the reference data amount, initially, the number of lines is ¼ from the line at the start position to the last line, and after the second time, the provisional end position is the number of lines that have been moved last time. Instruct the end position setting unit to advance by half the number of lines,
When the temporary end position is the number of lines moved last time, among the temporary division programs whose acquired data amount is equal to or less than the reference data amount, the temporary division program last registered in the temporary division program holding unit is formally The program dividing apparatus according to claim 1, wherein the program dividing apparatus is a unique dividing program.
基準とすべきオブジェクトデータ量を基準データ量としてオブジェクトデータ量保持部に保持する第1ステップと、
前記ソースプログラム内から、分割開始位置情報を開始位置情報検出部により検出する第2ステップと、
前記開始位置情報検出部により検出された分割開始位置情報で特定される開始位置から始まる分割プログラムの暫定終了位置を終了位置設定部により定める第3ステップと、
前記開始位置と、前記終了位置設定部により定められる暫定終了位置とで規定される仮分割プログラムをコンパイルするよう所定のコンパイラに、変換指示部により指示する第4ステップと、
前記変換指示部による指示に応じた、前記コンパイラの変換結果に対応するオブジェクトデータ量を取得データ量として変換結果取得部により取得する第5ステップと、
前記オブジェクトデータ量保持部により保持される基準データ量と、前記変換結果取得部により取得される取得データ量とを比較し、その比較結果に応じて前記終了位置設定部を制御部により制御する第6ステップと、を備え、
前記第6ステップは、前記基準データ量と前記取得データ量とが一致または近づくように前記暫定終了位置を変更するよう、前記終了位置設定部を制御することを特徴とするプログラム分割方法。 A dividing method for dividing a source program,
A first step of holding the object data amount to be a reference as a reference data amount in the object data amount holding unit;
A second step of detecting division start position information from within the source program by a start position information detection unit;
A third step of determining a provisional end position of the division program starting from the start position specified by the division start position information detected by the start position information detection section by the end position setting section;
A fourth step of instructing a predetermined compiler to compile a provisional division program defined by the start position and the provisional end position determined by the end position setting unit by a conversion instruction unit;
A fifth step of acquiring, by the conversion result acquisition unit, an object data amount corresponding to the conversion result of the compiler in accordance with an instruction from the conversion instruction unit as an acquisition data amount;
The reference data amount held by the object data amount holding unit is compared with the acquired data amount acquired by the conversion result acquiring unit, and the end position setting unit is controlled by the control unit according to the comparison result. 6 steps,
In the sixth step, the end position setting unit is controlled so as to change the provisional end position so that the reference data amount and the acquired data amount match or approach each other.
前記ソースプログラム内から分割開始位置情報を検出する開始位置情報検出部と、
前記ソースプログラム内から分割終了位置情報を検出する終了位置情報検出部と、
前記開始位置情報検出部により検出された分割開始位置情報で特定される開始位置と、前記終了位置情報検出部により検出された分割終了位置情報で特定される終了位置とで規定される分割プログラムをコンパイルするよう所定のコンパイラに指示する変換指示部と、
前記変換指示部による指示に応じた、前記コンパイラの変換結果を取得する変換結果取得部と、
を備えることを特徴とするプログラム分割装置。 A program dividing device for dividing a source program,
A start position information detecting unit for detecting division start position information from within the source program;
An end position information detection unit for detecting division end position information from within the source program;
A division program defined by a start position specified by the division start position information detected by the start position information detection unit and an end position specified by the division end position information detected by the end position information detection unit A conversion instruction section for instructing a predetermined compiler to compile,
A conversion result acquisition unit that acquires a conversion result of the compiler in response to an instruction from the conversion instruction unit;
A program dividing apparatus comprising:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008037825A JP5197061B2 (en) | 2008-02-19 | 2008-02-19 | Program dividing apparatus and method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008037825A JP5197061B2 (en) | 2008-02-19 | 2008-02-19 | Program dividing apparatus and method |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2009199175A true JP2009199175A (en) | 2009-09-03 |
JP5197061B2 JP5197061B2 (en) | 2013-05-15 |
Family
ID=41142629
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2008037825A Active JP5197061B2 (en) | 2008-02-19 | 2008-02-19 | Program dividing apparatus and method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5197061B2 (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002123563A (en) * | 2000-10-13 | 2002-04-26 | Nec Corp | Compiling method, composing device, and recording medium |
WO2002099704A1 (en) * | 2001-05-30 | 2002-12-12 | Yozan Inc. | System development supporting apparatus, system development supporting method, and computer-readable recorded medium |
JP2006099720A (en) * | 2004-08-30 | 2006-04-13 | Sanyo Electric Co Ltd | Data flow graph processing method |
JP2007219586A (en) * | 2006-02-14 | 2007-08-30 | Matsushita Electric Ind Co Ltd | Source code analysis device |
JP2007241364A (en) * | 2006-03-06 | 2007-09-20 | Canon Software Inc | Program generation device, program generation method, program and recording medium |
JP2007241695A (en) * | 2006-03-09 | 2007-09-20 | Sanyo Electric Co Ltd | Generation method for data flow graph and processor |
JP2007286671A (en) * | 2006-04-12 | 2007-11-01 | Fujitsu Ltd | Software/hardware division program and division method |
-
2008
- 2008-02-19 JP JP2008037825A patent/JP5197061B2/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002123563A (en) * | 2000-10-13 | 2002-04-26 | Nec Corp | Compiling method, composing device, and recording medium |
WO2002099704A1 (en) * | 2001-05-30 | 2002-12-12 | Yozan Inc. | System development supporting apparatus, system development supporting method, and computer-readable recorded medium |
JP2006099720A (en) * | 2004-08-30 | 2006-04-13 | Sanyo Electric Co Ltd | Data flow graph processing method |
JP2007219586A (en) * | 2006-02-14 | 2007-08-30 | Matsushita Electric Ind Co Ltd | Source code analysis device |
JP2007241364A (en) * | 2006-03-06 | 2007-09-20 | Canon Software Inc | Program generation device, program generation method, program and recording medium |
JP2007241695A (en) * | 2006-03-09 | 2007-09-20 | Sanyo Electric Co Ltd | Generation method for data flow graph and processor |
JP2007286671A (en) * | 2006-04-12 | 2007-11-01 | Fujitsu Ltd | Software/hardware division program and division method |
Also Published As
Publication number | Publication date |
---|---|
JP5197061B2 (en) | 2013-05-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP2921190B2 (en) | Parallel execution method | |
US20090113404A1 (en) | Optimum code generation method and compiler device for multiprocessor | |
KR101279179B1 (en) | Parallel program generation method | |
US20040083468A1 (en) | Instruction scheduling method, instruction scheduling device, and instruction scheduling program | |
JP5148674B2 (en) | Program parallelization apparatus and program | |
US20060130012A1 (en) | Program conversion device, program conversion and execution device, program conversion method, and program conversion and execution method | |
US9195444B2 (en) | Compiler method and compiler apparatus for optimizing a code by transforming a code to another code including a parallel processing instruction | |
JP2004038225A (en) | Compiler program and compiling method | |
JP2009524866A (en) | System and method for parallel execution of programs | |
JP2015194881A (en) | Compilation device, compilation program, and compilation method | |
US20200310766A1 (en) | Generating vectorized control flow using reconverging control flow graphs | |
JP2006268070A (en) | Parallelizing compilation method and parallel computer for executing parallelized object code | |
JP5197061B2 (en) | Program dividing apparatus and method | |
KR20140131200A (en) | Apparatus and Method for translating multithreaded program code | |
JP5504879B2 (en) | Multithread processing method and multithread processing apparatus | |
KR102161055B1 (en) | Method and Apparatus for instruction scheduling using software pipelining | |
US10089088B2 (en) | Computer that performs compiling, compiler program, and link program | |
JP4535912B2 (en) | Data flow graph generator | |
JP5385103B2 (en) | Macro expansion method and preprocessor | |
JP6175306B2 (en) | Control program dividing apparatus, control program dividing method and recording medium therefor | |
JPH04293150A (en) | Compiling method | |
JP2008015665A (en) | Program analysis method and program analyzer | |
JP2007108838A (en) | Compile method and compile device | |
JP4084374B2 (en) | Loop parallelization method and compiling device | |
JPH1196018A (en) | Compiling device, its method and computer-readable recording medium recording compiling execution program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20110128 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20121106 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20121120 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20121210 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20130108 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20130205 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20160215 Year of fee payment: 3 |
|
R151 | Written notification of patent or utility model registration |
Ref document number: 5197061 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20160215 Year of fee payment: 3 |