JP7239827B2 - Information processing device and compiler program - Google Patents

Information processing device and compiler program Download PDF

Info

Publication number
JP7239827B2
JP7239827B2 JP2019121513A JP2019121513A JP7239827B2 JP 7239827 B2 JP7239827 B2 JP 7239827B2 JP 2019121513 A JP2019121513 A JP 2019121513A JP 2019121513 A JP2019121513 A JP 2019121513A JP 7239827 B2 JP7239827 B2 JP 7239827B2
Authority
JP
Japan
Prior art keywords
instruction
matrix
loop
instructions
information
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
Application number
JP2019121513A
Other languages
Japanese (ja)
Other versions
JP2021009443A (en
Inventor
恭伸 谷村
栄次 山中
俊 鎌塚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2019121513A priority Critical patent/JP7239827B2/en
Publication of JP2021009443A publication Critical patent/JP2021009443A/en
Application granted granted Critical
Publication of JP7239827B2 publication Critical patent/JP7239827B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Devices For Executing Special Programs (AREA)

Description

本発明は、情報処理装置及びコンパイラプログラムに関する。 The present invention relates to an information processing device and a compiler program.

例えば、HPC(High Performance Conputing)等に用いられるコンパイラプログラム(以下、単にコンパイラとも呼ぶ)は、ソースコードのコンパイルを行う際に、処理速度等の処理性能を向上させるための最適化処理を行う。具体的に、コンパイラは、例えば、ソースコードに含まれるループ(以下、分割対象のループとも呼ぶ)を複数のループに分割するループ分割を行う。 For example, a compiler program (hereinafter simply referred to as a compiler) used for HPC (High Performance Computing) or the like performs optimization processing for improving processing performance such as processing speed when compiling source code. Specifically, the compiler performs loop division, for example, by dividing a loop included in a source code (hereinafter also referred to as a loop to be divided) into a plurality of loops.

これにより、コンパイラは、例えば、ハード資源不足等に起因する最適化阻害要因の発生を抑制することが可能になる。また、コンパイラは、例えば、キャッシュ効率の低下を抑制することが可能になる(例えば、特許文献1及び2参照)。 This enables the compiler to suppress the occurrence of optimization impediments caused by, for example, hardware resource shortages. In addition, the compiler can, for example, suppress deterioration in cache efficiency (see Patent Documents 1 and 2, for example).

特開2002-123563号公報JP-A-2002-123563 特開2009-104422号公報JP 2009-104422 A

ここで、上記のようなコンパイラは、例えば、分割対象のループに含まれる各命令間の依存関係をそれぞれ解析し、その解析結果に基づいて各命令を複数の分割ループにそれぞれ振り分けることにより、分析対象のループの分割を行う。 Here, the compiler as described above analyzes, for example, the dependency relationship between each instruction included in the loop to be divided, and distributes each instruction to a plurality of divided loops based on the analysis result. Split the target loop.

しかしながら、依存関係を解析する必要がある命令の組合せ数は、分割対象のループに含まれる命令の数に従って多くなる。そのため、分割対象のループに含まれる命令の数が膨大である場合、コンパイラは、ループ分割に多くの時間を要することになり、ソースコードのコンパイルを効率的に行うことができなくなる。 However, the number of combinations of instructions whose dependencies need to be analyzed increases according to the number of instructions included in the loop to be split. Therefore, if the number of instructions included in the loop to be divided is enormous, the compiler will take a long time to divide the loop, and it will be impossible to compile the source code efficiently.

そこで、一つの側面では、本発明は、ソースコードに含まれるループの分割を高速に行うことを可能とする情報処理装置及びコンパイラプログラムを提供することを目的とする。 Accordingly, in one aspect, an object of the present invention is to provide an information processing apparatus and a compiler program that enable division of loops included in source code at high speed.

実施の形態の一態様では、ソースコードから生成した中間言語のループに含まれる各命令間の依存関係を示す依存情報を生成し、生成した前記依存情報を行列に変換することによって第1行列を生成する情報生成部と、生成した前記第1行列から算出した各命令間における依存度合いに基づいて、前記ループに含まれる各命令を複数のグループに振り分けるグループ振分部と、振り分けた前記複数のグループごとに、前記ループの分割を行うループ分割部と、を有する。 In one aspect of the embodiment, dependency information indicating dependency between instructions included in a loop of the intermediate language generated from the source code is generated, and the generated dependency information is converted into a matrix to obtain the first matrix. an information generation unit for generating; a group allocation unit for allocating each instruction included in the loop to a plurality of groups based on the degree of dependence between each instruction calculated from the generated first matrix; and a loop dividing unit that divides the loop for each group.

一つの側面によれば、ソースコードに含まれるループの分割を高速に行うことを可能とする。 According to one aspect, it is possible to divide a loop included in the source code at high speed.

図1は、情報処理システム10の構成について説明する図である。FIG. 1 is a diagram illustrating the configuration of an information processing system 10. As shown in FIG. 図2は、情報処理装置1が行うコンパイル処理を説明するフローチャートである。FIG. 2 is a flowchart for explaining compilation processing performed by the information processing apparatus 1 . 図3は、情報処理装置1のハードウエア構成を説明する図である。FIG. 3 is a diagram for explaining the hardware configuration of the information processing device 1. As shown in FIG. 図4は、情報処理装置1の機能のブロック図である。FIG. 4 is a functional block diagram of the information processing apparatus 1. As shown in FIG. 図5は、S2の処理の概略について説明するフローチャートである。FIG. 5 is a flowchart for explaining the outline of the processing of S2. 図6は、S2の処理の詳細を説明するフローチャート図である。FIG. 6 is a flowchart for explaining the details of the process of S2. 図7は、S2の処理の詳細を説明するフローチャート図である。FIG. 7 is a flowchart for explaining the details of the process of S2. 図8は、S2の処理の詳細を説明するフローチャート図である。FIG. 8 is a flowchart for explaining the details of the process of S2. 図9は、中間言語22の内容を説明する具体例である。FIG. 9 is a specific example for explaining the contents of the intermediate language 22. As shown in FIG. 図10は、依存情報131の具体例について説明する図である。FIG. 10 is a diagram explaining a specific example of the dependency information 131. As shown in FIG. 図11は、依存グラフ131aの具体例について説明する図である。FIG. 11 is a diagram illustrating a specific example of the dependence graph 131a. 図12は、第1行列132の具体例について説明する図である。FIG. 12 is a diagram illustrating a specific example of the first matrix 132. As shown in FIG. 図13は、第2行列133の具体例について説明する図である。FIG. 13 is a diagram illustrating a specific example of the second matrix 133. As shown in FIG. 図14は、依存情報131の具体例について説明する図である。FIG. 14 is a diagram explaining a specific example of the dependency information 131. As shown in FIG. 図15は、第1行列132の具体例について説明する図である。FIG. 15 is a diagram illustrating a specific example of the first matrix 132. As shown in FIG. 図16は、第2行列133の具体例について説明する図である。FIG. 16 is a diagram illustrating a specific example of the second matrix 133. As shown in FIG. 図17は、依存情報131の具体例について説明する図である。FIG. 17 is a diagram explaining a specific example of the dependency information 131. As shown in FIG. 図18は、第1行列132の具体例について説明する図である。FIG. 18 is a diagram explaining a specific example of the first matrix 132. As shown in FIG. 図19は、依存グラフ131aの具体例について説明する図である。FIG. 19 is a diagram illustrating a specific example of the dependency graph 131a. 図20は、分割ループの内容を説明する具体例である。FIG. 20 is a specific example for explaining the content of the split loop. 図21は、第2の実施の形態におけるS2の処理を説明するフローチャート図である。FIG. 21 is a flowchart for explaining the process of S2 in the second embodiment. 図22は、第2の実施の形態におけるS2の処理を説明するフローチャート図である。FIG. 22 is a flowchart for explaining the processing of S2 in the second embodiment. 図23は、第2の実施の形態におけるS2の処理を説明するフローチャート図である。FIG. 23 is a flowchart for explaining the process of S2 in the second embodiment. 図24は、依存情報131の具体例について説明する図である。FIG. 24 is a diagram explaining a specific example of the dependency information 131. As shown in FIG. 図25は、第1行列132の具体例について説明する図である。FIG. 25 is a diagram illustrating a specific example of the first matrix 132. As shown in FIG. 図26は、第1行列132の具体例について説明する図である。FIG. 26 is a diagram illustrating a specific example of the first matrix 132. As shown in FIG. 図27は、依存グラフ131aの具体例について説明する図である。FIG. 27 is a diagram illustrating a specific example of the dependency graph 131a. 図28は、分割ループの内容を説明する具体例である。FIG. 28 is a specific example for explaining the content of the split loop.

[情報処理システムの構成]
初めに、情報処理システム10の構成について説明を行う。図1は、情報処理システム10の構成について説明する図である。
[Configuration of information processing system]
First, the configuration of the information processing system 10 will be described. FIG. 1 is a diagram illustrating the configuration of an information processing system 10. As shown in FIG.

図1に示すように、情報処理システム10は、例えば、1台以上の物理マシンからなる情報処理装置1と、情報処理装置1の内部または外部に設けられる記憶部130と、操作端末5とを含む。操作端末5は、例えば、ソースコードのコンパイルを行う作業者が使用するPC(Personal Computer)であり、ネットワークNWを介して情報処理装置1と接続する。 As shown in FIG. 1, the information processing system 10 includes, for example, an information processing device 1 made up of one or more physical machines, a storage unit 130 provided inside or outside the information processing device 1, and an operation terminal 5. include. The operation terminal 5 is, for example, a PC (Personal Computer) used by an operator who compiles the source code, and is connected to the information processing apparatus 1 via the network NW.

情報処理装置1(情報処理装置1において動作するコンパイラ)は、コンパイルを開始するタイミング(以下、コンパイル開始タイミングとも呼ぶ)になった場合、例えば、記憶部130に記憶されたソースコード21を取得し、取得したソースコード21のコンパイルを行う処理(以下、コンパイル処理とも呼ぶ)を行うことによって中間言語22を生成し、さらに、生成した中間言語22からオブジェクトコード23を生成する。コンパイル開始タイミングは、例えば、作業者が操作端末5を介してコンパイル処理を開始する旨の指示を行ったタイミングであってよい。 The information processing device 1 (the compiler that operates in the information processing device 1) acquires the source code 21 stored in the storage unit 130, for example, when it is time to start compiling (hereinafter also referred to as compilation start timing). , an intermediate language 22 is generated by performing a process of compiling the acquired source code 21 (hereinafter also referred to as a compilation process), and an object code 23 is generated from the generated intermediate language 22 . The compilation start timing may be, for example, the timing at which the operator issues an instruction to start compilation processing via the operation terminal 5 .

また、情報処理装置1は、オブジェクトコード23を実行するタイミング(以下、コード実行タイミングとも呼ぶ)になった場合、記憶部130に記憶されたオブジェクトコード23を取得し、コンパイル処理によって生成されたオブジェクトコード23を実行する処理(以下、コード実行処理とも呼ぶ)を行う。以下、情報処理装置1が行うコンパイル処理及びコード実行処理について説明を行う。 Further, when the timing for executing the object code 23 (hereinafter also referred to as code execution timing) comes, the information processing apparatus 1 acquires the object code 23 stored in the storage unit 130, and executes the object generated by the compilation process. Processing for executing code 23 (hereinafter also referred to as code execution processing) is performed. Compilation processing and code execution processing performed by the information processing apparatus 1 will be described below.

[情報処理装置によるコンパイル処理]
初めに、情報処理装置1が行うコンパイル処理について説明を行う。図2は、情報処理装置1が行うコンパイル処理を説明するフローチャートである。
[Compile processing by information processing device]
First, the compilation process performed by the information processing apparatus 1 will be described. FIG. 2 is a flowchart for explaining compilation processing performed by the information processing apparatus 1 .

情報処理装置1は、図2に示すように、ソースコード21の字句解析及び構文解析を行うことにより、中間言語22を生成する(S1)。そして、情報処理装置1は、例えば、生成した中間言語22を情報格納領域130に記憶する。 As shown in FIG. 2, the information processing device 1 generates an intermediate language 22 by performing lexical analysis and syntactic analysis of the source code 21 (S1). Then, the information processing device 1 stores the generated intermediate language 22 in the information storage area 130, for example.

その後、情報処理装置1は、S1の処理において生成された中間言語22の最適化を行う(S2)。具体的に、情報処理装置1は、中間言語22に含まれるループのそれぞれに対して、ループ分割等の処理を行う。 After that, the information processing device 1 optimizes the intermediate language 22 generated in the process of S1 (S2). Specifically, the information processing apparatus 1 performs processing such as loop division on each loop included in the intermediate language 22 .

続いて、情報処理装置1は、例えば、S1で最適化を行った中間言語22からオブジェクトコード23の生成を行う(S3)。そして、情報処理装置1は、例えば、生成したオブジェクトコード23を記憶部130に記憶する。 Subsequently, the information processing device 1 generates the object code 23 from the intermediate language 22 optimized in S1, for example (S3). Then, the information processing device 1 stores the generated object code 23 in the storage unit 130, for example.

ここで、図2で説明したS2の処理を行う場合、情報処理装置1は、例えば、ループに含まれる各命令間の依存関係をそれぞれ解析し、その解析結果に基づいて各命令を複数の分割ループにそれぞれ振り分けることにより、分析対象のループの分割を行う。 Here, when performing the processing of S2 described in FIG. 2, the information processing apparatus 1, for example, analyzes the dependency relationships between each instruction included in the loop, and divides each instruction into a plurality of groups based on the analysis result. The loops to be analyzed are divided by allocating them to the loops.

しかしながら、依存関係を解析する必要がある命令の組合せ数は、分割対象のループに含まれる命令の数に従って多くなる。そのため、例えば、分割対象のループに含まれる命令の数が膨大である場合、情報処理装置1は、ループ分割に多くの時間を要することになり、ソースコードのコンパイルを効率的に行うことができなくなる。 However, the number of combinations of instructions whose dependencies need to be analyzed increases according to the number of instructions included in the loop to be split. Therefore, for example, when the number of instructions included in the loop to be divided is enormous, the information processing apparatus 1 takes a long time to divide the loop, and cannot efficiently compile the source code. Gone.

そこで、本実施の形態における情報処理装置1は、ソースコード21から生成した中間言語22のループに含まれる各命令間の依存関係を示す情報(以下、依存情報とも呼ぶ)を生成し、生成した依存情報を変換することによって行列(以下、第1行列とも呼ぶ)を生成する。 Therefore, the information processing apparatus 1 according to the present embodiment generates information (hereinafter also referred to as dependency information) indicating the dependency relationship between each instruction included in the loop of the intermediate language 22 generated from the source code 21, and generates A matrix (hereinafter also referred to as a first matrix) is generated by transforming the dependency information.

そして、情報処理装置1は、生成した第1行列から算出した各命令間における依存度合いに基づいて、ループに含まれる各命令を複数のグループに振り分け、振り分けたグループごとにループの分割を行う。 Then, the information processing apparatus 1 divides the instructions included in the loop into a plurality of groups based on the degree of dependence between the instructions calculated from the generated first matrix, and divides the loop into each divided group.

すなわち、本実施の形態における情報処理装置1は、依存情報から生成された第1行列を用いる演算を行うことで、分割対象のループに含まれる命令の組合せごとの依存関係の解析等を行うことなく、各命令の振り分け先を決定する。 That is, the information processing apparatus 1 according to the present embodiment performs calculations using the first matrix generated from the dependency information, thereby analyzing the dependency relationship for each combination of instructions included in the loop to be divided. Instead, determine the allocation destination of each instruction.

これにより、情報処理装置1は、ループ分割を効率的に行うことが可能になり、ソースコード21のコンパイルに要する時間を短縮することが可能になる。 As a result, the information processing apparatus 1 can efficiently perform loop division, and can shorten the time required to compile the source code 21 .

また、情報処理装置1は、分割対象のループに含まれる各命令の振り分け先を計算によって決定することで、異なる分割ループに含まれる命令間の依存関係が最も疎になるループ分割の方法を特定することが可能になる。そのため、情報処理装置1は、特定した方法に従ってループの分割を行うことにより、ソースコード21から生成されるオブジェクトコード23の実行時間についても短縮させることが可能になる。 In addition, the information processing apparatus 1 determines the allocation destination of each instruction included in the loop to be split by calculation, thereby specifying the method of loop splitting that minimizes the dependency relationship between instructions included in different split loops. it becomes possible to Therefore, the information processing apparatus 1 can shorten the execution time of the object code 23 generated from the source code 21 by dividing the loop according to the specified method.

[情報処理システムのハードウエア構成]
次に、情報処理システム10のハードウエア構成について説明する。図3は、情報処理装置1のハードウエア構成を説明する図である。
[Hardware configuration of information processing system]
Next, the hardware configuration of the information processing system 10 will be described. FIG. 3 is a diagram for explaining the hardware configuration of the information processing device 1. As shown in FIG.

情報処理装置1は、図3に示すように、プロセッサであるCPU101と、メモリ102と、外部インターフェース(I/Oユニット)103と、記憶媒体104とを有する。各部は、バス105を介して互いに接続される。 The information processing apparatus 1 has a CPU 101 as a processor, a memory 102, an external interface (I/O unit) 103, and a storage medium 104, as shown in FIG. Each unit is connected to each other via a bus 105 .

記憶媒体104は、例えば、コンパイル処理を行うためのプログラム110(コンパイラ)を記憶するプログラム格納領域(図示しない)を有する。また、記憶媒体104は、例えば、コンパイル処理を行う際に用いられる情報を記憶する記憶部130(以下、情報格納領域130とも呼ぶ)を有する。なお、記憶媒体104は、例えば、HDD(Hard Disk Drive)やSSD(Sokid State Drive)であってよい。 The storage medium 104 has, for example, a program storage area (not shown) that stores a program 110 (compiler) for performing compilation processing. The storage medium 104 also has a storage unit 130 (hereinafter also referred to as an information storage area 130) that stores information used when performing compilation processing, for example. Note that the storage medium 104 may be, for example, an HDD (Hard Disk Drive) or an SSD (Sokid State Drive).

CPU101は、記憶媒体104からメモリ102にロードされたプログラム110を実行してコンパイル処理を行う。 The CPU 101 executes the program 110 loaded from the storage medium 104 to the memory 102 to perform compilation processing.

また、外部インターフェース103は、例えば、操作端末5と通信を行う。 Also, the external interface 103 communicates with the operation terminal 5, for example.

[情報処理システムの機能]
次に、情報処理システム10の機能について説明を行う。図4は、情報処理装置1の機能のブロック図である。
[Functions of information processing system]
Next, functions of the information processing system 10 will be described. FIG. 4 is a functional block diagram of the information processing apparatus 1. As shown in FIG.

情報処理装置1は、図4に示すように、例えば、CPU101やメモリ102等のハードウエアとプログラム110とが有機的に協働することにより、分割判定部111と、情報生成部112と、情報管理部113と、グループ振分部114と、ループ分割部115と、近接判定部116とを含む各種機能を実現する。 As shown in FIG. 4 , the information processing apparatus 1 includes, for example, hardware such as a CPU 101 and a memory 102 and a program 110 organically cooperate to achieve a division determination unit 111, an information generation unit 112, an information Various functions including a management unit 113, a group allocation unit 114, a loop division unit 115, and a proximity determination unit 116 are realized.

また、情報処理装置1は、例えば、図4に示すように、依存情報131と、第1行列132と、第2行列133とを情報格納領域130に記憶する。 The information processing apparatus 1 also stores dependency information 131, a first matrix 132, and a second matrix 133 in the information storage area 130, for example, as shown in FIG.

分割判定部111は、例えば、ソースコード21から生成した中間言語22に含まれる各ループについてループ分割を行うか否かを判定する。具体的に、分割判定部111は、例えば、実行時に用いられるレジスタ数やストリーム数がCPU101のレジスタ数やストリーム数を超えるループが中間言語22に含まれている場合、そのループについてループ分割を行う旨の判定を行う。 The division determination unit 111 , for example, determines whether or not each loop included in the intermediate language 22 generated from the source code 21 is to be divided into loops. Specifically, for example, if the intermediate language 22 includes a loop in which the number of registers and the number of streams used at the time of execution exceed the number of registers and the number of streams of the CPU 101, the division determination unit 111 divides the loop. Make a judgment to that effect.

情報生成部112は、分割対象のループに含まれる各命令間の依存関係を示す依存情報131を生成する。具体的に、情報生成部112は、分割判定部111がループ分割を行う旨の判定を行ったループが存在する場合、そのループに対応する依存情報131を生成する。また、情報生成部112は、生成した依存情報131を行列に変換することによって第1行列132を生成する。 The information generation unit 112 generates dependency information 131 indicating dependency relationships between instructions included in a loop to be divided. Specifically, when there is a loop for which the division determination unit 111 has determined to divide the loop, the information generation unit 112 generates the dependency information 131 corresponding to the loop. The information generation unit 112 also generates the first matrix 132 by converting the generated dependency information 131 into a matrix.

情報管理部113は、例えば、情報生成部112が生成した依存情報131や第1行列132を情報格納領域130に記憶する。 The information management unit 113 stores, for example, the dependency information 131 and the first matrix 132 generated by the information generation unit 112 in the information storage area 130 .

グループ振分部114は、情報生成部112が生成した第1行列132から算出した各命令間における依存度合いに基づいて、分割対象のループに含まれる各命令を複数のグループに振り分ける。 The grouping unit 114 sorts the instructions included in the loop to be divided into a plurality of groups based on the degree of dependence between the instructions calculated from the first matrix 132 generated by the information generating unit 112 .

ループ分割部115は、グループ振分部114が振り分けたグループごとに、分割対象のループについてのループ分割を行う。 The loop dividing unit 115 divides the loops to be divided for each group sorted by the group sorting unit 114 .

近接判定部116は、例えば、メモリ102内において近接するアドレスに格納された各データに対してアクセスを行う複数の命令が分割対象のループに含まれているか否かを判定する。 The proximity determination unit 116 determines, for example, whether or not the loop to be divided includes a plurality of instructions that access data stored at adjacent addresses in the memory 102 .

そして、例えば、メモリ102内において近接するアドレスに格納された各データに対してアクセスを行う複数の命令が分割対象のループに含まれていると近接判定部116が判定した場合、情報生成部112は、分割対象のループに含まれる各命令間の依存関係と、各命令がアクセスするデータのメモリ102内における位置関係とに対応する依存情報131を生成する。第2行列133の説明については後述する。 Then, for example, when the proximity determination unit 116 determines that the loop to be divided includes a plurality of instructions that access data stored at adjacent addresses in the memory 102, the information generation unit 112 generates dependency information 131 corresponding to the dependency relationship between instructions included in the loop to be divided and the positional relationship in the memory 102 of data accessed by each instruction. A description of the second matrix 133 will be given later.

[第1の実施の形態の概略]
次に、第1の実施の形態の概略について説明する。具体的に、図2で説明したS2の処理の概略について説明する。図5は、S2の処理の概略について説明するフローチャートである。
[Outline of the first embodiment]
Next, an outline of the first embodiment will be described. Concretely, the outline of the processing of S2 explained in FIG. 2 will be explained. FIG. 5 is a flowchart for explaining the outline of the processing of S2.

情報処理装置1の情報生成部112は、ソースコード21から生成した中間言語22のループに含まれる各命令間の依存関係を示す依存情報131を生成する(S11)。 The information generation unit 112 of the information processing device 1 generates dependency information 131 indicating dependency relationships between instructions included in the loop of the intermediate language 22 generated from the source code 21 (S11).

そして、情報生成部112は、S11の処理で生成した依存情報131を行列に変換することによって第1行列132を生成する(S12)。 Then, the information generation unit 112 generates the first matrix 132 by converting the dependency information 131 generated in the process of S11 into a matrix (S12).

続いて、情報処理装置1のグループ振分部114は、S12の処理で生成した第1行列132から算出した各命令間の依存度合いに基づいて、分割対象のループに含まれる各命令を複数のグループに振り分ける(S13)。 Subsequently, the grouping unit 114 of the information processing device 1 divides each instruction included in the loop to be divided into a plurality of groups based on the degree of dependence between each instruction calculated from the first matrix 132 generated in the process of S12. Allocate to groups (S13).

その後、情報処理装置のループ分割部115は、S13の処理で振り分けたグループごとに、分割対象のループの分割を行う(S14)。 After that, the loop dividing unit 115 of the information processing apparatus divides the loop to be divided for each group divided in the process of S13 (S14).

これにより、情報処理装置1は、ループ分割を効率的に行うことが可能になり、ソースコード21のコンパイルに要する時間を短縮することが可能になる。 As a result, the information processing apparatus 1 can efficiently perform loop division, and can shorten the time required to compile the source code 21 .

また、情報処理装置1は、分割対象のループに含まれる各命令の振り分け先を計算によって決定することで、異なる分割ループに含まれる命令間の依存関係が最も疎になるループ分割の方法を特定することが可能になる。そのため、情報処理装置1は、特定した方法に従ってループの分割を行うことにより、ソースコード21から生成されるオブジェクトコード23の実行時間についても短縮させることが可能になる。 In addition, the information processing apparatus 1 determines the allocation destination of each instruction included in the loop to be split by calculation, thereby specifying the method of loop splitting that minimizes the dependency relationship between instructions included in different split loops. it becomes possible to Therefore, the information processing apparatus 1 can shorten the execution time of the object code 23 generated from the source code 21 by dividing the loop according to the specified method.

[第1の実施の形態の詳細]
次に、第1の実施の形態の詳細について説明する。図6から図9は、図2で説明したS2の処理の詳細を説明するフローチャート図である。また、図9から図20は、S2の処理の詳細を説明する図である。
[Details of the first embodiment]
Next, details of the first embodiment will be described. 6 to 9 are flowcharts for explaining the details of the process of S2 explained in FIG. 9 to 20 are diagrams for explaining the details of the processing of S2.

情報処理装置1の分割判定部111は、図6に示すように、情報格納領域130に記憶された中間言語22に、分割対象のループが含まれているか否かを判定する(S21)。以下、中間言語22の具体例について説明を行う。 As shown in FIG. 6, the division determination unit 111 of the information processing device 1 determines whether or not the intermediate language 22 stored in the information storage area 130 includes a loop to be divided (S21). A specific example of the intermediate language 22 will be described below.

[中間言語の具体例]
図9は、中間言語22の内容を説明する具体例である。具体的に、図9は、ソースコード21をアセンブラ命令相当で表現した場合の中間言語22を説明する具体例である。
[Concrete example of intermediate language]
FIG. 9 is a specific example for explaining the contents of the intermediate language 22. As shown in FIG. Specifically, FIG. 9 is a specific example for explaining the intermediate language 22 when the source code 21 is expressed in terms of assembler instructions.

図9に示す中間言語22は、変数reg_iに初期値として1を設定することを示す命令である「mov reg_i,1」と、ループの開始位置を示すラベルである「LABEL1:」とを含む。 The intermediate language 22 shown in FIG. 9 includes an instruction "mov reg_i, 1" indicating setting 1 as an initial value to the variable reg_i and a label "LABEL1:" indicating the loop start position.

また、図9に示す中間言語22は、配列Aのreg_i番目に格納されている値を変数reg1に設定することを示す命令である「load reg1,mem“A(reg_i)”」と、配列Bのreg_i番目に格納されている値を変数reg2に設定することを示す命令である「load reg2,mem“B(reg_i)”」とを含む。 Also, the intermediate language 22 shown in FIG. 'load reg2, mem "B(reg_i)"', which is an instruction indicating to set the value stored in the reg_i-th position of the variable reg2 to the variable reg2.

また、図9に示す中間言語22は、変数reg1に設定されている値と変数reg2に設定されている値とを加算することによって算出した値を、変数reg3に設定することを示す命令である「add reg3,reg1,reg2」と、配列Cのreg_i番目に格納されている値を変数reg4に設定することを示す命令である「load reg4,mem“C(reg_i)”」とを含む。 Also, the intermediate language 22 shown in FIG. 9 is an instruction indicating that the value calculated by adding the value set in the variable reg1 and the value set in the variable reg2 is set in the variable reg3. It includes “add reg3, reg1, reg2” and “load reg4, mem “C(reg_i)”, which is an instruction indicating to set the value stored in the reg_i-th position of the array C to the variable reg4.

また、図9に示す中間言語22は、配列Dのreg_i番目に格納されている値を変数reg5に設定することを示す命令である「load reg5,mem“D(reg_i)”」と、配列Cのreg_i+10番目に格納されているデータを変数reg6に設定することを示す命令である「load reg6,mem“C(reg_i+10)”」とを含む。 Also, the intermediate language 22 shown in FIG. "load reg6, mem"C(reg_i+10)", which is an instruction indicating to set the data stored in the reg_i+10th position of the variable reg6 to the variable reg6.

また、配列Eのreg_i番目に格納されている値を変数reg7に設定することを示す命令である「load reg7,mem“E(reg_i)”」と、変数reg3に設定されている値と変数reg4に設定されている値とを加算することによって算出した値を、変数reg8に設定することを示す命令である「add reg8,reg3,reg4」とを含む。 Also, "load reg7, mem"E(reg_i)", which is an instruction indicating that the value stored in the reg_i-th position of the array E is set to the variable reg7, and the value set in the variable reg3 and the variable reg4 "add reg8, reg3, reg4", which is an instruction for setting the variable reg8 to the value calculated by adding the value set to .

また、図9に示す中間言語22は、変数reg4に設定されている値と変数reg8に設定されている値とを加算することによって算出した値を、変数reg9に設定することを示す命令である「add reg9,reg4,reg8」と、変数reg3に設定されている値と変数reg5に設定されている値とを乗算することによって算出した値に、変数reg9に設定されている値を加算することによって算出した値を、変数reg10に設定に設定することを示す命令である「madd reg10,reg3,reg5,reg9」とを含む。 Also, the intermediate language 22 shown in FIG. 9 is an instruction indicating that the value calculated by adding the value set in the variable reg4 and the value set in the variable reg8 is set in the variable reg9. Adding the value set in the variable reg9 to the value calculated by multiplying the value set in the variable reg3 and the value set in the variable reg5 with "add reg9, reg4, reg8" and "madd reg10, reg3, reg5, reg9" which is an instruction indicating to set the value calculated by the variable reg10.

また、図9に示す中間言語22は、変数reg5に設定されている値と変数reg6に設定されている値とを乗算することによって算出した値に、変数reg10に設定されている値を加算することによって算出した値を、変数reg11に設定することを示す命令である「madd reg11,reg5,reg6,reg10」と、変数reg7に設定されている値と変数reg11に設定されている値とを加算することによって算出した値を、変数reg12に設定することを示す命令である「add reg12,reg7,reg11」とを含む。 Further, the intermediate language 22 shown in FIG. 9 adds the value set in the variable reg10 to the value calculated by multiplying the value set in the variable reg5 and the value set in the variable reg6. ``madd reg11, reg5, reg6, reg10'', which is an instruction indicating to set the value calculated by and "add reg12, reg7, reg11" which is an instruction to set the value calculated by

また、図9に示す中間言語22は、変数reg12に設定されている値を配列Fのreg_i番目に格納することを示す命令である「store mem“F(reg_i)”,reg12」と、変数reg_iに設定されている値に1を加算することによって算出した値を、変数reg_iに設定することを示す命令である「add reg_i,reg_i,1」とを含む。 Also, the intermediate language 22 shown in FIG. 9 stores a command “store mem “F(reg_i)”, reg12” indicating that the value set in the variable reg12 is stored in the reg_i-th position of the array F, and the variable reg_i ``add reg_i, reg_i, 1'', which is an instruction indicating to set the variable reg_i to a value calculated by adding 1 to the value set to .

さらに、図9に示す中間言語22は、変数reg_iに設定されている値と100とを比較することを示す命令である「cmp reg_i,100」と、変数reg_iに設定されている値が100以下である場合、ループの開始位置を示す「LABEL1:」に分岐し、変数reg_iに設定されている値が100を上回る場合、ループを終了することを示す命令である「ble icc,LABAL1」とを含む。 Furthermore, the intermediate language 22 shown in FIG. 9 contains the command "cmpre reg_i, 100" indicating that the value set in the variable reg_i is compared with 100, and the value set in the variable reg_i is 100 or less. , branch to "LABEL1:" indicating the start position of the loop, and "ble icc, LABAL1", which is an instruction indicating to end the loop if the value set in the variable reg_i exceeds 100. include.

なお、以下、図9に示す中間言語22において各命令の左端に記載されている番号を、各命令の命令番号とも呼ぶ。また、以下、命令番号が「1」から「13」である命令のそれぞれを命令1から命令13とも呼ぶ。 In the intermediate language 22 shown in FIG. 9, the number written at the left end of each instruction is hereinafter also referred to as the instruction number of each instruction. Further, the instructions having the instruction numbers “1” to “13” are also called “instruction 1” to “instruction 13” below.

図6に戻り、情報格納領域130に記憶された中間言語22に、分割対象のループが含まれている場合(S22のYES)、情報処理装置1の情報生成部112は、S21の処理で分割対象のループであると判定したループに含まれる各命令間の依存関係を示す依存情報131を生成する(S23)。以下、依存情報131の具体例について説明を行う。 Returning to FIG. 6, when the intermediate language 22 stored in the information storage area 130 includes a loop to be divided (YES in S22), the information generation unit 112 of the information processing device 1 performs division in the process of S21. Dependency information 131 indicating the dependency relationship between instructions included in the loop determined to be the target loop is generated (S23). A specific example of the dependency information 131 will be described below.

[依存情報の具体例]
図10は、依存情報131の具体例について説明する図である。
[Specific example of dependency information]
FIG. 10 is a diagram explaining a specific example of the dependency information 131. As shown in FIG.

図10に示す依存情報131は、中間言語22に含まれる各命令の命令番号が記憶される「命令番号」と、各命令と依存関係にある命令の命令番号についてのリストである「データ依存リスト」と、各命令が含まれるグループ(分割ループ)の名称が記憶される「グループ名」とを項目として有する。 The dependency information 131 shown in FIG. 10 includes an "instruction number" in which the instruction number of each instruction included in the intermediate language 22 is stored, and a "data dependency list" that is a list of instruction numbers of instructions that are dependent on each instruction. ” and “group name” in which the name of the group (divided loop) containing each instruction is stored.

具体的に、図9で説明した中間言語22において、命令1で値が設定された変数reg1は、命令3のみにおいて参照されている。そのため、情報生成部112は、例えば、図10に示すように、「命令番号」が「1」である情報の「データ依存リスト」に「3」を記憶する。 Specifically, in the intermediate language 22 described with reference to FIG. 9, the variable reg1 whose value is set in the instruction 1 is referenced only in the instruction 3. Therefore, the information generator 112 stores "3" in the "data dependency list" of the information whose "instruction number" is "1", as shown in FIG. 10, for example.

また、図9で説明した中間言語22において、命令2で値が設定された変数reg2は、命令3のみにおいて参照されている。そのため、情報生成部112は、例えば、図10に示すように、「命令番号」が「2」である情報の「データ依存リスト」に「3」を記憶する。 Also, in the intermediate language 22 described with reference to FIG. 9, the variable reg2 whose value is set in the instruction 2 is referenced only in the instruction 3. Therefore, the information generator 112 stores "3" in the "data dependence list" of the information whose "instruction number" is "2", as shown in FIG. 10, for example.

さらに、図9で説明した中間言語22において、命令3は、命令1で値が設定された変数reg1と命令2で値が設定された変数reg2とを参照している。また、図9で説明した中間言語22において、命令3で値が設定された変数reg3は、命令8及び命令10において参照されている。そのため、情報生成部112は、例えば、図10に示すように、「命令番号」が「3」である情報の「データ依存リスト」に「1」、「2」、「8」及び「10」を記憶する。 Furthermore, in the intermediate language 22 described with reference to FIG. 9, the instruction 3 refers to the variable reg1 whose value is set by the instruction 1 and the variable reg2 whose value is set by the instruction 2. FIG. Also, in the intermediate language 22 described with reference to FIG. 9, the variable reg3 whose value is set in the instruction 3 is referred to in the instructions 8 and 10 . Therefore, for example, as shown in FIG. 10, the information generating unit 112 adds "1", "2", "8" and "10" to the "data dependency list" of the information whose "instruction number" is "3". memorize

また、情報生成部112は、例えば、図10に示すように、各命令に対応する「グループ名」の初期値として各命令の命令番号を記憶する。図10に含まれる他の情報についての説明は省略する。 For example, as shown in FIG. 10, the information generator 112 stores the instruction number of each instruction as the initial value of the "group name" corresponding to each instruction. Description of other information included in FIG. 10 is omitted.

なお、情報生成部112は、S23の処理において、依存情報131に含まれる内容に対応する依存グラフ131aを生成するものであってもよい。以下、依存グラフ131aの具体例について説明を行う。 The information generator 112 may generate the dependency graph 131a corresponding to the contents included in the dependency information 131 in the process of S23. A specific example of the dependency graph 131a will be described below.

[依存グラフの具体例(1)]
図11は、依存グラフ131aの具体例について説明する図である。以下、双方向の関係を示すエッジを双方向エッジとも呼び、単方向の関係を示すエッジを単方向エッジとも呼ぶ。
[Specific example of dependency graph (1)]
FIG. 11 is a diagram illustrating a specific example of the dependence graph 131a. Hereinafter, an edge indicating a bidirectional relationship is also referred to as a bidirectional edge, and an edge indicating a unidirectional relationship is also referred to as a unidirectional edge.

具体的に、図11に示す依存グラフ131aでは、命令1に対応するノードと命令3に対応するノードとの間、命令2に対応するノードと命令3に対応するノードとの間、命令3に対応するノードと命令8に対応するノードとの間、命令3に対応するノードと命令10に対応するノードとの間、及び、命令4に対応するノードと命令8に対応するノードとの間のそれぞれに双方向エッジが設定されている。また、図11に示す依存グラフ131aでは、命令4に対応するノードと命令9に対応するノードとの間、命令5に対応するノードと命令10に対応するノードとの間、命令5に対応するノードと命令11に対応するノードとの間、命令6に対応するノードと命令11に対応するノードとの間、及び、命令7に対応するノードと命令12に対応するノードとの間のそれぞれに双方向エッジが設定されている。さらに、図11に示す依存グラフ131aでは、命令8に対応するノードと命令9に対応するノードとの間、命令9に対応するノードと命令10に対応するノードとの間、命令10に対応するノードと命令11に対応するノードとの間、命令11に対応するノードと命令12に対応するノードとの間、及び、命令12に対応するノードと命令13に対応するノードとの間のそれぞれに双方向エッジが設定されている。すなわち、図11に示す依存グラフ131aには、15本の双方向エッジが設定されている。 Specifically, in the dependency graph 131a shown in FIG. Between the corresponding node and the node corresponding to instruction 8, between the node corresponding to instruction 3 and the node corresponding to instruction 10, and between the node corresponding to instruction 4 and the node corresponding to instruction 8 A bidirectional edge is set for each. Also, in the dependency graph 131a shown in FIG. 11, between the node corresponding to the instruction 4 and the node corresponding to the instruction 9, between the node corresponding to the instruction 5 and the node corresponding to the instruction 10, and Between the node corresponding to the instruction 11 and the node corresponding to the instruction 11, between the node corresponding to the instruction 6 and the node corresponding to the instruction 11, and between the node corresponding to the instruction 7 and the node corresponding to the instruction 12 A bidirectional edge is set. Furthermore, in the dependency graph 131a shown in FIG. 11, between the node corresponding to the instruction 8 and the node corresponding to the instruction 9, between the node corresponding to the instruction 9 and the node corresponding to the instruction 10, and between the node corresponding to the instruction 10 between the node corresponding to instruction 11 and the node corresponding to instruction 11, between the node corresponding to instruction 11 and the node corresponding to instruction 12, and between the node corresponding to instruction 12 and the node corresponding to instruction 13. A bidirectional edge is set. That is, fifteen bidirectional edges are set in the dependency graph 131a shown in FIG.

図10で説明した依存情報131において、例えば、「命令番号」が「1」である情報の「データ依存リスト」には、「3」が記憶されており、「命令番号」が「3」である情報の「データ依存リスト」には、「1」が記憶されている。そのため、情報生成部112は、例えば、図11に示すように、命令1に対応するノードと命令3に対応するノードとの間に双方向エッジを設定する。 In the dependency information 131 described with reference to FIG. 10, for example, "3" is stored in the "data dependency list" of information whose "instruction number" is "1". "1" is stored in the "data dependency list" of certain information. Therefore, the information generation unit 112 sets a bidirectional edge between the node corresponding to the instruction 1 and the node corresponding to the instruction 3, as shown in FIG. 11, for example.

また、図10で説明した依存情報131において、例えば、「命令番号」が「2」である情報の「データ依存リスト」には、「3」が記憶されており、「命令番号」が「3」である情報の「データ依存リスト」には、「2」が記憶されている。そのため、情報生成部112は、例えば、図11に示すように、命令2に対応するノードと命令3に対応するノードとの間に双方向エッジを設定する。 Further, in the dependency information 131 explained with reference to FIG. 10, for example, "3" is stored in the "data dependency list" of the information whose "instruction number" is "2", and "3" is stored in the "instruction number". "2" is stored in the "data dependence list" of the information ". Therefore, the information generator 112 sets a bidirectional edge between the node corresponding to the instruction 2 and the node corresponding to the instruction 3, as shown in FIG. 11, for example.

さらに、図10で説明した依存情報131において、例えば、「命令番号」が「3」である情報の「データ依存リスト」には、「8」が記憶されており、「命令番号」が「8」である情報の「データ依存リスト」には、「3」が記憶されている。そのため、情報生成部112は、例えば、図11に示すように、命令3に対応するノードと命令8に対応するノードとの間に双方向エッジを設定する。図11に含まれる他の情報についての説明は省略する。 Further, in the dependency information 131 described with reference to FIG. 10, for example, "8" is stored in the "data dependency list" of information whose "instruction number" is "3", and "8" is stored in the "instruction number". " is stored in the "data dependency list" of the information "3". Therefore, the information generator 112 sets a bidirectional edge between the node corresponding to the instruction 3 and the node corresponding to the instruction 8, as shown in FIG. 11, for example. Description of other information included in FIG. 11 is omitted.

図6に戻り、情報生成部112は、S23の処理で生成した依存情報131を行列に変換することによって第1行列132を生成する(S24)。以下、第1行列132の具体例について説明を行う。 Returning to FIG. 6, the information generator 112 generates the first matrix 132 by converting the dependency information 131 generated in the process of S23 into a matrix (S24). A specific example of the first matrix 132 will be described below.

[第1行列の具体例]
図12は、第1行列132の具体例について説明する図である。
[Specific example of the first matrix]
FIG. 12 is a diagram illustrating a specific example of the first matrix 132. As shown in FIG.

図12に示す第1行列132において、「1」から「13」のそれぞれに対応する行は、命令1から命令13のそれぞれに対応する行であり、「1」から「13」のそれぞれに対応する列は、命令1から命令13のそれぞれに対応する列である。また、図12に示す第1行列132の各要素(各欄)には、行に対応する命令と列に対応する命令との間に依存関係が存在することを示す値である「1」、または、行に対応する命令と列に対応する命令との間に依存関係が存在しないことを示す値である「0」が記憶される。 In the first matrix 132 shown in FIG. 12, the rows corresponding to "1" to "13" respectively correspond to the instructions 1 to 13, respectively, and correspond to "1" to "13" respectively. The corresponding columns are columns corresponding to the instructions 1 to 13, respectively. Also, each element (each column) of the first matrix 132 shown in FIG. Alternatively, a value "0" is stored which indicates that there is no dependency between the row-corresponding instruction and the column-corresponding instruction.

具体的に、図10に示す依存情報131において、「命令番号」が「1」である情報の「データ依存リスト」には、「3」が記憶されている。そのため、情報生成部112は、図12に示すように、例えば、命令1に対応する行に含まれる欄のうち、命令3に対応する列に含まれる欄に「1」を記憶する。 Specifically, in the dependency information 131 shown in FIG. 10, "3" is stored in the "data dependency list" of the information whose "instruction number" is "1". Therefore, the information generator 112 stores "1" in the column included in the column corresponding to the command 3 among the columns included in the row corresponding to the command 1, as shown in FIG.

また、図10に示す依存情報131において、「命令番号」が「2」である情報の「データ依存リスト」には、「3」が記憶されている。そのため、情報生成部112は、図12に示すように、例えば、命令2に対応する行に含まれる欄のうち、命令3に対応する列に含まれる欄に「1」を記憶する。 Further, in the dependency information 131 shown in FIG. 10, "3" is stored in the "data dependency list" of the information whose "instruction number" is "2". Therefore, the information generator 112 stores "1" in the column included in the column corresponding to the command 3 among the columns included in the row corresponding to the command 2, as shown in FIG.

さらに、図10に示す依存情報131において、「命令番号」が「3」である情報の「データ依存リスト」には、「1」、「2」、「8」及び「10」が記憶されている。そのため、情報生成部112は、図12に示すように、例えば、命令3に対応する行に含まれる欄のうち、命令1に対応する列に含まれる欄と、命令2に対応する列に含まれる欄と、命令8に対応する列に含まれる欄と、命令10に対応する列に含まれる欄とのそれぞれに「1」を記憶する。図12に含まれる他の情報についての説明は省略する。 Further, in the dependency information 131 shown in FIG. 10, '1', '2', '8' and '10' are stored in the 'data dependency list' of the information whose 'instruction number' is '3'. there is Therefore, as shown in FIG. "1" is stored in each of the column corresponding to the instruction 8, the column included in the column corresponding to the instruction 10, and the column included in the column corresponding to the instruction 10. Description of other information included in FIG. 12 is omitted.

図6に戻り、情報処理装置1のグループ振分部114は、S24の処理で生成した第1行列132から、各命令間における依存度合いを示す第2行列133を生成する(S25)。以下、第2行列の具体例について説明を行う。 Returning to FIG. 6, the grouping unit 114 of the information processing device 1 generates a second matrix 133 indicating the degree of dependency between instructions from the first matrix 132 generated in the process of S24 (S25). A specific example of the second matrix will be described below.

[第2行列の具体例]
図13は、第2行列133の具体例について説明する図である。
[Specific example of the second matrix]
FIG. 13 is a diagram illustrating a specific example of the second matrix 133. As shown in FIG.

図13に示す第2行列133において、「1」から「13」のそれぞれに対応する行は、命令1から命令13のそれぞれに対応する行であり、「1」から「13」のそれぞれに対応する列は、命令1から命令13のそれぞれに対応する列である。また、図13に示す第2行列133の各要素(各欄)には、行に対応する命令と列に対応する命令との間の依存度合いが記憶される。 In the second matrix 133 shown in FIG. 13, the rows corresponding to "1" to "13" respectively correspond to the instructions 1 to 13, respectively, and correspond to "1" to "13" respectively. The corresponding columns are columns corresponding to the instructions 1 to 13, respectively. Each element (each column) of the second matrix 133 shown in FIG. 13 stores the degree of dependence between the instruction corresponding to the row and the instruction corresponding to the column.

ここで、各命令間の依存度合いは、例えば、Newmanアルゴリズムによって算出されるクラスタリング指標値であってよい。この場合、グループ振分部114は、例えば、以下の式1を用いることによってクラスタリング指標値ΔQを算出する。 Here, the degree of dependence between instructions may be, for example, a clustering index value calculated by the Newman algorithm. In this case, the grouping unit 114 calculates the clustering index value ΔQ using, for example, Equation 1 below.

ΔQ=eij+eji-2a=2(eij-a) (式1) ΔQ=e ij +e ji −2a ia j =2(e ij −a ia j ) (equation 1)

上記の式1において、変数aは、図11で説明した依存グラフ131aに含まれる単方向エッジのうち、命令iに対応するノードと他の命令に対するノードとの間における単方向エッジの数の割合を示し、変数aは、図11で説明した依存グラフ131aに含まれる単方向エッジのうち、命令jに対応するノードと他の命令に対するノードとの間における単方向エッジの数の割合を示す。また、式1において、変数eijは、図11で説明した依存グラフ131aに含まれる単方向エッジのうち、命令iに対応するノードと命令jに対応するノードとの間における単方向エッジの数の割合を示す。 In Equation 1 above, the variable a i is the number of unidirectional edges between the node corresponding to the instruction i and the nodes corresponding to other instructions among the unidirectional edges included in the dependency graph 131a described with reference to FIG. The variable aj indicates the ratio of the number of unidirectional edges between the node corresponding to the instruction j and the nodes corresponding to other instructions among the unidirectional edges included in the dependency graph 131a described with reference to FIG. show. In Expression 1, the variable e ij is the number of unidirectional edges between the node corresponding to the instruction i and the node corresponding to the instruction j among the unidirectional edges included in the dependency graph 131a described with reference to FIG. indicates the percentage of

具体的に、図11で説明した依存グラフ131aが示す状態は、双方向エッジが15本含まれている状態であり、単方向エッジが30本含まれている場合と同じ状態である。また、図11で説明した依存グラフ131aにおいて、命令12に対応するノードと他のノードとの間における単方向エッジの数、命令13に対応するノードと他のノードとの間における単方向エッジの数及び命令12に対応するノードと命令13に対応するノードとの間における単方向エッジの数は、それぞれ3本、1本及び1本である。そのため、グループ振分部114は、例えば、命令iが命令12であって命令jが命令13である場合、以下の式(2)のように、クラスタリング指標値ΔQとして「0.060」を算出する。 Specifically, the state indicated by the dependency graph 131a described with reference to FIG. 11 is a state in which 15 bidirectional edges are included, which is the same as the state in which 30 unidirectional edges are included. In addition, in the dependency graph 131a described with reference to FIG. 11, the number of unidirectional edges between the node corresponding to instruction 12 and other nodes, the number of unidirectional edges between the node corresponding to instruction 13 and other nodes The number and number of unidirectional edges between the node corresponding to number and instruction 12 and the node corresponding to instruction 13 are 3, 1 and 1, respectively. Therefore, for example, when the instruction i is the instruction 12 and the instruction j is the instruction 13, the grouping unit 114 calculates "0.060" as the clustering index value ΔQ as shown in the following equation (2). do.

2*((1/30)-(3/30)*(1/30))=0.06 ・・・(式2) 2*((1/30)-(3/30)*(1/30))=0.06 (Formula 2)

そのため、グループ振分部114は、図13に示すように、例えば、命令12に対応する行に含まれる欄のうち、命令13に対応する列に含まれる欄に「0.060」を記憶する。 Therefore, as shown in FIG. 13, the grouping unit 114 stores "0.060" in the column included in the column corresponding to the command 13 among the columns included in the row corresponding to the command 12. .

なお、命令iが命令13であって命令jが12である場合のクラスタリング指標値ΔQは、命令iが命令12であって命令jが13である場合のクラスタリング指標値ΔQと同じ値になる。そのため、グループ振分部114は、例えば、命令iが命令12であって命令jが13である場合のクラスタリング指標値ΔQについての算出を行った場合、命令iが命令13であって命令jが12である場合のクラスタリング指標値ΔQについての算出を行わないものであってもよい。そして、グループ振分部114は、この場合、図13に示すように、命令13に対応する行に含まれる欄のうち、命令12に対応する列に含まれる欄に、クラスタリング指標値ΔQの算出を行っていないことを示す値である「0.000」を記憶するものであってよい。図13に含まれる他の情報についての説明は省略する。 Note that the clustering index value ΔQ when the instruction i is the instruction 13 and the instruction j is 12 is the same value as the clustering index value ΔQ when the instruction i is the instruction 12 and the instruction j is 13. Therefore, for example, when the grouping unit 114 calculates the clustering index value ΔQ when the instruction i is the instruction 12 and the instruction j is 13, the instruction i is the instruction 13 and the instruction j is The calculation of the clustering index value ΔQ in the case of 12 may not be performed. In this case, the grouping unit 114, as shown in FIG. It may store "0.000" which is a value indicating that it is not performed. Description of other information included in FIG. 13 is omitted.

図7に戻り、グループ振分部114は、S25の処理で生成した第2行列133の要素の値のうち、最大の値に対応する各命令の振り分け先を同じグループに決定する(S31)。 Returning to FIG. 7, the group allocation unit 114 determines the allocation destination of each instruction corresponding to the maximum value among the values of the elements of the second matrix 133 generated in the process of S25 to the same group (S31).

具体的に、図13で説明した第2行列133において、命令12に対応する行に含まれる欄のうち、命令13に対応する列に含まれる欄と、命令7に対応する行に含まれる欄のうち、命令12に対応する列に含まれる欄とのそれぞれには、最大の値である「0.060」が設定されている。そのため、グループ振分部114は、図13で説明した第2行列133の各要素に対応する命令の組合せのうち、命令12及び命令13の組合せまたは命令7及び命令12の組合せを特定する。そして、グループ振分部114は、例えば、命令12及び命令13の組合せを特定した場合、命令12と命令13とを同じグループに振り分ける旨の決定を行う。 Specifically, in the second matrix 133 described with reference to FIG. Among them, the column included in the column corresponding to the instruction 12 is set with the maximum value of "0.060". Therefore, the grouping unit 114 identifies the combination of the instructions 12 and 13 or the combination of the instructions 7 and 12 among the combinations of instructions corresponding to the elements of the second matrix 133 described with reference to FIG. Then, for example, when the combination of the instructions 12 and 13 is identified, the grouping unit 114 decides to allocate the instructions 12 and 13 to the same group.

そして、グループ振分部114は、S25の処理で生成した第2行列133またはS33の処理(後述する処理)で再生成した第2行列133における行のうち、S31の処理で振り分け先を決定した各命令に対応する複数の行を、その複数の行における同一列ごとの要素の和を要素とする単一の行に変換し、S25の処理で生成した第2行列133またはS33の処理で再生成した第2行列133における列のうち、S31の処理で振り分け先を決定した各命令に対応する複数の列を、その複数の列における同一行ごとの要素の和を要素とする単一の列に変換することにより、第1行列132を再生成する(S32)。 Then, the group allocation unit 114 determines the allocation destination in the process of S31 among the rows in the second matrix 133 generated in the process of S25 or the rows in the second matrix 133 regenerated in the process of S33 (process described later). A plurality of rows corresponding to each instruction are converted into a single row whose elements are sums of elements of the same column in the plurality of rows, and reproduced by the second matrix 133 generated by the processing of S25 or by the processing of S33. Among the columns in the formed second matrix 133, a plurality of columns corresponding to each instruction whose allocation destination is determined in the processing of S31 are combined into a single column whose elements are the sum of the elements of the same row in the plurality of columns. , the first matrix 132 is regenerated (S32).

具体的に、グループ振分部114は、例えば、S31の処理における決定結果に基づいて依存情報131を更新する。そして、グループ振分部114は、例えば、更新した依存情報131を参照することによって第1行列132の再生成を行う。以下、S32の処理の具体例について説明を行う。 Specifically, the group allocation unit 114 updates the dependency information 131 based on the determination result in the process of S31, for example. Then, the grouping unit 114 regenerates the first matrix 132 by referring to the updated dependency information 131, for example. A specific example of the processing of S32 will be described below.

[S32の処理の具体例]
図14及び図15は、S32の処理の具体例を説明する図である。
[Specific example of processing in S32]
14 and 15 are diagrams for explaining a specific example of the process of S32.

例えば、S31の処理で同じグループに振り分けることを決定した各命令が命令12及び命令13である場合、グループ振分部114は、図14に示すように、「命令番号」が「13」である情報の「グループ名」に記憶された値を、「命令番号」が「12」である情報の「グループ名」に記憶された値である「12」に更新するように、依存情報131を更新する。 For example, if the instructions decided to be assigned to the same group in the process of S31 are the instructions 12 and 13, the group assignment unit 114 assigns the instructions whose "instruction number" is "13" as shown in FIG. The dependency information 131 is updated so that the value stored in the "group name" of the information is updated to "12", which is the value stored in the "group name" of the information whose "instruction number" is "12". do.

その後、グループ振分部114は、例えば、図15に示すように、命令12に対応する行に含まれる欄に、命令12に対応する行に含まれる欄に設定されている値と、命令13に対応する行に含まれる欄に設定されている値とを同一列ごとに加算することによって算出した値をそれぞれ記憶する。また、グループ振分部114は、例えば、図15に示すように、命令12に対応する列に含まれる欄に、命令12に対応する列に含まれる欄に設定されている値と、命令13に対応する列に含まれる欄に設定されている値とを同一行ごとに加算することによって算出した値をそれぞれ記憶する。 After that, as shown in FIG. 15, the grouping unit 114 puts the value set in the column included in the row corresponding to the instruction 12 into the column included in the row corresponding to the instruction 12 and the value set in the column included in the row corresponding to the instruction 13 The values calculated by adding the values set in the columns included in the row corresponding to each column are stored. For example, as shown in FIG. The values calculated by adding the values set in the columns included in the column corresponding to each row are stored.

具体的に、図12で説明した第1行列132において、例えば、命令12に対応する行に含まれる欄のうち、命令7に対応する列に含まれる欄には、「1」が記憶されており、命令13に対応する行に含まれる欄のうち、命令7に対応する列に含まれる欄には、「0」が記憶されている。そのため、グループ振分部114は、図15に示すように、例えば、命令12に対応する行に含まれる欄のうち、命令7に対応する列に含まれる欄に、「1」及び「0」の和である「1」を記憶する。 Specifically, in the first matrix 132 described with reference to FIG. 12, for example, among the columns included in the row corresponding to the instruction 12, the column included in the column corresponding to the instruction 7 stores "1". Among the columns included in the row corresponding to the instruction 13, the column included in the column corresponding to the instruction 7 stores "0". Therefore, as shown in FIG. 15, the grouping unit 114 assigns "1" and "0" to the column included in the column corresponding to the instruction 7 among the columns included in the row corresponding to the instruction 12, for example. stores "1" which is the sum of

また、図12で説明した第1行列132において、例えば、命令11に対応する行に含まれる欄のうち、命令12に対応する列に含まれる欄には、「1」が記憶されており、命令11に対応する行に含まれる欄のうち、命令13に対応する列に含まれる欄には、「0」が記憶されている。そのため、グループ振分部114は、図15に示すように、例えば、命令11に対応する行に含まれる欄のうち、命令12に対応する列に含まれる欄に、「1」及び「0」の和である「1」を記憶する。 Further, in the first matrix 132 described with reference to FIG. 12, for example, among the columns included in the row corresponding to the instruction 11, the column included in the column corresponding to the instruction 12 stores "1", Among the columns included in the row corresponding to the instruction 11, the column included in the column corresponding to the instruction 13 stores "0". Therefore, as shown in FIG. 15, the grouping unit 114 assigns "1" and "0" to the column included in the column corresponding to the instruction 12 among the columns included in the row corresponding to the instruction 11, for example. stores "1" which is the sum of

さらに、図12で説明した第1行列132において、例えば、命令12に対応する行に含まれる欄のうち、命令12に対応する列に含まれる欄には、「0」が記憶されており、命令12に対応する行に含まれる欄のうち、命令13に対応する列に含まれる欄には、「1」が記憶されており、命令13に対応する行に含まれる欄のうち、命令12に対応する列に含まれる欄には、「1」が記憶されており、命令13に対応する行に含まれる欄のうち、命令13に対応する列に含まれる欄には、「0」が記憶されている。そのため、グループ振分部114は、図15に示すように、例えば、命令12に対応する行に含まれる欄のうち、命令12に対応する列に含まれる欄に、「0」、「1」、「1」及び「0」の和である「2」を記憶する。図15に含まれる他の情報についての説明は省略する。 Furthermore, in the first matrix 132 described with reference to FIG. 12, for example, among the columns included in the row corresponding to the instruction 12, the column included in the column corresponding to the instruction 12 stores "0", Among the columns included in the row corresponding to the instruction 12, the column included in the column corresponding to the instruction 13 stores "1". "1" is stored in the column included in the column corresponding to the instruction 13, and "0" is stored in the column included in the column corresponding to the instruction 13 among the columns included in the row corresponding to the instruction 13. remembered. Therefore, as shown in FIG. 15, the grouping unit 114 assigns "0" and "1" to the columns included in the column corresponding to the instruction 12 among the columns included in the row corresponding to the instruction 12, for example. , '2' which is the sum of '1' and '0'. Description of other information included in FIG. 15 is omitted.

図7に戻り、グループ振分部114は、S32の処理で再生成した第1行列132から第2行列133を再生成する(S33)。 Returning to FIG. 7, the grouping unit 114 regenerates the second matrix 133 from the first matrix 132 regenerated in the process of S32 (S33).

具体的に、グループ振分部114は、例えば、図15で説明した第1行列132に対してS25の処理と同じ処理を行うことにより、図16に示す第2行列133を生成(再生成)する。 Specifically, the grouping unit 114 generates (regenerates) the second matrix 133 shown in FIG. 16 by, for example, performing the same process as the process of S25 on the first matrix 132 described with reference to FIG. do.

そして、グループ振分部114は、S21の処理で分割対象であると判定したループに含まれる各命令の振り分け先のグループの数が所定数以下に到達したか否かを判定する(S34)。 Then, the group allocation unit 114 determines whether or not the number of groups to which each instruction included in the loop determined to be divided in the process of S21 has reached a predetermined number or less (S34).

具体的に、図14で説明した依存情報131の「グループ名」には、「1」から「12」までの値(12種類の値)が記憶されている。そのため、グループ振分部114は、この場合、S21の処理で分割対象であると判定したループに含まれる各命令の振り分け先のグループの数として「12」を特定する。そして、例えば、S34の処理における所定数が「2」である場合、グループ振分部114は、S21の処理で分割対象であると判定したループに含まれる各命令の振り分け先のグループの数が所定数以下に到達していないと判定する。 Specifically, values from "1" to "12" (12 kinds of values) are stored in the "group name" of the dependency information 131 described with reference to FIG. Therefore, in this case, the group allocation unit 114 specifies "12" as the number of groups to which each instruction included in the loop determined to be divided in the process of S21 is to be allocated. Then, for example, when the predetermined number in the process of S34 is "2", the group allocation unit 114 determines that the number of groups to which each instruction included in the loop determined to be divided in the process of S21 is to be allocated is It is determined that the number has not reached the predetermined number or less.

一方、図17に示す依存情報131の「グループ名」には、「1」及び「5」のみ(2種類の値)が記憶されている。そのため、グループ振分部114は、この場合、S21の処理で分割対象であると判定したループに含まれる各命令の振り分け先のグループの数として「2」を特定する。そして、例えば、S34の処理における所定数が「2」である場合、グループ振分部114は、S21の処理で分割対象であると判定したループに含まれる各命令の振り分け先のグループの数が所定数以下に到達したと判定する。 On the other hand, only "1" and "5" (two types of values) are stored in the "group name" of the dependency information 131 shown in FIG. Therefore, in this case, the group allocation unit 114 specifies "2" as the number of groups to which each instruction included in the loop determined to be divided in the process of S21 is to be allocated. Then, for example, when the predetermined number in the process of S34 is "2", the group allocation unit 114 determines that the number of groups to which each instruction included in the loop determined to be divided in the process of S21 is to be allocated is It is determined that the number has reached the predetermined number or less.

なお、グループ振分部114は、図17に示す依存情報131を生成したことに応じて、例えば、図18に示す第1行列132の生成を行う。また、グループ振分部114は、図17に示す依存情報131を生成したことに応じて、例えば、図19に示す依存グラフ131aを生成する。以下、図19に示す依存グラフ131aの具体例について説明を行う。 Note that the grouping unit 114 generates, for example, the first matrix 132 shown in FIG. 18 in response to generating the dependency information 131 shown in FIG. Further, the grouping unit 114 generates, for example, a dependency graph 131a shown in FIG. 19 in response to generating the dependency information 131 shown in FIG. A specific example of the dependence graph 131a shown in FIG. 19 will be described below.

[依存グラフの具体例(2)]
図19に示す依存グラフ131aにおいて、命令1、命令2、命令3、命令4、命令8及び命令9のそれぞれに対応するノード群と、命令5、命令6、命令7、命令10、命令11、命令12及び命令13のそれぞれに対応するノード群とは、それぞれ異なるグループに含まれている。
[Specific example of dependency graph (2)]
In the dependency graph 131a shown in FIG. 19, node groups corresponding to instructions 1, 2, 3, 4, 8 and 9, respectively, and instructions 5, 6, 7, 10, 11, The node groups respectively corresponding to the instructions 12 and 13 are included in different groups.

そして、図19に示す依存グラフ131aにおいて、命令1に対応するノードを含むグループと、命令5に対応するノードを含むグループとの間には、命令3に対応するノードと命令10に対応するノードとの間のエッジと、命令9に対応するノードと命令10に対応するノードとの間のエッジとが設定されている。 In the dependency graph 131a shown in FIG. 19, the node corresponding to the instruction 3 and the node corresponding to the instruction 10 are located between the group including the node corresponding to the instruction 1 and the group including the node corresponding to the instruction 5. and an edge between the node corresponding to the instruction 9 and the node corresponding to the instruction 10 are set.

すなわち、図19に示す依存グラフ131aは、命令1、命令2、命令3、命令4、命令8及び命令9が一方の分割ループに含まれ、かつ、命令5、命令6、命令7、命令10、命令11、命令12及び命令13が他方の分割ループに含まれるようにループ分割を行った場合、異なる分割ループのそれぞれに含まれる命令間におけるエッジの数を2本に抑えることが可能になることを示している。 That is, the dependency graph 131a shown in FIG. , 11, 12, and 13 are included in the other divided loop, the number of edges between instructions included in each of the different divided loops can be suppressed to two. It is shown that.

図9に戻り、S21の処理で分割対象であると判定したループに含まれる各命令の振り分け先のグループの数が所定数以下に到達したと判定した場合(S41のYES)、情報処理装置1のループ分割部115は、S33の処理で生成された第2行列133の内容に従って、S21の処理で分割対象であると判定したループのループ分割を行う(S42)。 Returning to FIG. 9, when it is determined that the number of groups to which each instruction included in the loop determined to be divided in the process of S21 has reached a predetermined number or less (YES in S41), the information processing apparatus 1 The loop splitting unit 115 performs loop splitting of the loop determined to be split in the process of S21 according to the contents of the second matrix 133 generated in the process of S33 (S42).

その後、情報処理装置1は、S2の処理を終了する。なお、情報処理装置1は、情報格納領域130に記憶された中間言語22に、分割対象のループが含まれていないと判定した場合も同様に(S22のNO)、S2の処理を終了する。 After that, the information processing device 1 terminates the process of S2. Similarly, when the information processing apparatus 1 determines that the intermediate language 22 stored in the information storage area 130 does not include the loop to be divided (NO in S22), the processing of S2 ends.

一方、S21の処理で分割対象であると判定したループに含まれる各命令の振り分け先のグループの数が所定数以下に到達していないと判定した場合(S41のNO)、グループ振分部114は、S32以降の処理を再度行う。以下、ループ分割を行った後の分割ループの具体例について説明を行う。 On the other hand, when it is determined that the number of groups to which each instruction included in the loop determined to be divided in the process of S21 has not reached the predetermined number or less (NO in S41), the group allocation unit 114 , the processing after S32 is performed again. A specific example of a divided loop after loop division is described below.

[分割ループの具体例]
図20は、分割ループの内容を説明する具体例である。図20(A)は、分割ループのうちの一方を説明する具体例であり、図20(B)は、分割ループのうちの他方を説明する具体例である。
[Specific example of split loop]
FIG. 20 is a specific example for explaining the content of the split loop. FIG. 20A is a specific example for explaining one of the divided loops, and FIG. 20B is a specific example for explaining the other of the divided loops.

図20(A)に示す分割ループには、図9で説明した中間言語のうち、命令1、命令2、命令3、命令4、命令8及び命令9が含まれている。 The divided loop shown in FIG. 20(A) includes instruction 1, instruction 2, instruction 3, instruction 4, instruction 8, and instruction 9 of the intermediate language described with reference to FIG.

そして、図20(A)に示す分割ループは、命令1等の後に、変数reg3に設定された値を、配列tmp_array1のreg_i番目に格納することを示す命令である「store tmp_array1(reg_i),reg3」と、変数reg9に設定された値を、配列tmp_array2のreg_i番目に格納することを示す命令である「store tmp_array2(reg_i),reg9」とを含む。 The divided loop shown in FIG. 20A is an instruction "store tmp_array1 (reg_i), reg3 ” and “store tmp_array2 (reg_i), reg9” which is an instruction indicating that the value set in the variable reg9 is stored in the reg_i-th position of the array tmp_array2.

一方、図20(B)に示す分割ループには、図9で説明した中間言語のうち、命令5、命令6、命令7、命令10、命令11、命令12及び命令13が含まれている。 On the other hand, the divided loop shown in FIG. 20(B) includes the instructions 5, 6, 7, 10, 11, 12 and 13 of the intermediate language described in FIG.

そして、図20(B)に示す分割ループは、命令5等の前に、配列tmp_array1のreg_i番目に格納されている値を変数reg3に設定することを示す命令である「load reg3,tmp_array1(reg_i)」と、配列tmp_array2のreg_i番目に格納されている値を変数reg9に設定することを示す命令である「load reg9,tmp_array2(reg_i)」とを含む。 The divided loop shown in FIG. 20B is an instruction "load reg3, tmp_array1 (reg_i )” and “load reg9, tmp_array2 (reg_i)” which is an instruction indicating to set the value stored in the reg_i-th position of the array tmp_array2 to the variable reg9.

すなわち、図19で説明したように、変数reg3に設定された値(命令3に対応する値)、及び、変数reg9に設定された値(命令9に対応する値)は、図20(B)に示す分割ループに含まれる命令10において参照される。そのため、図20(A)に示す分割ループには、変数reg3に設定された値及び変数reg9に設定された値を一時配列に格納する命令が含まれている。また、図20(B)に示す分割ループには、一時配列に格納されている値を取り出す命令が含まれている。 That is, as described with reference to FIG. 19, the value set to the variable reg3 (value corresponding to instruction 3) and the value set to variable reg9 (value corresponding to instruction 9) are shown in FIG. is referenced in the instruction 10 contained in the split loop shown in FIG. Therefore, the divided loop shown in FIG. 20A includes an instruction to store the value set in the variable reg3 and the value set in the variable reg9 in the temporary array. Also, the split loop shown in FIG. 20B includes an instruction for retrieving the values stored in the temporary array.

このように、本実施の形態における情報処理装置1は、ソースコード21から生成した中間言語22のループに含まれる各命令間の依存関係を示す依存情報131を生成し、生成した依存情報131を行列に変換することによって第1行列132を生成する。 As described above, the information processing apparatus 1 according to the present embodiment generates the dependency information 131 indicating the dependency relationship between the instructions included in the loop of the intermediate language 22 generated from the source code 21, and converts the generated dependency information 131 into A first matrix 132 is generated by converting to a matrix.

そして、情報処理装置1は、生成した第1行列132から算出した各命令間における依存度合いに基づいて、ループに含まれる各命令を複数のグループに振り分け、振り分けたグループごとにループの分割を行う。 Then, the information processing apparatus 1 distributes the instructions included in the loop to a plurality of groups based on the degree of dependence between the instructions calculated from the generated first matrix 132, and divides the loop for each of the divided groups. .

すなわち、本実施の形態における情報処理装置1は、依存情報131から生成された第1行列132を用いた演算を行うことで、分割対象のループに含まれる命令の組合せごとの依存関係の解析等を行うことなく、各命令の振り分け先を決定する。 That is, the information processing apparatus 1 according to the present embodiment performs an operation using the first matrix 132 generated from the dependency information 131, thereby analyzing the dependency relationship for each combination of instructions included in the loop to be divided. Determines the allocation destination of each instruction without performing

これにより、情報処理装置1は、ループ分割を効率的に行うことが可能になり、ソースコード21のコンパイルに要する時間を短縮することが可能になる。 As a result, the information processing apparatus 1 can efficiently perform loop division, and can shorten the time required to compile the source code 21 .

また、情報処理装置1は、分割対象のループに含まれる各命令の振り分け先を計算によって決定することで、異なる分割ループに含まれる命令間の依存関係が最も疎になるループ分割の方法を特定することが可能になる。そのため、情報処理装置1は、特定した方法に従ってループの分割を行うことにより、ソースコード21から生成されるオブジェクトコード23の実行時間についても短縮させることが可能になる。 In addition, the information processing apparatus 1 determines the allocation destination of each instruction included in the loop to be split by calculation, thereby specifying the method of loop splitting that minimizes the dependency relationship between instructions included in different split loops. it becomes possible to Therefore, the information processing apparatus 1 can shorten the execution time of the object code 23 generated from the source code 21 by dividing the loop according to the specified method.

なお、情報処理装置1は、S21及びS22の処理において、情報格納領域130に記憶された中間言語22に分割対象のループが複数含まれていると判定した場合、S23以降の処理を分割対象のループごとに行うものであってよい。 Note that when the information processing apparatus 1 determines in the processes of S21 and S22 that the intermediate language 22 stored in the information storage area 130 includes a plurality of loops to be divided, the information processing apparatus 1 performs the processes of S23 and thereafter on the loops to be divided. It may be performed for each loop.

また、情報処理装置1は、S25に処理においてクラスタリング指標値を算出する場合、Newmanアルゴリズム以外のアルゴリズム(例えば、ラベル伝搬法やK-means法等のアルゴリズム)を用いるものであってもよい。 The information processing apparatus 1 may use an algorithm other than the Newman algorithm (for example, a label propagation method, a K-means method, or the like) when calculating the clustering index value in the process of S25.

[第2の実施の形態]
次に、第2の実施の形態の詳細について説明する。図21から図23は、第2の実施の形態におけるS2の処理を説明するフローチャート図である。また、図24から図28は、第2の実施の形態におけるS2の処理の詳細を説明する図である。
[Second embodiment]
Next, details of the second embodiment will be described. 21 to 23 are flowcharts for explaining the processing of S2 in the second embodiment. 24 to 28 are diagrams for explaining the details of the processing of S2 in the second embodiment.

第2の実施の形態におけるコンパイル処理は、第1の実施の形態におけるコンパイル処理と異なり、各命令がアクセスするデータのメモリ102内における位置関係についても参照してループの分割を行う。 Unlike the compilation process in the first embodiment, the compilation process in the second embodiment also refers to the positional relationship in the memory 102 of the data accessed by each instruction to divide the loop.

分割判定部111は、図21に示すように、情報格納領域130に記憶された中間言語22に、分割対象のループが含まれるか否かを判定する(S51)。 As shown in FIG. 21, the division determination unit 111 determines whether or not the intermediate language 22 stored in the information storage area 130 includes a loop to be divided (S51).

そして、情報格納領域130に記憶された中間言語22に、分割対象のループが含まれていると判定した場合(S52のYES)、情報処理装置1の近接判定部116は、例えば、メモリ102内において近接するアドレスに格納された各データに対してアクセスを行う複数の命令が分割対象のループに含まれているか否かを判定する(S53)。 Then, when it is determined that the intermediate language 22 stored in the information storage area 130 includes the loop to be divided (YES in S52), the proximity determination unit 116 of the information processing apparatus 1 stores the is included in the loop to be divided (S53).

具体的に、近接判定部116は、例えば、同一の配列に格納された各データに対してアクセスを行う複数の命令が同一の分割対象のループに含まれているか否かを判定する。 Specifically, the proximity determination unit 116 determines, for example, whether or not a plurality of instructions that access data stored in the same array are included in the same loop to be divided.

すなわち、オブジェクトコード23の実行時において、例えば、第1命令の実行に伴って第1配列の第1データに対するアクセスが発生する場合、CPU101は、メモリ102に格納されている第1配列の各データを含む所定サイズのデータをキャッシュメモリ(図示しない)に一時的に格納し、キャッシュメモリに格納した第1データに対してアクセスを行う。 That is, when the object code 23 is executed, for example, when the first data in the first array is accessed with the execution of the first instruction, the CPU 101 executes each data in the first array stored in the memory 102. is temporarily stored in a cache memory (not shown), and the first data stored in the cache memory is accessed.

そして、例えば、第1命令と異なる第2命令の実行に伴って第1配列の第2データに対するアクセスが発生する場合、CPU101は、第1配列の各データがキャッシュメモリにまだ格納されていれば、キャッシュメモリに格納されている第2データに対してアクセスを行う。一方、他のデータに対するアクセスの発生等に伴って第1配列の各データがキャッシュメモリから既に追い出されている場合、CPU101は、メモリ102に格納されている第1配列の各データを含む所定サイズのデータをキャッシュメモリに再度に格納し、キャッシュメモリに格納した第2データに対してアクセスを行う。 Then, for example, when access to the second data in the first array occurs due to the execution of a second instruction that is different from the first instruction, the CPU 101 determines if each data in the first array is still stored in the cache memory. , to access the second data stored in the cache memory. On the other hand, if each data in the first array has already been evicted from the cache memory due to the occurrence of access to other data, etc., the CPU 101 retrieves data of a predetermined size including each data in the first array stored in the memory 102 . is stored again in the cache memory, and the second data stored in the cache memory is accessed.

そのため、情報処理装置1は、例えば、上記のような第1命令及び第2命令が分割対象のループに含まれている場合、第1命令と第2命令が同じ分割ループに含まれるようにループ分割を行い、第1命令の実行タイミングと第2命令の実行タイミングとを近接させる。 Therefore, for example, when the first instruction and the second instruction as described above are included in the loop to be split, the information processing apparatus 1 divides the loop so that the first instruction and the second instruction are included in the same split loop. By dividing, the execution timing of the first instruction and the execution timing of the second instruction are brought close to each other.

これにより、情報処理装置1は、分割対象のループの実行中に第1データがキャッシュメモリから追い出される確率を抑えることが可能になる。そのため、情報処理装置1は、第1データをキャッシュメモリに再格納する処理の発生頻度を抑えることが可能になり、オブジェクトコード23の実行時間を短縮させることが可能になる。 As a result, the information processing apparatus 1 can reduce the probability that the first data will be evicted from the cache memory during execution of the loop to be divided. Therefore, the information processing device 1 can reduce the frequency of occurrence of the process of re-storing the first data in the cache memory, and can shorten the execution time of the object code 23 .

したがって、近接判定部116は、S53の処理において、例えば、分割対象のループに含まれる命令から、同一の配列に含まれる各データに対してアクセスを行う複数の命令の特定を行う。 Therefore, in the processing of S53, the proximity determination unit 116 identifies, for example, a plurality of instructions that access each piece of data included in the same array from the instructions included in the loop to be divided.

なお、近接判定部116は、例えば、ある配列に含まれるデータのうち、所定の回転数に対応する範囲内のデータに対してアクセスを行う複数の命令の特定を行うものであってもよい。 Note that the proximity determination unit 116 may, for example, identify a plurality of instructions for accessing data within a range corresponding to a predetermined number of rotations among data contained in a certain array.

図21に戻り、情報生成部112は、S51の処理で分割対象であると判定したループに含まれる各命令間の依存関係と、各命令がアクセスするデータのメモリ102内における位置関係とを示す依存情報131を生成する(S54)。 Returning to FIG. 21, the information generation unit 112 indicates the dependency relationship between each instruction included in the loop determined to be divided in the process of S51 and the positional relationship in the memory 102 of the data accessed by each instruction. Dependency information 131 is generated (S54).

[依存情報の具体例]
図24は、依存情報131の具体例について説明する図である。
[Specific example of dependency information]
FIG. 24 is a diagram explaining a specific example of the dependency information 131. As shown in FIG.

図24に示す依存情報131は、図10で説明した依存情報131が有する項目に加え、メモリ102内における近接したアドレスに格納された各データに対してアクセスを行う複数の命令の命令番号についてのリストである「キャッシュ共有依存リスト」を項目として有する。 Dependency information 131 shown in FIG. 24 includes, in addition to the items included in the dependency information 131 described with reference to FIG. It has as an item "cache sharing dependency list" which is a list.

具体的に、図9で説明した中間言語22において、配列Cに格納されているデータは、命令4及び命令6のそれぞれにおいて参照されている。そのため、情報生成部112は、例えば、図24に示すように、「命令番号」が「4」である情報の「キャッシュ共有依存リスト」に「6」を記憶し、「命令番号」が「6」である情報の「キャッシュ共有依存リスト」に「4」を記憶する。また、情報生成部112は、この場合、例えば、図24に示すように、「命令番号」が「4」及び「6」以外である情報の「キャッシュ共有依存リスト」に、情報が存在しないことを示す「-」を記憶する。 Specifically, in the intermediate language 22 described with reference to FIG. 9, the data stored in the array C is referenced in each of the instructions 4 and 6. FIG. Therefore, for example, as shown in FIG. 24, the information generating unit 112 stores "6" in the "cache sharing dependency list" of the information whose "instruction number" is "4", "4" is stored in the "cache sharing dependency list" of the information ". Also, in this case, the information generation unit 112 determines that there is no information in the “cache share dependency list” of information with “instruction numbers” other than “4” and “6”, as shown in FIG. 24, for example. "-" indicating is stored.

図21に戻り、情報生成部112は、S54の処理で生成した依存情報131を行列に変換することによって第1行列132を生成する(S55)。以下、第1行列132の具体例について説明を行う。 Returning to FIG. 21, the information generator 112 generates the first matrix 132 by converting the dependency information 131 generated in the process of S54 into a matrix (S55). A specific example of the first matrix 132 will be described below.

[第1行列の具体例]
図25は、第1行列132の具体例について説明する図である。
[Specific example of the first matrix]
FIG. 25 is a diagram illustrating a specific example of the first matrix 132. As shown in FIG.

図25に示す第1行列132の各要素(各欄)には、行に対応する命令と列に対応する命令との間に依存関係が存在することを示す値である「1」、行に対応する命令及び列に対応する命令のそれぞれがアクセスするデータのメモリ102内における位置が近接していることを示す値である「5」、または、行に対応する命令と列に対応する命令との間に依存関係がせず、かつ、行に対応する命令及び列に対応する命令のそれぞれがアクセスするデータのメモリ102内における位置が近接していないことを示す値である「0」が記憶される。 Each element (each column) of the first matrix 132 illustrated in FIG. "5" which is a value indicating that the positions of data accessed by the corresponding instruction and the instruction corresponding to the column are close to each other in the memory 102, or the instruction corresponding to the row and the instruction corresponding to the column. A value "0" is stored as a value indicating that there is no dependency between the be done.

具体的に、図24で説明した依存情報131において、「命令番号」が「4」である情報の「キャッシュ共有依存リスト」には、「6」が記憶されており、「命令番号」が「6」である情報の「キャッシュ共有依存リスト」には、「4」が記憶されている。そのため、情報生成部112は、図25に示すように、例えば、命令4に対応する行に含まれる欄のうち、命令6に対応する列に含まれる欄に「5」を記憶する。また、情報生成部112は、図25に示すように、例えば、命令6に対応する行に含まれる欄のうち、命令4に対応する列に含まれる欄に「5」を記憶する。 Specifically, in the dependency information 131 described with reference to FIG. 24, "6" is stored in the "cache shared dependency list" of information whose "instruction number" is "4", and "6" is stored in the "instruction number" of "4". "4" is stored in the "cache sharing dependency list" of the information "6". Therefore, the information generator 112 stores "5" in the column included in the column corresponding to the command 6 among the columns included in the row corresponding to the command 4, as shown in FIG. 25, the information generator 112 stores "5" in the column included in the column corresponding to command 4 among the columns included in the row corresponding to command 6, for example.

すなわち、依存関係にある複数の命令が異なる分割ループに含まれることによるオブジェクトコード23の実行時間に対する影響よりも、キャッシュミスの発生回数が増加することによるオブジェクトコード23の実行時間に対する影響の方が大きいと判断できる。そのため、情報生成部112は、図25に示すように、例えば、各命令がアクセスするデータのメモリ102内における位置が近接していることを示す値が、各命令間に依存関係が存在することを示す値よりも大きくなるように、第1行列132の生成を行う。 That is, an increase in the number of occurrences of cache misses has a greater impact on the execution time of the object code 23 than the inclusion of a plurality of dependent instructions in different divided loops. can be determined to be large. Therefore, as shown in FIG. 25, the information generating unit 112 generates a value indicating that the positions of the data accessed by each instruction in the memory 102 are close to each other, indicating that there is a dependency relationship between each instruction. The first matrix 132 is generated so as to be larger than the value indicating .

図21に戻り、グループ振分部114は、S55の処理で生成した第1行列132から、各命令間における依存度合いを示す第2行列133を生成する(S56)。 Returning to FIG. 21, the group allocation unit 114 generates a second matrix 133 indicating the degree of dependency between instructions from the first matrix 132 generated in the process of S55 (S56).

そして、グループ振分部114は、図22に示すように、S56の処理で生成した第2行列133の要素の値のうち、最大の値に対応する複数の命令の振り分け先を同じグループに決定する(S61)。 Then, as shown in FIG. 22, the group allocation unit 114 determines the allocation destination of a plurality of instructions corresponding to the maximum value among the values of the elements of the second matrix 133 generated in the process of S56 to the same group. (S61).

続いて、グループ振分部114は、S56の処理で生成した第2行列133またはS63の処理で再生成した第2行列133における行のうち、S61の処理で振り分け先を決定した各命令に対応する複数の行を、その複数の行における同一列ごとの要素の和を要素とする単一の行に変換し、S56の処理で生成した第2行列133またはS63の処理で再生成した第2行列133における列のうち、S61の処理で振り分け先を決定した各命令に対応する複数の列を、その複数の列における同一行ごとの要素の和を要素とする単一の列に変換することにより、第1行列132を再生成する(S62)。 Subsequently, the grouping unit 114 corresponds to each instruction, among the rows in the second matrix 133 generated in the process of S56 or the second matrix 133 regenerated in the process of S63, for which the allocation destination is determined in the process of S61. are converted into a single row whose elements are sums of elements of the same column in the plurality of rows, and the second matrix 133 generated in the process of S56 or the second matrix 133 regenerated in the process of S63 To convert a plurality of columns of the matrix 133 corresponding to each instruction whose allocation destination is determined in the processing of S61 into a single column whose element is the sum of the elements of the same row in the plurality of columns. to regenerate the first matrix 132 (S62).

さらに、グループ振分部114は、S62の処理で再生成した第1行列132から第2行列133を再生成する(S63)。 Further, the grouping unit 114 regenerates the second matrix 133 from the first matrix 132 regenerated in the process of S62 (S63).

その後、グループ振分部114は、S51の処理で分割対象であると判定したループに含まれる各命令の振り分け先のグループの数が所定数以下に到達したか否かを判定する(S64)。 After that, the group allocation unit 114 determines whether or not the number of groups to which each instruction included in the loop determined to be divided in the process of S51 has reached a predetermined number or less (S64).

具体的に、例えば、S64の処理における所定数が「2」である場合において、図26に示す第1行列132が生成されている場合、グループ振分部114は、S51の処理で分割対象であると判定したループに含まれる各命令の振り分け先のグループの数が所定数以下に到達したと判定する。 Specifically, for example, when the predetermined number in the process of S64 is "2", if the first matrix 132 shown in FIG. It is determined that the number of groups to which each instruction included in the loop determined to exist has reached a predetermined number or less.

なお、図27に示すように、図26に示す第1行列132に対応する依存グラフ131aでは、同じ配列に格納された各データを参照する各命令(命令4及び命令6)が同じグループに振り分けられている。 As shown in FIG. 27, in the dependency graph 131a corresponding to the first matrix 132 shown in FIG. 26, each instruction (instruction 4 and instruction 6) referencing each data stored in the same array is assigned to the same group. It is

続いて、S51の処理で分割対象であると判定したループに含まれる各命令の振り分け先のグループの数が所定数以下に到達したと判定した場合(S71のYES)、ループ分割部115は、S63の処理で生成された第2行列133の内容に従って、S51の処理で分割対象であると判定したループのループ分割を行う(S72)。 Subsequently, when it is determined that the number of groups to which each instruction included in the loop determined to be divided in the process of S51 has reached a predetermined number or less (YES in S71), the loop dividing unit 115 According to the contents of the second matrix 133 generated in the process of S63, loop division is performed for the loop determined to be to be divided in the process of S51 (S72).

そして、情報処理装置1は、S2の処理を終了する。なお、情報処理装置1は、情報格納領域130に記憶された中間言語22に、分割対象のループが含まれていないと判定した場合も同様に(S52のNO)、S2の処理を終了する。 Then, the information processing device 1 terminates the process of S2. Similarly, when the information processing apparatus 1 determines that the intermediate language 22 stored in the information storage area 130 does not include the loop to be divided (NO in S52), the processing of S2 ends.

一方、S51の処理で分割対象であると判定したループに含まれる各命令の振り分け先のグループの数が所定数以下に到達していないと判定した場合(S71のNO)、グループ振分部114は、S62以降の処理を再度行う。以下、ループ分割を行った後の分割ループの具体例について説明を行う。 On the other hand, when it is determined that the number of groups to which each instruction included in the loop determined to be divided in the process of S51 has not reached the predetermined number or less (NO in S71), the group allocation unit 114 , the processing after S62 is performed again. A specific example of a divided loop after loop division is described below.

[分割ループの具体例]
図28は、分割ループの内容を説明する具体例である。図28(A)は、分割ループのうちの一方を説明する具体例であり、図28(B)は、分割ループのうちの他方を説明する具体例である。
[Specific example of split loop]
FIG. 28 is a specific example for explaining the content of the split loop. FIG. 28A is a specific example for explaining one of the divided loops, and FIG. 28B is a specific example for explaining the other of the divided loops.

図28(A)に示す分割ループには、図9で説明した中間言語のうち、命令1、命令2、命令3、命令4、命令6、命令8及び命令9が含まれている。 The divided loop shown in FIG. 28(A) includes instruction 1, instruction 2, instruction 3, instruction 4, instruction 6, instruction 8, and instruction 9 of the intermediate language described in FIG.

また、図28(A)に示す分割ループは、命令1等の後に、変数reg3に設定された値を、配列tmp_array1のreg_i番目に格納することを示す命令である「store tmp_array1(reg_i),reg3」と、変数reg6に設定された値を、配列tmp_array2のreg_i番目に格納することを示す命令である「store tmp_array2(reg_i),reg6」と、変数reg9に設定された値を、配列tmp_array3のreg_i番目に格納することを示す命令である「store tmp_array3(reg_i),reg9」とを含む。 The divided loop shown in FIG. 28A is an instruction "store tmp_array1 (reg_i), reg3 "store tmp_array2 (reg_i), reg6" which is an instruction indicating to store the value set in the variable reg6 in the reg_i-th position of the array tmp_array2, and the value set in the variable reg9 to the reg_i 'store tmp_array3 (reg_i), reg9', which is an instruction to store in the th.

一方、図28(B)に示す分割ループには、図9で説明した中間言語のうち、命令5、命令7、命令10、命令11、命令12及び命令13が含まれている。 On the other hand, the divided loop shown in FIG. 28(B) includes the instructions 5, 7, 10, 11, 12 and 13 of the intermediate language described in FIG.

また、図28(B)に示す分割ループは、命令5等の前に、配列tmp_array1のreg_i番目に格納されている値を変数reg3に設定することを示す命令である「load reg3,tmp_array1(reg_i)」と、配列tmp_array2のreg_i番目に格納されている値を変数reg6に設定することを示す命令である「load reg6,tmp_array2(reg_i)」と、配列tmp_array3のreg_i番目に格納されている値を変数reg9に設定することを示す命令である「load reg9,tmp_array3(reg_i)」とを含む。 In addition, the divided loop shown in FIG. 28B is an instruction "load reg3, tmp_array1 (reg_i )”, “load reg6, tmp_array2 (reg_i)” which is an instruction indicating to set the value stored in the reg_i-th position in the array tmp_array2 to the variable reg6, and the value stored in the reg_i-th position in the array tmp_array3. ``load reg9, tmp_array3 (reg_i)'', which is an instruction to set the variable reg9.

すなわち、図28に示す分割ループは、図20で説明した分割ループよりも一時配列の数が増加している。しかしながら、図28に示す分割ループでは、同じ配列に格納された各データを参照する各命令(命令4及び命令6)が同じ分割ループに含まれている。 That is, the split loop shown in FIG. 28 has more temporary arrays than the split loop described in FIG. However, in the split loop shown in FIG. 28, each instruction (instruction 4 and instruction 6) that references each data stored in the same array is included in the same split loop.

これにより、情報処理装置1は、オブジェクトコード23の実行時間をより短縮させることが可能になる。 As a result, the information processing device 1 can further shorten the execution time of the object code 23 .

以上の実施の形態をまとめると、以下の付記のとおりである。 The above embodiments are summarized as follows.

(付記1)
ソースコードから生成した中間言語のループに含まれる各命令間の依存関係を示す依存情報を生成し、生成した前記依存情報を行列に変換することによって第1行列を生成する情報生成部と、
生成した前記第1行列から算出した各命令間における依存度合いに基づいて、前記ループに含まれる各命令を複数のグループに振り分けるグループ振分部と、
振り分けた前記複数のグループごとに、前記ループの分割を行うループ分割部と、を有する、
ことを特徴とする情報処理装置。
(Appendix 1)
an information generation unit that generates dependency information indicating dependency relationships between instructions included in a loop of an intermediate language generated from a source code and converts the generated dependency information into a matrix to generate a first matrix;
a group sorting unit that sorts the instructions included in the loop into a plurality of groups based on the degree of dependence between the instructions calculated from the generated first matrix;
a loop dividing unit that divides the loop for each of the plurality of divided groups;
An information processing device characterized by:

(付記2)
付記1において、
前記情報生成部は、
前記ループに含まれる命令の組合せごとに、各組合せに含まれる命令間に依存関係があることを前記依存情報が示しているか否かを判定し、
前記命令の組合せのうち、各組合せに含まれる命令間に依存関係があることを前記依存情報が示している組合せに対応する要素を第1の値とし、前記命令の組合せのうち、各組合せに含まれる命令間に依存関係があることを前記依存情報が示していない組合せに対応する要素を第2の値とすることにより、前記第1行列の生成を行う、
ことを特徴とする情報処理装置。
(Appendix 2)
In Appendix 1,
The information generation unit
determining whether the dependency information indicates that there is a dependency between instructions included in each combination for each combination of instructions included in the loop;
Among the combinations of instructions, the element corresponding to the combination in which the dependency information indicates that there is a dependency between instructions included in each combination is set as a first value, and each combination of the instructions includes: generating the first matrix by setting, as a second value, an element corresponding to a combination in which the dependency information does not indicate that there is a dependency between the included instructions;
An information processing device characterized by:

(付記3)
付記1において、
前記グループ振分部は、異なるグループにそれぞれ含まれる命令間において存在する依存関係が少なくなるように、前記ループに含まれる各命令を複数のグループに振り分ける、
ことを特徴とする情報処理装置。
(Appendix 3)
In Appendix 1,
The grouping unit sorts each instruction included in the loop into a plurality of groups so as to reduce dependencies existing between instructions included in different groups.
An information processing device characterized by:

(付記4)
付記1において、
前記グループ振分部は、
前記第1行列から各命令間における依存度合いを示す第2行列を生成し、
生成した前記第2行列に基づいて、前記ループに含まれる各命令を前記複数のグループに振り分ける、
ことを特徴とする情報処理装置。
(Appendix 4)
In Appendix 1,
The group allocation unit
generating a second matrix indicating the degree of dependency between instructions from the first matrix;
Allocating each instruction included in the loop to the plurality of groups based on the generated second matrix;
An information processing device characterized by:

(付記5)
付記4において、
前記グループ振分部は、
前記ループに含まれる命令の組合せごとに、各組合せに含まれる命令間における依存度合いを算出し、
算出した前記依存度合いのそれぞれを要素とすることにより、前記第2行列を生成する、
ことを特徴とする情報処理装置。
(Appendix 5)
In Appendix 4,
The group allocation unit
calculating the degree of dependence between instructions included in each combination for each combination of instructions included in the loop;
generating the second matrix by using each of the calculated degrees of dependence as elements;
An information processing device characterized by:

(付記6)
付記5において、
前記グループ振分部は、Newmanアルゴリズムを用いることにより、前記依存度合いを算出する、
ことを特徴とする情報処理装置。
(Appendix 6)
In Appendix 5,
The group allocation unit calculates the degree of dependence by using the Newman algorithm,
An information processing device characterized by:

(付記7)
付記5において、
前記グループ振分部は、
前記第2行列の要素の値のうち、最大の値に対応する複数の命令の振り分け先を同じグループに決定し、
前記第2行列における前記複数の命令に対応する複数の行を、前記複数の行における同一列ごとの要素の和を要素とする単一の行に変換し、かつ、前記第2行列における前記複数の命令に対応する複数の列を、前記複数の列における同一行ごとの要素の和を要素とする単一の列に変換することによって、前記第1行列を再生成し、
再生成した前記第1行列から前記第2行列を再生成し、
前記ループに含まれる各命令の振り分け先として決定したグループの数が所定数以下になるまで、前記決定する処理と前記第1行列を再生成する処理と前記第2行列を再生成する処理とを繰り返す、
ことを特徴とする情報処理装置。
(Appendix 7)
In Appendix 5,
The group allocation unit
determining to assign to the same group a plurality of instructions corresponding to the largest value among the values of the elements of the second matrix;
converting the plurality of rows corresponding to the plurality of instructions in the second matrix into a single row whose elements are sums of the same column-wise elements in the plurality of rows; and regenerate the first matrix by transforming the columns corresponding to the instruction of to a single column whose elements are the sums of the same row-wise elements in the columns;
regenerating the second matrix from the regenerated first matrix;
The determining process, the regenerating the first matrix, and the regenerating the second matrix are repeated until the number of groups determined as allocation destinations of the instructions included in the loop becomes equal to or less than a predetermined number. repeat,
An information processing device characterized by:

(付記8)
付記2において、さらに、
近接する記憶領域に格納された各データに対してアクセスを行う複数の命令が前記ループに含まれているか否かを判定する近接判定部を有し、
前記情報生成部は、前記複数の命令が前記ループに含まれているか否かの判定結果に基づいて、前記第1行列の生成を行う、
ことを特徴とする情報処理装置。
(Appendix 8)
In Supplementary Note 2, further,
a proximity determination unit that determines whether or not the loop includes a plurality of instructions for accessing data stored in adjacent storage areas;
The information generation unit generates the first matrix based on a determination result as to whether the plurality of instructions are included in the loop.
An information processing device characterized by:

(付記9)
付記8において、
前記情報生成部は、前記複数の命令が前記ループに含まれていると判定した場合、前記複数の命令間に対応する要素を前記第1の値よりも大きい第3の値とすることにより、前記第1行列の生成を行う、
ことを特徴とする情報処理装置。
(Appendix 9)
In Appendix 8,
When the information generating unit determines that the plurality of instructions are included in the loop, the information generation unit sets the element corresponding to the plurality of instructions to a third value larger than the first value, generating the first matrix;
An information processing device characterized by:

(付記10)
付記8において、
前記近接する記憶領域に格納された各データは、同一の配列である、
ことを特徴とする情報処理装置。
(Appendix 10)
In Appendix 8,
each data stored in the adjacent storage area is the same array,
An information processing device characterized by:

(付記11)
ソースコードから生成した中間言語のループに含まれる各命令間の依存関係を示す依存情報を生成し、
生成した前記依存情報を行列に変換することによって第1行列を生成し、
生成した前記第1行列から算出した各命令間における依存度合いに基づいて、前記ループに含まれる各命令を複数のグループに振り分け、
振り分けた前記複数のグループごとに、前記ループの分割を行う、
処理をコンピュータに実行させることを特徴とするコンパイラプログラム。
(Appendix 11)
Generate dependency information that indicates the dependency between each instruction included in the intermediate language loop generated from the source code,
generating a first matrix by converting the generated dependency information into a matrix;
Allocating each instruction included in the loop into a plurality of groups based on the degree of dependence between each instruction calculated from the generated first matrix,
dividing the loop for each of the divided groups;
A compiler program that causes a computer to execute processing.

(付記12)
付記11において、
前記第1行列を生成する処理では、
前記ループに含まれる命令の組合せごとに、各組合せに含まれる命令間に依存関係があることを前記依存情報が示しているか否かを判定し、
前記命令の組合せのうち、各組合せに含まれる命令間に依存関係があることを前記依存情報が示している組合せに対応する要素を第1の値とし、前記命令の組合せのうち、各組合せに含まれる命令間に依存関係があることを前記依存情報が示していない組合せに対応する要素を第2の値とすることにより、前記第1行列の生成を行う、
ことを特徴とするコンパイラプログラム。
(Appendix 12)
In Appendix 11,
In the process of generating the first matrix,
determining whether the dependency information indicates that there is a dependency between instructions included in each combination for each combination of instructions included in the loop;
Among the combinations of instructions, the element corresponding to the combination in which the dependency information indicates that there is a dependency between instructions included in each combination is set as a first value, and each combination of the instructions includes generating the first matrix by setting, as a second value, an element corresponding to a combination in which the dependency information does not indicate that there is a dependency between the included instructions;
A compiler program characterized by:

(付記13)
付記11において、
前記複数のグループに振り分ける処理では、異なるグループにそれぞれ含まれる命令間において存在する依存関係が少なくなるように、前記ループに含まれる各命令を複数のグループに振り分ける、
ことを特徴とするコンパイラプログラム。
(Appendix 13)
In Appendix 11,
In the process of assigning to the plurality of groups, each instruction included in the loop is assigned to a plurality of groups so as to reduce dependencies existing between instructions included in different groups.
A compiler program characterized by:

(付記14)
付記11において、
前記複数のグループに振り分ける処理では、
前記第1行列から各命令間における依存度合いを示す第2行列を生成し、
生成した前記第2行列に基づいて、前記ループに含まれる各命令を前記複数のグループに振り分ける、
ことを特徴とするコンパイラプログラム。
(Appendix 14)
In Appendix 11,
In the process of sorting into the plurality of groups,
generating a second matrix indicating the degree of dependency between instructions from the first matrix;
Allocating each instruction included in the loop to the plurality of groups based on the generated second matrix;
A compiler program characterized by:

1:情報処理装置 5:操作端末
21:ソースコード 22:中間言語
23:オブジェクトコード 130:記憶部
NW:ネットワーク
1: Information processing device 5: Operation terminal 21: Source code 22: Intermediate language 23: Object code 130: Storage part NW: Network

Claims (11)

ソースコードから生成した中間言語のループに含まれる各命令間の依存関係を示す依存情報を生成し、生成した前記依存情報を行列に変換することによって第1行列を生成する情報生成部と、
生成した前記第1行列から算出した各命令間における依存度合いに基づいて、前記ループに含まれる各命令を複数のグループに振り分けるグループ振分部と、
振り分けた前記複数のグループごとに、前記ループの分割を行うループ分割部と、を有する、
ことを特徴とする情報処理装置。
an information generation unit that generates dependency information indicating dependency relationships between instructions included in a loop of an intermediate language generated from a source code and converts the generated dependency information into a matrix to generate a first matrix;
a group sorting unit that sorts the instructions included in the loop into a plurality of groups based on the degree of dependence between the instructions calculated from the generated first matrix;
a loop dividing unit that divides the loop for each of the plurality of divided groups;
An information processing device characterized by:
請求項1において、
前記情報生成部は、
前記ループに含まれる命令の組合せごとに、各組合せに含まれる命令間に依存関係があることを前記依存情報が示しているか否かを判定し、
前記命令の組合せのうち、各組合せに含まれる命令間に依存関係があることを前記依存情報が示している組合せに対応する要素を第1の値とし、前記命令の組合せのうち、各組合せに含まれる命令間に依存関係があることを前記依存情報が示していない組合せに対応する要素を第2の値とすることにより、前記第1行列の生成を行う、
ことを特徴とする情報処理装置。
In claim 1,
The information generation unit
determining whether the dependency information indicates that there is a dependency between instructions included in each combination for each combination of instructions included in the loop;
Among the combinations of instructions, the element corresponding to the combination in which the dependency information indicates that there is a dependency between instructions included in each combination is set as a first value, and each combination of the instructions includes generating the first matrix by setting, as a second value, an element corresponding to a combination in which the dependency information does not indicate that there is a dependency between included instructions;
An information processing device characterized by:
請求項1において、
前記グループ振分部は、異なるグループにそれぞれ含まれる命令間において存在する依存関係が少なくなるように、前記ループに含まれる各命令を複数のグループに振り分ける、
ことを特徴とする情報処理装置。
In claim 1,
The grouping unit sorts each instruction included in the loop into a plurality of groups so as to reduce dependencies existing between instructions included in different groups.
An information processing device characterized by:
請求項1において、
前記グループ振分部は、
前記第1行列から各命令間における依存度合いを示す第2行列を生成し、
生成した前記第2行列に基づいて、前記ループに含まれる各命令を前記複数のグループに振り分ける、
ことを特徴とする情報処理装置。
In claim 1,
The group allocation unit
generating a second matrix indicating the degree of dependency between instructions from the first matrix;
Allocating each instruction included in the loop to the plurality of groups based on the generated second matrix;
An information processing device characterized by:
請求項4において、
前記グループ振分部は、
前記ループに含まれる命令の組合せごとに、各組合せに含まれる命令間における依存度合いを算出し、
算出した前記依存度合いのそれぞれを要素とすることにより、前記第2行列を生成する、
ことを特徴とする情報処理装置。
In claim 4,
The group allocation unit
calculating the degree of dependence between instructions included in each combination for each combination of instructions included in the loop;
generating the second matrix by using each of the calculated degrees of dependence as elements;
An information processing device characterized by:
請求項5において、
前記グループ振分部は、Newmanアルゴリズムを用いることにより、前記依存度合いを算出する、
ことを特徴とする情報処理装置。
In claim 5,
The group allocation unit calculates the degree of dependence by using the Newman algorithm,
An information processing device characterized by:
請求項5において、
前記グループ振分部は、
前記第2行列の要素の値のうち、最大の値に対応する複数の命令の振り分け先を同じグループに決定し、
前記第2行列における前記複数の命令に対応する複数の行を、前記複数の行における同一列ごとの要素の和を要素とする単一の行に変換し、かつ、前記第2行列における前記複数の命令に対応する複数の列を、前記複数の列における同一行ごとの要素の和を要素とする単一の列に変換することによって、前記第1行列を再生成し、
再生成した前記第1行列から前記第2行列を再生成し、
前記ループに含まれる各命令の振り分け先として決定したグループの数が所定数以下になるまで、前記決定する処理と前記第1行列を再生成する処理と前記第2行列を再生成する処理とを繰り返す、
ことを特徴とする情報処理装置。
In claim 5,
The group allocation unit
determining to assign to the same group a plurality of instructions corresponding to the largest value among the values of the elements of the second matrix;
converting the plurality of rows corresponding to the plurality of instructions in the second matrix into a single row whose elements are sums of the same column-wise elements in the plurality of rows; and regenerate the first matrix by transforming the columns corresponding to the instruction of to a single column whose elements are the sums of the same row-wise elements in the columns;
regenerating the second matrix from the regenerated first matrix;
The determining process, the regenerating the first matrix, and the regenerating the second matrix are repeated until the number of groups determined as allocation destinations of the instructions included in the loop becomes equal to or less than a predetermined number. repeat,
An information processing device characterized by:
請求項2において、さらに、
近接する記憶領域に格納された各データに対してアクセスを行う複数の命令が前記ループに含まれているか否かを判定する近接判定部を有し、
前記情報生成部は、前記複数の命令が前記ループに含まれているか否かの判定結果に基づいて、前記第1行列の生成を行う、
ことを特徴とする情報処理装置。
In claim 2, further,
a proximity determination unit that determines whether or not the loop includes a plurality of instructions for accessing data stored in adjacent storage areas;
The information generation unit generates the first matrix based on a determination result as to whether the plurality of instructions are included in the loop.
An information processing device characterized by:
請求項8において、
前記情報生成部は、前記複数の命令が前記ループに含まれていると判定した場合、前記複数の命令間に対応する要素を前記第1の値よりも大きい第3の値とすることにより、前記第1行列の生成を行う、
ことを特徴とする情報処理装置。
In claim 8,
When the information generating unit determines that the plurality of instructions are included in the loop, the information generation unit sets the element corresponding to the plurality of instructions to a third value larger than the first value, generating the first matrix;
An information processing device characterized by:
請求項8において、
前記近接する記憶領域に格納された各データは、同一の配列である、
ことを特徴とする情報処理装置。
In claim 8,
each data stored in the adjacent storage area is the same array,
An information processing device characterized by:
ソースコードから生成した中間言語のループに含まれる各命令間の依存関係を示す依存情報を生成し、
生成した前記依存情報を行列に変換することによって第1行列を生成し、
生成した前記第1行列から算出した各命令間における依存度合いに基づいて、前記ループに含まれる各命令を複数のグループに振り分け、
振り分けた前記複数のグループごとに、前記ループの分割を行う、
処理をコンピュータに実行させることを特徴とするコンパイラプログラム。
Generate dependency information that indicates the dependency between each instruction included in the intermediate language loop generated from the source code,
generating a first matrix by converting the generated dependency information into a matrix;
Allocating each instruction included in the loop into a plurality of groups based on the degree of dependence between each instruction calculated from the generated first matrix,
dividing the loop for each of the divided groups;
A compiler program that causes a computer to execute processing.
JP2019121513A 2019-06-28 2019-06-28 Information processing device and compiler program Active JP7239827B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2019121513A JP7239827B2 (en) 2019-06-28 2019-06-28 Information processing device and compiler program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2019121513A JP7239827B2 (en) 2019-06-28 2019-06-28 Information processing device and compiler program

Publications (2)

Publication Number Publication Date
JP2021009443A JP2021009443A (en) 2021-01-28
JP7239827B2 true JP7239827B2 (en) 2023-03-15

Family

ID=74199960

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2019121513A Active JP7239827B2 (en) 2019-06-28 2019-06-28 Information processing device and compiler program

Country Status (1)

Country Link
JP (1) JP7239827B2 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001306333A (en) 2000-04-24 2001-11-02 Hitachi Ltd Loop parallelizing method
US6651246B1 (en) 1999-11-08 2003-11-18 International Business Machines Corporation Loop allocation for optimizing compilers
JP4211830B2 (en) 2006-09-14 2009-01-21 三浦工業株式会社 Safety control system for combustion equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04211830A (en) * 1990-02-05 1992-08-03 Matsushita Electric Ind Co Ltd Parallel compiling system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6651246B1 (en) 1999-11-08 2003-11-18 International Business Machines Corporation Loop allocation for optimizing compilers
JP2001306333A (en) 2000-04-24 2001-11-02 Hitachi Ltd Loop parallelizing method
JP4211830B2 (en) 2006-09-14 2009-01-21 三浦工業株式会社 Safety control system for combustion equipment

Also Published As

Publication number Publication date
JP2021009443A (en) 2021-01-28

Similar Documents

Publication Publication Date Title
Wahib et al. Scalable kernel fusion for memory-bound GPU applications
US9418048B2 (en) Apparatus and method for allocating shared storage areas to parallel processors for multiplication of sparse matrix and vector
Lu et al. Optimizing depthwise separable convolution operations on gpus
Parsons et al. A++/P++ array classes for architecture independent finite difference computations
US8943484B2 (en) Code generation method and information processing apparatus
US20070250825A1 (en) Compiling Alternative Source Code Based on a Metafunction
Ohno et al. Accelerating spark RDD operations with local and remote GPU devices
Kireev et al. Fragmentation of numerical algorithms for parallel subroutines library
US20140244969A1 (en) List Vector Processing Apparatus, List Vector Processing Method, Storage Medium, Compiler, and Information Processing Apparatus
US20060010432A1 (en) Program and apparatus for translating language, and program converting method
US20090037690A1 (en) Dynamic Pointer Disambiguation
US20070300210A1 (en) Compiling device, list vector area assignment optimization method, and computer-readable recording medium having compiler program recorded thereon
Hartley Compile-time program restructuring in multiprogrammed virtual memory systems
US7356812B2 (en) Passing parameters by implicit reference
Belgin et al. A library for pattern-based sparse matrix vector multiply
Pai T et al. A systematic literature review of lexical analyzer implementation techniques in compiler design
JP7239827B2 (en) Information processing device and compiler program
US9038045B2 (en) Unified parallel C work-sharing loop construct transformation
US9311065B2 (en) Data splitting for multi-instantiated objects
Song et al. Feedback-directed thread scheduling with memory considerations
JP2023180315A (en) Conversion program and conversion processing method
Yan et al. Homp: Automated distribution of parallel loops and data in highly parallel accelerator-based systems
US20140040908A1 (en) Resource assignment in a hybrid system
JPH0844577A (en) Data dividing method and multi-processor system
Matam et al. PartitionedVC: Partitioned external memory graph analytics framework for SSDs

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20220308

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20221221

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: 20230131

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20230213

R150 Certificate of patent or registration of utility model

Ref document number: 7239827

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150