JP7059776B2 - Parallelization method, parallelization tool, and multi-core microcontroller - Google Patents
Parallelization method, parallelization tool, and multi-core microcontroller Download PDFInfo
- Publication number
- JP7059776B2 JP7059776B2 JP2018083128A JP2018083128A JP7059776B2 JP 7059776 B2 JP7059776 B2 JP 7059776B2 JP 2018083128 A JP2018083128 A JP 2018083128A JP 2018083128 A JP2018083128 A JP 2018083128A JP 7059776 B2 JP7059776 B2 JP 7059776B2
- Authority
- JP
- Japan
- Prior art keywords
- data
- cores
- memory
- access
- memories
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/43—Checking; Contextual analysis
- G06F8/433—Dependency analysis; Data or control flow analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/45—Exploiting coarse grain parallelism in compilation, i.e. parallelism between groups of instructions
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/45—Exploiting coarse grain parallelism in compilation, i.e. parallelism between groups of instructions
- G06F8/456—Parallelism detection
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Devices For Executing Special Programs (AREA)
Description
本発明は、シングルコアマイコン用のシングルプログラムからマルチコアマイコン用の並列プログラムを生成する並列化方法と並列化ツール、及びシングルプログラムから生成された並列プログラムを実行するマルチコアマイコンに関する。 The present invention relates to a parallelization method and a parallelization tool for generating a parallel program for a multi-core microcomputer from a single program for a single-core microcomputer, and a multi-core microcomputer for executing a parallel program generated from the single program.
従来、シングルコアマイコン用のシングルプログラムから、マルチコアマイコン用の並列プログラムを生成する並列化方法の一例として、特許文献1に開示された並列化コンパイル方法が知られている。
Conventionally, the parallel compilation method disclosed in
この並列化コンパイル方法では、シングルプログラムのソースコードの字句解析や構文解析を行って中間言語に展開し、この中間言語を用いて、複数のマクロタスク(処理単位)の依存関係の解析や最適化等を行う。また、従来の並列化コンパイル方法では、各マクロタスクの依存関係やマクロタスク毎の実行時間を基にコアへの割り付けやスケジューリングを行って並列プログラムを生成する。 In this parallel compilation method, the source code of a single program is lexically analyzed and parsed and expanded into an intermediate language, and this intermediate language is used to analyze and optimize the dependencies of multiple macro tasks (processing units). And so on. Further, in the conventional parallel compilation method, a parallel program is generated by allocating and scheduling to the core based on the dependency of each macro task and the execution time of each macro task.
並列プログラムを実行するマルチコアマイコンが、複数のコアによってアクセス可能な、複数のRAMや複数のROMなどの複数のメモリを有し、かつ、複数のコアによる複数のメモリへのアクセス必要時間(アクセスレイテンシ)が異なる場合、データをどのメモリに格納するかに応じて、並列プログラムの実行時間に差が生じることが考えられる。例えば、第1コアと第2コアとが、割り付けられた処理単位をそれぞれ実行したとき、第1コアからアクセスする頻度が第2コアからアクセスする頻度よりも高いデータを、第1コアからのアクセス必要時間が第2コアからのアクセス必要時間よりも長いメモリに格納した場合、アクセス頻度の高い第1コアからのアクセス時間が長くかかることに起因して、並列プログラムの実行時間が長くなってしまう。 A multi-core microcomputer that executes a parallel program has multiple memories such as multiple RAMs and multiple ROMs that can be accessed by multiple cores, and the time required to access multiple memories by multiple cores (access latency). ) Is different, it is possible that the execution time of the parallel program will differ depending on which memory the data is stored in. For example, when the first core and the second core execute the assigned processing units, the data that is accessed from the first core more frequently than the frequency accessed from the second core is accessed from the first core. If the required time is stored in a memory longer than the required access time from the second core, the execution time of the parallel program becomes longer due to the longer access time from the first core, which is frequently accessed. ..
本発明は、上述した点に鑑みてなされたものであり、並列プログラムの実行時における複数のコアによるメモリへのアクセス時間を全体として短縮させることが可能な並列プログラムを生成する並列化方法と並列化ツール、及びその並列プログラムを実行するマルチコアマイコンを提供することを目的とする。 The present invention has been made in view of the above points, and is parallel to a parallelization method for generating a parallel program capable of shortening the access time to the memory by a plurality of cores at the time of executing the parallel program as a whole. The purpose is to provide a computerization tool and a multi-core microcomputer that executes its parallel program.
上記目的を達成するために本開示の一つは、
コアが一つであるシングルコアマイコン用のシングルプログラムから、複数のコア(C0、C1、C2)と複数のコアがアクセス可能な複数のメモリ(L0、L1、L2、G0、G1)とを有し、当該複数のメモリは複数のコアによるアクセスに要するアクセス必要時間が異なるメモリを含むマルチコアマイコン(20)用の並列プログラム(18a)を生成する並列化方法であって、
シングルプログラムに含まれる、複数の処理単位からなるタスク毎に、複数の処理単位の依存関係に基づき、複数の処理単位の前記複数のコアへの割り付けと実行順序とを決定し、この決定した複数のコアへの割り付け及び実行順序に従って複数の処理単位が実行されるように並列プログラムを生成する並列プログラム生成手順(10a~10e)と、
複数の処理単位の複数のコアへの割り付け情報、複数の処理単位がアクセスするデータに関するデータアクセス情報、タスクの実行頻度を示す実行頻度情報、及び複数のコアによる複数のメモリの各々へのアクセス必要時間を示すアクセス必要時間情報に基づき、複数のコアによるデータへのアクセス時間が全体として短縮されるように、複数のメモリの中から、データを格納するメモリを決定する格納メモリ決定手順(10h)と、
格納メモリ決定手順によって決定されたデータとその格納先のメモリとの関係を示すメモリマップ(18b)を生成するメモリマップ生成手順(10i)と、を備える。
In order to achieve the above objectives, one of the present disclosures is
From a single program for a single-core microcomputer with one core, there are multiple cores (C0, C1, C2) and multiple memories (L0, L1, L2, G0, G1) that can be accessed by multiple cores. However, the plurality of memories are a parallelization method for generating a parallel program (18a) for a multi-core microcomputer (20) including memories having different access times required for access by a plurality of cores.
For each task consisting of a plurality of processing units included in a single program, the allocation and execution order of the plurality of processing units to the plurality of cores are determined based on the dependency of the plurality of processing units, and the determined plurality of processing units are determined. Parallel program generation procedure (10a to 10e) to generate a parallel program so that a plurality of processing units are executed according to the allocation to the core and the execution order.
Allocation information of multiple processing units to multiple cores, data access information regarding data accessed by multiple processing units, execution frequency information indicating the execution frequency of tasks, and access to each of multiple memories by multiple cores is required. Storage memory determination procedure (10h) that determines the memory for storing data from a plurality of memories so that the access time to data by a plurality of cores is shortened as a whole based on the access required time information indicating the time. When,
A memory map generation procedure (10i) for generating a memory map (18b) showing the relationship between the data determined by the storage memory determination procedure and the storage destination memory thereof is provided.
本開示の並列化方法によれば、格納メモリ決定手順において、複数の処理単位の複数のコアへの割り付け情報、複数の処理単位がアクセスするデータに関するデータアクセス情報、タスクの実行頻度を示す実行頻度情報、及び複数のコアによる複数のメモリの各々へのアクセス必要時間を示すアクセス必要時間情報を用いることで、複数のコアによるデータへのアクセス時間が全体として短縮されるように、複数のメモリの中から、データを格納するメモリを決定することが可能になる。 According to the parallelization method of the present disclosure, in the storage memory determination procedure, information on allocation of a plurality of processing units to a plurality of cores, data access information on data accessed by a plurality of processing units, and execution frequency indicating the execution frequency of a task are shown. By using information and access time information indicating the time required to access each of multiple memories by multiple cores, the access time to data by multiple cores can be shortened as a whole. From the inside, it becomes possible to determine the memory to store the data.
そして、本開示の並列化方法によれば、メモリマップ生成手順において、決定されたデータとその格納先のメモリとの関係を示すメモリマップが生成される。このメモリマップを利用することにより、マルチコアマイコンにおいて、そのメモリマップに含まれるデータと格納先メモリとの関係を満たすように、各データを格納するメモリを定めることができる。その結果、マルチコアマイコンの複数のコアによるデータのアクセス時間を全体として短縮することができ、ひいては、並列プログラムの実行時間の短縮化を図ることができる。 Then, according to the parallelization method of the present disclosure, a memory map showing the relationship between the determined data and the memory of the storage destination is generated in the memory map generation procedure. By using this memory map, it is possible to determine the memory for storing each data so as to satisfy the relationship between the data included in the memory map and the storage destination memory in the multi-core microcomputer. As a result, the data access time by the plurality of cores of the multi-core microcomputer can be shortened as a whole, and the execution time of the parallel program can be shortened.
本開示の他の一つは、
コアが一つであるシングルコアマイコン用のシングルプログラムから、複数のコア(C0、C1、C2)と複数のコアがアクセス可能な複数のメモリ(L0、L1、L2、G0、G1)とを有し、当該複数のメモリは複数のコアによるアクセスに要するアクセス必要時間が異なるメモリを含むマルチコアマイコン(20)用の並列プログラム(18a)を生成する並列化ツールであって、
シングルプログラムに含まれる、複数の処理単位からなるタスク毎に、複数の処理単位の依存関係に基づき、複数の処理単位の複数のコアへの割り付けと実行順序とを決定し、この決定した複数のコアへの割り付け及び実行順序に従って複数の処理単位が実行されるように並列プログラムを生成する並列プログラム生成部(10a~10e)と、
複数の処理単位の複数のコアへの割り付け情報、複数の処理単位がアクセスするデータに関するデータアクセス情報、タスクの実行頻度を示す実行頻度情報、及び複数のコアによる複数のメモリの各々へのアクセス必要時間を示すアクセス必要時間情報に基づき、複数のコアによるデータへのアクセス時間が全体として短縮されるように、複数のメモリの中から、データを格納するメモリを決定する格納メモリ決定部(10h)と、
格納メモリ決定部によって決定されたデータとその格納先のメモリとの関係を示すメモリマップ(18b)を生成するメモリマップ生成部(10i)と、を備える
本開示の並列化ツールによれば、格納メモリ決定部が、複数の処理単位の複数のコアへの割り付け情報、複数の処理単位がアクセスするデータに関するデータアクセス情報、タスクの実行頻度を示す実行頻度情報、及び複数のコアによる複数のメモリの各々へのアクセス必要時間を示すアクセス必要時間情報を用いることで、複数のコアによるデータへのアクセス時間が全体として短縮されるように、複数のメモリの中から、データを格納するメモリを決定することが可能になる。
The other one of this disclosure is
From a single program for a single-core microcomputer with one core, there are multiple cores (C0, C1, C2) and multiple memories (L0, L1, L2, G0, G1) that can be accessed by multiple cores. However, the plurality of memories are parallelization tools for generating a parallel program (18a) for a multi-core microcomputer (20) including memories having different access times required for access by a plurality of cores.
For each task consisting of multiple processing units included in a single program, the allocation and execution order of multiple processing units to multiple cores are determined based on the dependencies of multiple processing units, and the determined plurality of processes are determined. A parallel program generator (10a to 10e) that generates a parallel program so that a plurality of processing units are executed according to the allocation to the core and the execution order.
Allocation information of multiple processing units to multiple cores, data access information regarding data accessed by multiple processing units, execution frequency information indicating the execution frequency of tasks, and access to each of multiple memories by multiple cores is required. A storage memory determination unit (10h) that determines a memory for storing data from a plurality of memories so that the access time to data by a plurality of cores is shortened as a whole based on the access required time information indicating the time. When,
According to the parallelization tool of the present disclosure, which comprises a memory map generation unit (10i) that generates a memory map (18b) showing the relationship between the data determined by the storage memory determination unit and the storage destination memory thereof. The memory determination unit determines the allocation information of multiple processing units to multiple cores, data access information regarding data accessed by multiple processing units, execution frequency information indicating the execution frequency of tasks, and multiple memories by multiple cores. By using the access required time information indicating the access required time for each, the memory for storing the data is determined from the multiple memories so that the access time to the data by the multiple cores is shortened as a whole. Will be possible.
そして、メモリマップ生成部が、決定されたデータとその格納先のメモリとの関係を示すメモリマップを生成する。このメモリマップを利用することにより、マルチコアマイコンにおいて、そのメモリマップに含まれるデータと格納先メモリとの関係を満たすように、各データを格納するメモリを定めることができる。その結果、マルチコアマイコンの複数のコアによるデータのアクセス時間を全体として短縮することができ、ひいては、並列プログラムの実行時間の短縮化を図ることができる。 Then, the memory map generation unit generates a memory map showing the relationship between the determined data and the memory of the storage destination. By using this memory map, in a multi-core microcomputer, a memory for storing each data can be determined so as to satisfy the relationship between the data included in the memory map and the storage destination memory. As a result, the data access time by the plurality of cores of the multi-core microcomputer can be shortened as a whole, and the execution time of the parallel program can be shortened.
本開示の他の一つは、
コアが一つであるシングルコアマイコン用のシングルプログラムから生成された、複数のコア(C0、C1、C2)を有するマルチコアマイコン(20)用の並列プログラム(18a)を実行するマルチコアマイコンであって、
複数のコアがアクセス可能な複数のメモリ(L0、L1、L2、G0、G1)を有し、当該複数のメモリは複数のコアによるアクセスに要するアクセス必要時間が異なるメモリを含み、
並列プログラムは、シングルプログラムに含まれる、複数の処理単位からなるタスク毎に、複数の処理単位の依存関係に基づき、複数の処理単位の複数のコアへの割り付けと実行順序とが決定され、この決定された複数のコアへの割り付け及び実行順序に従って複数の処理単位が実行されるように生成されたものであり、
複数のコアが、それぞれ割り付けられた処理単位の実行のために複数のメモリに格納されるデータにアクセスする際、そのアクセス対象となるメモリは、複数の処理単位の複数のコアへの割り付け情報、複数の処理単位がアクセスするデータに関するデータアクセス情報、タスクの実行頻度を示す実行頻度情報、及び複数のコアによる複数のメモリの各々へのアクセス必要時間を示すアクセス必要時間情報に基づき、複数のコアによるデータへのアクセス時間が全体として短縮されるように、複数のメモリの中から、データを格納するメモリが決定され、その決定されたデータと格納先のメモリとの関係を示すように生成されたメモリマップ(18b)に従って定められたメモリである。
The other one of this disclosure is
A multi-core microcomputer that executes a parallel program (18a) for a multi-core microcomputer (20) having a plurality of cores (C0, C1, C2) generated from a single program for a single-core microcomputer having one core. ,
It has a plurality of memories (L0, L1, L2, G0, G1) that can be accessed by a plurality of cores, and the plurality of memories include memories that require different access times for access by the plurality of cores.
In a parallel program, for each task consisting of multiple processing units included in a single program, the allocation and execution order of multiple processing units to multiple cores are determined based on the dependencies of multiple processing units. It was generated so that multiple processing units would be executed according to the determined allocation to multiple cores and the execution order.
When multiple cores access data stored in multiple memories for the execution of each allocated processing unit, the access target memory is the allocation information to the multiple cores of the multiple processing units. Multiple cores based on data access information about data accessed by multiple processing units, execution frequency information indicating task execution frequency, and access required time information indicating the time required to access each of multiple memories by multiple cores. The memory to store the data is determined from multiple memories so that the access time to the data by the data is shortened as a whole, and it is generated to show the relationship between the determined data and the storage destination memory. It is a memory defined according to the memory map (18b).
メモリマップには、複数のコアが、それぞれ割り付けられた処理単位の実行のためにデータにアクセスする際に、そのデータを格納するための最適なメモリが定められている。従って、このメモリマップを利用することにより、マルチコアマイコンにおいて、そのメモリマップに含まれるデータと格納先メモリとの関係を満たすように、各データを格納するメモリを定めることができる。その結果、マルチコアマイコンの複数のコアによるデータのアクセス時間を全体として短縮することができ、ひいては、並列プログラムの実行時間の短縮化を図ることができる。 The memory map defines the optimum memory for storing the data when a plurality of cores access the data for the execution of the assigned processing unit. Therefore, by using this memory map, it is possible to determine the memory for storing each data so as to satisfy the relationship between the data included in the memory map and the storage destination memory in the multi-core microcomputer. As a result, the data access time by the plurality of cores of the multi-core microcomputer can be shortened as a whole, and the execution time of the parallel program can be shortened.
上記括弧内の参照番号は、本開示の理解を容易にすべく、後述する実施形態における具体的な構成との対応関係の一例を示すものにすぎず、なんら発明の範囲を制限することを意図したものではない。 The reference numbers in parentheses are merely examples of the correspondence with the specific configurations in the embodiments described below, and are intended to limit the scope of the invention in order to facilitate the understanding of the present disclosure. Not what I did.
また、上述した特徴以外の、特許請求の範囲の各請求項に記載した技術的特徴に関しては、後述する実施形態の説明及び添付図面から明らかになる。 Further, the technical features described in each claim of the claims other than the above-mentioned features will be clarified from the description of the embodiment described later and the attached drawings.
以下において、図面を参照しながら、発明を実施するための形態を説明する。本実施形態では、並列化ツールとしてのコンピュータ10が、コアが一つであるシングルコアマイコン用のシングルプログラムから、3個のコアC0、C1、C2を有するマルチコアマイコン20用に並列化した並列プログラム18aを生成する例について説明する。なお、マルチコアマイコン20が備えるコアの数は3個に限られず、2個であってもよいし、4個以上であってもよい。
Hereinafter, embodiments for carrying out the invention will be described with reference to the drawings. In the present embodiment, the
このように、シングルプログラムから並列プログラム18aを生成する背景として、制御の高度化によりプログラム量は年々増加する傾向にあるのに対し、シングルコアマイコンの性能向上には限界があることが挙げられる。つまり、例えばシングルコアマイコンの動作周波数を高めて処理能力を向上しようとしても、動作周波数を高めるにも限界があり、また動作周波数を高めることにより発熱量の増大や消費電力の増加を招いてしまう。このため、コア数の増加により処理能力向上を図るマルチコアマイコン20を適用することが有効と考えられている。
As described above, as a background for generating the
この際、プログラムの開発者が、マルチコアの能力を最大限に発揮させられるように、各コアに適切に処理を割り振ったり、そのスケジューリングも行ったりしなければならないとすると、プログラムの開発負荷が増加してしまう。このようなプログラムの開発負荷を低減するために、シングルプログラムから並列プログラム18aを自動生成することは技術的意義がある。さらに、シングルプログラムから並列プログラム18aを自動生成することにより、シングルプロセッサ用に開発した既存のソフト資産を有効に活用することも可能となる。
At this time, if the program developer must appropriately allocate processing to each core and schedule it so that the multi-core capability can be maximized, the program development load increases. Resulting in. In order to reduce the development load of such a program, it is technically significant to automatically generate a
まず、図1を参照して、コンピュータ10の構成に関して説明する。コンピュータ10は、並列化方法を実行する並列化ツールに相当し、シングルプログラムから並列プログラム18aを生成するものである。なお、本実施形態では、コンピュータ10は、C言語で記述されたシングルプログラムに基づき、C言語で記述された並列プログラム18aを生成するように構成される。このため、後述するマルチコアマイコン20のROMに記憶され、マルチコアマイコン20によって実行される並列プログラム18a’は、図2に示すように、さらにコンパイラ19によりコンパイルされて、バイナリコードに翻訳されたものとなる。
First, the configuration of the
しかしながら、本発明は、これに限定されない。シングルプログラムは、C言語とは異なるプログラミング言語で記述されていてもよい。また、並列プログラム18aは、例えば、シングルプログラムの解析時に使用する中間言語で記述されていてもよい。あるいは、コンピュータ10は、C言語で記述された並列プログラムと中間言語で記述された並列プログラムとをともに生成してもよい。さらに、コンピュータ10が、コンパイラ19としての機能も取り込み、直接、バイナリコードの並列プログラム18a’を生成してもよい。
However, the present invention is not limited to this. The single program may be written in a programming language different from C language. Further, the
コンピュータ10は、図1に示すように、ディスプレイ11、HDD12、CPU13、ROM14、RAM15、入力装置16、読取部17などを備えて構成されている。コンピュータ10は、読取部17により、記憶媒体1に記憶された記憶内容を読み取ることができる。図1に示すように、記憶媒体1には、例えば、自動並列化コンパイラ1aが記憶される。なお、コンピュータ10及び記憶媒体1は、特開2015-1807号公報に記載されたパーソナルコンピュータ100及び記憶媒体180と同様であるため、詳細は、特開2015-1807号公報を参照されたい。
As shown in FIG. 1, the
自動並列化コンパイラ1aは、並列プログラム18aを生成するための手順をコンピュータ10に実行させるソフトウエアである。よって、自動並列化コンパイラ1aにより、コンピュータ10は並列化方法を実行可能となる。換言すれば、自動並列化コンパイラ1aは、並列化方法を含むプログラムである。コンピュータ10は、自動並列化コンパイラ1aを実行することで、並列化ツールとして、並列プログラム18aを生成する。
The
次に、図2を参照して、並列化ツールとしてのコンピュータ10が有する、シングルプログラムから並列プログラム18aを生成するための各機能及び処理手順について説明する。図2は、コンピュータ10の各機能及び処理手順を機能ブロックとして表した図である。図2に示すように、コンピュータ10は、字句解析部10a、構文・意味解析部10b、依存関係解析部10c、コア割付及びスケジューリング部10d、コード生成部10e、タスク実行頻度解析部10f、データアクセス解析部10g、格納メモリ決定部10h、及びメモリマップ生成部10iとしての機能を有している。
Next, with reference to FIG. 2, each function and processing procedure for generating the
本実施形態では、図2に示すように、コンピュータ10には、制御対象機器を制御するためのシングルプログラム全体を一度に解析して並列プログラムを生成するのではなく、独立した処理機能(タスク)毎に分割されたシングルプログラムを対象として、その並列プログラムを生成する。なお、本実施形態により生成される並列プログラム18aは、マルチコアマイコン20において実行されるときの実行速度を早めることができるので、制御対象機器として、例えば、素早い処理速度が求められる、車両に搭載されたエンジンや電動モータとすることが好適である。この場合、マルチコアマイコン20は、車両に搭載されるエンジン制御装置、モータ制御装置、ハイブリッド制御装置などの車載装置として具現化される。
In the present embodiment, as shown in FIG. 2, the
タスク毎に分割されたシングルプログラムは複数の処理単位を含み、その複数の処理単位が実行されることにより、タスク毎の目的とする処理機能を実現することができる。このように複数の処理単位は、目的とする処理機能を実現するために協働するものであり、例えば先の処理単位で処理された変数データを参照する後の処理単位や、先の処理単位の条件分岐によって実行される後の処理単位などを含む。 A single program divided for each task includes a plurality of processing units, and by executing the plurality of processing units, the target processing function for each task can be realized. In this way, the plurality of processing units cooperate to realize the target processing function, for example, a processing unit after referring to the variable data processed in the previous processing unit, or a previous processing unit. Includes the processing unit after being executed by the conditional branch of.
ここで、処理単位とは、各コアに割り振る際の最小単位であるコア配置単位や、関数をいう。コア配置単位は、処理ブロック、マクロタスク、あるいは単なる処理単位などと言い換えることができる。コア配置単位と関数との関係は、コア配置単位≧関数である。つまり、関数は、コア配置単位自体である場合や、コア配置単位に含まれる親関数やサブ関数の場合がある。 Here, the processing unit refers to a core placement unit or a function, which is the minimum unit when allocating to each core. The core placement unit can be rephrased as a processing block, a macro task, or a simple processing unit. The relationship between the core placement unit and the function is that the core placement unit ≧ function. That is, the function may be the core placement unit itself, or it may be a parent function or a subfunction included in the core placement unit.
字句解析部10a及び構文・意味解析部10bは、C言語で記述されたシングルプログラムのソースコードを対象として、字句解析や、構文と意味の解析を行い、中間言語に展開する。字句解析部10a及び構文・意味解析部10bによって展開された中間言語は、汎用的な命令を含んでいる。なお、字句解析部10a及び構文・意味解析部10bは、特開2015-1807号公報のFE3に相当するため、詳細は、特開2015-1807号公報を参照されたい。
The
依存関係解析部10cは、中間言語に展開されたシングルプログラムに含まれる処理単位の依存関係を解析し、並列実行可能な処理単位を抽出する。依存関係には、後に実行される処理単位が先に実行される処理単位で更新された変数データを参照するなどのデータ依存関係と、後に実行される処理単位が先に実行される処理単位の条件分岐先となるなどの制御依存関係とが含まれる。このような依存関係がある複数の処理単位は、依存関係に従う処理順序で実行される必要がある。なお、本実施形態では、上述したようにタスク毎に分割されたシングルプログラムが並列化の対象である。タスク毎に分割されたシングルプログラムに含まれる複数の処理単位は、データ依存関係や制御依存関係を有している。
The
コア割付及びスケジューリング部10dは、依存関係解析部10cで解析した解析結果に基づき、複数の処理単位を3個のコアC0~C2に割り付ける(割り振る)。この際、コア割付及びスケジューリング部10dは、例えば、並列実行可能な処理単位が2個以上のコアC0~C2で並行して実行されるように、複数の処理単位の割り付けを行う。コア割付及びスケジューリング部10dは、各タスクの処理単位の割り付けが終了する毎に、あるいは、すべてのタスクの処理単位の割り付けが完了したときなど、任意のタイミングで、どの処理単位をいずれのコアC0~C2に割り付けたかに関するコア割付情報を格納メモリ決定部10hに出力する。
The core allocation and
図3にコア割付情報の一例を示す。図3に示すコア割付情報は、シングルプログラムに含まれるタスクは、第1タスクと第2タスクの2つのタスクであって、第1タスクには6個の処理単位が含まれており、処理単位ナンバーが「1」の処理単位と、「4」の処理単位とが、コアC0に割り付けられたことを示している。また、処理単位ナンバーが「2」の処理単位と、「5」の処理単位とが、コアC1に割り付けられたことを示している。さらに、処理単位ナンバーが「3」の処理単位と、「6」の処理単位とが、コアC2に割り付けられたことを示している。第2タスクに関しては、4個の処理単位の内、処理単位ナンバーが「1」の処理単位と、「4」の処理単位とが、コアC0に割り付けられ、処理単位ナンバーが「2」の処理単位がコアC1に割り付けられ、処理単位ナンバーが「3」の処理単位がコアC2に割り付けられたことを示している。なお、処理単位ナンバーは、第1タスク及び第2タスクのそれぞれのタスクに含まれる複数の処理単位を区別するために、便宜的に付与したものである。 FIG. 3 shows an example of core allocation information. In the core allocation information shown in FIG. 3, the tasks included in the single program are two tasks, the first task and the second task, and the first task includes six processing units, and the processing units are included. It shows that the processing unit whose number is "1" and the processing unit whose number is "4" are assigned to the core C0. Further, it is shown that the processing unit whose processing unit number is "2" and the processing unit whose processing unit number is "5" are assigned to the core C1. Further, it is shown that the processing unit whose processing unit number is "3" and the processing unit whose processing unit number is "6" are assigned to the core C2. Regarding the second task, of the four processing units, the processing unit whose processing unit number is "1" and the processing unit whose processing unit number is "4" are assigned to the core C0, and the processing unit number is "2". It shows that the unit is assigned to the core C1 and the processing unit having the processing unit number "3" is assigned to the core C2. The processing unit number is given for convenience in order to distinguish a plurality of processing units included in each task of the first task and the second task.
さらに、コア割付及びスケジューリング部10dは、3個のコアC0~C2に割り付けられた複数の処理単位のスケジューリングを行う。具体的には、コア割付及びスケジューリング部10dは、各処理単位の実行時間や依存関係に基づいて、3個のコアC0~C2に割り付けられた各処理単位の実行スケジュールを決定する。なお、依存関係解析部10c、及びコア割付及びスケジューリング部10dは、特開2015-1807号公報のMP5に相当するため、詳細は、特開2015-1807号公報を参照されたい。
Further, the core allocation and
コード生成部10eは、コア割付及びスケジューリング部10dによって決定された各コアC0~C2への割り付け及び実行順序に従って該当するタスクの複数の処理単位が実行されるように、並列プログラムに相当するプログラムコードを生成する。コンピュータ10は、コード生成部10eによって生成されたプログラムコードを並列プログラム21a1として出力する。
The
タスク実行頻度解析部10fは、並列化の対象となっているタスクのプログラムから、該当するタスクの実行頻度に関する情報を抽出することで、各タスクの実行頻度を解析する。具体的には、タスク実行頻度解析部10fは、タスクの実行頻度情報として、タスクの実行周期を示す情報を抽出する。そして、タスク実行頻度解析部10fは、抽出した実行頻度情報を格納メモリ決定部10hに出力する。
The task execution
データアクセス解析部10gは、構文・意味解析部10bによって中間言語に展開された、シングルプログラムに含まれる各処理単位が、マルチコアマイコン20のメモリ(RAM、データROM、コードROM)に格納されるデータにアクセスするものであるかどうか、アクセスする場合には、そのアクセス対象となるデータを解析する。そして、データアクセス解析部10gは、すべてのタスクの解析が完了した時点など、任意のタイミングで、その解析結果をデータアクセス情報としてまとめ、格納メモリ決定部10hに出力する。各タスクに含まれる複数の処理単位がアクセスする、マルチコアマイコン20のメモリに格納されるデータには、RAMに格納される変数又は定数データ、データROMに格納される定数データ、及びコードROMに格納される、処理単位として共用される関数データの少なくとも1つが含まれる。データアクセス解析部10gは、RAMに格納されるデータ、データROMに格納されるデータ、及びコードROMに格納されるデータ毎に分けて、データアクセス情報を生成する。
In the data access analysis unit 10g, each processing unit included in the single program developed in the intermediate language by the syntax /
ここで、一例として、マルチコアマイコン20のRAMに格納されるデータを対象として、データアクセス解析部10gによって生成されるデータアクセス情報を図4に示す。図4に示す例おいて、データナンバーの1~10は、マルチコアマイコン20のRAMに格納されて、並列プログラム18aに含まれるすべてのタスクのいずれかの処理単位によりアクセスされるすべてのデータを対象として、それらのデータを区別するために便宜的に付与された番号である。ただし、データアクセス情報に含まれるデータは、単一の処理単位によってアクセスされるデータを対象から除外し、複数の処理単位によってアクセスされるデータだけに絞り込んでもよい。単一の処理単位によってアクセスされるデータは、その単一の処理単位が割り付けられたコアから最も短いアクセス時間でアクセス可能なRAMに保存されればよいためである。
Here, as an example, FIG. 4 shows data access information generated by the data access analysis unit 10g for the data stored in the RAM of the
また、データアクセス情報には、各タスクの、処理単位ナンバーによって区別される各々の処理単位が、データナンバーによって区別されるどのデータにアクセスするかに関する情報が含まれている。例えば、図4に例示するデータアクセス情報には、第1タスクの処理単位ナンバーが「1」の処理単位は、データナンバーが「1」のデータ、「3」のデータ、及び「7」のデータにそれぞれ1回アクセスするとの情報が含まれている。また、第1タスクの処理単位ナンバーが「2」の処理単位は、データナンバーが「2」のデータ、「3」のデータ、「7」のデータ及び「8」のデータにそれぞれ1回アクセスするとの情報が含まれている。データアクセス情報には、第1タスクの他の処理単位及び第2タスクの各処理単位に関しても、同様に、どのデータにアクセスするかの情報が含まれている。 Further, the data access information includes information on which data of each task, which is distinguished by the processing unit number, accesses which data is distinguished by the data number. For example, in the data access information exemplified in FIG. 4, the processing unit whose processing unit number is "1" in the first task is the data whose data number is "1", the data "3", and the data "7". Contains information that each will be accessed once. Further, when the processing unit whose processing unit number of the first task is "2" accesses the data whose data number is "2", the data "3", the data "7", and the data "8", respectively, once. Information is included. The data access information also includes information on which data is to be accessed for each of the other processing units of the first task and each processing unit of the second task.
格納メモリ決定部10hには、上述したタスクの実行頻度情報、各処理単位によるデータアクセス情報、及び処理単位のコア割付情報に加えて、図2に示すように、マルチコアマイコン20における、各コアC0~C2から各メモリへのアクセス必要時間を示すアクセスレイテンシ情報(アクセス必要時間情報)2が入力される。このアクセスレイテンシ情報2は、予め、並列プログラム18a’を実装するマルチコアマイコン20における各コアC0~C2に対する各メモリの配置に基づき、計算もしくは実測により、各コアC0~C2から各メモリへのアクセス必要時間を求めてデータ化したものである。
In the storage
例えば、マルチコアマイコン20が、各コアC0~C2に対するメモリの配置として、図5に示すようなRAMの配置を有していたとする。具体的には、図5に示す例では、コアC0の近傍にローカルRAML0が配置され、コアC1の近傍にローカルRAML1が配置され、コアC2の近傍にローカルRAML2が配置され、コアC0とコアC1とを結ぶバスに接続されるようにグローバルRAMG0が配置され、コアC0とコアC1との接続バスとコアC2とを結ぶバスに接続されるようにグローバルRAMG1が配置されている。なお、図5では省略しているが、マルチコアマイコン20は、メモリとして、制御に使用する定数データなどを格納する複数のデータROM、及び並列プログラム18aや関数データを格納するための複数のコードROMも有している。これらの複数のデータROM及び複数のコードROMも、各コアC0~C2からのアクセス必要時間が異なる。
For example, it is assumed that the
図5に示すような、各コアC0~C2に対する各メモリL0~L2、G0~G1の配置において、各コアC0~C2から各メモリL0~L2、G0~G1へのアクセス必要時間を求め、アクセスレイテンシ情報2としてまとめた結果の一例を図6に示す。なお、図6では、マルチコアマイコン20の命令実行サイクルを時間単位として、それぞれのアクセス必要時間を示している。
In the arrangement of the memories L0 to L2 and G0 to G1 for each core C0 to C2 as shown in FIG. 5, the required access time from the cores C0 to C2 to the memories L0 to L2 and G0 to G1 is obtained and accessed. FIG. 6 shows an example of the results summarized as the
図6に示すように、例えば、コアC0が、ローカルRAML0にアクセスする場合には1サイクルに相当する時間で済む。しかし、コアC0が、ローカルRAML1にアクセスする場合には3サイクル、ローカルRAML2にアクセスする場合には5サイクル、グローバルRAMG0にアクセスする場合には2サイクル、グローバルRAMG1にアクセスする場合には4サイクルに相当する時間をそれぞれ要することとなる。このように、一般的に、各コアC0~C2の近傍に配置されたメモリL0~L2ほど、該当するコアC0~C2によるアクセス必要時間は短時間で済む。逆に、各コアC0~C2から離間して配置されたメモリ(例えば、コアC0に対するメモリL2)ほど、アクセス必要時間は長くなる。このため、例えば、コアC0に割り付けられた処理単位によって高頻度でアクセスされるデータが、ローカルRAML2に格納されたとすると、コアC0からローカルRAML2へのアクセス時間が長くかかるようになってしまい、ひいては、並列プログラム18aの実行時間が長くなってしまうという問題が生じる。
As shown in FIG. 6, for example, when the core C0 accesses the local RAML0, the time corresponding to one cycle is sufficient. However, when the core C0 accesses the local RAML1, it has 3 cycles, when it accesses the local RAML2, it has 5 cycles, when it accesses the global RAMG0, it has 2 cycles, and when it accesses the global RAMG1, it has 4 cycles. It will take a considerable amount of time. As described above, in general, the memory L0 to L2 arranged in the vicinity of each core C0 to C2 requires a shorter access time by the corresponding cores C0 to C2. On the contrary, the memory arranged apart from each core C0 to C2 (for example, the memory L2 with respect to the core C0) has a longer access time. Therefore, for example, if the data frequently accessed by the processing unit assigned to the core C0 is stored in the local RAML2, the access time from the core C0 to the local RAML2 becomes long, which in turn takes a long time. , There arises a problem that the execution time of the
このため、格納メモリ決定部10hは、タスクの実行頻度情報、各処理単位によるデータアクセス情報、各処理単位のコア割付情報、及びアクセスレイテンシ情報2に基づき、複数のコアC0~C2によるデータへのアクセス時間が全体として短縮されるように、複数のメモリ(例えば、メモリL0~L2、G0~G1)の中から、データを格納するメモリを決定する。そして、メモリマップ生成部10iは、格納メモリ決定部10hによって決定されたデータとその格納先のメモリとの関係を示すとともに、格納先メモリにおける各データの格納場所を示すアドレス情報を示すメモリマップ18bを生成する。
Therefore, the storage
並列化ツールとしてのコンピュータ10により生成された並列プログラム18aは、上述したように、コンパイラ19によってコンパイルされ、バイナリコードに翻訳された並列プログラム18a’に変換される。コンパイラ19は、図2に示すように、コンピュータ10から与えられるメモリマップ18bを参照して、メモリマップ18bに含まれるデータと格納先メモリとの関係を満たすように、コンパイル後の並列プログラム18a’が各データを格納するメモリと、そのメモリにおける格納場所を示すアドレスを定める。つまり、コンパイラ19は、格納先のメモリ及び当該メモリのアドレス情報に従って、各データの格納場所を定める。このように、メモリマップ18bを利用することにより、マルチコアマイコン20にて並列プログラム18a’を実行するときに、メモリマップ18bに含まれるデータと格納先メモリとの関係を満たすように、各データを格納するメモリを定めることができる。その結果、マルチコアマイコン20の複数のコアC0~C2によるデータのアクセス時間を全体として短縮することができ、ひいては、並列プログラム181’の実行時間の短縮化を図ることができる。
As described above, the
なお、データROM及び/又はコードROMに関するメモリマップが生成された場合には、並列プログラム18a’をマルチコアマイコン20のROMに実装する際に、併せて、メモリマップ18bに従って、該当するデータROM及び/又はコードROMの指定されたアドレスに、定数データ及び/又は関数データを格納すればよい。
When a memory map related to the data ROM and / or the code ROM is generated, when the parallel program 18a'is mounted on the ROM of the
以下、図7~図9のフローチャート及び図10~図12の説明図を参照しつつ、格納メモリ決定部10hが、複数のメモリの中からデータを格納するメモリを決定するとともに、メモリマップ生成部がメモリマップを生成するための処理について詳しく説明する。図7のフローチャートは、RAMに格納されるデータについて、格納先となるメモリを決定するとともにメモリマップを作成するための処理を示す。図8のフローチャートは、データROMに格納されるデータについて、格納先となるメモリを決定するとともにメモリマップを作成するための処理を示す。図9のフローチャートは、コードROMに格納されるデータについて、格納先となるメモリを決定するとともにメモリマップを作成するための処理を示す。
Hereinafter, with reference to the flowcharts of FIGS. 7 to 9 and the explanatory diagrams of FIGS. 10 to 12, the storage
最初に、図7のフローチャートに示す処理について説明する。最初のステップS100では、タスク実行頻度解析部10fから、各タスクの実行頻度情報を取得する。また、コア割付及びスケジューリング部10dから、図3に示すような、各タスクに含まれる処理単位の各コアC0~C2へのコア割付情報を取得する。さらに、データアクセス解析部10gから、図4に示すような、RAMに格納されるデータのデータアクセス情報を取得する。なお、ステップS100における各情報の取得は、一度にまとめて行われる必要はない。例えば、複数回に分けてそれぞれの情報の一部を取得し、すべての情報が収集できた時点で、それまで取得した情報をまとめることにより、各情報を取得することも可能である。
First, the process shown in the flowchart of FIG. 7 will be described. In the first step S100, the execution frequency information of each task is acquired from the task execution
続くステップS110では、ステップS100にて取得した各タスクの実行頻度情報、コア割付情報、及びデータアクセス情報に基づき、データ毎に、単位時間当たりの各コアC0~C2からのアクセス頻度を算出する。各コアC0~C2からのアクセス頻度を算出する具体例を、図10及び図11の説明図を参照して詳しく説明する。 In the following step S110, the access frequency from each core C0 to C2 per unit time is calculated for each data based on the execution frequency information, core allocation information, and data access information of each task acquired in step S100. A specific example of calculating the access frequency from each core C0 to C2 will be described in detail with reference to the explanatory diagrams of FIGS. 10 and 11.
まず、各タスクの実行頻度情報とデータアクセス情報とに基づいて、図10に示すような、単位時間当たりの各処理単位による各データへのアクセス頻度(アクセス回数)を算出する。図10の単位時間当たりの各処理単位による各データへのアクセス頻度は、図4に示した各処理単位の各データへのアクセス情報に基づいて算出されたものである。図4に示すように、第1タスクは実行周期が1ms毎であり、第2タスクは実行周期が4ms毎である。このように第1タスクと第2タスクとでは実行周期が異なり、第1タスクは第2タスクの4倍の頻度で実行される。従って、図4に示される、第1タスクの処理単位によるデータアクセスの回数と、第2タスクの処理単位によるデータアクセスの回数とをそのまま同等に扱うことはできない。 First, based on the execution frequency information of each task and the data access information, the access frequency (access count) to each data by each processing unit per unit time as shown in FIG. 10 is calculated. The access frequency to each data by each processing unit per unit time in FIG. 10 is calculated based on the access information to each data in each processing unit shown in FIG. As shown in FIG. 4, the first task has an execution cycle of every 1 ms, and the second task has an execution cycle of every 4 ms. In this way, the execution cycle is different between the first task and the second task, and the first task is executed four times as frequently as the second task. Therefore, the number of data accesses by the processing unit of the first task and the number of data accesses by the processing unit of the second task, which are shown in FIG. 4, cannot be treated as they are.
そのため、各タスクの実行周期を利用して、単位時間当たりに、各タスクの処理単位による各データのアクセスの回数を算出する。これにより、各タスクの処理単位による各データへのアクセス回数の持つ意味が同等になる。図10に示す例では、単位時間を8msとしている。単位時間である8msの間に、第1タスクに含まれる処理単位の実行回数は8回となり、第2タスクに含まれる処理単位の実行回数は2回となる。従って、図4に示すデータアクセス情報のアクセス回数が、第1タスクに含まれる処理単位については8倍され、第2タスクに含まれる処理単位については2倍される。これにより、図10に示す単位時間当たりの各処理単位による各データへのアクセス頻度が得られる。 Therefore, the number of times each data is accessed by the processing unit of each task is calculated per unit time by using the execution cycle of each task. As a result, the meaning of the number of accesses to each data by the processing unit of each task becomes the same. In the example shown in FIG. 10, the unit time is 8 ms. During the unit time of 8 ms, the number of executions of the processing unit included in the first task is eight, and the number of executions of the processing unit included in the second task is two. Therefore, the number of times of access of the data access information shown in FIG. 4 is multiplied by 8 for the processing unit included in the first task and doubled for the processing unit included in the second task. As a result, the access frequency to each data by each processing unit per unit time shown in FIG. 10 can be obtained.
さらに、図10に示すような、単位時間当たりの各処理単位による各データへのアクセス頻度と、図3に示すような、各処理単位の各コアC0~C2への割付情報とに基づいて、各コア毎に、各データへのアクセス頻度(アクセス回数)をまとめることにより、図11に示すような、単位時間当たりの各コアC0~C2による各データへのアクセス頻度を算出する。例えば、図3のコア割付情報が得られた場合、第1タスクの処理単位ナンバーが「1」、「4」の処理単位と、第2タスクの処理単位ナンバーが「1」、「4」の処理単位とが、コアC0に割り付けられることになる。単位時間当たりのコアC0からの各データへのアクセス回数を求めるために、コアC0に割り付けられるすべての処理単位(第1タスクの処理単位ナンバーが「1」、「4」の処理単位と、第2タスクの処理単位ナンバーが「1」、「4」の処理単位)による各データへのアクセス回数の総計をデータ毎に求める。同様に、単位時間当たりのコアC1、C2からの各データへのアクセス回数を求めるために、コアC1、C2に割り付けられるすべての処理単位による各データへのアクセス回数の総計をデータ毎に求める。このようにして各コアC0~C2からの各データへのアクセス回数の総計をまとめることで、図11に示す、単位時間当たりの各コアC0~C2による各データへのアクセス頻度が得られる。 Further, based on the access frequency to each data by each processing unit per unit time as shown in FIG. 10 and the allocation information to each core C0 to C2 of each processing unit as shown in FIG. By summarizing the access frequency (access count) to each data for each core, the access frequency to each data by each core C0 to C2 per unit time as shown in FIG. 11 is calculated. For example, when the core allocation information shown in FIG. 3 is obtained, the processing unit numbers of the first task are "1" and "4", and the processing unit numbers of the second task are "1" and "4". The processing unit is assigned to the core C0. All processing units assigned to core C0 in order to obtain the number of accesses to each data from core C0 per unit time (processing units whose first task processing unit numbers are "1" and "4", and the first The total number of accesses to each data by the processing unit numbers of 2 tasks (processing units of "1" and "4") is calculated for each data. Similarly, in order to obtain the number of accesses to each data from the cores C1 and C2 per unit time, the total number of accesses to each data by all the processing units assigned to the cores C1 and C2 is obtained for each data. By summarizing the total number of accesses to each data from each core C0 to C2 in this way, the access frequency to each data by each core C0 to C2 per unit time shown in FIG. 11 can be obtained.
次に、図7のフローチャートのステップS120では、図6に示すような、各コアC0~C2から各RAML0、L1、L2、G0、G1にアクセスする必要時間に関するアクセスレイテンシ情報を取得する。続くステップS130では、各データを各RAML0、L1、L2、G0、G1に格納したと仮定した場合の、単位時間当たりのアクセス必要時間の合計を算出する。このアクセス必要時間の合計は、図11の単位時間当たりの各コアからのアクセス頻度と図6のアクセスレイテンシ情報とから算出することができる。 Next, in step S120 of the flowchart of FIG. 7, access latency information regarding the time required to access each RAM L0, L1, L2, G0, and G1 is acquired from each core C0 to C2 as shown in FIG. In the following step S130, the total access required time per unit time is calculated assuming that each data is stored in each RAM L0, L1, L2, G0, G1. The total required access time can be calculated from the access frequency from each core per unit time in FIG. 11 and the access latency information in FIG.
例えば、データナンバーが「1」のデータをRAML0に格納した場合、コアC0からデータナンバーが「1」のデータへのアクセス頻度は18回であり、RAML0へのアクセス必要時間は1サイクルであるため、コアC0からRAML0へのアクセス必要時間の合計は18×1=18(サイクル)となる。また、コアC1とコアC2からRAML0に格納されたデータナンバーが「1」のデータへのアクセス必要時間の合計は、それぞれ、2×3=6(サイクル)、16×5=80(サイクル)となる。従って、データナンバーが「1」のデータをRAML0に格納した場合、各コアC0~C2からのアクセス必要時間の合計は、18+6+80=104(サイクル)となる。同様にして、データナンバーが「1」のデータが他のRAML1、L2、G0、G1に格納された場合の、各コアC0~C2からのアクセス必要時間の合計も求めることができる。さらに、他のデータに関しても、各RAML0、L1、L2、G0、G1に格納したと仮定した場合の、単位時間当たりの各コアC0~C2からのアクセス必要時間の合計を求めて、それらをまとめたものが、図12に示すアクセス必要時間の合計データとなる。 For example, when the data with the data number "1" is stored in the RAM L0, the access frequency from the core C0 to the data with the data number "1" is 18 times, and the time required to access the RAM L0 is one cycle. , The total required access time from the core C0 to the RAML0 is 18 × 1 = 18 (cycle). Further, the total time required to access the data whose data number is "1" stored in RAML0 from the core C1 and the core C2 is 2 × 3 = 6 (cycle) and 16 × 5 = 80 (cycle), respectively. Become. Therefore, when the data whose data number is "1" is stored in RAML0, the total required access time from each core C0 to C2 is 18 + 6 + 80 = 104 (cycle). Similarly, when the data having the data number "1" is stored in the other RAM L1, L2, G0, G1, the total access required time from each core C0 to C2 can be obtained. Furthermore, for other data, the total access time required from each core C0 to C2 per unit time is calculated and summarized assuming that the data is stored in each RAM L0, L1, L2, G0, G1. Is the total data of the required access time shown in FIG.
ステップS140では、アクセス必要時間の合計データに基づき、データ毎に、アクセス必要時間の合計が最小となるメモリを、該当データを格納するメモリとして決定する。例えば、図12に示すアクセス必要時間の合計データが得られた場合、データナンバーが「1」のデータに関しては、RAML0とRAMG0とのアクセス必要時間の合計が最も小さい。このため、データナンバーが「1」のデータを格納するメモリは、RAML1(又はRAMG0)に決定する。他のデータナンバーのデータについても、同様にして、該当のデータを格納するメモリを決定することができる。 In step S140, based on the total data of the required access time, the memory having the minimum total of the required access time is determined as the memory for storing the corresponding data for each data. For example, when the total access required time data shown in FIG. 12 is obtained, the total access required time between RAML0 and RAMG0 is the smallest for the data whose data number is "1". Therefore, the memory for storing the data whose data number is "1" is determined to be RAML1 (or RAMG0). For the data of other data numbers, the memory for storing the corresponding data can be determined in the same manner.
そして、ステップS150では、ステップS140にて決定した各データと格納先となるRAMとの関係に加え、格納先RAMにおける格納場所のアドレスを決定し、その決定したアドレス情報をメモリマップ18bとして生成する。
Then, in step S150, in addition to the relationship between each data determined in step S140 and the storage destination RAM, the address of the storage location in the storage destination RAM is determined, and the determined address information is generated as the
以上が、RAMに格納されるデータについて、格納先となるメモリを決定するとともにメモリマップ18bを作成するための処理となる。データROM及びコードROMに格納されるデータに関しても、図8及び図9のフローチャートに示すように、基本的に上述した図7のフローチャートと同様の処理によって、格納先となるメモリを決定するとともにメモリマップ18bを作成することができる。従って、図8及び図9のフローチャートに関しては、詳細な説明を省略する。
The above is the process for determining the memory to be stored in the data stored in the RAM and creating the
以上、本発明の好ましい実施形態について説明した。しかしながら、本発明は、上記実施形態に何ら制限されることはなく、本発明の趣旨を逸脱しない範囲において、種々の変形が可能である。 The preferred embodiment of the present invention has been described above. However, the present invention is not limited to the above embodiment, and various modifications can be made without departing from the spirit of the present invention.
(変形例1)
例えば、上述した実施形態では、マルチコアマイコン20が、RAM、データROM、及びコードRAMをそれぞれ複数備え、RAM、データROM、及びコードRAMに格納されるデータに関して、最適なメモリに格納する例について説明した。しかしながら、マルチコアマイコン20は、RAM、データROM、及びコードROMの少なくとも1種類のメモリについて複数のメモリを備え、それら複数のメモリの中から、データを格納するための最適なメモリを決定するものであってもよい。
(Modification 1)
For example, in the above-described embodiment, the example in which the
(変形例2)
また、上述した実施形態では、データを格納するメモリを決定するために、各データを各メモリに格納したと仮定した場合における、単位時間当たりの各コアC0~C2からのアクセス必要時間の合計を求め、そのアクセス必要時間の合計が最少となるメモリを選択する例について説明した。しかしながら、データを格納するメモリを決定する手法は、これに限られない。例えば、データ毎に、単位時間当たりのアクセス頻度が最も高いコアを選び、そのコアからのアクセス必要時間が最も短いメモリを、該当するデータを格納するメモリとして決定しても良い。この場合において、単位時間当たりのアクセス頻度が最も高いコアが複数ある場合には、その複数のコアの間にあるグローバルメモリを、該当するデータを格納するメモリとして決定することが好ましい。
(Modification 2)
Further, in the above-described embodiment, in order to determine the memory for storing the data, the total access required time from each core C0 to C2 per unit time is calculated assuming that each data is stored in each memory. An example of selecting the memory that minimizes the total access time required was explained. However, the method for determining the memory for storing data is not limited to this. For example, the core having the highest access frequency per unit time may be selected for each data, and the memory having the shortest access time required from the core may be determined as the memory for storing the corresponding data. In this case, when there are a plurality of cores having the highest access frequency per unit time, it is preferable to determine the global memory between the plurality of cores as the memory for storing the corresponding data.
(変形例3)
さらに、上述した実施形態では、アクセスレイテンシ情報として、各コアC0~C2から各メモリへの一種類のアクセス必要時間を用いていた。しかしながら、各コアC0~C2が各メモリからデータを読み出すためのアクセスを行うときと、各メモリへデータを書き込むためのアクセスを行うときとで、有意なアクセス必要時間の相違が有る場合には、アクセスレイテンシ情報として、読み出し必要時間と書き込み必要時間とを別々に定めてもよい。
(Modification 3)
Further, in the above-described embodiment, one type of access required time from each core C0 to C2 to each memory is used as the access latency information. However, if there is a significant difference in the required access time between when each core C0 to C2 makes an access for reading data from each memory and when making an access for writing data to each memory, As the access latency information, the read required time and the write required time may be separately determined.
(変形例4)
また、上述した実施形態では、マルチコアマイコン20を車載装置として適用する例について説明したが、マルチコアマイコン20の適用対象はこれに限られない。
(Modification example 4)
Further, in the above-described embodiment, an example in which the
1…記憶媒体、1a…自動並列化コンパイラ、2…アクセスレイテンシ情報、10…コンピュータ、10a…字句解析部、10b…構文・意味解析部、10c…依存関係解析部、10d…コア割付及びスケジューリング部、10e…コード生成部、10f…タスク実行頻度解析部、10g…データアクセス解析部、10h…格納メモリ決定部、10i…メモリマップ生成部、11…ディスプレイ、12…HDD、13…CPU、14…ROM、15…RAM、16…入力装置、17…読取部、19…コンパイラ、20…マルチコアマイコン
1 ... Storage medium, 1a ... Automatic parallelizing compiler, 2 ... Access latency information, 10 ... Computer, 10a ... Lexical analysis unit, 10b ... Syntax / semantic analysis unit, 10c ... Dependency analysis unit, 10d ... Core allocation and
Claims (18)
前記シングルプログラムに含まれる、複数の処理単位からなるタスク毎に、前記複数の処理単位の依存関係に基づき、前記複数の処理単位の前記複数のコアへの割り付けと実行順序とを決定し、この決定した前記複数のコアへの割り付け及び実行順序に従って前記複数の処理単位が実行されるように前記並列プログラムを生成する並列プログラム生成手順(10a~10e)と、
前記複数の処理単位の前記複数のコアへの割り付け情報、前記複数の処理単位がアクセスするデータに関するデータアクセス情報、前記タスクの実行頻度を示す実行頻度情報、及び前記複数のコアによる前記複数のメモリの各々へのアクセス必要時間を示すアクセス必要時間情報に基づき、前記複数のコアによる前記データへのアクセス時間が全体として短縮されるように、前記複数のメモリの中から、前記データを格納するメモリを決定する格納メモリ決定手順(10h)と、
前記格納メモリ決定手順によって決定された前記データとその格納先のメモリとの関係を示すメモリマップ(18b)を生成するメモリマップ生成手順(10i)と、を備える並列化方法。 From a single program for a single-core microcomputer having one core, a plurality of cores (C0, C1, C2) and a plurality of memories (L0, L1, L2, G0, G1) accessible by the plurality of cores can be obtained. The plurality of memories are a parallelization method for generating a parallel program (18a) for a multi-core microcomputer (20) including memories having different access required times required for access by the plurality of cores.
For each task composed of a plurality of processing units included in the single program, the allocation and execution order of the plurality of processing units to the plurality of cores are determined based on the dependency of the plurality of processing units. A parallel program generation procedure (10a to 10e) for generating the parallel program so that the plurality of processing units are executed according to the determined allocation to the plurality of cores and the execution order.
Allocation information of the plurality of processing units to the plurality of cores, data access information regarding data accessed by the plurality of processing units, execution frequency information indicating the execution frequency of the task, and the plurality of memories by the plurality of cores. A memory for storing the data from the plurality of memories so that the access time to the data by the plurality of cores is shortened as a whole based on the access required time information indicating the access required time for each of the above. Storage memory determination procedure (10h) to determine
A parallelization method comprising a memory map generation procedure (10i) for generating a memory map (18b) showing a relationship between the data determined by the storage memory determination procedure and the storage destination memory thereof.
前記複数の処理単位の前記複数のコアへの割り付け情報、複数の処理単位がアクセスするデータに関するデータアクセス情報、及び前記タスクの実行頻度情報に基づいて、単位時間当たりの前記複数のコアによる前記データへのアクセス頻度を算出するアクセス頻度算出手順(S110、S210、S310)を含み、
前記複数のコアによる前記データへのアクセス頻度と、前記複数のコアによる前記複数のメモリの各々についてのアクセス必要時間情報とに基づき、前記データを格納するメモリを決定する請求項1に記載の並列化方法。 The storage memory determination procedure is as follows.
The data by the plurality of cores per unit time based on the allocation information of the plurality of processing units to the plurality of cores, the data access information regarding the data accessed by the plurality of processing units, and the execution frequency information of the task. Including the access frequency calculation procedure (S110, S210, S310) for calculating the access frequency to
The parallel according to claim 1, wherein the memory for storing the data is determined based on the access frequency of the data by the plurality of cores and the access required time information for each of the plurality of memories by the plurality of cores. How to make it.
前記複数のコアによる前記データへのアクセス頻度と、前記複数のコアによる前記複数のメモリの各々についてのアクセス必要時間情報とに基づき、前記データを格納するメモリとして、前記単位時間当たりの前記複数のコアによるアクセス必要時間の合計が最小となるメモリを選択するメモリ選択手順(S140、S240、S340)を含み、
前記メモリ選択手順によって選択されたメモリを、前記データを格納するメモリとして決定する請求項2に記載の並列化方法。 The storage memory determination procedure is as follows.
Based on the access frequency of the data by the plurality of cores and the access required time information for each of the plurality of memories by the plurality of cores, the plurality of memories per unit time as the memory for storing the data. It includes a memory selection procedure (S140, S240, S340) that selects the memory that minimizes the total access time required by the core.
The parallelization method according to claim 2, wherein the memory selected by the memory selection procedure is determined as the memory for storing the data.
前記マルチコアマイコンの前記複数のコアが、それぞれ割り付けられた前記処理単位の実行のために前記データにアクセスする際、そのアクセス対象となるメモリは、前記メモリマップに従って定められたメモリであるマルチコアマイコン。 A multi-core microcomputer (20) that executes the parallel program generated by the parallelization method according to any one of claims 1 to 5.
When the plurality of cores of the multi-core microcomputer access the data for execution of the processing unit assigned to each, the memory to be accessed is the memory defined according to the memory map.
前記シングルプログラムに含まれる、複数の処理単位からなるタスク毎に、前記複数の処理単位の依存関係に基づき、前記複数の処理単位の前記複数のコアへの割り付けと実行順序とを決定し、この決定した前記複数のコアへの割り付け及び実行順序に従って前記複数の処理単位が実行されるように前記並列プログラムを生成する並列プログラム生成部(10a~10e)と、
前記複数の処理単位の前記複数のコアへの割り付け情報、前記複数の処理単位がアクセスするデータに関するデータアクセス情報、前記タスクの実行頻度を示す実行頻度情報、及び前記複数のコアによる前記複数のメモリの各々へのアクセス必要時間を示すアクセス必要時間情報に基づき、前記複数のコアによる前記データへのアクセス時間が全体として短縮されるように、前記複数のメモリの中から、前記データを格納するメモリを決定する格納メモリ決定部(10h)と、
前記格納メモリ決定部によって決定された前記データとその格納先のメモリとの関係を示すメモリマップ(18b)を生成するメモリマップ生成部(10i)と、を備える並列化ツール。 From a single program for a single-core microcomputer having one core, a plurality of cores (C0, C1, C2) and a plurality of memories (L0, L1, L2, G0, G1) accessible by the plurality of cores can be obtained. The plurality of memories are parallelization tools for generating a parallel program (18a) for a multi-core microcomputer (20) including memories having different access required times for access by the plurality of cores.
For each task composed of a plurality of processing units included in the single program, the allocation and execution order of the plurality of processing units to the plurality of cores are determined based on the dependency of the plurality of processing units. A parallel program generation unit (10a to 10e) that generates the parallel program so that the plurality of processing units are executed according to the determined allocation to the plurality of cores and the execution order.
Allocation information of the plurality of processing units to the plurality of cores, data access information regarding data accessed by the plurality of processing units, execution frequency information indicating the execution frequency of the task, and the plurality of memories by the plurality of cores. A memory for storing the data from the plurality of memories so that the access time to the data by the plurality of cores is shortened as a whole based on the access required time information indicating the access required time for each of the above. Storage memory determination unit (10h) that determines
A parallelization tool including a memory map generation unit (10i) that generates a memory map (18b) showing the relationship between the data determined by the storage memory determination unit and the storage destination memory thereof.
前記複数の処理単位の前記複数のコアへの割り付け情報、複数の処理単位がアクセスするデータに関するデータアクセス情報、及び前記タスクの実行頻度情報に基づいて、単位時間当たりの前記複数のコアによる前記データへのアクセス頻度を算出するアクセス頻度算出部(S110、S210、S310)を含み、
前記複数のコアによる前記データへのアクセス頻度と、前記複数のコアによる前記複数のメモリの各々についてのアクセス必要時間情報とに基づき、前記データを格納するメモリを決定する請求項7に記載の並列化ツール。 The storage memory determination unit is
The data by the plurality of cores per unit time based on the allocation information of the plurality of processing units to the plurality of cores, the data access information regarding the data accessed by the plurality of processing units, and the execution frequency information of the task. Includes an access frequency calculation unit (S110, S210, S310) that calculates the access frequency to
The parallel according to claim 7, wherein the memory for storing the data is determined based on the access frequency of the data by the plurality of cores and the access required time information for each of the plurality of memories by the plurality of cores. Tool.
前記複数のコアによる前記データへのアクセス頻度と、前記複数のコアによる前記複数のメモリの各々についてのアクセス必要時間情報とに基づき、前記データを格納するメモリとして、前記単位時間当たりの前記複数のコアによるアクセス必要時間の合計が最小となるメモリを選択するメモリ選択部(S140、S240、S340)を含み、
前記メモリ選択部によって選択されたメモリを、前記データを格納するメモリとして決定する請求項8に記載の並列化ツール。 The storage memory determination unit is
Based on the access frequency of the data by the plurality of cores and the access required time information for each of the plurality of memories by the plurality of cores, the plurality of memories per unit time as the memory for storing the data. Includes memory selection units (S140, S240, S340) that select the memory that minimizes the total access time required by the core.
The parallelization tool according to claim 8, wherein the memory selected by the memory selection unit is determined as the memory for storing the data.
前記マルチコアマイコンの前記複数のコアが、それぞれ割り付けられた前記処理単位の実行のために前記データにアクセスする際、そのアクセス対象となるメモリは、前記メモリマップに従って定められたメモリであるマルチコアマイコン。 A multi-core microcomputer (20) that executes the parallel program generated by the parallelization tool according to any one of claims 7 to 11.
When the plurality of cores of the multi-core microcomputer access the data for execution of the processing unit assigned to each, the memory to be accessed is the memory defined according to the memory map.
前記複数のコアがアクセス可能な複数のメモリ(L0、L1、L2、G0、G1)を有し、当該複数のメモリは前記複数のコアによるアクセスに要するアクセス必要時間が異なるメモリを含み、
前記並列プログラムは、前記シングルプログラムに含まれる、複数の処理単位からなるタスク毎に、前記複数の処理単位の依存関係に基づき、前記複数の処理単位の前記複数のコアへの割り付けと実行順序とが決定され、この決定された前記複数のコアへの割り付け及び実行順序に従って前記複数の処理単位が実行されるように生成されたものであり、
前記複数のコアが、それぞれ割り付けられた前記処理単位の実行のために前記複数のメモリに格納されるデータにアクセスする際、そのアクセス対象となるメモリは、前記複数の処理単位の前記複数のコアへの割り付け情報、前記複数の処理単位がアクセスするデータに関するデータアクセス情報、前記タスクの実行頻度を示す実行頻度情報、及び前記複数のコアによる前記複数のメモリの各々へのアクセス必要時間を示すアクセス必要時間情報に基づき、前記複数のコアによる前記データへのアクセス時間が全体として短縮されるように、前記複数のメモリの中から、前記データを格納するメモリが決定され、その決定された前記データと格納先のメモリとの関係を示すように生成されたメモリマップ(18b)に従って定められたメモリであるマルチコアマイコン。 A multi-core microcomputer that executes a parallel program (18a) for a multi-core microcomputer (20) having a plurality of cores (C0, C1, C2) generated from a single program for a single-core microcomputer having one core. ,
The plurality of cores have a plurality of memories (L0, L1, L2, G0, G1) that can be accessed, and the plurality of memories include memories that require different access times for access by the plurality of cores.
In the parallel program, for each task including a plurality of processing units included in the single program, the allocation and execution order of the plurality of processing units to the plurality of cores based on the dependency relationship of the plurality of processing units. Is determined, and the plurality of processing units are generated to be executed according to the determined allocation to the plurality of cores and the execution order.
When the plurality of cores access the data stored in the plurality of memories for the execution of the allocated processing unit, the memory to be accessed is the plurality of cores of the plurality of processing units. Allocation information to, data access information regarding data accessed by the plurality of processing units, execution frequency information indicating the execution frequency of the task, and access indicating the time required to access each of the plurality of memories by the plurality of cores. Based on the required time information, a memory for storing the data is determined from the plurality of memories so that the access time to the data by the plurality of cores is shortened as a whole, and the determined data is determined. A multi-core microcomputer that is a memory defined according to a memory map (18b) generated to show the relationship between the data and the storage destination memory.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2018083128A JP7059776B2 (en) | 2018-04-24 | 2018-04-24 | Parallelization method, parallelization tool, and multi-core microcontroller |
DE102019205674.1A DE102019205674A1 (en) | 2018-04-24 | 2019-04-18 | Parallelization method, parallelizing tool and multi-core microcomputer |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2018083128A JP7059776B2 (en) | 2018-04-24 | 2018-04-24 | Parallelization method, parallelization tool, and multi-core microcontroller |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2019191870A JP2019191870A (en) | 2019-10-31 |
JP7059776B2 true JP7059776B2 (en) | 2022-04-26 |
Family
ID=68105185
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2018083128A Active JP7059776B2 (en) | 2018-04-24 | 2018-04-24 | Parallelization method, parallelization tool, and multi-core microcontroller |
Country Status (2)
Country | Link |
---|---|
JP (1) | JP7059776B2 (en) |
DE (1) | DE102019205674A1 (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2008262340A (en) | 2007-04-11 | 2008-10-30 | Denso Corp | Automatic code generating device for dual core |
JP2012247827A (en) | 2011-05-25 | 2012-12-13 | Ricoh Co Ltd | Program generation device, program generation method and program |
US20160253106A1 (en) | 2015-02-27 | 2016-09-01 | Fujitsu Limited | Data deployment determination apparatus, data deployment determination program, and data deployment determination method |
JP2017107448A (en) | 2015-12-10 | 2017-06-15 | 株式会社デンソー | Parallelization method, parallelization tool, and on-vehicle device |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5856122A (en) | 1993-08-24 | 1999-01-05 | University Of Alberta | Modification of pertussis toxin |
JP6018022B2 (en) | 2013-06-14 | 2016-11-02 | 株式会社デンソー | Parallel compilation method, parallel compiler, parallel compilation device, and in-vehicle device |
-
2018
- 2018-04-24 JP JP2018083128A patent/JP7059776B2/en active Active
-
2019
- 2019-04-18 DE DE102019205674.1A patent/DE102019205674A1/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2008262340A (en) | 2007-04-11 | 2008-10-30 | Denso Corp | Automatic code generating device for dual core |
JP2012247827A (en) | 2011-05-25 | 2012-12-13 | Ricoh Co Ltd | Program generation device, program generation method and program |
US20160253106A1 (en) | 2015-02-27 | 2016-09-01 | Fujitsu Limited | Data deployment determination apparatus, data deployment determination program, and data deployment determination method |
JP2016162008A (en) | 2015-02-27 | 2016-09-05 | 富士通株式会社 | Data arrangement determination apparatus, data arrangement determination program, and data arrangement determination method |
JP2017107448A (en) | 2015-12-10 | 2017-06-15 | 株式会社デンソー | Parallelization method, parallelization tool, and on-vehicle device |
US20170168790A1 (en) | 2015-12-10 | 2017-06-15 | Denso Corporation | Parallelization method, parallelization tool, and in-vehicle apparatus |
Also Published As
Publication number | Publication date |
---|---|
JP2019191870A (en) | 2019-10-31 |
DE102019205674A1 (en) | 2019-10-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6018022B2 (en) | Parallel compilation method, parallel compiler, parallel compilation device, and in-vehicle device | |
US6718541B2 (en) | Register economy heuristic for a cycle driven multiple issue instruction scheduler | |
JP4339907B2 (en) | Optimal code generation method and compiling device for multiprocessor | |
US20100229161A1 (en) | Compile method and compiler | |
Soliman et al. | WCET-driven dynamic data scratchpad management with compiler-directed prefetching | |
US20110119660A1 (en) | Program conversion apparatus and program conversion method | |
US20100070958A1 (en) | Program parallelizing method and program parallelizing apparatus | |
US10296316B2 (en) | Parallelization method, parallelization tool, and in-vehicle apparatus | |
JP2008009957A (en) | Compiling device | |
JP2016192153A (en) | Parallelizing compilation method, parallelizing compiler, and in-vehicle device | |
Tian et al. | Speculative parallelization using state separation and multiple value prediction | |
JP2017228029A (en) | Parallelization method, parallelization tool, on-vehicle device | |
US11226798B2 (en) | Information processing device and information processing method | |
Arandi et al. | Combining compile and run-time dependency resolution in data-driven multithreading | |
JP5576605B2 (en) | Program conversion apparatus and program conversion method | |
JP7059776B2 (en) | Parallelization method, parallelization tool, and multi-core microcontroller | |
JP2008305337A (en) | Program conversion device, program conversion method, program, storage medium, debug device, debug method, and program development system | |
US20190042389A1 (en) | Design assistance device, design assistance method, and recording medium storing design assistance program | |
US11573777B2 (en) | Method and apparatus for enabling autonomous acceleration of dataflow AI applications | |
JP7095513B2 (en) | Multi-core microcomputers and in-vehicle devices | |
JP6933001B2 (en) | Parallelization method, parallelization tool | |
Kim et al. | WCET-aware function-level dynamic code management on scratchpad memory | |
JP7139633B2 (en) | Parallelization method, parallelization tool, and multicore microcomputer | |
Fang et al. | Quantifying the performance impacts of using local memory for many-core processors | |
Baloukas et al. | Mapping embedded applications on MPSoCs: the MNEMEE approach |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20210120 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20211227 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20211228 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20220221 |
|
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: 20220315 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20220328 |
|
R151 | Written notification of patent or utility model registration |
Ref document number: 7059776 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |