JP2021093012A - Compilation program and information processing device - Google Patents
Compilation program and information processing device Download PDFInfo
- Publication number
- JP2021093012A JP2021093012A JP2019223768A JP2019223768A JP2021093012A JP 2021093012 A JP2021093012 A JP 2021093012A JP 2019223768 A JP2019223768 A JP 2019223768A JP 2019223768 A JP2019223768 A JP 2019223768A JP 2021093012 A JP2021093012 A JP 2021093012A
- Authority
- JP
- Japan
- Prior art keywords
- loop
- simd
- instruction sequence
- instruction
- processing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Advance Control (AREA)
- Executing Machine-Instructions (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
【課題】適切な手法でループ処理を最適化できるようにする。【解決手段】情報処理装置10は、ループ命令列1に基づいて、マスクで有効とした1以上の要素に対してSIMD命令によって並列で演算を実行させる処理を繰り返すループ処理が記述された第1SIMD化命令列2を生成する。次に情報処理装置10は、配列内の不連続の複数の要素をSIMDレジスタ内の連続の領域へ格納して、SIMDレジスタ内の複数の要素に対してSIMD命令により並列で演算を実行する処理を繰り返すループ処理が記述された第2SIMD化命令列3を生成する。そして情報処理装置10は、第1SIMD化命令列2と第2SIMD化命令列3と処理時間に基づいて、コンパイル後のプログラムに含める命令列を選択する。【選択図】図1PROBLEM TO BE SOLVED: To optimize loop processing by an appropriate method. SOLUTION: An information processing apparatus 10 describes a first SIMD in which a loop process of repeating a process of executing operations in parallel by a SIMD instruction for one or more elements enabled by a mask based on a loop instruction sequence 1 is described. Generate instruction sequence 2. Next, the information processing device 10 stores a plurality of discontinuous elements in the array in a continuous area in the SIMD register, and executes operations in parallel with the SIMD instructions for the plurality of elements in the SIMD register. The second SIMD instruction sequence 3 in which the loop processing that repeats the above is described is generated. Then, the information processing apparatus 10 selects an instruction sequence to be included in the compiled program based on the first SIMD instruction sequence 2, the second SIMD instruction sequence 3, and the processing time. [Selection diagram] Fig. 1
Description
本発明は、コンパイルプログラム、および情報処理装置に関する。 The present invention relates to a compilation program and an information processing device.
コンピュータで実行するプログラムは、高級言語で作成されたソースプログラムを、コンパイラを用いて実行形式のコード列に変換することで生成される。コンパイラを実行するコンピュータは、生成するプログラムを実行させるプロセッサのマイクロアーキテクチャに合わせて最適化したプログラムを生成する。マイクロアーキテクチャは、プロセッサの回路の論理的構造(レジスタ、バス、SIMD(Single Instruction Multiple Data)、パイプラインなど構造)を定義したものである。 A program to be executed on a computer is generated by converting a source program written in a high-level language into an executable code string using a compiler. The computer that runs the compiler produces a program that is optimized for the microarchitecture of the processor that executes the program to be generated. The microarchitecture defines the logical structure of a processor circuit (structures such as registers, buses, SIMD (Single Instruction Multiple Data), and pipelines).
なおSIMDとは、1つの命令を同時に複数のデータに適用することで並列処理を実現する命令の実行方式である。SIMDによる並列処理の実行を指示する命令をSIMD命令と呼ぶ。またループ処理を、SIMD命令を用いて並列化する処理に置き換えることを、SIMD化と呼ぶ。 SIMD is an instruction execution method that realizes parallel processing by applying one instruction to a plurality of data at the same time. An instruction that instructs the execution of parallel processing by SIMD is called a SIMD instruction. Replacing the loop processing with processing that parallelizes using the SIMD instruction is called SIMD conversion.
コンピュータは、ソースプログラムをコンパイルする際、ループ処理を最適化することで、プログラムの処理効率を格段に向上させることができる。例えばループ処理には、メモリ上の不連続の領域に格納された複数の要素(例えば所定長のデータ)それぞれに対して同じ演算を行う処理がある。このようなループ処理の最適化方法としては、マスク付きSIMD命令を利用する命令列に書き換える方法と、gather命令とscatter命令を利用する命令列に書き換える方法とがある。以下、gather命令とscatter命令との両方を指して、gather/scatter命令と呼ぶことがある。 When compiling a source program, a computer can significantly improve the processing efficiency of the program by optimizing the loop processing. For example, in the loop process, there is a process of performing the same operation for each of a plurality of elements (for example, data having a predetermined length) stored in a discontinuous area on the memory. As a method of optimizing such loop processing, there are a method of rewriting to an instruction sequence using a masked SIMD instruction and a method of rewriting to an instruction sequence using a gather instruction and a scatter instruction. Hereinafter, both the gather instruction and the scatter instruction may be referred to as a gather / scatter instruction.
マスク付きSIMD命令とは、SIMD命令用のレジスタ(SIMDレジスタ)に格納された複数の要素のうち、マスクデータによって指定された一部の要素に対してのみ演算を並列で実行することを指示する命令である。マスク付きSIMD命令を用いれば、不連続の領域に格納された複数の要素であっても、SIMDによる並列処理が可能となる。 The masked SIMD instruction indicates that the operation is executed in parallel only for some of the elements specified by the mask data among the plurality of elements stored in the SIMD instruction register (SIMD register). It is an instruction. By using the masked SIMD instruction, parallel processing by SIMD is possible even for a plurality of elements stored in a discontinuous area.
gather命令とは、メモリ上の不連続の領域に格納された複数の要素を、1つのSIMDレジスタに格納する命令である。scatter命令とは、1つのレジスタに格納された複数の要素を、メモリ上の不連続の領域に書き出す命令である。gather命令により、メモリ上の不連続の領域から複数の要素をSIMDレジスタに格納し、それらの要素にSIMD命令により並列で同じ演算を実行し、演算結果の要素をscatter命令で、メモリ上の不連続の領域に書き出すことができる。これにより、ループ処理の効率化が可能となる。 The gather instruction is an instruction for storing a plurality of elements stored in a discontinuous area on the memory in one SIMD register. The scatter instruction is an instruction to write a plurality of elements stored in one register to a discontinuous area in the memory. By the gather instruction, multiple elements are stored in the SIMD register from the discontinuous area in the memory, the same operation is executed in parallel by the SIMD instruction in those elements, and the element of the operation result is discontinuous in the memory by the scatter instruction. Can be exported to a continuous area. This makes it possible to improve the efficiency of loop processing.
コンパイラに関する技術としては、例えば、並列SIMDネイティブ・ソース・コードの生成を自動化する方法が開示されている。また同一演算の繰り返し処理を効率的に実行させることができるコード生成方法も開示されている。さらに、生成されるオブジェクトプログラムの命令数を削減し、実行性能を向上させるコンパイル方法も開示されている。 As a technique related to a compiler, for example, a method of automating the generation of parallel SIMD native source code is disclosed. Further, a code generation method capable of efficiently executing the iterative processing of the same operation is also disclosed. Further, a compilation method for reducing the number of instructions of the generated object program and improving the execution performance is also disclosed.
マスク付きSIMD命令を利用するループ処理では、SIMDレジスタに格納された要素のうち、マスクされていない一部の要素に対して同じ演算を並列で実行できる。他方、gather/scatter命令を利用するループ処理では、SIMDレジスタに格納された複数の要素すべてに対する同じ演算を並列で実行できる。そのため多くの場合、マスク付きSIMD命令を利用する命令列を用いたループ処理よりも、gather/scatter命令を利用する命令列を用いたループ処理の方が大幅な性能向上が期待できる。 In the loop processing using the masked SIMD instruction, the same operation can be executed in parallel for some of the unmasked elements stored in the SIMD register. On the other hand, in the loop processing using the gather / scatter instruction, the same operation can be executed in parallel for all the plurality of elements stored in the SIMD register. Therefore, in many cases, a significant performance improvement can be expected in the loop processing using the instruction sequence using the gather / scatter instruction rather than the loop processing using the instruction sequence using the masked SIMD instruction.
ただし、一般的には、gather/scatter命令の実行には、マスク付きSIMD命令を利用する際のSIMDレジスタへのload/store命令の実行よりも時間がかかる。そのため、gather/scatter命令の実行速度によっては、gather/scatter命令を利用する命令列を用いたループ処理よりもマスク付きSIMD命令を利用するループ処理の方が、処理が速い可能性がある。 However, in general, the execution of the gather / scatter instruction takes longer than the execution of the load / store instruction to the SIMD register when using the masked SIMD instruction. Therefore, depending on the execution speed of the gather / scatter instruction, the loop processing using the masked SIMD instruction may be faster than the loop processing using the instruction sequence using the gather / scatter instruction.
従来は、マスク付きSIMD命令を利用するループ処理とgather/scatter命令を利用するループ処理のどちらの方が効率的なのかについて適切な判断が行われておらず、ループ処理が適切な手法で最適化されていない可能性がある。 In the past, it has not been properly determined whether loop processing using a masked SIMD instruction or loop processing using a gather / scatter instruction is more efficient, and loop processing is optimal with an appropriate method. It may not have been converted.
1つの側面では、本件は、適切な手法でループ処理を最適化できるようにすることを目的とする。 On the one hand, this case aims to enable the loop processing to be optimized in an appropriate manner.
1つの案では、コンピュータに以下の処理を実行させるコンパイルプログラムが提供される。
コンピュータは、コンパイル対象のプログラムから、配列内の一部の要素に対する演算を指示するループ命令列を抽出する。次にコンピュータは、ループ命令列に基づいて、配列内の複数の要素のうち演算対象の要素のみを有効にするマスクを用い、マスクで有効とした1以上の要素に対してSIMD命令によって並列で演算を実行させる処理を繰り返すループ処理が記述された第1SIMD化命令列を生成する。またコンピュータは、ループ命令列に基づいて、配列内の不連続の複数の要素をSIMDレジスタ内の連続の領域へ格納して、SIMDレジスタ内の複数の要素に対してSIMD命令により並列で演算を実行する処理を繰り返すループ処理が記述された第2SIMD化命令列を生成する。さらにコンピュータは、複数の命令それぞれの実行に要する時間を表す数値が設定された実行時間情報に基づいて、第1SIMD化命令列の処理時間と第2SIMD化命令列の処理時間とを算出する。そしてコンピュータは、第1SIMD化命令列の処理時間と第2SIMD化命令列の処理時間とに基づいて、第1SIMD化命令列と第2SIMD化命令列とのうち、コンパイル後のプログラムに含める命令列を選択する。
One idea is to provide a compilation program that causes the computer to perform the following operations:
The computer extracts from the program to be compiled a loop instruction sequence that directs operations on some elements in the array. Next, the computer uses a mask that enables only the element to be calculated out of the multiple elements in the array based on the loop instruction sequence, and in parallel with the SIMD instruction for one or more elements enabled by the mask. A first SIMD instruction sequence is generated in which a loop process for repeating a process for executing an operation is described. In addition, the computer stores a plurality of discontinuous elements in the array in a continuous area in the SIMD register based on the loop instruction sequence, and performs operations in parallel with the SIMD instruction for the plurality of elements in the SIMD register. A second SIMD instruction sequence is generated in which a loop process that repeats the process to be executed is described. Further, the computer calculates the processing time of the first SIMD instruction sequence and the processing time of the second SIMD instruction sequence based on the execution time information in which the numerical value indicating the time required for executing each of the plurality of instructions is set. Then, the computer determines the instruction sequence to be included in the compiled program from the first SIMD instruction sequence and the second SIMD instruction sequence based on the processing time of the first SIMD instruction sequence and the processing time of the second SIMD instruction sequence. select.
1態様によれば、適切な手法でループ処理を最適化できる。 According to one aspect, the loop processing can be optimized by an appropriate method.
以下、本実施の形態について図面を参照して説明する。なお各実施の形態は、矛盾のない範囲で複数の実施の形態を組み合わせて実施することができる。
〔第1の実施の形態〕
図1は、第1の実施の形態に係る情報処理装置によるコンパイル方法の一例を示す図である。情報処理装置10は、例えばコンパイルプログラムを実行することにより、図1に示すコンパイル方法を実施することができる。
Hereinafter, the present embodiment will be described with reference to the drawings. It should be noted that each embodiment can be implemented by combining a plurality of embodiments within a consistent range.
[First Embodiment]
FIG. 1 is a diagram showing an example of a compilation method by the information processing apparatus according to the first embodiment. The
情報処理装置10は、記憶部11と処理部12とを有する。記憶部11は、例えば情報処理装置10が有するメモリ、またはストレージ装置である。処理部12は、例えば情報処理装置10が有するプロセッサ、または演算回路である。
The
記憶部11は、例えばコンパイル対象のプログラム11aと実行時間情報11bとを記憶する。プログラム11aは、例えば高級言語で命令が記述されたソースファイルである。実行時間情報11bは、複数の命令それぞれの実行に要する時間を表す数値が設定されている。実行に要する時間を表す数値は、例えば、複数の命令それぞれの実行に要するプロセッサのクロックのサイクル数である。この場合、ループ処理の処理時間は、プロセッサのクロックの1サイクルの時間を単位時間として表されることとなる。
The
処理部12は、プログラム11aをコンパイルする処理の中で、以下のループ最適化処理を実行する。
処理部12は、プログラム11aから、配列内の一部の要素に対する演算を指示するループ命令列1を抽出する(ステップS1)。ここでループ命令列1に示されるループ処理のループ回転数(繰り返し回数)をn(nは1以上の整数)とする。
The
The
次に処理部12は、ループ命令列1に基づいて、第1SIMD化命令列2を生成する(ステップS2)。第1SIMD化命令列2は、配列内の複数の要素のうち演算対象の要素のみを有効にするマスクを用い、マスクで有効とした1以上の要素に対してSIMD命令によって並列で演算を実行させる処理を繰り返すループ処理が記述された命令列である。第1SIMD化命令列2に示されるループ処理内には、例えば4つの命令「命令#11」〜「命令#14」が含まれる。「命令#11」は、マスクを生成する命令である。「命令#12」は、マスク付きで要素をロードする命令である。「命令#13」は、マスク付きでSIMD演算を行う命令である。「命令#14」は、マスク付きで演算結果をストアする命令である。
Next, the
次に処理部12は、ループ命令列1に基づいて、第2SIMD化命令列3を生成する(ステップS3)。第2SIMD化命令列3は、配列内の不連続の複数の要素をSIMDレジスタ内の連続の領域へ格納して、SIMDレジスタ内の複数の要素に対してSIMD命令により並列で演算を実行する処理を繰り返すループ処理が記述された命令列である。第2SIMD化命令列3に示されるループ処理内には、例えば4つの命令「命令#21」〜「命令#24」が含まれる。「命令#21」は、処理対象のインデックス値のリストの作成命令である。「命令#22」は、配列内の不連続の要素をSIMDレジスタ内の連続の記憶領域へロードするgather命令である。「命令#23」は、SIMD演算を行う命令である。「命令#24」は、演算結果を配列の不連続の要素の値としてストアするscatter命令である。
Next, the
次に処理部12は、複数の命令それぞれの実行に要するサイクル数が設定された実行時間情報11bに基づいて、第1SIMD化命令列2の処理時間と第2SIMD化命令列3の処理時間とを算出する(ステップS4)。例えば処理部12は、実行時間情報11bを参照し、第1SIMD化命令列2と第2SIMD化命令列3とのそれぞれに含まれる命令の実行に要するサイクル数を認識する。そして処理部12は、第1SIMD化命令列2のループ処理1回転当りの処理の実行に要するサイクル数に、第1SIMD化命令列2のループ回転数を乗算した値を、第1SIMD化命令列2の処理時間とする。同様に処理部12は、第2SIMD化命令列3のループ処理1回転当りの処理の実行に要するサイクル数に、第2SIMD化命令列3のループ回転数を乗算した値を、第2SIMD化命令列3の処理時間とする。
Next, the
なお処理部12は、例えばループ命令列1におけるループ処理の回転数を、SIMDレジスタに格納可能な要素数で除算した値を、第1SIMD化命令列2のループ回転数とする。また処理部12は、ループ命令列1におけるループ処理の回転数を、SIMDレジスタに格納可能な要素数と演算対象の要素を示すインデックス値のループ処理1回転ごとの増分値とで除算した値を、第2SIMD化命令列3のループ回転数とする。
The
そして処理部12は、第1SIMD化命令列2の処理時間と第2SIMD化命令列3の処理時間に基づいて、第1SIMD化命令列2と第2SIMD化命令列3とのうち、コンパイル後のプログラムに含める命令列を選択する(ステップS5)。例えば処理部12は、処理時間が短い方の命令列を、コンパイル後のプログラムに含める命令列として選択する。
Then, the
図1の例では、第1SIMD化命令列2では、ループ処理の1回転の処理に「命令#11」〜「命令#14」の4つの命令が含まれる。「命令#11」の実行に要するサイクル数は「4」であり、「命令#12」の実行に要するサイクル数は「10」であり、「命令#13」の実行に要するサイクル数は「9」であり、「命令#14」の実行に要するサイクル数は「10」である。ターゲットとするマイクロアーキテクチャにおいて、SIMDレジスタに格納可能な要素数が「8」の場合、マスク付きSIMD命令を利用する場合のループ回転数は「n/8」となる。すると第1SIMD化命令列2の実行に要する時間は、「4.1n(cycles)」となる。
In the example of FIG. 1, in the first
また第2SIMD化命令列3では、ループ処理の1回転の処理に「命令#21」〜「命令#24」の4つの命令が含まれる。「命令#21」の実行に要するサイクル数は「4」であり、「命令#22」の実行に要するサイクル数は「20」であり、「命令#23」の実行に要するサイクル数は「9」であり、「命令#24」の実行に要するサイクル数は「40」である。ここでSIMDレジスタに格納可能な要素数が「8」であり、ループ命令列1におけるループ制御変数のループ回転ごとの増分値が「2」であるものとする。この場合、gather/scatter命令を利用する場合のループ回転数は「n/16」となる。すると第2SIMD化命令列3の実行に要する時間は、「4.6n(cycles)」となる。
Further, in the second
この場合、第1SIMD化命令列2の方が第2SIMD化命令列3よりも実行に要する時間が短くなる。従って処理部12は、コンパイル後のプログラムに含める命令列として、第1SIMD化命令列2を選択する。すなわちマスク付きSIMD命令を利用するループ命令列が選択される。
In this case, the time required for execution of the first
このような情報処理装置10によれば、プログラム11aをコンパイルする際に、SIMD命令を用いた演算の並列化が可能なループ命令列1について、より処理効率が高い手法で最適化することができる。
According to such an
なお記憶部11には、複数のマイクロアーキテクチャそれぞれに対応する実行時間情報11bを記憶させておくことができる。この場合、処理部12は、命令列を選択する際に、コンパイル時に指定されたマイクロアーキテクチャに対応する実行時間情報を参照して、第1SIMD化命令列2と第2SIMD化命令列3との処理時間を算出する。これにより、マイクロアーキテクチャに応じた適切な処理時間を算出することができる。
The
なお処理部12は、第1SIMD化命令列2を生成する際、マスクの生成処理をループ処理の開始前に実行させるような第1SIMD化命令列2を生成することができる。これにより第1SIMD化命令列2の実行に要する処理時間がさらに短くなる。
When generating the first
また処理部12は、処理時間の比較をするまでもなく第2SIMD化命令列3の方が、処理時間が短くなることが分かっている場合、一部の処理の実行を抑止することができる。例えば処理部12は、ループ命令列1の1回のループ処理ごとのループ制御変数の増分値が所定の閾値を超えるか否かを判断する。処理部12は、増分値が閾値を超える場合、第1SIMD化命令列2の生成処理、および処理時間の算出処理の実行を抑止する。そして処理部12は、第1SIMD化命令列2の処理時間と第2SIMD化命令列3の処理時間との比較をせずに、コンパイル後のプログラムに含める命令列として第2SIMD化命令列3を選択する。
Further, the
このようにループ制御変数の増分値が十分に大きいと、第2SIMD化命令列3におけるループ回転数が第1SIMD化命令列2に比べて非常に少なくなる。そのため、第2SIMD化命令列3の方が、処理時間が短くなる。このような場合、第1SIMD化命令列2の生成などの処理をせずに、コンパイル後のプログラムに含める命令列として第2SIMD化命令列3を選択することで、コンパイル処理の効率化を図ることができる。
When the increment value of the loop control variable is sufficiently large in this way, the loop rotation speed in the second
〔第2の実施の形態〕
次に第2の実施の形態について説明する。第2の実施の形態は、C,C++,Fortranを代表とする高級言語を、ターゲットのマシン向けのより高速なオブジェクト(実行モジュール、オブジェクトファイル、アセンブリ言語のプログラムファイル)に最適化するコンパイル技術である。
[Second Embodiment]
Next, the second embodiment will be described. The second embodiment is a compilation technique that optimizes high-level languages such as C, C ++, and Fortran to faster objects (execution modules, object files, assembly language program files) for the target machine. is there.
図2は、コンパイルの実行に用いるコンピュータのハードウェアの一構成例を示す図である。コンピュータ100は、プロセッサ101によって装置全体が制御されている。プロセッサ101には、バス109を介してメモリ102と複数の周辺機器が接続されている。プロセッサ101は、マルチプロセッサであってもよい。プロセッサ101は、例えばCPU(Central Processing Unit)、MPU(Micro Processing Unit)、またはDSP(Digital Signal Processor)である。プロセッサ101がプログラムを実行することで実現する機能の少なくとも一部を、ASIC(Application Specific Integrated Circuit)、PLD(Programmable Logic Device)などの電子回路で実現してもよい。
FIG. 2 is a diagram showing a configuration example of computer hardware used for executing compilation. In the
またプロセッサ101は、SIMDレジスタ群101aを有している。SIMDレジスタ群101aは、SIMD拡張命令を格納できるだけのデータ幅を有するレジスタの集合である。プロセッサ101がSIMDレジスタ群101aを有していることで、コンピュータ100が、プロセッサ101をターゲットマシンとしたコンパイルを実施する場合には、ループ処理を、SIMDレジスタを用いた並列処理に最適化することができる。
Further, the
メモリ102は、コンピュータ100の主記憶装置として使用される。メモリ102には、プロセッサ101に実行させるOS(Operating System)のプログラムやアプリケーションプログラムの少なくとも一部が一時的に格納される。また、メモリ102には、プロセッサ101による処理に利用する各種データが格納される。メモリ102としては、例えばRAM(Random Access Memory)などの揮発性の半導体記憶装置が使用される。
The
バス109に接続されている周辺機器としては、ストレージ装置103、グラフィック処理装置104、入力インタフェース105、光学ドライブ装置106、機器接続インタフェース107およびネットワークインタフェース108がある。
Peripheral devices connected to the bus 109 include a
ストレージ装置103は、内蔵した記録媒体に対して、電気的または磁気的にデータの書き込みおよび読み出しを行う。ストレージ装置103は、コンピュータの補助記憶装置として使用される。ストレージ装置103には、OSのプログラム、アプリケーションプログラム、および各種データが格納される。なお、ストレージ装置103としては、例えばHDD(Hard Disk Drive)やSSD(Solid State Drive)を使用することができる。
The
グラフィック処理装置104には、モニタ21が接続されている。グラフィック処理装置104は、プロセッサ101からの命令に従って、画像をモニタ21の画面に表示させる。モニタ21としては、有機EL(Electro Luminescence)を用いた表示装置や液晶表示装置などがある。
A monitor 21 is connected to the
入力インタフェース105には、キーボード22とマウス23とが接続されている。入力インタフェース105は、キーボード22やマウス23から送られてくる信号をプロセッサ101に送信する。なお、マウス23は、ポインティングデバイスの一例であり、他のポインティングデバイスを使用することもできる。他のポインティングデバイスとしては、タッチパネル、タブレット、タッチパッド、トラックボールなどがある。
A keyboard 22 and a mouse 23 are connected to the
光学ドライブ装置106は、レーザ光などを利用して、光ディスク24に記録されたデータの読み取りを行う。光ディスク24は、光の反射によって読み取り可能なようにデータが記録された可搬型の記録媒体である。光ディスク24には、DVD(Digital Versatile Disc)、DVD−RAM、CD−ROM(Compact Disc Read Only Memory)、CD−R(Recordable)/RW(ReWritable)などがある。
The
機器接続インタフェース107は、コンピュータ100に周辺機器を接続するための通信インタフェースである。例えば機器接続インタフェース107には、メモリ装置25やメモリリーダライタ26を接続することができる。メモリ装置25は、機器接続インタフェース107との通信機能を搭載した記録媒体である。メモリリーダライタ26は、メモリカード27へのデータの書き込み、またはメモリカード27からのデータの読み出しを行う装置である。メモリカード27は、カード型の記録媒体である。
The
ネットワークインタフェース108は、ネットワーク20に接続されている。ネットワークインタフェース108は、ネットワーク20を介して、他のコンピュータまたは通信機器との間でデータの送受信を行う。
The
コンピュータ100は、以上のようなハードウェア構成によって、第2の実施の形態の処理機能を実現することができる。なお、第1の実施の形態に示した情報処理装置10も、図3に示したコンピュータ100と同様のハードウェアにより実現することができる。
The
コンピュータ100は、例えばコンピュータ読み取り可能な記録媒体に記録されたプログラムを実行することにより、第2の実施の形態の処理機能を実現する。コンピュータ100に実行させる処理内容を記述したプログラムは、様々な記録媒体に記録しておくことができる。例えば、コンピュータ100に実行させるプログラムをストレージ装置103に格納しておくことができる。プロセッサ101は、ストレージ装置103内のプログラムの少なくとも一部をメモリ102にロードし、プログラムを実行する。またコンピュータ100に実行させるプログラムを、光ディスク24、メモリ装置25、メモリカード27などの可搬型記録媒体に記録しておくこともできる。可搬型記録媒体に格納されたプログラムは、例えばプロセッサ101からの制御により、ストレージ装置103にインストールされた後、実行可能となる。またプロセッサ101が、可搬型記録媒体から直接プログラムを読み出して実行することもできる。
The
次に、コンピュータ100がプログラムをコンパイルするために利用する機能について説明する。
図3は、コンピュータの機能を示すブロック図である。コンピュータ100は、記憶部110とコンパイラ120とを有する。
Next, the functions used by the
FIG. 3 is a block diagram showing the functions of the computer. The
記憶部110は、コンパイルに利用するデータと、コンパイルによって生成されたデータとを記憶する。例えば記憶部110には、複数の命令スケジューリング用テーブル111a,111b,・・・、ソースファイル112、オブジェクトファイル113、実行プログラムモジュール114、アセンブリプログラムファイル115などが格納される。記憶部110は、例えばメモリ102またはストレージ装置103の記憶領域の少なくとも一部を用いて実現される。
The
複数の命令スケジューリング用テーブル111a,111b,・・・は、それぞれ異なるマイクロアーキテクチャに対応する。命令スケジューリング用テーブル111a,111b,・・・は、対応するマイクロアーキテクチャで使用可能な命令のレイテンシなどの情報が登録されたデータテーブルである。命令スケジューリング用テーブル111a,111b,・・・は、第1の実施の形態に示した実行時間情報11bの一例である。
The plurality of instruction scheduling tables 111a, 111b, ... Correspond to different microarchitectures. The instruction scheduling tables 111a, 111b, ... Are data tables in which information such as instruction latency that can be used in the corresponding microarchitecture is registered. The instruction scheduling tables 111a, 111b, ... Are examples of the
ソースファイル112は、C,C++,Fortranなどの高級言語で記述されたプログラムを含むファイルである。オブジェクトファイル113は、コンパイラ120によって生成され、機械語で命令が記述されたプログラムファイルである。実行プログラムモジュール114は、コンパイラ120によって生成され、直接実行可能なように機械語の命令が記述されたプログラムファイルである。アセンブリプログラムファイル115は、コンパイラ120によって生成され、アセンブリ言語で命令が記述されたプログラムファイルである。
The
コンパイラ120は、ソースファイル112に記述されたソースコードを機械語に変換し、オブジェクトファイル113を生成する。コンパイラ120は、例えば解析部121、最適化部122、およびコード出力部123を有する。
The
解析部121は、ソースファイル112に記述されているソースコードを解析する。解析部121は、例えば高級言語で記述されたソースコードを中間言語に変換する。
最適化部122は、中間言語で示される命令列の最適化を行う。例えば最適化部122は、ループ処理について、SIMD命令を用いた並列処理に変更する。最適化部122は、ループ処理を最適化するために、ループ最適化部122aとSIMD化部122bとを有する。
The
The
ループ最適化部122aは、ループ処理の最適化を行う。例えばループ最適化部122aは、中間言語に変換された命令列の中から、マスク付きSIMD命令を用いた最適化、またはgather/scatter命令を用いた最適化が可能なループ処理を記述する命令列(ループ命令列)を抽出する。次にループ最適化部122aは、抽出したループ命令列について、マスク付きSIMD命令を利用して最適化した場合のループ処理の実行時間と、gather/scatter命令を用いて最適化した場合のループ処理の実行時間とを比較する。そしてループ最適化部122aは、実行時間が短くなる手法によってループ処理が実行されるように、ループ命令列を最適化する。
The
SIMD化部122bは、SIMD命令で並列処理が可能なループ命令列を、SIMD命令を用いた処理に変換する。なおSIMD化部122bは、ループ処理のSIMD化を、ループ最適化部122aによるループ最適化処理より後に実行する。
The
コード出力部123は、最適化された中間言語の命令を機械語のコードに変換し、機械語で記述されたオブジェクトファイル113を出力する。例えばコード出力部123は、オブジェクトファイル113を、記憶部110に格納する。
The
なお、図3に示した各要素(解析部121、最適化部122、ループ最適化部122a、SIMD化部122b、コード出力部123)間を接続する線は通信経路の一部を示すものであり、図示した通信経路以外の通信経路も設定可能である。また、図3に示した各要素の機能は、例えば、その要素に対応するプログラムモジュールをコンピュータ100に実行させることで実現することができる。
The line connecting each element (
次に、記憶部110に格納されている命令スケジューリング用テーブル111a,111b,・・・について詳細に説明する。
図4は、命令スケジューリング用テーブルの一例を示す図である。命令スケジューリング用テーブル111aには、中間言語命令、レイテンシ情報、パイプライン情報、および非パイプライン命令フラグの欄が設けられている。
Next, the instruction scheduling tables 111a, 111b, ... Stored in the
FIG. 4 is a diagram showing an example of an instruction scheduling table. The instruction scheduling table 111a is provided with columns for intermediate language instructions, latency information, pipeline information, and non-pipeline instruction flags.
中間言語命令の欄には、中間言語として用いられる命令(中間言語命令)が設定される。例えば中間言語命令の欄には、コンパイル時に使用可能なすべての中間言語命令が設定されている。 Instructions used as an intermediate language (intermediate language instructions) are set in the intermediate language instruction column. For example, in the intermediate language instruction column, all intermediate language instructions that can be used at compile time are set.
レイテンシ情報の欄には、対応する中間言語命令を実行する際のレイテンシ(命令の実行が開始されてから実行が終了するまでの待ち時間)が設定される。例えばレイテンシは、プロセッサの動作クロックのサイクル数で表される。なお中間言語命令のレイテンシは、その中間言語命令を実行する際の引数や他の条件に応じて変わることがある。例えばgather命令であれば、取得する要素間のメモリ上での間隔が広いほど、メモリの大きく異なる位置から各要素のデータを読み出すこととなり、レイテンシが長期化する。そのためレイテンシ情報の欄には、例えば中間言語命令の標準的なレイテンシ(平均、最頻値などの代表値)が設定される。 In the latency information field, the latency (waiting time from the start of instruction execution to the end of execution) when executing the corresponding intermediate language instruction is set. Latency, for example, is represented by the number of cycles of the processor's operating clock. The latency of an intermediate language instruction may change depending on the arguments used when executing the intermediate language instruction and other conditions. For example, in the case of the gather instruction, the wider the distance between the elements to be acquired in the memory, the more the data of each element is read from the positions in the memory, and the latency becomes longer. Therefore, for example, the standard latency (representative value such as average and mode) of the intermediate language instruction is set in the latency information column.
パイプライン情報の欄には、対応する中間言語命令の実行に利用する1以上の演算器の名称が設定される。なおパイプライン情報の欄において、複数の演算器の名称が「,」で接続されている場合、「,」の両側の演算器の両方を使用することを示している。例えば中間言語命令のパイプライン情報が「AGP,PRP」の場合、その中間言語命令の実行には、演算器「AGP」(アドレス計算用演算器)と演算器「PRP」(predicate用演算器)との両方が使用される。なおpredicate用演算器は、各命令について実行時に出力するか否かの制御回路である。パイプライン情報の欄において、複数の演算器の名称が「|」で接続されている場合、「|」の両側の演算器のいずれか一方を使用することを示している。例えば中間言語命令のパイプライン情報が「FPA|FPB」の場合、その中間言語命令の実行には、演算器「FPA」と「FPB」(共に浮動小数点演算用演算器)のいずれか一方が使用される。 In the pipeline information column, the names of one or more arithmetic units used to execute the corresponding intermediate language instructions are set. In the pipeline information column, when the names of multiple arithmetic units are connected by ",", it is indicated that both arithmetic units on both sides of "," are used. For example, when the pipeline information of the intermediate language instruction is "AGP, PRP", the arithmetic unit "AGP" (address calculation arithmetic unit) and the arithmetic unit "PRP" (predicate arithmetic unit) are used to execute the intermediate language instruction. And both are used. The predicate arithmetic unit is a control circuit for whether or not to output each instruction at the time of execution. In the pipeline information column, when the names of a plurality of arithmetic units are connected by "|", it is indicated that one of the arithmetic units on both sides of "|" is used. For example, when the pipeline information of an intermediate language instruction is "FPA | FPB", one of the arithmetic units "FPA" and "FPB" (both are floating-point arithmetic arithmetic units) is used to execute the intermediate language instruction. Will be done.
非パイプライン命令フラグの欄には、対応する中間言語命令が非パイプライン命令か否かを示すフラグが設定される。非パイプライン命令とは、レイテンシの分だけ特定の演算器を占有する命令である。中間言語命令が非パイプライン命令である場合、非パイプライン命令フラグの欄に、非パイプライン命令であることを示すフラグ(図4では丸印で表記)が設定される。 In the non-pipeline instruction flag field, a flag indicating whether or not the corresponding intermediate language instruction is a non-pipeline instruction is set. A non-pipeline instruction is an instruction that occupies a specific arithmetic unit by the amount of latency. When the intermediate language instruction is a non-pipeline instruction, a flag indicating that it is a non-pipeline instruction (indicated by a circle in FIG. 4) is set in the non-pipeline instruction flag field.
なお、命令スケジューリング用テーブル111a以外の命令スケジューリング用テーブル111b,・・・にも、命令スケジューリング用テーブル111aと同種の情報が設定されている。なお、コンパイル時にどの命令スケジューリング用テーブルを使用するのかは、コンパイル時に指定されたマイクロアーキテクチャによって決定される。すなわちコンパイルの実行指示では、ターゲットとするマイクロアーキテクチャが指定される。ループ最適化部122aは、指定されたマイクロアーキテクチャに対応する命令スケジューリング用テーブルを参照して、ループ最適化処理を実行する。
Information similar to that of the instruction scheduling table 111a is also set in the instruction scheduling tables 111b, ... Other than the instruction scheduling table 111a. Which instruction scheduling table is used at compile time is determined by the microarchitecture specified at compile time. That is, the target microarchitecture is specified in the compile execution instruction. The
次に、コンパイラ120によるループ処理の最適化方式について具体的に説明する。ループ処理の最適化方式としては、マスク付きSIMD命令を利用する最適化と、gather/scatter命令を利用する最適化とがある。
Next, the optimization method of the loop processing by the
図5は、ループ処理を記述する命令列の例を示す図である。図5には、配列bのインデクス値が奇数の要素に、配列cの同じインデックス値の要素を加算し、加算結果を配列aの同じインデックス値の要素として格納する処理の例が示されている。このような処理は、マスク付きSIMD命令を利用するループ処理の最適化と、gather/scatter命令を利用するループ処理の最適化との両方が可能である。 FIG. 5 is a diagram showing an example of an instruction sequence describing loop processing. FIG. 5 shows an example of a process of adding an element having the same index value in the array c to an element having an odd index value in the array b and storing the addition result as an element having the same index value in the array a. .. Such processing can be both optimization of loop processing using the masked SIMD instruction and optimization of loop processing using the gather / scatter instruction.
マスク付きSIMD命令を利用してループ処理を実行させる場合、図5の下段の左側に示すループ命令列41が生成される。gather/scatter命令を利用してループ処理を実行させる場合、図5の下段の右側に示すループ命令列42が生成される。 When the loop processing is executed by using the masked SIMD instruction, the loop instruction sequence 41 shown on the left side of the lower part of FIG. 5 is generated. When the loop processing is executed by using the gather / scatter instruction, the loop instruction sequence 42 shown on the lower right side of FIG. 5 is generated.
配列b,配列cそれぞれには、n個の要素があるものとする。この場合、マスク付きSIMD命令を利用する場合のループ命令列41は、ループ制御変数iを1ずつカウントアップさせながら、i=nとなるまでループ(do i=1,n)するような記述となる。なおループ命令列41では、命令「if(mod(i,2)==1) then」により、インデックス値が奇数(ループ制御変数iの値を2で除算したときの剰余が1)の場合に、演算「a(i)=b(i)+c(i)」を行うことが記述されている。この剰余を用いた条件分岐が、SIMD命令に付与するマスクによって実現される。 It is assumed that each of the array b and the array c has n elements. In this case, the loop instruction sequence 41 when using the masked SIMD instruction is described so as to loop (do i = 1, n) until i = n while counting up the loop control variable i by 1. Become. In the loop instruction sequence 41, when the index value is odd (the remainder when the value of the loop control variable i is divided by 2 is 1) by the instruction "if (mod (i, 2) == 1) the". , It is described that the operation "a (i) = b (i) + c (i)" is performed. Conditional branching using this remainder is realized by the mask given to the SIMD instruction.
またgather/scatter命令を利用する場合のループ命令列42は、ループ制御変数iを2ずつカウントアップさせながらi=nとなるまでループ(do i=1,n,2)するような記述となる。このような配列上の一定間隔おきのインデックス値の要素に対する処理の場合、配列上のとびとびの領域に存在する複数の要素の同時取得がgather命令によって実現される。また、演算結果の、配列上のとびとびの領域への格納が、scatter命令によって実現される。なお、ループ命令列42のように、取得する要素を示すループ制御変数iの値を1ずつではなく、2以上ずつ増加させるようなループを、strideループと呼ぶことがある。 Further, the loop instruction sequence 42 when the gather / scatter instruction is used is described so as to loop (do i = 1, n, 2) until i = n while counting up the loop control variable i by 2. .. In the case of processing for the elements of the index value at regular intervals on the array, simultaneous acquisition of a plurality of elements existing in the discrete areas on the array is realized by the gather instruction. In addition, the calculation result is stored in the discrete area on the array by the scatter instruction. A loop such as the loop instruction sequence 42 in which the value of the loop control variable i indicating the element to be acquired is increased by 2 or more instead of 1 is sometimes called a stride loop.
図6は、マスク付きSIMD命令を利用するループ処理の内容を示す図である。図6の例では、コンパイルにおけるターゲットのマシンのプロセッサが、幅512ビットのSIMDレジスタ51,52,53を有しているものとする。これらのSIMDレジスタ51,52,53それぞれには、倍精度浮動小数点(8バイト)の要素を8つ同時に格納できる。 FIG. 6 is a diagram showing the contents of loop processing using the masked SIMD instruction. In the example of FIG. 6, it is assumed that the processor of the target machine in compilation has SIMD registers 51, 52, 53 with a width of 512 bits. Eight double-precision floating-point (8-byte) elements can be stored in each of these SIMD registers 51, 52, and 53 at the same time.
ループ命令列41では、インデックス値が奇数の要素のみを演算対象とする。そのため配列bの要素を読み込む際には、該当要素を「T」(真)、他の要素を「F」(偽)とするマスク54を用いたロード(load with mask)が行われる。このロードでは、SIMDレジスタ51と同じ幅の配列の要素に対してロードが実行されるが、マスク54において「T」と設定されたインデックス値の要素のみが、SIMDレジスタ51にロードされる。図6の例では、インデックス値「1」〜「8」の8つの要素に対するロード命令が行われ、マスク54で「T」の4つの要素のみがSIMDレジスタ51に格納される。同様に配列cの要素を読み込む際には、マスク55を用いたロード(load with mask)が行われ、マスク55で「T」の4つの要素のみがSIMDレジスタ52に格納される。
In the loop instruction sequence 41, only the elements having an odd index value are calculated. Therefore, when reading the elements of the array b, a load (load with mask) is performed using a
そしてSIMDレジスタ51,52の同じインデックス値(奇数のインデックス値に限る)の要素同士の加算が行われ、加算結果がSIMDレジスタ53に格納される。SIMDレジスタ53に格納された値は、インデックス値が奇数の要素を「T」、他の要素を「F」とするマスク56を用いたストア(store with mask)によって、配列aに格納される。これにより、配列aには、インデックス値が奇数の要素にのみ演算結果が格納される。なお、マスク付きSIMD命令利用時のロード命令とストア命令とを合わせて、以下load/store命令と呼ぶ。
Then, elements having the same index value (limited to an odd index value) of the SIMD registers 51 and 52 are added, and the addition result is stored in the
このように、ループ命令列41に対してSIMD化による最適化が行われると、配列において連続する8つの要素をループ1回転での処理対象とし、そのうちの演算対象の要素を並列で演算を実行する処理手順となる。そのためループの回転数は、nの1/8となる。すなわちSIM化前にループ回転数=nであったものが、SIMD化後にループ回転数=n/8となる。 In this way, when the loop instruction sequence 41 is optimized by SIMD, eight consecutive elements in the array are targeted for processing in one rotation of the loop, and the elements to be calculated are executed in parallel. It becomes a processing procedure to be performed. Therefore, the rotation speed of the loop is 1/8 of n. That is, what was loop rotation speed = n before SIM conversion becomes loop rotation speed = n / 8 after SIMD conversion.
図7は、gather/scatter命令を利用するループ処理の内容を示す図である。ループ命令列42では、インデックス値が奇数の要素のみを演算対象とする。そのため配列bの要素を読み込む際には、gather命令によって、配列b内の非連続の領域の8つの要素が同時に読み出され、SIMDレジスタ51に格納される。同様に配列cの要素を読み込む際には、gather命令によって、配列c内の非連続の領域の8つの要素が同時に読み出され、SIMDレジスタ52に格納される。
FIG. 7 is a diagram showing the contents of loop processing using the gather / scatter instruction. In the loop instruction sequence 42, only the elements having an odd index value are calculated. Therefore, when reading the elements of the array b, eight elements of the discontinuous region in the array b are simultaneously read by the gather instruction and stored in the
そしてSIMDレジスタ51,52の同じインデックス値の要素同士の加算が行われ、加算結果がSIMDレジスタ53に格納される。SIMDレジスタ53に格納された値は、scatter命令によって、配列a内の非連続の領域に格納される。
Then, elements having the same index value in the SIMD registers 51 and 52 are added, and the addition result is stored in the
このようにgather/scatter命令を利用できれば、幅512ビットのSIMDレジスタ51〜53内の倍精度浮動小数点で8要素分の領域を、すべて有効利用できる。その結果、SIMD化前のループ命令列42ではループ回転数=n/2であったものが、SIMD化後にはループ回転数=n/2/8となる。 If the gather / scatter instruction can be used in this way, all the areas of eight elements in double-precision floating point in the SIMD registers 51 to 53 having a width of 512 bits can be effectively used. As a result, in the loop instruction sequence 42 before SIMD conversion, the loop rotation speed = n / 2, but after SIMD conversion, the loop rotation speed = n / 2/8.
図6と図7とを比較すると、gather/scatter命令を利用するループ処理の方が、ループ回転数が半分で済むことが分かる。ここで、gather/scatter命令を利用する場合と、マスク付きSIMDにおけるload/store命令とで、要素のロードとストアに要する時間が同じであれば、gather/scatter命令を利用するループ処理を採用することで大幅な性能向上が期待できる。 Comparing FIG. 6 and FIG. 7, it can be seen that the loop processing using the gather / scatter instruction requires only half the loop rotation speed. Here, if the time required to load and store the element is the same between the case of using the gather / scatter instruction and the load / store instruction in the masked SIMD, the loop processing using the gather / scatter instruction is adopted. This can be expected to significantly improve performance.
ただし、gather/scatter命令では不連続の領域へのアクセスが行われるため、一般的には、その処理に要する時間は、マスク付きSIMD命令におけるload/store命令に要する時間よりも長い。そのため、gather/scatter命令の処理に要する時間によっては、例えループ処理の回転数が倍になっても連続領域にアクセスするマスク付きSIMD命令を利用した方が、全体として処理が速い可能性がある。 However, since the gather / scatter instruction accesses a discontinuous area, the time required for the processing is generally longer than the time required for the load / store instruction in the masked SIMD instruction. Therefore, depending on the time required to process the gather / scatter instruction, it may be faster to use the masked SIMD instruction that accesses the continuous area even if the rotation speed of the loop processing is doubled. ..
なお、gather/scatter命令を使うか、マスク付きSIMD命令を使うかは、マイクロアーキテクチャの各命令のレイテンシ情報だけで判断できるものではない。例えばループ1回転分(1イタレーション)の演算に要する時間が長ければ、gather/scatter命令が遅いマイクロアークチャでも、gather/scatter命令を利用する価値が高まる。それに対して、ループ1回転分の演算に要する時間が短い場合、gather/scatter命令のスピードがそのままそのループの性能に大きく影響するため、gather/scatter命令を利用する価値は下がる。このように実行性能の向上を図るには、それらの選択余地があるループの効率化手法に対して、それぞれの手法のループ命令列を使ったときにどちらのループ命令列を使えば速くなるかを適切に判断することが重要となる。 Whether to use the gather / scatter instruction or the masked SIMD instruction cannot be determined only by the latency information of each instruction of the microarchitecture. For example, if the time required for the calculation for one rotation of the loop (1 iteration) is long, the value of using the gather / scatter instruction increases even in the microarccha where the gather / scatter instruction is slow. On the other hand, when the time required for the calculation for one rotation of the loop is short, the speed of the gather / scatter instruction directly affects the performance of the loop, so that the value of using the gather / scatter instruction decreases. In order to improve the execution performance in this way, which loop instruction sequence should be used faster when using the loop instruction sequence of each method for the loop efficiency method that has a choice. It is important to make an appropriate judgment.
そこでコンピュータ100が有するコンパイラ120では、最適化部122に含まれるループ最適化部122aが、以下の計算により、どちらのループ命令列を利用するかを決定する。
Therefore, in the
[手順1]ループ最適化部122aは、IF文を含むループ命令列(マスク付きSIMD命令利用)の1イタレーション分のサイクル数にループ回転数(例えばn/8)を掛け合わせ、ループのコストを算出する。
[Procedure 1] The
[手順2]ループ最適化部122aは、strideループ(gather/scatter利用)の1イタレーション分のサイクル数にループ回転数(例えばn/16)を掛け合わせ、ループコストを算出する。
[Procedure 2] The
[手順3]ループ最適化部122aは、手順1で算出したコストと手順2で算出したコストとの比較により、gather/scatter命令を利用するループ命令列を採用するか、マスク付きSIMD命令を利用するループ命令列を採用するかを判定する。
[Procedure 3] The
以下、採用するループ命令列の判定例について説明する。
図8は、採用するループ命令列の判定例を示す図である。図8には、マスク付きSIMD命令とgather/scatter命令の実行時間に差があるケースの例を示している。
Hereinafter, an example of determining the loop instruction sequence to be adopted will be described.
FIG. 8 is a diagram showing a determination example of the loop instruction sequence to be adopted. FIG. 8 shows an example of a case where there is a difference in execution time between the masked SIMD instruction and the gather / scatter instruction.
例えばマスク付きSIMD命令を利用するループ命令列41の1イタレーション内の命令を中間言語命令で書き換えると、中間言語命令列61となる。中間言語命令列61は、第1の実施の形態に示す第1SIMD化命令列2の一例である。
For example, if the instruction in one iteration of the loop instruction sequence 41 using the masked SIMD instruction is rewritten with the intermediate language instruction, the intermediate language instruction sequence 61 is obtained. The intermediate language instruction sequence 61 is an example of the first
中間言語命令列61の1行目は、マスクを設定する命令である。「(mod(i:i+7,2)== (1,1,1,1,1,1,1,1)」によって、ループ制御変数iの現在値からi+7までの整数それぞれを2で除算したときの剰余が1であれば「T」、1でなければ「F」のマスクが生成される。生成されたマスクは、レジスタ「p1」に設定される。 The first line of the intermediate language instruction column 61 is an instruction for setting a mask. By "(mod (i: i + 7,2) == (1,1,1,1,1,1,1,1)", each integer from the current value of the loop control variable i to i + 7 was divided by 2. If the remainder is 1, a mask of "T" is generated, and if it is not 1, a mask of "F" is generated. The generated mask is set in the register "p1".
中間言語命令列61の2行目は、マスクを用いたロード命令である。「vload_with_mask(b(i:i+7),p1)」によって、ループ制御変数iの現在値からi+7までの整数それぞれをインデックス値とする配列bの要素のうち、マスク内の対応する値が「T」である要素が、メモリからロードされる。ロードされた要素は、レジスタ「v1」に設定される。また「vload_with_mask(c(i:i+7),p1)」によって、ループ制御変数iの現在値からi+7までの整数それぞれをインデックス値とする配列cの要素のうち、マスク内の対応する値が「T」である要素が、メモリからロードされる。ロードされた要素は、レジスタ「v2」に設定される。なお、2行目に記載されている2つのロード命令は、並列に実行可能である。 The second line of the intermediate language instruction column 61 is a load instruction using a mask. By "vroad_with_mask (b (i: i + 7), p1)", the corresponding value in the mask is "T" among the elements of the array b whose index values are the integers from the current value of the loop control variable i to i + 7. The element that is is loaded from memory. The loaded element is set in the register "v1". Further, by "vroad_with_mask (c (i: i + 7), p1)", among the elements of the array c having each integer from the current value of the loop control variable i to i + 7 as an index value, the corresponding value in the mask is "T". The element that is "is loaded from memory. The loaded element is set in the register "v2". The two load instructions described on the second line can be executed in parallel.
中間言語命令列61の3行目の「vadd_with_mask(v1,v2,p1)」は、レジスタ「v1」とレジスタ「v2」との、マスク内の対応する値が「T」である要素同士の加算命令である。加算結果は、レジスタ「v3」に設定される。 The third line "badd_with_mask (v1, v2, p1)" of the intermediate language instruction string 61 is the addition of the elements of the register "v1" and the register "v2" whose corresponding values in the mask are "T". It is an instruction. The addition result is set in the register "v3".
中間言語命令列61の4行目は、マスクを用いたストア命令である。「vstore_with_mask(a(i:i+7),v3,p1)」によって、マスク内の対応する値が「T」であるレジスタ「v3」内の値が、ループ制御変数iの現在値からi+7までの整数それぞれをインデックス値とする配列aの要素に設定される。 The fourth line of the intermediate language instruction column 61 is a store instruction using a mask. By "vstore_with_mask (a (i: i + 7), v3, p1)", the value in the register "v3" whose corresponding value in the mask is "T" is an integer from the current value of the loop control variable i to i + 7. It is set in the element of the array a having each as the index value.
ループ最適化部122aは、命令スケジューリング用テーブル111aを参照し、中間言語命令列61の各行のレイテンシを特定する。なお中間言語命令列61の1行目のマスクを設定する命令は、図4に示す命令スケジューリング用テーブル111aの中間言語命令「vcmp」に対応する。中間言語命令列61の2行目〜4行目の各命令は、命令スケジューリング用テーブル111aの同名の中間言語命令に対応する。
The
すると中間言語命令列61の1行目の命令のレイテンシは「4」、2行目のレイテンシは「10」、3行目のレイテンシは「9」、4行目のレイテンシは「10」となる。その結果、中間言語命令列61に示される1イタレーションの実行時間は、「4+10+9+10=33(cycles)」となる。マスク付きSIMD命令を利用するループ命令列41のループ回転数は「n/8」であるため、実行時間にループ回転数を乗算した値「4.1n(cycles)」が、SIMD命令を利用するループ命令列41の実行時間となる。 Then, the latency of the instruction in the first row of the intermediate language instruction column 61 is "4", the latency of the second row is "10", the latency of the third row is "9", and the latency of the fourth row is "10". .. As a result, the execution time of one iteration shown in the intermediate language instruction sequence 61 is "4 + 10 + 9 + 10 = 33 (cycles)". Since the loop rotation speed of the loop instruction sequence 41 using the masked SIMD instruction is "n / 8", the value "4.1n (cycles)" obtained by multiplying the execution time by the loop rotation speed uses the SIMD instruction. This is the execution time of the loop instruction sequence 41.
gather/scatter命令を利用するループ命令列42の1イタレーション内の命令を中間言語命令で書き換えると、中間言語命令列62となる。中間言語命令列62は、第1の実施の形態に示す第2SIMD化命令列3の一例である。
When the instruction in one iteration of the loop instruction sequence 42 using the gather / scatter instruction is rewritten with the intermediate language instruction, the intermediate language instruction sequence 62 is obtained. The intermediate language instruction sequence 62 is an example of the second
中間言語命令列62の1行目は、演算処理対象の要素のインデックス値を設定する命令である。「vindex(i,2)」によって、ループ制御変数iから2つとびのインデックス値のリストが生成される。なおリストには、レジスタ「v0」のサイズに応じた数の要素(図8の例では8要素)のインデックス値が登録される。生成されたリストは、レジスタ「v0」に設定される。 The first line of the intermediate language instruction column 62 is an instruction for setting the index value of the element to be processed. By "vinex (i, 2)", a list of two index values is generated from the loop control variable i. In the list, index values of a number of elements (8 elements in the example of FIG. 8) corresponding to the size of the register "v0" are registered. The generated list is set in the register "v0".
中間言語命令列62の2行目は、gather命令である。「gather(b(v0))」によって、レジスタ「v0」に設定されたインデックス値の配列bの要素が、メモリからロードされる。ロードされた要素は、レジスタ「v1」に設定される。また「gather(c(v0))」によって、レジスタ「v0」に設定されたインデックス値の配列cの要素が、メモリからロードされる。ロードされた要素は、レジスタ「v2」に設定される。なお、2行目に記載されている2つのgather命令は、並列に実行可能である。 The second line of the intermediate language instruction column 62 is a gather instruction. By "gather (b (v0))", the elements of the array b of the index values set in the register "v0" are loaded from the memory. The loaded element is set in the register "v1". Further, the element of the array c of the index values set in the register "v0" is loaded from the memory by "gather (c (v0))". The loaded element is set in the register "v2". The two gather instructions described on the second line can be executed in parallel.
中間言語命令列62の3行目の「vadd(v1,v2)」は、レジスタ「v1」とレジスタ「v2」との、対応する要素同士の加算命令である。加算結果は、レジスタ「v3」に設定される。 The third line "vadd (v1, v2)" of the intermediate language instruction column 62 is an addition instruction between the corresponding elements of the register "v1" and the register "v2". The addition result is set in the register "v3".
中間言語命令列62の4行目は、scatter命令である。「scatter(a(v0),v3)」によって、レジスタ「v3」内の値が、レジスタ「v0」に設定されたインデックス値の配列aの要素に設定される。 The fourth line of the intermediate language instruction column 62 is a scatter instruction. By "scatter (a (v0), v3)", the value in the register "v3" is set in the element of the array a of the index values set in the register "v0".
ループ最適化部122aは、命令スケジューリング用テーブル111aを参照し、中間言語命令列62の各行のレイテンシを特定する。例えば中間言語命令列62の4行目のマスク付きストアを命令する「scatter」のレイテンシは、図4に示す命令スケジューリング用テーブル111aの中間言語命令「scatter」のレイテンシ情報に示されている。中間言語命令列62の1行目〜3行目の各命令は、命令スケジューリング用テーブル111aの同名の中間言語命令に対応する。
The
すると中間言語命令列62の1行目の命令のレイテンシは「4」、2行目のレイテンシは「20」、3行目のレイテンシは「9」、4行目のレイテンシは「40」となる。その結果、中間言語命令列62に示される1イタレーションの実行時間は、「4+20+9+40=73(cycles)」となる。gather/scatter命令を利用するループ命令列42のループ回転数は「n/16」であるため、実行時間にループ回転数を乗算した値「4.6n(cycles)」が、gather/scatter命令を利用するループ命令列42の実行時間となる。 Then, the latency of the instruction in the first row of the intermediate language instruction column 62 is "4", the latency of the second row is "20", the latency of the third row is "9", and the latency of the fourth row is "40". .. As a result, the execution time of one iteration shown in the intermediate language instruction sequence 62 is "4 + 20 + 9 + 40 = 73 (cycles)". Since the loop rotation speed of the loop instruction sequence 42 using the gather / scatter instruction is "n / 16", the value "4.6n (cycles)" obtained by multiplying the execution time by the loop rotation speed is the gather / scatter instruction. This is the execution time of the loop instruction sequence 42 to be used.
ループ最適化部122aは、SIMD命令を利用するループ命令列41の実行時間とgather/scatter命令を利用するループ命令列42の実行時間とを比較し、時間が短い方のループ命令列を採用する。図8の例では、SIMD命令を利用するループ命令列41が採用される。すなわち、図8の例では、回転数が倍になっても、マスク付きSIMD命令を利用した方が効率がよい。
The
ループ最適化部122aは、このようなループ処理の最適化方式を、ループごとに判定する。これにより、ソースファイル112に含まれる多数のループ処理が、個別に適切な方式で最適化される。
The
以下、ループ最適化処理の手順を、フローチャートを参照して詳細に説明する。
図9は、ループ最適化処理の手順の一例を示すフローチャートである。以下、図9に示す処理をステップ番号に沿って説明する。
Hereinafter, the procedure of the loop optimization process will be described in detail with reference to the flowchart.
FIG. 9 is a flowchart showing an example of the procedure of the loop optimization process. Hereinafter, the process shown in FIG. 9 will be described along with the step numbers.
[ステップS101]ループ最適化部122aは、解析されたソースファイル112内のソースコード中のループ群から、ループ命令列を1つずつ抽出する。以下、ソースコードから抽出したループ命令列をオリジナルループと呼ぶこととする。
[Step S101] The
[ステップS102]ループ最適化部122aは、ステップS101においてループ命令列が抽出できたか否かを判断する。例えばソースファイル112に記述されたすべてのループ命令列を抽出し終えたら、処理を終了する。ループ最適化部122aは、抽出したループ命令列に対し、処理をステップS103に進める。またループ最適化部122aは、ループ命令列が抽出できなかった場合、ループ最適化処理を終了する。
[Step S102] The
[ステップS103]ループ最適化部122aは、抽出したループ命令列のループタイプを判定する。ループタイプとは、ループ命令列で示されるループ処理の種別である。
ループタイプとしては、最適化するとマスク付きSIMD命令を利用することとなるループ処理(TYPE1)、最適化するとgather/scatter命令を利用することとなるループ処理(TYPE2)、およびその他のループ処理(TYPE0)がある。「TYPE0」のループ処理は、ループ最適化部122aによる最適化の対象外のループ処理である。「TYPE1」のループ処理は、例えば配列内の連続する要素のうち、条件分岐(IF文など)によって演算対象の要素を選択する処理である。「TYPE2」のループ処理は、配列内のインデックス値が不連続の要素(例えば一定のストライド幅間隔のインデックス値を有する要素)に対して演算を実行する処理である。ループタイプ判定処理の詳細は後述する(図10参照)。
[Step S103] The
Loop types include loop processing (TYPE1) that uses masked SIMD instructions when optimized, loop processing (TYPE2) that uses gather / scatter instructions when optimized, and other loop processing (TYPE0). ). The loop processing of "TYPE0" is a loop processing that is not the target of optimization by the
[ステップS104]ループ最適化部122aは、ループ命令列に示されるループ処理のループタイプが「TYPE1」または「TYPE2」か否かを判断する。ループ最適化部122aは、ループタイプが「TYPE1」または「TYPE2」であれば処理をステップS105に進める。またループ最適化部122aは、ループタイプが「TYPE0」であれば処理をステップS101に進める。
[Step S104] The
[ステップS105]ループ最適化部122aは、ステップS101で抽出したオリジナルループと等価の等価ループの生成処理を行う。等価ループとは、抽出したループ命令列と同じ処理結果を得る異なるループタイプのループ命令列である。例えばループ最適化部122aは、抽出したループ命令列のループタイプが「TYPE1」であれば同じ処理結果を得る「TYPE2」のループ命令列を生成する。またループ最適化部122aは、抽出したループ命令列のループタイプが「TYPE2」であれば同じ処理結果を得る「TYPE1」のループ命令列を生成する。等価ループ生成処理の詳細は後述する(図11参照)。
[Step S105] The
[ステップS106]ループ最適化部122aは、オリジナルループと等価ループとのそれぞれについて、命令スケジューリング処理を行う。命令スケジューリング処理では、例えば処理効率が向上するように命令の順序の入れ替えが行われる。例えばループ最適化部122aは、SIMD命令で並列処理が可能なループ処理について、SIMD命令を用いた命令列に書き換える。命令スケジューリング処理の詳細は後述する(図14参照)。
[Step S106] The
[ステップS107]ループ最適化部122aは、オリジナルループと等価ループとのそれぞれについて、ループコスト算出処理を行う。ループコスト算出処理は、ループ命令列に応じたループ処理全体の実行に要する時間(1イタレーションの実行時間×回転数)を、コストとして換算する処理である。ループコスト算出処理の詳細は後述する(図15参照)。
[Step S107] The
[ステップS108]ループ最適化部122aは、オリジナルループと等価ループとのループコストを比較し、オリジナルループのループコストの方が等価ループのループコストより大きいか否かを判断する。ループ最適化部122aは、オリジナルループのループコストの方が大きい場合、処理をステップS109に進める。またループ最適化部122aは、ループコストが等しいか、あるいは等価ループの方が大きい場合、処理をステップS101に進める。
[Step S108] The
[ステップS109]ループ最適化部122aは、オリジナルループのループ命令列を、等価ループのループ命令列に入れ替える。
[ステップS110]ループ最適化部122aは、不採用となったループ命令列を破棄し、処理をステップS101に進める。
[Step S109] The
[Step S110] The
このようにして、ループ最適化部122aは、マスク付きSIMD命令を利用するループ命令列とgather/scatter命令を利用するループ命令列とのどちらでも実施可能なループ処理について、処理時間が短くなる方のループ命令列を採用することができる。
In this way, the
次にループタイプ判定処理について詳細に説明する。
図10は、ループタイプ判定処理の手順の一例を示すフローチャートである。以下、図10に示す処理をステップ番号に沿って説明する。
Next, the loop type determination process will be described in detail.
FIG. 10 is a flowchart showing an example of the procedure of the loop type determination process. Hereinafter, the process shown in FIG. 10 will be described along with the step numbers.
[ステップS121]ループ最適化部122aは、オリジナルループの中から、ループ制御変数を認識したか否かを判断する。ループ制御変数とは、「do i=s,n,k」における変数「i」のようにループの回転ごとに更新される変数である。ループ最適化部122aは、例えばループの回転で1回転(1イタレーション)当り1回更新される変数をループ制御変数として認識する。ループ最適化部122aは、1イタレーション当りの更新回数が2回以上ある変数は、その変数を最適化対象としないために、ループ制御変数ではないと認識する。
[Step S121] The
ループ最適化部122aは、ループ制御変数を認識した場合、処理をステップS122に進める。またループ最適化部122aは、ループ制御変数を認識できなかった場合、処理をステップS125に進める。
When the
[ステップS122]ループ最適化部122aは、ループ制御変数の増分値を認識する。増分値とは、ループ制御変数の1イタレーション当りの増加量である。例えば「do i=s,n,k」における定数「k」が増分値である。増分値は、演算対象となる要素のインデックス値のストライド幅を表している。
[Step S122] The
なおループ処理は「do i=s,n」と記述することもできる。この記述は、デフォルト値として定義されている増分値「1」の記載が省略されたものである。「do i=s,n」と記述されていた場合、ループ最適化部122aは、この記述が「do i=s,n,1」と等価であると判断し、増分値を「1」と認識する。
The loop processing can also be described as "do i = s, n". In this description, the description of the increment value "1" defined as the default value is omitted. When "do i = s, n" is described, the
[ステップS123]ループ最適化部122aは、ループ制御変数の初期値s(「do i=s,n,k」における「s」)が、0以上の定数か否かを判断する。ループ最適化部122aは、初期値sが0以上の定数の場合、処理をステップS124に進める。またループ最適化部122aは、初期値sが0以上の定数ではない場合、処理をステップS125に進める。
[Step S123] The
[ステップS124]ループ最適化部122aは、増分値kが定数か否かを判断する。ループ最適化部122aは、増分値kが定数の場合、処理をステップS126に進める。またループ最適化部122aは、増分値kが定数ではない場合、処理をステップS125に進める。
[Step S124] The
[ステップS125]ループ最適化部122aは、ループタイプ判定処理の戻り値を「TYPE0」として、ループタイプ判定処理を終了する。すなわちループ最適化部122aは、オリジナルループのループタイプを「TYPE0」に決定する。
[Step S125] The
[ステップS126]ループ最適化部122aは、増分値k=1か否かを判断する。ループ最適化部122aは、増分値k=1であれば、処理をステップS127に進める。またループ最適化部122aは、増分値k=1でなければ、処理をステップS129に進める。
[Step S126] The
[ステップS127]ループ最適化部122aは、オリジナルループがIFマスクタイプの条件を満たすか否かを判断する。IFマスクタイプの条件は、例えば以下の5つの条件である。
・ループ回転分岐以外の分岐(IF文)は1つである。
・IF文の条件節が「mod(ループ制御変数,閾値)==定数VAL」である。
・定数VALが「0≦定数VAL<増分値k」を満たす。
・IF文配下の演算が一定幅のデータに対して実行される。
・IF条件節とIF分岐、ループ繰り返し判定以外の命令列はIF文配下である。
[Step S127] The
-There is one branch (IF statement) other than the loop rotation branch.
-The conditional clause of the IF statement is "mod (loop control variable, threshold) == constant VAL".
-The constant VAL satisfies "0 ≤ constant VAL <incremental value k".
-The operation under the IF statement is executed for data of a certain width.
-The instruction sequence other than the IF conditional clause, IF branch, and loop repetition judgment is under the IF statement.
ループ最適化部122aは、これらの5つの条件のすべてが満たされる場合、IFマスクタイプの条件を満たすと判断し、処理をステップS128に進める。またループ最適化部122aは、これらの5つの条件の少なくとも1つが満たされない場合、IFマスクタイプの条件を満たさないと判断し、処理をステップS130に進める。
If all of these five conditions are satisfied, the
[ステップS128]ループ最適化部122aは、ループタイプ判定処理の戻り値を「TYPE1」として、ループタイプ判定処理を終了する。すなわちループ最適化部122aは、オリジナルループのループタイプを「TYPE1」に決定する。
[Step S128] The
[ステップS129]ループ最適化部122aは、増分値kが、予め設定された閾値より大きいか否かを判断する。閾値は、ユーザが任意に設定することができる。例えば、インデックス値が奇数または偶数の要素に対して演算を行うループ処理のみを最適化するのであれば、ユーザは、閾値として「2」を設定すればよい。ループ最適化部122aは、増分値kが閾値より大きければ、処理をステップS130に進める。またループ最適化部122aは、増分値kが閾値以下であれば、処理をステップS131に進める。
[Step S129] The
[ステップS130]ループ最適化部122aは、ループタイプ判定処理の戻り値を「TYPE0」として、ループタイプ判定処理を終了する。すなわちループ最適化部122aは、オリジナルループのループタイプを「TYPE0」に決定する。
[Step S130] The
[ステップS131]ループ最適化部122aは、ループタイプ判定処理の戻り値を「TYPE2」として、ループタイプ判定処理を終了する。すなわちループ最適化部122aは、オリジナルループのループタイプを「TYPE2」に決定する。
[Step S131] The
このようにして、ループ命令列に示されるループ処理の内容に応じて、オリジナルループのループタイプが判定される。そして「TYPE1」または「TYPE2」のループ命令列が、ループ最適化部122aによる最適化対象となる。ループタイプの判定が終了すると、等価ループの生成処理が実行される。
In this way, the loop type of the original loop is determined according to the content of the loop processing shown in the loop instruction sequence. Then, the loop instruction sequence of "TYPE1" or "TYPE2" is the object of optimization by the
図11は、等価ループ生成処理の手順の一例を示すフローチャートである。以下、図11に示す処理をステップ番号に沿って説明する。
[ステップS141]ループ最適化部122aは、オリジナルループのループタイプが「TYPE1」か否かを判断する。ループ最適化部122aは、ループタイプが「TYPE1」であれば、処理をステップS142に進める。またループ最適化部122aは、ループタイプが「TYPE2」であれば、処理をステップS143に進める。
FIG. 11 is a flowchart showing an example of the procedure of the equivalent loop generation process. Hereinafter, the process shown in FIG. 11 will be described along with the step numbers.
[Step S141] The
[ステップS142]ループ最適化部122aは、オリジナルループと同じ処理結果が得られる「TYPE2」のループ命令列(gather/scatter命令を利用するループ命令列)を、等価ループとして生成する。その後、ループ最適化部122aは処理をステップS144に進める。
[Step S142] The
[ステップS143]ループ最適化部122aは、オリジナルループと同じ処理結果が得られる「TYPE1」のループ命令列(マスク付きSIMD命令を利用するループ命令列)を生成する。
[Step S143] The
[ステップS144]ループ最適化部122aは、等価ループであるループ命令列において定数にできる部分について、最適化を行う。そしてループ最適化部122aは、該当部分の記述を定数に変換する。例えば「mod(s,stride)」のsが定数であり、増分値を示すstrideも定数の場合、ループ最適化部122aは、「mod(s,stride)」の定数計算結果が「1」となる場合には、「mod(s,stride)」を定数「1」に変換する。
[Step S144] The
[ステップS145]ループ最適化部122aは、定数化できない不変式の最適化を行う。例えばループ最適化部122aは、mod(s,stride)のsが定数でなくとも、strideが定数の場合にはmod(s,stride)をループ外に追い出す。
[Step S145] The
[ステップS146]ループ最適化部122aは、生成した等価ループを戻り値として出力し、等価ループ生成処理を終了する。
このようにして、オリジナルループと同じ処理結果を得ることができる等価ループが生成される。ループ最適化部122aは、生成されたオリジナルループと等価ループとをメモリ102に格納する。
[Step S146] The
In this way, an equivalent loop that can obtain the same processing result as the original loop is generated. The
図12は、「TYPE1」のオリジナルループから「TYPE2」の等価ループへの変換例を示す図である。図12に示すオリジナルループ71では、IF文の中で「mod(i,stride).eq.val」という条件が示されている。これはループ制御変数iを定数「stride」で除算したときの剰余が定数「val」と等しいという条件である。このようなループ処理内で条件が定義されているループ処理は、SIMD化部122bにより、マスクSIMD命令を利用する処理に最適化されることとなる。
FIG. 12 is a diagram showing an example of conversion from the original loop of “
オリジナルループ71に基づいて生成された等価ループ72では、ループ処理内で「i+=stride」によって、一定間隔でループ制御変数を増加させている。このような一定のストライド幅でのループ制御変数の増加を伴うループ処理は、SIMD化部122bにより、gather/scatter命令を利用する処理に最適化されることとなる。また等価ループ72では、オリジナルループ71のIF文内の条件を最初に満たすループ制御変数iの値を、ループ処理の前の2行の命令で算出している。これによりループ処理における1イタレーション当りの処理時間を短縮することができる。
In the equivalent loop 72 generated based on the original loop 71, the loop control variable is increased at regular intervals by “i + = stride” in the loop processing. The loop processing accompanied by the increase of the loop control variable with such a constant stride width is optimized by the
図13は、「TYPE2」のオリジナルループから「TYPE1」の等価ループへの変換例を示す図である。図13に示すオリジナルループ73では、ループ処理内で「i+=stride」によって、一定間隔でループ制御変数を増加させている。このような一定のストライド幅でのループ制御変数の増加を伴うループ処理は、SIMD化部122bにより、gather/scatter命令を利用する処理に最適化されることとなる。
FIG. 13 is a diagram showing an example of conversion from the original loop of “
オリジナルループ73に基づいて生成された等価ループ74では、IF文の中で「mod(i,stride).eq.mod(s,stride)」という条件が示されている。このようなループ処理内で条件が定義されているループ処理は、SIMD化部122bにより、マスクSIMD命令を利用する処理に最適化されることとなる。
In the equivalent loop 74 generated based on the original loop 73, the condition “mod (i, stride) .eq. Mod (s, stride)” is shown in the IF statement. The loop processing in which the conditions are defined in such a loop processing is optimized by the
オリジナルループに基づいて等価ループが生成されることにより、「TYPE1」のループ命令列と「TYPE2」のループ命令列との組が生成される。そしてループ最適化部122aは、ループ命令列の組に対して、命令スケジューリング処理を行う。
By generating the equivalent loop based on the original loop, a pair of the loop instruction sequence of "TYPE1" and the loop instruction sequence of "TYPE2" is generated. Then, the
図14は、命令スケジューリング処理の手順の一例を示すフローチャートである。以下、図14に示す処理をステップ番号に沿って説明する。
[ステップS151]ループ最適化部122aは、「TYPE1」のループ命令列をメモリ102から取得する。
FIG. 14 is a flowchart showing an example of the instruction scheduling process procedure. Hereinafter, the process shown in FIG. 14 will be described along with the step numbers.
[Step S151] The
[ステップS152]ループ最適化部122aは、「TYPE1」のループ命令列の命令スケジューリングを行う。例えばループ最適化部122aは、命令スケジューリング用テーブル111aから、各命令に対するレイテンシ情報、利用する演算器情報を参照して、命令スケジューリングを実施する。例えばループ最適化部122aは、効率的にループ処理が実行されるように、演算結果に影響を与えない範囲で命令の順序を入れ替える。ループ最適化部122aは、命令スケジューリングの手法としては、例えばリストスケジューリング、ソフトウェアパイプラインなどの手法を用いることができる。
[Step S152] The
[ステップS153]ループ最適化部122aは、「TYPE2」のループ命令列をメモリ102から取得する。
[ステップS154]ループ最適化部122aは、命令スケジューリング用テーブル111aを参照し、ステップS152と同様に、「TYPE2」のループ命令列の命令スケジューリングを行う。
[Step S153] The
[Step S154] The
[ステップS155]ループ最適化部122aは、命令スケジューリング後の「TYPE1」と「TYPE2」とのループ命令列の組を戻り値として出力し、命令スケジューリング処理を終了する。命令スケジューリング処理後のループ命令列は、例えば中間言語命令によって記述されている。ループ最適化部122aは、命令スケジューリング後の「TYPE1」と「TYPE2」とのループ命令列の組をメモリ102に格納する。
[Step S155] The
その後、ループ最適化部122aは、「TYPE1」と「TYPE2」それぞれのループ命令列のループコストを算出する。
図15は、ループコスト算出処理の手順の一例を示すフローチャートである。以下、図15に示す処理をステップ番号に沿って説明する。
After that, the
FIG. 15 is a flowchart showing an example of the procedure of the loop cost calculation process. Hereinafter, the process shown in FIG. 15 will be described along with the step numbers.
[ステップS161]ループ最適化部122aは、「TYPE1」の命令スケジューリング後のループ命令列をメモリ102から取得する。
[ステップS162]ループ最適化部122aは、「TYPE1」のループ命令列の1回転(1イタレーション)におけるクリティカルパスの命令列を実行するのに要するプロセッサの処理のサイクル数C1を算出する。クリティカルパスとは、ループ内の命令列の連鎖の中で、最も処理時間が長くなる処理ルートである。算出したサイクル数に、プログラムを実行させるプロセッサの動作クロックの周期を乗算すれば、そのプロセッサにおける処理時間となる。
[Step S161] The
[Step S162] The
[ステップS163]ループ最適化部122aは、「TYPE1」の場合のSIMD化後のループ回転数×サイクル数C1を計算し、「TYPE1」のループコストTC1とする。例えばSIMDレジスタに8つの要素を格納可能な場合、「TYPE1」の場合のSIMD化後のループ回転数は、SIMD化前のループ回転数の8分の1である。
[Step S163] The
[ステップS164]ループ最適化部122aは、「TYPE2」の命令スケジューリング後のループ命令列をメモリ102から取得する。
[ステップS165]ループ最適化部122aは、「TYPE2」のループ命令列の1回転(1イタレーション)におけるクリティカルパスの命令列を実行するのに要するプロセッサの処理のサイクル数C2を算出する。
[Step S164] The
[Step S165] The
[ステップS166]ループ最適化部122aは、「TYPE2」の場合のSIMD化後のループ回転数×サイクル数C2を計算し、「TYPE2」のループコストTC2とする。例えばSIMDレジスタに8つの要素を格納可能であり、ループ制御変数iの増分値が2の場合、「TYPE2」の場合のSIMD化後のループ回転数は、SIMD化前のループ回転数の16分の1である。
[Step S166] The
[ステップS167]ループ最適化部122aは、「TYPE1」と「TYPE2」とのループ命令列それぞれのループコストTC1,TC2を戻り値として出力し、ループコスト算出処理を終了する。
[Step S167] The
このように「TYPE1」と「TYPE2」とのループ命令列それぞれのループコストTC1,TC2を算出後、ループ最適化部122aは、ループコストの低い方のループ命令列をコンパイル後のプログラムに適用する命令列として採用する。これにより、より効率的に処理を実行可能なオブジェクトファイル113が生成される。
After calculating the loop costs TC1 and TC2 of each of the loop instruction sequences of "TYPE1" and "TYPE2" in this way, the
またループ最適化部122aは、ループ命令列のうち定数化が可能な部分について定数に置き換えている。これにより、ループ処理の効率化が図れる。またループ最適化部122aは、ループ外に移動可能な命令をループ外に移動させることで、ループ内での処理を簡略化している。これにより、ループ処理のさらなる効率化が図れる。
Further, the
例えばマスク付きSIMD命令を利用するループ命令列の場合、マスクを固定値にすることができる。
図16は、マスク付きSIMD命令におけるマスクの固定値化の例を示す図である。図16に示すループ命令列81は、図5に示したループ命令列41のマスクの定義を固定値化したものである。ループ命令列41は、配列のインデックス値が奇数の要素に対して演算を実行する処理である。この場合、ループ命令列81に示すように、「mask=(/T,F,T,F,T,F,T,F/)」として、固定値のマスクをループの外で定義することができる。このようにマスクの定義をループ外に出すことで、ループ処理内の1イタレーションの処理の中間言語命令列82では、マスクの定義に関する命令を除外することができる。その結果、ループコストは「3.6n」となり、図8に示したループ命令列41のループコストよりも小さくなる。
For example, in the case of a loop instruction sequence using a masked SIMD instruction, the mask can be set to a fixed value.
FIG. 16 is a diagram showing an example of fixing the mask value in the masked SIMD instruction. The loop instruction sequence 81 shown in FIG. 16 is a fixed value definition of the mask of the loop instruction sequence 41 shown in FIG. The loop instruction sequence 41 is a process of executing an operation on an element having an odd index value in the array. In this case, as shown in the loop instruction sequence 81, a fixed value mask can be defined outside the loop with "mask = (/ T, F, T, F, T, F, T, F /)". it can. By taking the mask definition out of the loop in this way, the instruction related to the mask definition can be excluded from the intermediate language instruction sequence 82 of the processing of one iteration in the loop processing. As a result, the loop cost becomes "3.6n", which is smaller than the loop cost of the loop instruction sequence 41 shown in FIG.
このようにループ最適化部122aがマスクの固定値化を行い、ループ外でマスクを定義することで、マスク付きSIMD命令利用の方が性能向上するケースが増加する。
なお、上記の説明では、インデックス値が奇数であることを判定する場合(奇数判定)の例を用いて説明しているが、インデックス値が偶数であることを判定する場合(偶数判定)にも、同様に適用可能である。
In this way, the
In the above description, an example of determining that the index value is odd (odd number determination) is used, but it is also possible to determine that the index value is even (even number determination). , Applicable as well.
図17は、偶数判定の場合のループ命令列の一例を示す図である。マスク付きSIMD命令を利用するループ命令列91では、IF文内の条件が「mod(i,2)==0」となっている。これにより、インデックス値が2で割り切れる場合にIF文の判定結果が真となり、インデックス値が偶数の要素に対して演算が実施される。gather/scatter命令を利用するループ命令列92では、「do i=2,n,2」により、ループ制御変数を、偶数の初期値「2」から、増分値「2」でループ回転ごとに増加させる。 FIG. 17 is a diagram showing an example of a loop instruction sequence in the case of even number determination. In the loop instruction sequence 91 that uses the masked SIMD instruction, the condition in the IF statement is "mod (i, 2) == 0". As a result, when the index value is divisible by 2, the determination result of the IF statement becomes true, and the operation is performed on the element having an even index value. In the loop instruction sequence 92 using the gather / scatter instruction, the loop control variable is increased from the even initial value "2" to the increment value "2" for each loop rotation by "do i = 2, n, 2". Let me.
偶数判定の場合であっても、ループ最適化部122aは、図17に示すループ命令列91,92それぞれのループコストを比較することで、処理効率がよい方のループ命令列を採用することができる。
Even in the case of even-numbered determination, the
なお、奇数判定と偶数判定とは、演算対象の要素のストライド幅(インデックス値の増分値)は「2」であるが、ストライド幅が「3」以上の場合もある。
図18は、ストライド幅が「3」の場合のループ命令列の一例を示す図である。マスク付きSIMD命令を利用するループ命令列93では、IF文内の条件が「mod(i,3)==1」となっている。これにより、インデックス値を3で除算したときの剰余が1の場合にIF文の判定結果が真となり、該当要素に対して演算が実施される。gather/scatter命令を利用するループ命令列94では、「do i=1,n,3」により、ループ制御変数を、初期値「1」から、増分値「3」でループ回転ごとに増加させる。
In the odd-numbered determination and the even-numbered determination, the stride width (incremental value of the index value) of the element to be calculated is "2", but the stride width may be "3" or more.
FIG. 18 is a diagram showing an example of a loop command sequence when the stride width is “3”. In the loop instruction sequence 93 using the masked SIMD instruction, the condition in the IF statement is "mod (i, 3) == 1". As a result, when the remainder when the index value is divided by 3 is 1, the determination result of the IF statement becomes true, and the operation is performed on the corresponding element. In the loop instruction sequence 94 using the gather / scatter instruction, the loop control variable is increased from the initial value "1" to the increment value "3" for each loop rotation by "do i = 1, n, 3".
ストライド幅「3」の場合であっても、ループ最適化部122aは、図18に示すループ命令列93,94それぞれのループコストを比較することで、処理効率がよい方のループ命令列を採用することができる。
Even when the stride width is "3", the
図19は、ストライド幅が「4」の場合のループ命令列の一例を示す図である。マスク付きSIMD命令を利用するループ命令列95では、IF文内の条件が「mod(i,4)==1」となっている。これにより、インデックス値を4で除算したときの剰余が1の場合にIF文の判定結果が真となり、該当要素に対して演算が実施される。gather/scatter命令を利用するループ命令列96では、「do i=1,n,4」により、ループ制御変数を、偶数の初期値「1」から、増分値「4」でループ回転ごとに増加させる。 FIG. 19 is a diagram showing an example of a loop command sequence when the stride width is “4”. In the loop instruction sequence 95 that uses the masked SIMD instruction, the condition in the IF statement is "mod (i, 4) == 1". As a result, when the remainder when the index value is divided by 4 is 1, the determination result of the IF statement becomes true, and the operation is performed on the corresponding element. In the loop instruction sequence 96 using the gather / scatter instruction, the loop control variable is increased from the even initial value "1" to the increment value "4" for each loop rotation by "do i = 1, n, 4". Let me.
ストライド幅「4」の場合であっても、ループ最適化部122aは、図19に示すループ命令列95,96それぞれのループコストを比較することで、処理効率がよい方のループ命令列を採用することができる。
Even when the stride width is “4”, the
なお、ストライド幅が大きくなるほど、マスク付きSMID命令を利用した場合にSIMD命令で並列処理できる要素数が少なくなる。そのため、ストライド幅が大きくなるほど、マスク付きSMID命令を利用するループ命令列よりも、gather/scatter命令を利用するループ命令列の方が効率的となる可能性が高くなる。そこでループ最適化部122aは、ループタイプ判定処理(図10参照)において、増分値kが「1」以外であり、所定の閾値より大きい場合には、ループタイプを「TYPE0」とすることで以後の処理を省略し、コンパイル処理の効率化を図っている。
The larger the stride width, the smaller the number of elements that can be processed in parallel by the SIMD instruction when the masked SCID instruction is used. Therefore, as the stride width becomes larger, the loop instruction sequence using the gather / scatter instruction is more likely to be more efficient than the loop instruction sequence using the masked SCID instruction. Therefore, in the loop type determination process (see FIG. 10), the
すなわち、増分値kが「1」以外の場合、オリジナルループはgather/scatter命令を利用するループ命令列であるが、増分値kが閾値を超えているとループコストの計算をするまでもなく、gather/scatter命令を利用する方が効率的となる。このような場合、ループ最適化部122aは、等価ループの生成やループコストの算出処理を省略することで、コンパイル時の処理の効率化を図っている。
That is, when the increment value k is other than "1", the original loop is a loop instruction sequence using the gather / scatter instruction, but when the increment value k exceeds the threshold value, it is not necessary to calculate the loop cost. It is more efficient to use the gather / scatter instruction. In such a case, the
〔その他の実施の形態〕
第2の実施の形態は、SIMDレジスタのサイズが512ビット(64バイト)の場合の例を示したが、SIMDレジスタのサイズは512ビットに限定されない。さらに第2の実施の形態では、SIMD命令による演算対象の要素のデータ長を8バイトとしているが、要素のデータ長は8バイトに限定されない。各ループ命令列におけるループ回転数は、SIMDレジスタのサイズが大きいほど少なくなり、演算対象のデータのサイズが大きいほど大きくなる。
[Other embodiments]
The second embodiment shows an example in which the size of the SIMD register is 512 bits (64 bytes), but the size of the SIMD register is not limited to 512 bits. Further, in the second embodiment, the data length of the element to be calculated by the SIMD instruction is 8 bytes, but the data length of the element is not limited to 8 bytes. The loop rotation speed in each loop instruction sequence decreases as the size of the SIMD register increases, and increases as the size of the data to be calculated increases.
以上、実施の形態を例示したが、実施の形態で示した各部の構成は同様の機能を有する他のものに置換することができる。また、他の任意の構成物や工程が付加されてもよい。さらに、前述した実施の形態のうちの任意の2以上の構成(特徴)を組み合わせたものであってもよい。 Although the embodiment has been illustrated above, the configuration of each part shown in the embodiment can be replaced with another having the same function. Further, any other components or processes may be added. Further, any two or more configurations (features) of the above-described embodiments may be combined.
1 ループ命令列
2 第1SIMD化命令列
3 第2SIMD化命令列
10 情報処理装置
11 記憶部
11a プログラム
11b 実行時間情報
12 処理部
1
Claims (7)
コンパイル対象のプログラムから、配列内の一部の要素に対する演算を指示するループ命令列を抽出し、
前記ループ命令列に基づいて、前記配列内の複数の要素のうち演算対象の要素のみを有効にするマスクを用い、前記マスクで有効とした1以上の要素に対してSIMD(Single Instruction Multiple Data)命令によって並列で演算を実行させる処理を繰り返すループ処理が記述された第1SIMD化命令列を生成し、
前記ループ命令列に基づいて、前記配列内の不連続の複数の要素をSIMDレジスタ内の連続の領域へ格納して、前記SIMDレジスタ内の複数の要素に対してSIMD命令により並列で演算を実行する処理を繰り返すループ処理が記述された第2SIMD化命令列を生成し、
複数の命令それぞれの実行に要する時間を表す数値が設定された実行時間情報に基づいて、前記第1SIMD化命令列の処理時間と前記第2SIMD化命令列の処理時間とを算出し、
前記第1SIMD化命令列の処理時間と前記第2SIMD化命令列の処理時間とに基づいて、前記第1SIMD化命令列と前記第2SIMD化命令列とのうち、コンパイル後のプログラムに含める命令列を選択する、
処理を実行させるコンパイルプログラム。 On the computer
Extract a loop instruction sequence that directs operations on some elements in the array from the program to be compiled.
Based on the loop instruction sequence, a mask that enables only the element to be calculated among the plurality of elements in the array is used, and SIMD (Single Instruction Multiple Data) is applied to one or more elements enabled by the mask. Generate a first SIMD instruction sequence that describes a loop process that repeats the process of executing operations in parallel by instructions.
Based on the loop instruction sequence, a plurality of discontinuous elements in the array are stored in a continuous area in the SIMD register, and operations are executed in parallel by the SIMD instruction for the plurality of elements in the SIMD register. Generates a second SIMD instruction sequence that describes the loop processing that repeats the processing to be performed.
Based on the execution time information in which the numerical value indicating the time required for executing each of the plurality of instructions is set, the processing time of the first SIMD instruction sequence and the processing time of the second SIMD instruction sequence are calculated.
Based on the processing time of the first SIMD instruction sequence and the processing time of the second SIMD instruction sequence, the instruction sequence to be included in the compiled program among the first SIMD instruction sequence and the second SIMD instruction sequence is selected. select,
A compilation program that executes processing.
請求項1記載のコンパイルプログラム。 In the calculation of the processing time, the value obtained by multiplying the time required for executing the processing per rotation of the loop processing of the first SIMD conversion instruction sequence by the loop rotation speed of the first SIMD conversion instruction sequence is multiplied by the loop rotation speed of the first SIMD conversion instruction sequence. The processing time is defined as the processing time of the second SIMD instruction sequence, which is obtained by multiplying the time required for executing the processing per rotation of the loop processing of the second SIMD instruction sequence by the loop rotation speed of the second SIMD instruction sequence. To
The compilation program according to claim 1.
請求項2記載のコンパイルプログラム。 In the calculation of the processing time, the value obtained by dividing the number of rotations of the loop processing in the loop instruction sequence by the number of elements that can be stored in the SIMD register is used as the loop rotation number of the first SIMD instruction sequence, and is used in the loop instruction sequence. The loop rotation of the second SIMD instruction sequence is obtained by dividing the number of rotations of the loop processing by the number of elements that can be stored in the SIMD register and the increment value for each rotation of the index value indicating the element to be calculated. Number,
The compilation program according to claim 2.
処理時間の算出では、コンパイル時に指定されたマイクロアーキテクチャに対応する前記実行時間情報を参照して、前記第1SIMD化命令列と前記第2SIMD化命令列との処理時間を算出する、
請求項2または3記載のコンパイルプログラム。 It has the execution time information corresponding to each of a plurality of microarchitectures,
In the calculation of the processing time, the processing time between the first SIMD instruction sequence and the second SIMD instruction sequence is calculated with reference to the execution time information corresponding to the microarchitecture specified at compile time.
The compilation program according to claim 2 or 3.
請求項1ないし4のいずれかに記載のコンパイルプログラム。 In the generation of the first SIMD instruction sequence, the first SIMD instruction sequence for executing the mask generation process before the start of the loop process is generated.
The compilation program according to any one of claims 1 to 4.
前記ループ命令列の1回のループ処理ごとのループ制御変数の増分値が所定の閾値を超えるか否かを判断し、
前記増分値が所定の閾値を超える場合、前記第1SIMD化命令列の生成、および処理時間の算出の実行を抑止する処理を実行させ、
前記命令列の選択では、前記増分値が所定の閾値を超える場合、前記第2SIMD化命令列を選択する、
請求項1ないし5のいずれかに記載のコンパイルプログラム。 On the computer,
It is determined whether or not the increment value of the loop control variable for each loop processing of the loop instruction sequence exceeds a predetermined threshold value.
When the increment value exceeds a predetermined threshold value, a process of suppressing the generation of the first SIMD instruction sequence and the execution of the calculation of the processing time is executed.
In the selection of the command sequence, when the incremental value exceeds a predetermined threshold value, the second SIMD command sequence is selected.
The compilation program according to any one of claims 1 to 5.
前記プログラムから、配列内の一部の要素に対する演算を指示するループ命令列を抽出し、前記ループ命令列に基づいて、前記配列内の複数の要素のうち演算対象の要素のみを有効にするマスクを用い、前記マスクで有効とした1以上の要素に対してSIMD(Single Instruction Multiple Data)命令によって並列で演算を実行させる処理を繰り返すループ処理が記述された第1SIMD化命令列を生成し、前記ループ命令列に基づいて、前記配列内の不連続の複数の要素をSIMDレジスタ内の連続の領域へ格納して、前記SIMDレジスタ内の複数の要素に対してSIMD命令により並列で演算を実行する処理を繰り返すループ処理が記述された第2SIMD化命令列を生成し、複数の命令それぞれの実行に要する時間を表す数値が設定された実行時間情報に基づいて、前記第1SIMD化命令列の処理時間と前記第2SIMD化命令列の処理時間とを算出し、前記第1SIMD化命令列の処理時間と前記第2SIMD化命令列の処理時間とに基づいて、前記第1SIMD化命令列と前記第2SIMD化命令列とのうち、コンパイル後のプログラムに含める命令列を選択する処理部と、
を有する情報処理装置。 A storage unit that stores the program to be compiled,
A mask that extracts a loop instruction sequence instructing an operation on some elements in the array from the program and enables only the element to be operated out of a plurality of elements in the array based on the loop instruction sequence. Is used to generate a first SIMD instruction sequence in which a loop process of repeating a process of executing operations in parallel by a SIMD (Single Instruction Multiple Data) instruction for one or more elements enabled by the mask is generated. Based on the loop instruction sequence, a plurality of discontinuous elements in the sequence are stored in a continuous area in the SIMD register, and operations are executed in parallel by the SIMD instruction for the plurality of elements in the SIMD register. The processing time of the first SIMD instruction sequence is based on the execution time information in which the second SIMD instruction sequence in which the loop processing that repeats the processing is described is generated and a numerical value indicating the time required for executing each of the plurality of instructions is set. And the processing time of the second SIMD instruction sequence are calculated, and based on the processing time of the first SIMD instruction sequence and the processing time of the second SIMD instruction sequence, the first SIMD instruction sequence and the second SIMD instruction sequence are calculated. Of the instruction sequences, the processing unit that selects the instruction sequences to be included in the compiled program, and
Information processing device with.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2019223768A JP2021093012A (en) | 2019-12-11 | 2019-12-11 | Compilation program and information processing device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2019223768A JP2021093012A (en) | 2019-12-11 | 2019-12-11 | Compilation program and information processing device |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JP2021093012A true JP2021093012A (en) | 2021-06-17 |
Family
ID=76312585
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2019223768A Pending JP2021093012A (en) | 2019-12-11 | 2019-12-11 | Compilation program and information processing device |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP2021093012A (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115421849A (en) * | 2022-07-30 | 2022-12-02 | 苏州浪潮智能科技有限公司 | A Method of Improving JVM Performance Based on SIMD |
| JP2023063815A (en) * | 2021-10-25 | 2023-05-10 | 株式会社Preferred Networks | Compiler device, instruction generation method, program, compilation method and compiler program |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPS59165147A (en) * | 1983-03-11 | 1984-09-18 | Fujitsu Ltd | Vector instruction method for conditional statements in compilers |
| JP2015191346A (en) * | 2014-03-27 | 2015-11-02 | 富士通株式会社 | Compile program, compile method, and compile device |
| JP2016040691A (en) * | 2014-08-13 | 2016-03-24 | 富士通株式会社 | Program optimization method, program optimization program, and program optimization apparatus |
| JP2019067117A (en) * | 2017-09-29 | 2019-04-25 | 富士通株式会社 | Code generation apparatus, code generation method and code generation program |
-
2019
- 2019-12-11 JP JP2019223768A patent/JP2021093012A/en active Pending
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPS59165147A (en) * | 1983-03-11 | 1984-09-18 | Fujitsu Ltd | Vector instruction method for conditional statements in compilers |
| JP2015191346A (en) * | 2014-03-27 | 2015-11-02 | 富士通株式会社 | Compile program, compile method, and compile device |
| JP2016040691A (en) * | 2014-08-13 | 2016-03-24 | 富士通株式会社 | Program optimization method, program optimization program, and program optimization apparatus |
| JP2019067117A (en) * | 2017-09-29 | 2019-04-25 | 富士通株式会社 | Code generation apparatus, code generation method and code generation program |
Non-Patent Citations (2)
| Title |
|---|
| ロバーツ マーク: "コンパイラの最適化技法", 日経バイト, vol. 第41号, JPN6023027592, 1 January 1988 (1988-01-01), pages 213 - 220, ISSN: 0005098168 * |
| 小松 一彦、他5名: "HPCアプリケーションの性能可搬性に関する一検討", 情報処理学会研究報告 2012(平成24)年度▲4▼ [CD−ROM], vol. Vol. 2012-HPC-136、No. 27, JPN6023027593, 15 December 2012 (2012-12-15), pages 1 - 8, ISSN: 0005098167 * |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2023063815A (en) * | 2021-10-25 | 2023-05-10 | 株式会社Preferred Networks | Compiler device, instruction generation method, program, compilation method and compiler program |
| CN115421849A (en) * | 2022-07-30 | 2022-12-02 | 苏州浪潮智能科技有限公司 | A Method of Improving JVM Performance Based on SIMD |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US8296746B2 (en) | Optimum code generation method and compiler device for multiprocessor | |
| JP5966509B2 (en) | Program, code generation method, and information processing apparatus | |
| JP6245031B2 (en) | Compilation program, compilation method, and compilation apparatus | |
| US9823911B2 (en) | Method and apparatus for compiling code based on a dependency tree | |
| JP5846005B2 (en) | Program, code generation method, and information processing apparatus | |
| EP2951682B1 (en) | Hardware and software solutions to divergent branches in a parallel pipeline | |
| US9395986B2 (en) | Compiling method and compiling apparatus | |
| US11714619B2 (en) | Method and apparatus for retaining optimal width vector operations in arbitrary/flexible vector width architecture | |
| JP6666554B2 (en) | Information processing apparatus, conversion program, and conversion method | |
| CN116830080A (en) | Consolidated machine-level intermediate representation optimization | |
| JP2021093012A (en) | Compilation program and information processing device | |
| JP6492943B2 (en) | Computer, compiling method, compiling program, and pipeline processing program | |
| KR102161055B1 (en) | Method and Apparatus for instruction scheduling using software pipelining | |
| JP2023045347A (en) | Program and information processing method | |
| WO2012032807A1 (en) | Execution module optimization device, execution module optimization method, and program | |
| US20220405110A1 (en) | Non-transitory computer-readable recording medium and compilation method | |
| JP5979965B2 (en) | Circuit design support apparatus, circuit design support method, and program | |
| JP2018124877A (en) | Code generation apparatus, code generation method, and code generation program | |
| US20220229664A1 (en) | Information processing device, compiling method, and non-transitory computer-readable recording medium | |
| JP7006097B2 (en) | Code generator, code generator and code generator | |
| CN111309329A (en) | A kind of instruction address adaptive relocation method and program compilation method | |
| US7676799B1 (en) | Address simplification by binary transformation | |
| JPH02176938A (en) | Machine language instruction optimizing system | |
| JP2014099108A (en) | Execution time calculating device, execution time calculating method, and program | |
| Jones | Updates to the Provet Compiler |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20220809 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20230630 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20230704 |
|
| A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20231226 |