JP2012208615A - Instruction execution analysis device, instruction execution analysis method, and program - Google Patents
Instruction execution analysis device, instruction execution analysis method, and program Download PDFInfo
- Publication number
- JP2012208615A JP2012208615A JP2011072473A JP2011072473A JP2012208615A JP 2012208615 A JP2012208615 A JP 2012208615A JP 2011072473 A JP2011072473 A JP 2011072473A JP 2011072473 A JP2011072473 A JP 2011072473A JP 2012208615 A JP2012208615 A JP 2012208615A
- Authority
- JP
- Japan
- Prior art keywords
- instruction
- inefficient
- block
- memory
- access
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Landscapes
- Memory System Of A Hierarchy Structure (AREA)
Abstract
Description
本発明は、キャッシュメモリの利用効率を向上させる技術に関する。 The present invention relates to a technique for improving the utilization efficiency of a cache memory.
情報処理装置は、プロセッサ装置、メインメモリ装置、入出力装置から構成され、特に実行性能が要求される装置については、高い周波数で動作し、キャッシュメモリを有するプロセッサ装置を活用する。
このとき、キャッシュメモリのヒット率が性能に影響する。
一般に、ヒット率は95%以上、高速なものは99%近いヒット率を実現する。
言いかえれば、キャッシュメモリのヒット率が数%低下するだけで、システム全体の性能が大幅に低下することは珍しいことではない。
そのため、例えば、特許文献1のように、ヒット率を中心とするキャッシュメモリの挙動情報を収集し、チューニングを行うことが提案されている。
The information processing apparatus is composed of a processor device, a main memory device, and an input / output device. Especially for a device that requires execution performance, it operates at a high frequency and utilizes a processor device having a cache memory.
At this time, the hit rate of the cache memory affects the performance.
In general, the hit rate is 95% or higher, and a high-speed one achieves a hit rate close to 99%.
In other words, it is not uncommon for the performance of the entire system to drop significantly with only a few percent drop in the cache memory hit rate.
Therefore, for example, as disclosed in
特許文献1に記載の方式は、命令を模擬するシミュレータを有し、命令をシミュレーションするとともにキャッシュメモリもシミュレーションする。
特許文献1に記載の方式によれば、大規模な配列をもつプログラムに対して、配列の要素ごとにアクセス回数やキャッシュミス回数(アクセス回数−ヒット回数)を表示することができる。
また、特許文献1に記載の方式は、アクセス回数とキャッシュミス回数の多い行を検出して、キャッシュを有効に使用するようソースプログラムを改善する。
つまり、キャッシュミスの大きい配列は、遅延が大きいのでコンパイラによりその間に別の命令を実行するようにコード生成させる。
The method described in
According to the method described in
The method described in
That is, since an array having a large cache miss has a large delay, code is generated by the compiler so that another instruction is executed in the meantime.
しかし、特許文献1の手法で得られる情報は、プログラムのデータ配列のアクセス回数とミス回数であり、キャッシュ全体に対してどういう影響を与えているかが不明である。
例えば、キャッシュミス回数=0と表示されれば、キャッシュとしては有効に機能しているように見えるが、同一のキャッシュブロックにのっている、ある要素だけがアクセス回数=10,000回、ミス回数=1回で、他の要素はアクセス回数=1回、ミス回数=0回である場合、キャッシュは有効に使われているとはいえない。
アクセス回数=1回の要素は利用頻度が低いため、本来はキャッシュメモリに乗らなくても影響がない。
むしろ、利用頻度が高い別の配列の別のデータがそのキャッシュメモリを使うのが効率的といえる。
いいかえると、このような配列があると、他の配列のキャッシュミス回数を増やしていることが想像される。
すなわち、キャッシュミスも少なく効率的にアクセスしている配列の要素が、他の配列に対して悪影響を及ぼしていることがあるが、特許文献1の方式では、そのような原因に遡ることは容易にはできない。
キャッシュメモリを有効に使う一つのテクニックとしては、キャッシュのブロックには、アクセス回数が高いものだけを固めてのせ、アクセス回数が低いものも固めておき、キャッシュのブロックには乗らないようにしておくことが必要である。
アクセス頻度が高いものと低いものが混在することがキャッシュ利用効率の低下の要因の一つである。
特に、近年の高性能プロセッサは、キャッシュ容量の大規模化に伴い、キャッシュブロックのサイズが大きくなる傾向にあるため、このような傾向がだんだん顕著になってきた。
また、特許文献1の方式では、このような原因がプログラムのどの部分に起因して発生したのかが容易にはわからないので、効率的なプログラム修正が困難である。
However, the information obtained by the method of
For example, if the number of cache misses is displayed as 0, it appears that the cache is functioning effectively, but only certain elements in the same cache block have access counts of 10,000 times. If the number of times = 1, and the other elements are the number of accesses = 1, and the number of misses = 0, the cache cannot be said to be used effectively.
Since the access frequency = 1 element is less frequently used, there is no influence even if it is not placed in the cache memory.
Rather, it can be said that it is efficient to use the cache memory for another data in another array having a high frequency of use.
In other words, it can be imagined that such an array increases the number of cache misses of other arrays.
In other words, an array element that is accessed efficiently with few cache misses may have an adverse effect on other arrays. However, in the method of
One technique for effectively using cache memory is to only harden cache blocks that have a high number of accesses and harden those that have a low number of accesses so that they do not get on the cache block. It is necessary.
One of the causes of a decrease in cache use efficiency is a mixture of high access frequency and low access frequency.
In particular, in recent high-performance processors, as the cache capacity increases, the size of the cache block tends to increase, and this tendency has become increasingly prominent.
Further, in the method of
この発明は、上記のような課題を解決することを主な目的の一つとしており、キャッシュメモリの同一ブロックにアクセス頻度の高いデータと低いデータが混在することを防止し、キャッシュメモリの利用効率を向上させることを主な目的とする。 One of the main objects of the present invention is to solve the above-mentioned problems, and it is possible to prevent data with high access frequency and data with low access from being mixed in the same block of the cache memory, thereby improving the use efficiency of the cache memory. The main purpose is to improve.
本発明に係る命令実行分析装置は、
メインメモリ装置へのメモリアクセスが実施されて命令が実行されるシミュレーションにおける前記メインメモリ装置へのメモリアクセスの状況を分析し、分析結果に基づいて、前記メインメモリ装置内の複数のメモリブロックのうち、メモリアクセスの対象がメモリブロック内の一部のデータに偏っているメモリブロックを非効率ブロックとして抽出する非効率ブロック抽出部と、
前記非効率ブロック抽出部により抽出された非効率ブロックへのメモリアクセスを発生させた命令のうち所定の条件に合致する命令を非効率命令として抽出する非効率命令抽出部とを有することを特徴とする。
An instruction execution analysis apparatus according to the present invention includes:
Analyzing the status of memory access to the main memory device in a simulation in which a memory access to the main memory device is executed and executing an instruction, and based on the analysis result, out of a plurality of memory blocks in the main memory device An inefficient block extraction unit that extracts a memory block whose memory access target is biased toward some data in the memory block as an inefficient block;
An inefficient instruction extracting unit that extracts an instruction that satisfies a predetermined condition as an inefficient instruction among the instructions that have generated memory access to the inefficient block extracted by the inefficient block extracting unit; To do.
本発明によれば、シミュレーションにおいてメモリアクセスの対象がメモリブロック内の一部のデータに偏っているメモリブロックを非効率ブロックとして抽出するとともに、非効率ブロックへのメモリアクセスを発生させた命令を非効率命令として抽出するため、キャッシュメモリの同一ブロックにアクセス頻度の高いデータと低いデータが混在することを防止し、キャッシュメモリの利用効率を向上させることができる。 According to the present invention, in the simulation, a memory block whose memory access target is biased toward a part of the data in the memory block is extracted as an inefficient block, and the instruction that caused the memory access to the inefficient block is Since the instructions are extracted as efficient instructions, it is possible to prevent data with high access frequency and data with low access frequencies from being mixed in the same block of the cache memory, and improve the use efficiency of the cache memory.
実施の形態1及び実施の形態2では、例えば、高性能な情報処理装置において、キャッシュメモリのブロックに、アクセス頻度の高いものと低いものが混在し、キャッシュメモリが効率的に活用できず、情報処理装置が持つ本来の性能が発揮できないようなケースにおいて、その原因を明らかにし、性能改善のためのソースプログラムの修正箇所を指示する手法を説明する。
より具体的には、本手法の中核の部分、すなわち、バイナリコードから非効率命令を取り出すところまでを実施の形態1に示し、中核の部分を実際に適用した例、すなわち、ソースプログラムに対して修正箇所を指示する例を実施の形態2で示す。
In the first embodiment and the second embodiment, for example, in a high-performance information processing apparatus, a cache memory block includes a mixture of frequently accessed and low-accessed blocks, and the cache memory cannot be efficiently used. In the case where the original performance of the processing device cannot be exhibited, the cause will be clarified and a method for instructing the correction location of the source program for performance improvement will be described.
More specifically, the core part of the present method, that is, up to extracting the inefficient instruction from the binary code is shown in the first embodiment, and an example in which the core part is actually applied, that is, the source program is shown. An example of instructing a correction location is shown in the second embodiment.
実施の形態1.
図1から図4にて、上記手法の中核部分の説明をする。
図1は、本実施の形態に係る命令実行分析方法の全体のフローを示す。
図2と図4では、図1で示したフローのうち重要構成要素を説明する。
図3は、図2での特定要素の説明を追加する。
図10は、図1に示した命令実行分析方法を実現する命令実行分析装置の構成例を示す。
The core part of the above method will be described with reference to FIGS.
FIG. 1 shows an overall flow of the instruction execution analysis method according to the present embodiment.
2 and 4, important components in the flow shown in FIG. 1 will be described.
FIG. 3 adds a description of the specific elements in FIG.
FIG. 10 shows a configuration example of an instruction execution analysis apparatus that realizes the instruction execution analysis method shown in FIG.
図1は、本実施の形態に係る命令実行分析方法の全体のフローである。 FIG. 1 is an overall flow of the instruction execution analysis method according to the present embodiment.
1は、入力データであり、バイナリコードと実行環境である。
実行環境とは、初期データや実行中に外部要因により変化するデータを指す。
2は非効率ブロックの抽出処理、3は非効率命令の抽出処理である。
非効率ブロックとは、ひとつのキャッシュブロックに対して、一部のデータのみ頻繁に使われ、他の部分はほとんど使われないため、ブロック全体としては、利用効率が低くなっているものを指す。
非効率命令とは、非効率ブロックの生成要因となっている命令を指す。
非効率ブロックの抽出処理2は、図2に示すように、メモリアクセス数の計測処理と非効率ブロックの判定処理に大別される。
非効率命令の抽出処理3は、図4に示すように、非効率ブロックへのアクセス回数の計測処理と非効率命令の判定処理に大別される。
図2及び図4の詳細は後述する。
4は、出力データであり、非効率命令の一覧表と非効率命令に関する情報である。
図5に具体的な出力例を示す。
図5の詳細は後述する。
The execution environment refers to initial data or data that changes due to external factors during execution.
2 is an inefficient block extraction process, and 3 is an inefficient instruction extraction process.
An inefficient block refers to a block in which the use efficiency of the entire block is low because only a part of data is frequently used for one cache block and the other part is hardly used.
An inefficient instruction refers to an instruction that is a cause for generating an inefficient block.
As shown in FIG. 2, the inefficient
As shown in FIG. 4, the inefficiency instruction extraction process 3 is broadly divided into an inefficient block access count measurement process and an inefficient instruction determination process.
Details of FIGS. 2 and 4 will be described later.
FIG. 5 shows a specific output example.
Details of FIG. 5 will be described later.
図10は、図1に示した命令実行分析方法を実現する命令実行分析装置100の構成例を示す。
命令実行分析装置100は、例えば、情報処理装置に実装されているツール(命令実行分析ツール)である。
FIG. 10 shows a configuration example of the instruction
The instruction
命令実行分析装置100において、シミュレーション部101は、バイナリコード、実行環境200を用いて、命令実行のシミュレーションを行う。
より具体的には、シミュレーション部101は、CPU(Central Processing Unit)などのプロセッサ装置を模擬し、メインメモリ装置(例えば、命令実行分析装置100が実装されている情報処理装置のメインメモリ装置)へのメモリアクセスを実施してバイナリコードの命令の実行をシミュレートする。
メインメモリ装置は、プロセッサ装置に含まれているキャッシュメモリのキャッシュブロック数に対応させた複数のメモリブロックに区分されている。
なお、シミュレーション部101は、後述する図2の203、204、206、207の処理、図4の303、304、307、308の処理を行う。
In the instruction
More specifically, the
The main memory device is divided into a plurality of memory blocks corresponding to the number of cache blocks of the cache memory included in the processor device.
The
非効率ブロック抽出部102は、開始指示300があった際に、図1の非効率ブロックの抽出処理2を行う。
より具体的には、非効率ブロック抽出部102は、シミュレーション部101のシミュレーションにおけるメインメモリ装置へのメモリアクセスの状況を分析し、分析結果に基づいて、メインメモリ装置内の複数のメモリブロックのうち、メモリアクセスの対象がメモリブロック内の一部のデータに偏っているメモリブロックを非効率ブロックとして抽出する。
When there is a
More specifically, the inefficient
非効率命令抽出部103は、図1の非効率命令の抽出処理3を行い、非効率命令の一覧表と非効率命令に関連する情報400を出力する。
より具体的には、非効率命令抽出部103は、非効率ブロック抽出部102により抽出された非効率ブロックへのメモリアクセスを発生させた命令のうち所定の条件に合致する命令を非効率命令として抽出する。
また、命令実行分析装置100には、図示していない表示装置が接続されており、非効率命令抽出部103は、図5のように、抽出した非効率命令と当該非効率命令のアドレスの情報を、非効率命令の一覧表と非効率命令に関連する情報400として表示装置に出力する。
The inefficient
More specifically, the inefficient
Further, a display device (not shown) is connected to the instruction
非効率ブロック抽出部102において、メモリアクセス計測部1021は、後述する図2の201、202、205の処理(メモリアクセス数の計測処理)を行う。
非効率ブロック判定部1022は、後述する図2の208〜212の処理(非効率ブロックの判定処理)を行う。
In the inefficient
The inefficient
非効率命令抽出部103において、非効率ブロックアクセス計測部1031は、後述する図4の301、302、305、306の処理(非効率ブロックへのアクセス回数の計測処理)を行う。
非効率命令判定部1032は、後述する図4の309〜312の処理(非効率命令の判定処理)を行う。
In the inefficient
The inefficient
図2は、図1の非効率ブロックの抽出処理2のフローを示す。
201から212のステップで構成されるが、大きく2つの処理に分けることができ、前半の201から207がメモリアクセス回数の計測であり、後半の208から212が非効率ブロックの判定フローとなっている。
以下では、図1に示した命令実行分析方法を、図10に示した命令実行分析装置100を用いて実行する例として説明する。
FIG. 2 shows a flow of the inefficient
The process consists of
In the following, the instruction execution analysis method shown in FIG. 1 will be described as an example in which the instruction
前半(201〜207)は、命令実行をシミュレータ(図10のシミュレーション部101)でシミュレーションし、メモリアクセス回数を計測するのが目的である。
The first half (201 to 207) is intended to simulate instruction execution by a simulator (
201で、メモリアクセス計測部1021が、メモリアクセスカウンタMC[Addr]をすべてのアドレス(Addr)について初期化、即ちゼロクリアする。
In 201, the memory
202で、メモリアクセス計測部1021が、命令ポインタ(IP)を初期値に初期化する。即ち、IPは最初に実行する命令のアドレスを指す。
In 202, the memory
203で、シミュレーション部101が、IPの指すアドレスから命令(Inst)をフェッチしてくる。
一般に1命令は、1バイトとは限らないので、命令を構成するのに必要なバイト数がInstに入る。
In 203, the
In general, since one instruction is not necessarily one byte, the number of bytes necessary for composing the instruction enters Inst.
204で、シミュレーション部101が、命令(Inst)をシミュレーションする。
シミュレーション部101は、内部に本物のプロセッサ装置と同じ内部リソース(演算装置やレジスタやキャッシュメモリなど)をソフトウェアで実現し、それらのリソースに中間状態を格納し、各種処理を行わせることにより、本物のプロセッサ装置と同じ状態を作り出す。
In 204, the
The
205で、メモリアクセス計測部1021が、命令(Inst)の実行に、メインメモリ装置へのメモリアクセスがある場合、該当アドレス(Addr)のアクセス回数を更新する。
具体的にはMC[Addr]に1を加算する。
In 205, the memory
Specifically, 1 is added to MC [Addr].
206で、シミュレーション部101が、命令実行が終了したかどうかを判断する。終了の条件は実行命令数、実行サイクル数、特定命令の実行、特定のアドレスにIPが到達するなど様々な条件が考えられるが、本明細書では特定はしない。
In 206, the
207で、シミュレーション部101が、命令ポインタ(IP)を次の命令を指す値に更新する。
実行した命令が分岐命令でなければ、新しいIPは古いIPに命令長を加算した値になる。
分岐命令であれば、IPは分岐先のアドレスを指す。
In 207, the
If the executed instruction is not a branch instruction, the new IP is a value obtained by adding the instruction length to the old IP.
In the case of a branch instruction, IP indicates a branch destination address.
203から207までのループを206の終了条件が成立するまで繰り返し、206の終了条件が成立したとき、シミュレーションは終了し、メモリアクセス回数の計測が完了する。
The loop from 203 to 207 is repeated until the
次に、後半(208〜212)の非効率ブロックの判定処理について説明する。 Next, the second half (208 to 212) inefficient block determination processing will be described.
208で、非効率ブロック判定部1022が、ブロック番号(N)を0に初期化する。
In 208, the inefficient
209で、非効率ブロック判定部1022が、ブロック内のアクセス頻度が高いバイト数と低いバイト数を算出する。
アクセス頻度の高いバイト数は配列BA_High[N]に、アクセス頻度の低いバイト数は配列BA_Low[N]に算出される。
詳細は図3で説明する。
In 209, the inefficient
The number of bytes with high access frequency is calculated in the array BA_High [N], and the number of bytes with low access frequency is calculated in the array BA_Low [N].
Details will be described with reference to FIG.
210で、非効率ブロック判定部1022が、非効率ブロックか否かの判定を行う。
アクセス頻度が高いバイトがあり、しかも、アクセス頻度が低いバイトが多数ある場合、非効率ブロックと判断する。
具体的には、BA_High[N]≧1 かつ BA_High[N] ≧ BlockSize × JudgeRatio で表す。
JudgeRatioは、判断基準を変更するパラメータであり0から1までの値を取り得るが、例えば0.5を指定すれば、全ブロックのうち半数以上のバイトが低頻度アクセスで、高頻度アクセスが1バイト以上あるときに非効率ブロックと判断することになる。
非効率ブロックであれば、非効率ブロック判定部1022は、ブロックNが非効率(Not Effeciency)であることを表す配列NE[N]に1をセットし、そうでなければ0をセットする。
In 210, the inefficient
When there are bytes with high access frequency and there are many bytes with low access frequency, it is determined that the block is inefficient.
Specifically, BA_High [N] ≧ 1 and BA_High [N] ≧ BlockSize × JudgeRatio.
JudgeRatio is a parameter for changing the judgment criterion and can take a value from 0 to 1. For example, if 0.5 is specified, more than half of all the blocks are low-frequency accesses and high-frequency access is 1 When there are more than bytes, it is determined as an inefficient block.
If it is an inefficient block, the inefficient
211で、非効率ブロック判定部1022は、以上の処理をすべてのブロックに対して実施したかを確認し、実施済みであれば、処理を完了し、そうでなければ、212でブロック番号Nに1を加え更新し、209のステップに戻り、209から212の処理を繰り返す。
In 211, the inefficient
以上の処理により、すべてのブロックに対して非効率ブロックを示す配列NE[]が求められる。 With the above processing, an array NE [] indicating inefficient blocks is obtained for all blocks.
ここで、図3により209でのブロック内のアクセス頻度が高いバイト数と低いバイト数の算出方法を説明する。
図2の209の処理は、ブロックNの配列BA_High[N]と配列BA_Low[N]を求めるのが目的である。
図2の209の処理は、2091から2097の7個のステップから構成される。
Here, the calculation method of the number of bytes with high access frequency and the number of low bytes within the block at 209 will be described with reference to FIG.
The purpose of the
The
2091で、非効率ブロック判定部1022は、配列BA_High[N]と配列BA_Low[N]を0に初期化する。
2092で、非効率ブロック判定部1022は、閾値ThHとThLを求める。
閾値ThHは、高アクセス頻度か否かの判断の閾値であり、閾値ThLは、低アクセス頻度か否かの判断の閾値である。
これらの閾値は、プログラムの振る舞いが明確な場合は、外部パラメータとして与えることも可能であるが、一般的には、閾値を決定するほど明確な情報を外部にもつことは困難である。
従って、閾値を内部の動作結果に応じて作成することにする。
具体的には、ブロックについて、平均的なメモリアクセス回数(AverageMC)に対して、十分に大きい値をThH、十分に小さい値をThLとする。
この例では、平均メモリアクセスの4倍をThHとし、平均メモリアクセスの1/2をThLとした。
AverageMCは、そのメモリブロック(メモリブロックN)の総メモリアクセス回数(MC[Addr]の総和(但し、Addr∈ブロックN))をブロックのバイト数(BlockSize)で除算すれば求められる。
In 2091, the inefficient
In 2092, the inefficient
The threshold ThH is a threshold for determining whether or not the access frequency is high, and the threshold ThL is a threshold for determining whether or not the access frequency is low.
These threshold values can be given as external parameters when the behavior of the program is clear, but it is generally difficult to have clear information externally so as to determine the threshold values.
Therefore, the threshold value is created according to the internal operation result.
Specifically, for a block, a sufficiently large value is set to ThH, and a sufficiently small value is set to ThL with respect to the average memory access count (AverageMC).
In this example, ThH is four times the average memory access, and ThL is half the average memory access.
AverageMC is obtained by dividing the total number of memory accesses (MC [Addr] (where Addrεblock N)) of the memory block (memory block N) by the number of bytes (BlockSize) of the block.
2093で、非効率ブロック判定部1022は、以下のループで使用する変数である、アドレス(Addr)とカウンタ(I)を初期化する。
In 2093, the inefficient
2094で、非効率ブロック判定部1022は、バイト毎のアクセス数の閾値判定を行う。
メモリアクセス回数MC[Addr]が閾値ThH以上であれば、BA_High[N]に1を加算する。
メモリアクセス回数MC[Addr]が閾値ThL以下であれば、BA_Low[N]に1を加算する。
In 2094, the inefficient
If the memory access count MC [Addr] is greater than or equal to the threshold ThH, 1 is added to BA_High [N].
If the memory access count MC [Addr] is less than or equal to the threshold ThL, 1 is added to BA_Low [N].
2095で、非効率ブロック判定部1022は、カウンタ値(I)に1を加算し更新する。
In 2095, the inefficient
2096で、非効率ブロック判定部1022は、ループの終了判定を行う。
即ち、カウンタ(I)がブロックのバイト数(BlockSize)と等しくなれば、本処理を終了する。
そうでなければ、非効率ブロック判定部1022は、2097で、アドレス(Addr)に1を加算し、2094に戻り、終了条件が成立するまで2094〜2097の処理を繰り返す。
In 2096, the inefficient
That is, when the counter (I) is equal to the number of bytes (BlockSize) of the block, this processing is terminated.
Otherwise, the inefficient
上記のループが終了したとき、配列BA_High[N]と配列BA_Low[N]には、それぞれ、高アクセス頻度と低アクセス頻度のバイト数が入力されている。 When the above loop ends, the array BA_High [N] and the array BA_Low [N] are respectively input with the high access frequency and the low access frequency bytes.
図4は、図1の非効率命令の抽出処理3のフローを示す。
301から312のステップで構成されるが、大きく2つの処理に分けることができ、前半の301から308が非効率ブロックへのアクセス回数の計測であり、後半の309から312が非効率命令の判定フローとなっている。
前半(301〜308)は、命令実行をシミュレータ(図10のシミュレーション部101)でシミュレーションし、非効率ブロックへのアクセス回数を計測するのが目的である。
FIG. 4 shows a flow of the inefficiency instruction extraction process 3 of FIG.
The process consists of 301 to 312 steps, which can be roughly divided into two processes. The
The first half (301 to 308) is intended to simulate instruction execution by a simulator (
301で、非効率ブロックアクセス計測部1031が、命令毎の非効率アクセスカウンタMC_InstAC[IP]をすべての命令ポインタ(IP)について初期化、即ちゼロクリアする。 In 301, the inefficient block access measuring unit 1031 initializes the inefficient access counter MC_InstAC [IP] for each instruction for all instruction pointers (IP), that is, clears it to zero.
302で、非効率ブロックアクセス計測部1031が、命令ポインタ(IP)を初期値に初期化する。
即ち、IPは最初に実行する命令のアドレスを指す。
In 302, the inefficient block access measurement unit 1031 initializes the instruction pointer (IP) to an initial value.
That is, IP indicates the address of the instruction to be executed first.
303で、シミュレーション部101が、IPの指すアドレスから命令(Inst)をフェッチしてくる。
In 303, the
304で、シミュレーション部101が、命令(Inst)を内部のシミュレータでシミュレーションする。
In 304, the
305で、非効率ブロックアクセス計測部1031が、命令(Inst)の実行に、メインメモリ装置へのメモリアクセスがある場合、該当アドレス(Addr)が非効率ブロックか否かを検索する。
具体的には、Addr/BlockSizeの商(整数値)がブロック番号Nになるので、非効率ブロック抽出で求めた配列NE[N]を読むことで非効率ブロックかどうかが分かる。
NE[N]=1のとき、非効率ブロックなので変数NoEffeciency=1にセットし、NE[N]=0のときは、非効率ブロックでないので変数NoEffeciency=0にセットする。
In 305, if the inefficient block access measuring unit 1031 has memory access to the main memory device in executing the instruction (Inst), the inefficient block access measuring unit 1031 searches whether the corresponding address (Addr) is an inefficient block.
Specifically, since the quotient (integer value) of Addr / BlockSize is the block number N, it can be determined whether or not the block is an inefficient block by reading the array NE [N] obtained by the inefficient block extraction.
When NE [N] = 1, the variable NoEfficiency = 1 is set since it is an inefficient block, and when NE [N] = 0, the variable NoEffectiveness = 0 is set because the block is not an inefficient block.
306で、非効率ブロックアクセス計測部1031が、非効率ブロックのアクセスなら命令毎の非効率アクセスカウンタNE_InstAC[IP]に1を加えて更新する。 In 306, the inefficient block access measuring unit 1031 updates the inefficient access counter NE_InstAC [IP] for each instruction by adding 1 if the inefficient block is accessed.
307で、シミュレーション部101が、命令実行が終了したかどうかを判断する。
終了の条件は実行命令数、実行サイクル数、特定命令の実行、特定のアドレスにIPが到達するなど様々な条件が考えられるが、本明細書では特定はしない。
In 307, the
Various conditions such as the number of execution instructions, the number of execution cycles, the execution of a specific instruction, and the arrival of an IP at a specific address can be considered as termination conditions, but are not specified in this specification.
308で、シミュレーション部101が、命令ポインタ(IP)を次の命令を指す値に更新する。
実行した命令が分岐命令でなければ、新しいIPは古いIPに命令長を加算した値になる。
分岐命令であれば、IPは分岐先のアドレスを指す。
In 308, the
If the executed instruction is not a branch instruction, the new IP is a value obtained by adding the instruction length to the old IP.
In the case of a branch instruction, IP indicates a branch destination address.
303から308までのループを307の終了条件が成立するまで繰り返す。
307の終了条件が成立したとき、シミュレーションは終了し、メモリアクセス回数の計測が完了する。
The loop from 303 to 308 is repeated until the end condition of 307 is satisfied.
When the
次に後半(309〜312)の非効率ブロックの判定処理について説明する。 Next, the second half (309 to 312) inefficient block determination processing will be described.
309で、非効率命令判定部1032が、命令の格納アドレスの最小値をAddrにセットする。
この値はシステム依存であるが、本実施の形態では0をセットしている。
In 309, the inefficient
This value is system-dependent, but 0 is set in this embodiment.
310で、非効率命令判定部1032が、非効率命令の判定を行う。
命令毎の非効率アクセスカウンタNE_InstAC[Addr]が閾値Th_NE_Inst以上であれば、非効率命令と判断し、結果を表す配列NE_Inst[Addr]に1をセットし、非効率命令でなければ0をセットする。
閾値Th_NE_Instは、目的に応じてシステムの外部から与える。
すべての非効率ブロックアクセスしている命令が知りたければ、Th_NE_Inst=1を与え、もっと絞り込んだ情報が知りたければ、Th_NE_Instに大きな値を与える。
At 310, the inefficient
If the inefficient access counter NE_InstAC [Addr] for each instruction is greater than or equal to the threshold Th_NE_Inst, it is determined that the instruction is inefficient, and 1 is set in the array NE_Inst [Addr] representing the result, and 0 is set if the instruction is not inefficient. .
The threshold Th_NE_Inst is given from the outside of the system according to the purpose.
If you want to know all the instructions that are accessing inefficient blocks, give Th_NE_Inst = 1, and if you want to know more refined information, give Th_NE_Inst a large value.
311で、非効率命令判定部1032が、ループの終了を判定する。
すなわち、命令の格納アドレスの最大値に到達したか否かを調べ、到達していれば、この処理が終了する。
そうでなければ、312で命令の格納アドレスに1加えて更新して、310に戻り、310〜312の処理を繰り返す。
In 311, the inefficient
That is, it is checked whether or not the maximum value of the instruction storage address has been reached. If it has been reached, this processing ends.
Otherwise, at 312, the instruction storage address is updated by 1 and the process returns to 310 to repeat the processes of 310 to 312.
上記の処理が終了すると、非効率命令か否かを表す配列NE_Inst[]と、その命令が非効率ブロックにアクセスした回数を表す配列NE_Inst_AC[]が求められる。 When the above processing is completed, an array NE_Inst [] indicating whether or not the instruction is an inefficient instruction and an array NE_Inst_AC [] indicating the number of times the instruction has accessed the inefficient block are obtained.
図5に出力例を示す。
NE_Inst[Addr]=1となるAddrについて、アドレスAddr、命令Inst=Mem[Addr]、非効率ブロックへのアクセス回数Ne_Inst_AC[Addr]を表示した例である。
FIG. 5 shows an output example.
In this example, the address Addr, the instruction Inst = Mem [Addr], and the number of accesses to the inefficient block Ne_Inst_AC [Addr] are displayed for Addr where NE_Inst [Addr] = 1.
このように、本実施の形態では、シミュレーションにおいてメモリアクセスの対象がメモリブロック内の一部のデータに偏っているメモリブロックを非効率ブロックとして抽出するとともに、非効率ブロックへのメモリアクセスを発生させた命令を非効率命令として抽出する。
そして、図5に例示するように、抽出した非効率命令を、当該非効率命令のアドレスとともに表示するため、キャッシュメモリの同一ブロックにアクセス頻度の高いデータと低いデータが混在することを防止し、キャッシュメモリの利用効率を向上させることができる。
As described above, in the present embodiment, in the simulation, a memory block whose memory access target is biased toward a part of the data in the memory block is extracted as an inefficient block, and a memory access to the inefficient block is generated. Are extracted as inefficient instructions.
Then, as illustrated in FIG. 5, since the extracted inefficient instruction is displayed together with the address of the inefficient instruction, it is possible to prevent data with high access frequency and low data from being mixed in the same block of the cache memory, The utilization efficiency of the cache memory can be improved.
以上、本実施の形態では、
以下の手段を備えた命令実行分析装置を説明した。
(a)特定のプロセッサに対応したプログラムのバイナリコードと実行環境を入力する手段、
実行環境とは、初期データや実行中に外部要因により変化するデータを指す。
(b)プロセッサの命令の実行を模擬する手段、
このプロセッサは、メモリをアクセスするとき、実行時間の短縮のためキャッシュメモリを有することを前提とする。
(c)命令のメモリアクセスにおける非効率ブロックの抽出手段、
非効率ブロックとは、ひとつのキャッシュブロックに対して、一部のデータのみ頻繁に使われ、他の部分はほとんど使われないため、ブロック全体としては、利用効率が低くなっているものを指す。
(d)非効率命令の抽出手段、
非効率命令とは、前記非効率ブロックの生成要因となっている命令を指す。
As described above, in the present embodiment,
An instruction execution analyzer having the following means has been described.
(A) means for inputting a binary code of a program corresponding to a specific processor and an execution environment;
The execution environment refers to initial data or data that changes due to external factors during execution.
(B) means for simulating the execution of instructions of the processor;
When accessing the memory, this processor is premised on having a cache memory for shortening the execution time.
(C) means for extracting inefficient blocks in instruction memory access;
An inefficient block refers to a block in which the use efficiency of the entire block is low because only a part of data is frequently used for one cache block and the other part is hardly used.
(D) means for extracting inefficient instructions;
An inefficient instruction refers to an instruction that is a cause of generation of the inefficient block.
また、本実施の形態では、非効率ブロックの抽出手段の実現方法として、
(a)プロセッサの命令の実行を模擬する手段、
(b)メモリアクセス回数を計測する手段、
(c)ブロック内のバイトに対して、高頻度のアクセスの個数を計測する手段、
(d)ブロック内のバイトに対して、低頻度のアクセスの個数を計測する手段、
(e)該当ブロックが非効率化か否かを、高頻度アクセスのバイト数と低頻度アクセスのバイト数を用いて判断する手段
を説明した。
In the present embodiment, as an implementation method of the inefficient block extraction means,
(A) means for simulating execution of instructions of the processor;
(B) means for measuring the number of memory accesses;
(C) means for measuring the number of high-frequency accesses to the bytes in the block;
(D) means for measuring the number of infrequent accesses to the bytes in the block;
(E) The means for determining whether the corresponding block is inefficient or not using the number of bytes of high-frequency access and the number of bytes of low-frequency access has been described.
また、本実施の形態では、以下の手段を備えた命令実行分析装置を説明した。
(a)高頻度アクセスか否かを判定するための閾値を算出する手段、
(b)低頻度アクセスか否かを判定するための閾値を算出する手段。
Further, in the present embodiment, the instruction execution analysis apparatus provided with the following means has been described.
(A) means for calculating a threshold value for determining whether or not there is a high-frequency access;
(B) A means for calculating a threshold for determining whether or not the access is infrequent.
また、本実施の形態では、非効率命令の抽出手段の実現方法として、
(a)プロセッサの命令の実行を模擬する手段、
(b)命令毎の非効率ブロックへのアクセス回数を計測する手段、
(c)すべての命令に対し、非効率ブロックへのアクセス回数と閾値を比較する手段
を説明した。
Further, in this embodiment, as an implementation method of the inefficient instruction extraction means,
(A) means for simulating execution of instructions of the processor;
(B) means for measuring the number of accesses to the inefficient block for each instruction;
(C) The means for comparing the number of accesses to the inefficient block with the threshold for all instructions has been described.
実施の形態2.
次に、実施の形態1で示した命令実行分析方法をさらに有効に活用する手法を説明する。
ユーザが実際に実施の形態1に係る命令実行分析方法を活用する場合、図5のような形式より、ソースプログラムに直接指示やヒントが書かれることが望ましい。
Next, a method for more effectively using the instruction execution analysis method shown in the first embodiment will be described.
When the user actually uses the instruction execution analysis method according to the first embodiment, it is desirable that instructions and hints are directly written in the source program from the format shown in FIG.
例えば図6のようなソースプログラムを考える。
このプログラムは、C言語の文法で、本実施の形態に関係があるところのみを記載している。
図6において、1行目でプログラム名を定義し、2行目で変数と配列を定義している。
配列はa、b、cと3つあり、要素数はいずれも10000である。
3行目から6行目まで制御変数iでループを構成し、配列aに配列bと配列cを加算し代入している。
このとき、4行目に示すように、配列bのインデックスjは、変数iの一の位を切り落とし10の倍数のみを取るようになっている。
従って、配列bは要素毎にアクセス数が異なり、非効率ブロックとなっている。
一方、配列aと配列cは、効率的なブロックである。
For example, consider a source program as shown in FIG.
This program describes only the C language grammar that is relevant to the present embodiment.
In FIG. 6, a program name is defined on the first line, and variables and arrays are defined on the second line.
There are three arrays, a, b, and c, and the number of elements is 10,000.
A loop is constituted by the control variable i from the third line to the sixth line, and the array b and the array c are added to the array a and assigned.
At this time, as shown in the fourth row, the index j of the array b is cut off the first digit of the variable i and takes only a multiple of 10.
Therefore, the array b has an inefficient block with a different number of accesses for each element.
On the other hand, array a and array c are efficient blocks.
図7は、非効率命令のマーキング付きソースプログラムの例である。
図6のプログラムに対して、6行目に/* 配列b[j]の参照が非効率です */というメッセージが挿入されている。
このようなメッセージがあるとユーザは、5行目の式のb[j]のメモリ参照が非効率であり、この配列を改善すればよいことが分かる。
例えば、配列bを必要最小限の配列(b[1000])として定義し、j=int(i/10)とすれば、配列b[j]の利用効率が上がることは容易に想像できる。
一般に、このようにデータサイズを小さくすると、キャッシュメモリの利用効率が向上し、システムの性能が向上する。
FIG. 7 is an example of a source program with inefficient instruction marking.
In the program of FIG. 6, the message / * reference to the array b [j] is inefficient in the sixth line is inserted.
With such a message, the user knows that the memory reference of b [j] in the expression on the fifth line is inefficient, and this arrangement should be improved.
For example, if the array b is defined as the minimum necessary array (b [1000]) and j = int (i / 10), it can be easily imagined that the utilization efficiency of the array b [j] increases.
Generally, when the data size is reduced in this way, the utilization efficiency of the cache memory is improved and the performance of the system is improved.
図8では、上記のようなことを実現するためのフローを説明する。
図において、11はソースプログラムで、例えば図6のようなものである。
12はコンパイラとリンカである。
13はバイナリコードである。
14はリンカの出力の一つで、ソースプログラムとバイナリコードの対応をつける表(以降、対応表と呼ぶ)で、例えば図9のようなものである。
15は実行環境である。
2は非効率ブロックの抽出処理である。
3は、非効率命令の抽出処理である。
4は非効率命令の一覧である。
5は非効率命令をソースプログラムへひもづけする処理である。
6は非効率命令のマーキング付きソースプログラムで、例えば図7のようなものである。
FIG. 8 illustrates a flow for realizing the above.
In the figure, 11 is a source program, for example, as shown in FIG.
13 is a binary code.
Reference numeral 3 denotes inefficiency instruction extraction processing.
4 is a list of inefficient instructions.
5 is a process for linking inefficient instructions to the source program.
Reference numeral 6 denotes a source program with inefficient instruction marking, for example, as shown in FIG.
図11は、本実施の形態に係る命令実行分析装置100の構成例を示す。
図11において、図10と同じ符号の要素は図10と同じであり、説明を省略する。
ソースプログラム加工部104は、図8の非効率命令のソースプログラムへのひもづけ処理5を実施して、図7に示すようなメッセージをソースプログラムに挿入する。
つまり、ソースプログラム加工部104は、シミュレーションの対象となる命令が記述されるバイナリコードのソースプログラム600内で非効率命令が記述されている位置を非効率命令記述位置として特定し、非効率命令記述位置に、当該非効率命令記述位置に記述されている命令が非効率命令であることを通知するメッセージを挿入する。
FIG. 11 shows a configuration example of the instruction
11, elements having the same reference numerals as those in FIG. 10 are the same as those in FIG.
The source
That is, the source
ソースプログラムとバイナリコードの対応表500は、図8のソースプログラムとバイナリコードの対応表14に相当し、例えば、図9に示すものである。 The source program / binary code correspondence table 500 corresponds to the source program / binary code correspondence table 14 of FIG. 8, and is shown in FIG. 9, for example.
ソースプログラム600は、図8のソースプログラム11に対応する。
The
非効率命令のマーキング付きソースプログラム700は、図8の非効率命令のマーキング付きソースプログラム6に対応し、例えば図7に示すものである。
The
以下、図8及び図11を参照して、本実施の形態に係る処理を説明する。 Hereinafter, processing according to the present embodiment will be described with reference to FIGS.
11のソースプログラムを12のコンパイラとリンカで処理すると、実行可能なバイナリコード13と対応表14が生成される。
バイナリコード13と実行環境15を非効率ブロックの抽出処理2(非効率ブロック抽出部10)に入力すると、実施の形態1で説明したように非効率ブロックの一覧が出力される。
非効率命令の抽出処理3(非効率命令抽出部103)に非効率ブロックの一覧を入力すると実施の形態1で説明したように、非効率命令一覧4が出力される。
非効率命令一覧4と対応表14を非効率命令のソースプログラムへのひもづけ処理5(ソースプログラム加工部104)に入力することで、非効率命令のマーキング付きソースプログラム6、即ち、図7のようなソースプログラムが出力される。
対応表14は、具体的には図9のようなもので、ソースプログラムの行番号、それに対応する命令のアドレスと命令と命令がアクセスする変数などの情報が記載されている。
ソースプログラム加工部104は、非効率命令一覧(図5)に掲載されている命令アドレスを対応表(図9)で見つけ、その行番号と変数名を検索することで、ソースプログラムの修正行番号と非効率命令でアクセスされている変数が見つけられる。
この例では、図5の表の1行目に命令アドレス=1000Hがあるので、図9の対応表で命令アドレス=1000Hを探し、そのときのソースプログラム行番号は5行目で、変数名は配列b[j]であることが分かる。
この情報をもとに、ソースプログラム加工部104は、非効率命令記述位置である図6の5行目のあとにメッセージを挿入すると図7を生成することができる。
When 11 source programs are processed by 12 compilers and linkers,
When the
When the list of inefficient blocks is input to the inefficient instruction extraction process 3 (inefficient instruction extraction unit 103), the
The
The correspondence table 14 is specifically as shown in FIG. 9 and describes information such as the line number of the source program, the address of the corresponding instruction, the instruction and the variable accessed by the instruction.
The source
In this example, there is an instruction address = 1000H in the first line of the table of FIG. 5, so the instruction address = 1000H is searched for in the correspondence table of FIG. 9, the source program line number at that time is the fifth line, and the variable name is It can be seen that this is an array b [j].
Based on this information, the source
このように、本実施の形態によれば、ユーザに対して、キャッシュメモリの利用効率を改善するための修正箇所をソースプログラムにおいて提示することができる。 As described above, according to the present embodiment, it is possible to present, to the user, a correction location for improving the use efficiency of the cache memory in the source program.
以上、本実施の形態では、実施の形態1の構成に加えて、以下の手段を備えた命令実行分析装置を説明した。
(a)ソースプログラムとバイナリコードの対応表(リンカの出力)により、非効率命令とソースプログラムのひもづけをする手段、
(b)非効率命令にひもづけされたソースプログラムの変数名にマーキングをする手段。
As described above, in this embodiment, the instruction execution analysis apparatus including the following means in addition to the configuration of the first embodiment has been described.
(A) Means for associating inefficient instructions with the source program based on the correspondence table (linker output) between the source program and the binary code,
(B) Means for marking variable names of source programs linked to inefficient instructions.
最後に、実施の形態1及び2に示した命令実行分析装置100を実現するためのハードウェア構成例について説明する。
図12は、実施の形態1及び2に示す命令実行分析装置100を実現するためのハードウェア資源の一例を示す図である。
なお、図12の構成は、あくまでもハードウェア構成の一例を示すものであり、命令実行分析装置100は図12に記載の構成に限らず、他の構成によって実現されてもよい。
Finally, a hardware configuration example for realizing the instruction
FIG. 12 is a diagram illustrating an example of hardware resources for realizing the instruction
Note that the configuration in FIG. 12 is merely an example of a hardware configuration, and the instruction
図12において、命令実行分析装置100は、プログラムを実行するCPU911(Central Processing Unit、中央処理装置、処理装置、演算装置、マイクロプロセッサ、マイクロコンピュータ、プロセッサともいう)を備えている。
CPU911は、バス912を介して、例えば、ROM(Read Only Memory)913、RAM(Random Access Memory)914、通信ボード915、表示装置901、キーボード902、マウス903、磁気ディスク装置920と接続され、これらのハードウェアデバイスを制御する。
更に、CPU911は、FDD904(Flexible Disk Drive)、コンパクトディスク装置905(CDD)、プリンタ装置906、スキャナ装置907と接続していてもよい。また、磁気ディスク装置920の代わりに、SSD(Solid State Drive)、光ディスク装置、メモリカード(登録商標)読み書き装置などの記憶装置でもよい。
RAM914は、揮発性メモリの一例である。ROM913、FDD904、CDD905、磁気ディスク装置920の記憶媒体は、不揮発性メモリの一例である。これらは、記憶装置の一例である。
通信ボード915、キーボード902、マウス903、スキャナ装置907、FDD904などは、入力装置の一例である。
また、通信ボード915、表示装置901、プリンタ装置906などは、出力装置の一例である。
In FIG. 12, the instruction
The
Further, the
The
A
The
通信ボード915は、ネットワークに接続されている。
例えば、通信ボード915は、LAN(ローカルエリアネットワーク)、インターネット、WAN(ワイドエリアネットワーク)、SAN(ストレージエリアネットワーク)などに接続されている。
The
For example, the
磁気ディスク装置920には、オペレーティングシステム921(OS)、ウィンドウシステム922、プログラム群923、ファイル群924が記憶されている。
プログラム群923のプログラムは、CPU911がオペレーティングシステム921、ウィンドウシステム922を利用しながら実行する。
The
The programs in the
また、RAM914には、CPU911に実行させるオペレーティングシステム921のプログラムやアプリケーションプログラムの少なくとも一部が一時的に格納される。
また、RAM914には、CPU911による処理に必要な各種データが格納される。
The
The
また、ROM913には、BIOS(Basic Input Output System)プログラムが格納され、磁気ディスク装置920にはブートプログラムが格納されている。
命令実行分析装置100の起動時には、ROM913のBIOSプログラム及び磁気ディスク装置920のブートプログラムが実行され、BIOSプログラム及びブートプログラムによりオペレーティングシステム921が起動される。
The
When the
上記プログラム群923には、実施の形態1及び2の説明において「〜部」、「〜手段」として説明している機能を実行するプログラムが記憶されている。プログラムは、CPU911により読み出され実行される。
The
ファイル群924には、実施の形態1及び2の説明において、「〜の判定」、「〜のシミュレーション」、「〜の算出」、「〜の検索」、「〜の計測」、「〜の更新」、「〜の設定」、「〜の加工」、「〜の挿入」、「〜の選択」、「〜の入力」、「〜の出力」等として説明している処理の結果を示す情報やデータや信号値や変数値やパラメータが、「〜ファイル」や「〜データベース」の各項目として記憶されている。
「〜ファイル」や「〜データベース」は、ディスクやメモリなどの記録媒体に記憶される。
ディスクやメモリなどの記憶媒体に記憶された情報やデータや信号値や変数値やパラメータは、読み書き回路を介してCPU911によりメインメモリやキャッシュメモリに読み出される。
そして、読み出された情報やデータや信号値や変数値やパラメータは、抽出・検索・参照・比較・演算・計算・処理・編集・出力・印刷・表示などのCPUの動作に用いられる。
抽出・検索・参照・比較・演算・計算・処理・編集・出力・印刷・表示のCPUの動作の間、情報やデータや信号値や変数値やパラメータは、メインメモリ、レジスタ、キャッシュメモリ、バッファメモリ等に一時的に記憶される。
また、実施の形態1及び2で説明しているフローチャートの矢印の部分は主としてデータや信号の入出力を示す。
データや信号値は、RAM914のメモリ、FDD904のフレキシブルディスク、CDD905のコンパクトディスク、磁気ディスク装置920の磁気ディスク、その他光ディスク、ミニディスク、DVD等の記録媒体に記録される。
また、データや信号は、バス912や信号線やケーブルその他の伝送媒体によりオンライン伝送される。
In the
The “˜file” and “˜database” are stored in a recording medium such as a disk or a memory.
Information, data, signal values, variable values, and parameters stored in a storage medium such as a disk or memory are read out to the main memory or cache memory by the
The read information, data, signal value, variable value, and parameter are used for CPU operations such as extraction, search, reference, comparison, calculation, calculation, processing, editing, output, printing, and display.
Information, data, signal values, variable values, and parameters are stored in the main memory, registers, cache memory, and buffers during the CPU operations of extraction, search, reference, comparison, calculation, processing, editing, output, printing, and display. It is temporarily stored in a memory or the like.
In addition, the arrows in the flowcharts described in the first and second embodiments mainly indicate input / output of data and signals.
Data and signal values are recorded on a recording medium such as a memory of the
Data and signals are transmitted online via a bus 912, signal lines, cables, or other transmission media.
また、実施の形態1及び2の説明において「〜部」、「〜手段」として説明しているものは、「〜回路」、「〜装置」、「〜機器」であってもよく、また、「〜ステップ」、「〜手順」、「〜処理」であってもよい。
すなわち、実施の形態1及び2で説明したフローチャートに示すステップ、手順、処理により、本発明に係る「命令実行分析方法」を実現することができる。
また、「〜部」、「〜手段」として説明しているものは、ROM913に記憶されたファームウェアで実現されていても構わない。
或いは、ソフトウェアのみ、或いは、素子・デバイス・基板・配線などのハードウェアのみ、或いは、ソフトウェアとハードウェアとの組み合わせ、さらには、ファームウェアとの組み合わせで実施されても構わない。
ファームウェアとソフトウェアは、プログラムとして、磁気ディスク、フレキシブルディスク、光ディスク、コンパクトディスク、ミニディスク、DVD等の記録媒体に記憶される。
プログラムはCPU911により読み出され、CPU911により実行される。
すなわち、プログラムは、実施の形態1及び2の「〜部」、「〜手段」としてコンピュータを機能させるものである。あるいは、実施の形態1及び2の「〜部」、「〜手段」の手順や方法をコンピュータに実行させるものである。
Further, in the description of the first and second embodiments, what is described as “to part” and “to means” may be “to circuit”, “to device”, and “to device”. It may be “˜step”, “˜procedure”, “˜processing”.
That is, the “instruction execution analysis method” according to the present invention can be realized by the steps, procedures, and processes shown in the flowcharts described in the first and second embodiments.
In addition, what is described as “˜unit” and “˜means” may be realized by firmware stored in the
Alternatively, it may be implemented only by software, or only by hardware such as elements, devices, substrates, and wirings, by a combination of software and hardware, or by a combination of firmware.
Firmware and software are stored as programs in a recording medium such as a magnetic disk, a flexible disk, an optical disk, a compact disk, a mini disk, and a DVD.
The program is read by the
That is, the program causes the computer to function as “˜unit” and “˜means” of the first and second embodiments. Alternatively, the procedures and methods of “to part” and “to means” of the first and second embodiments are executed by a computer.
このように、実施の形態1及び2に示す命令実行分析装置100は、処理装置たるCPU、記憶装置たるメモリ、磁気ディスク等、入力装置たるキーボード、マウス、通信ボード等、出力装置たる表示装置、通信ボード等を備えるコンピュータにより実現される。
そして、上記したように「〜部」、「〜手段」として示された機能をこれら処理装置、記憶装置、入力装置、出力装置を用いて実現するものである。
As described above, the instruction
As described above, the functions indicated as “˜unit” and “˜means” are realized by using these processing devices, storage devices, input devices, and output devices.
100 命令実行分析装置、101 シミュレーション部、102 非効率ブロック抽出部、103 非効率命令抽出部、104 ソースプログラム加工部、1021 メモリアクセス計測部、1022 非効率ブロック判定部、1031 非効率ブロックアクセス計測部、1032 非効率命令判定部。
DESCRIPTION OF
Claims (10)
前記非効率ブロック抽出部により抽出された非効率ブロックへのメモリアクセスを発生させた命令のうち所定の条件に合致する命令を非効率命令として抽出する非効率命令抽出部とを有することを特徴とする命令実行分析装置。 Analyzing the status of memory access to the main memory device in a simulation in which a memory access to the main memory device is executed and executing an instruction, and based on the analysis result, out of a plurality of memory blocks in the main memory device An inefficient block extraction unit that extracts a memory block whose memory access target is biased toward some data in the memory block as an inefficient block;
An inefficient instruction extracting unit that extracts an instruction that satisfies a predetermined condition as an inefficient instruction among the instructions that have generated memory access to the inefficient block extracted by the inefficient block extracting unit; Instruction execution analysis device.
前記非効率命令抽出部は、
抽出した非効率命令を、当該非効率命令のアドレスとともに前記表示装置に出力することを特徴とする請求項1に記載の命令実行分析装置。 The instruction execution analyzer is connected to a display device,
The inefficient instruction extraction unit includes:
The instruction execution analysis apparatus according to claim 1, wherein the extracted inefficient instruction is output to the display device together with an address of the inefficient instruction.
所定のキャッシュメモリのキャッシュブロック数に対応させた複数のメモリブロックの中から非効率ブロックを抽出することを特徴とする請求項1又は2に記載の命令実行分析装置。 The inefficient block extraction unit includes:
3. The instruction execution analysis apparatus according to claim 1, wherein an inefficient block is extracted from a plurality of memory blocks corresponding to the number of cache blocks of a predetermined cache memory.
メモリブロックごとに、メモリブロック内のデータのうち、前記シミュレーションの際のアクセス頻度が高い高アクセスデータとアクセス頻度が低い低アクセスデータとを抽出し、
各メモリブロックの高アクセスデータの数と低アクセスデータの数に基づいて、非効率ブロックを抽出することを特徴とする請求項1〜3のいずれかに記載の命令実行分析装置。 The inefficient block extraction unit includes:
For each memory block, among the data in the memory block, extract high access data with high access frequency and low access data with low access frequency during the simulation,
4. The instruction execution analysis apparatus according to claim 1, wherein inefficient blocks are extracted based on the number of high access data and the number of low access data in each memory block.
前記シミュレーションの際の前記複数のメモリブロックにおける平均メモリアクセス回数に基づいて、高アクセスデータを抽出するための抽出基準と、低アクセスデータを抽出するための抽出基準とを導出することを特徴とする請求項4に記載の命令実行分析装置。 The inefficient block extraction unit includes:
An extraction criterion for extracting high access data and an extraction criterion for extracting low access data are derived based on an average number of memory accesses in the plurality of memory blocks during the simulation. The instruction execution analysis apparatus according to claim 4.
メインメモリ装置へのメモリアクセスが実施されて命令が実行されるシミュレーションにおける前記メインメモリ装置へのメモリアクセスの状況を分析し、分析結果に基づいて、前記非効率ブロックへのメモリアクセスを発生させた命令を特定し、特定した命令のうち、前記非効率ブロックへのメモリアクセスを所定回数以上発生させた命令を非効率命令として抽出することを特徴とする請求項1〜5のいずれかに記載の命令実行分析装置。 The inefficient instruction extraction unit includes:
The state of memory access to the main memory device in the simulation in which the memory access to the main memory device is executed and the instruction is executed is analyzed, and the memory access to the inefficient block is generated based on the analysis result 6. The instruction according to claim 1, wherein an instruction is specified, and an instruction that has generated a predetermined number of memory accesses to the inefficient block is extracted as an inefficient instruction among the specified instructions. Instruction execution analyzer.
前記シミュレーションで実行される命令が記述されるバイナリコードのソースプログラム内で、前記非効率命令抽出部により抽出された非効率命令が記述されている位置を非効率命令記述位置として特定し、前記ソースプログラム内の非効率命令記述位置に、当該非効率命令記述位置に記述されている命令が非効率命令であることを通知する通知メッセージを挿入するソースプログラム加工部を有することを特徴とする請求項1〜6のいずれかに記載の命令実行分析装置。 The instruction execution analyzer further includes:
The position where the inefficient instruction extracted by the inefficient instruction extracting unit is described as the inefficient instruction description position in the binary code source program in which the instruction executed in the simulation is described, and the source A source program processing unit for inserting a notification message for notifying that an instruction described in the inefficient instruction description position is an inefficient instruction at an inefficient instruction description position in the program. The instruction execution analyzer according to any one of 1 to 6.
前記ソースプログラム内の非効率命令記述位置に記述されている命令に含まれている変数の設定が非効率であることを通知する通知メッセージを、前記ソースプログラム内の非効率命令記述位置に挿入することを特徴とする請求項7に記載の命令実行分析装置。 The source program processing unit
A notification message notifying that the setting of the variable included in the instruction described in the inefficient instruction description position in the source program is inefficient is inserted into the inefficient instruction description position in the source program. The instruction execution analysis apparatus according to claim 7, wherein:
メインメモリ装置へのメモリアクセスが実施されて命令が実行されるシミュレーションにおける前記メインメモリ装置へのメモリアクセスの状況を分析し、分析結果に基づいて、前記メインメモリ装置内の複数のメモリブロックのうち、メモリアクセスの対象がメモリブロック内の一部のデータに偏っているメモリブロックを非効率ブロックとして抽出する非効率ブロック抽出ステップと、
前記コンピュータが、
前記非効率ブロック抽出ステップにより抽出された非効率ブロックへのメモリアクセスを発生させた命令のうち所定の条件に合致する命令を非効率命令として抽出する非効率命令抽出ステップとを有することを特徴とする命令実行分析方法。 Computer
Analyzing the status of memory access to the main memory device in a simulation in which a memory access to the main memory device is executed and executing an instruction, and based on the analysis result, out of a plurality of memory blocks in the main memory device An inefficient block extraction step for extracting a memory block whose memory access target is biased toward partial data in the memory block as an inefficient block;
The computer is
An inefficiency instruction extraction step for extracting, as an inefficiency instruction, an instruction that satisfies a predetermined condition among the instructions that have caused memory access to the inefficiency block extracted in the inefficiency block extraction step; Instruction execution analysis method.
前記非効率ブロック抽出ステップにより抽出された非効率ブロックへのメモリアクセスを発生させた命令のうち所定の条件に合致する命令を非効率命令として抽出する非効率命令抽出ステップとをコンピュータに実行させることを特徴とするプログラム。 Analyzing the status of memory access to the main memory device in a simulation in which a memory access to the main memory device is executed and executing an instruction, and based on the analysis result, out of a plurality of memory blocks in the main memory device An inefficient block extraction step for extracting a memory block whose memory access target is biased toward partial data in the memory block as an inefficient block;
Causing the computer to execute an inefficiency instruction extraction step of extracting, as an inefficiency instruction, an instruction that satisfies a predetermined condition among the instructions that have generated memory access to the inefficiency block extracted in the inefficiency block extraction step. A program characterized by
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2011072473A JP5597584B2 (en) | 2011-03-29 | 2011-03-29 | Instruction execution analysis apparatus, instruction execution analysis method, and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2011072473A JP5597584B2 (en) | 2011-03-29 | 2011-03-29 | Instruction execution analysis apparatus, instruction execution analysis method, and program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2012208615A true JP2012208615A (en) | 2012-10-25 |
JP5597584B2 JP5597584B2 (en) | 2014-10-01 |
Family
ID=47188317
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2011072473A Expired - Fee Related JP5597584B2 (en) | 2011-03-29 | 2011-03-29 | Instruction execution analysis apparatus, instruction execution analysis method, and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5597584B2 (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH01173135A (en) * | 1987-12-26 | 1989-07-07 | Fujitsu Ltd | Conversion processing system applying source converter |
JPH08263372A (en) * | 1995-03-28 | 1996-10-11 | Hitachi Ltd | Device for collection of cache miss information and tuning |
JP2004157686A (en) * | 2002-11-05 | 2004-06-03 | Matsushita Electric Ind Co Ltd | Device and method for memory management |
JP2005122481A (en) * | 2003-10-16 | 2005-05-12 | Matsushita Electric Ind Co Ltd | Compiler system and linker system |
JP2007018254A (en) * | 2005-07-07 | 2007-01-25 | Toshiba Corp | Language processor |
US20080016308A1 (en) * | 2006-07-13 | 2008-01-17 | Bartley Gerald K | Dynamic Latency Map for Memory Optimization |
-
2011
- 2011-03-29 JP JP2011072473A patent/JP5597584B2/en not_active Expired - Fee Related
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH01173135A (en) * | 1987-12-26 | 1989-07-07 | Fujitsu Ltd | Conversion processing system applying source converter |
JPH08263372A (en) * | 1995-03-28 | 1996-10-11 | Hitachi Ltd | Device for collection of cache miss information and tuning |
JP2004157686A (en) * | 2002-11-05 | 2004-06-03 | Matsushita Electric Ind Co Ltd | Device and method for memory management |
JP2005122481A (en) * | 2003-10-16 | 2005-05-12 | Matsushita Electric Ind Co Ltd | Compiler system and linker system |
JP2007018254A (en) * | 2005-07-07 | 2007-01-25 | Toshiba Corp | Language processor |
US20080016308A1 (en) * | 2006-07-13 | 2008-01-17 | Bartley Gerald K | Dynamic Latency Map for Memory Optimization |
Also Published As
Publication number | Publication date |
---|---|
JP5597584B2 (en) | 2014-10-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7752414B2 (en) | Splash tables: an efficient hash scheme for processors | |
EP3391224B1 (en) | Method and apparatus for data mining from core traces | |
US20110307688A1 (en) | Synthesis system for pipelined digital circuits | |
US10437949B1 (en) | Scheduling events in hardware design language simulation | |
CN113868068B (en) | Kernel performance testing method, computing device and storage medium | |
US8612952B2 (en) | Performance optimization based on data accesses during critical sections | |
JP6234639B2 (en) | Simulation apparatus, simulation method, and simulation program | |
US20150154103A1 (en) | Method and apparatus for measuring software performance | |
US11055458B1 (en) | Functional coverage of designs using transition bins and cross coverage | |
JP5597584B2 (en) | Instruction execution analysis apparatus, instruction execution analysis method, and program | |
CN116149917A (en) | Method and apparatus for evaluating processor performance, computing device, and readable storage medium | |
US7707560B2 (en) | Analyzing software performance without requiring hardware | |
US8756580B2 (en) | Instance-based field affinity optimization | |
US10628542B2 (en) | Core-only system management interrupt | |
US10740521B1 (en) | System and method for localized logic simulation replay using emulated values | |
US20140258688A1 (en) | Benchmark generation using instruction execution information | |
JP6234640B2 (en) | Simulation apparatus, simulation method, and simulation program | |
JP3214459B2 (en) | Simulation method and apparatus | |
US11836426B1 (en) | Early detection of sequential access violations for high level synthesis | |
JP7230719B2 (en) | Information processing device and information processing method | |
CN104462368A (en) | Data calculating method, device and server | |
WO2018163387A1 (en) | Analysis device, analysis method, and analysis program | |
US7917739B2 (en) | Storage medium storing calculation processing visualization program, calculation processing visualization apparatus, and calculation processing visualization method | |
US20150127318A1 (en) | Apparatus and method for simulating an operation of an out-of-order processor | |
CN117349100A (en) | Method, apparatus and medium for determining operator performance |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20131114 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20140430 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20140513 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20140602 |
|
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: 20140715 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20140811 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 5597584 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
LAPS | Cancellation because of no payment of annual fees |