JP3770091B2 - Cache control method and cache control circuit - Google Patents
Cache control method and cache control circuit Download PDFInfo
- Publication number
- JP3770091B2 JP3770091B2 JP2001033857A JP2001033857A JP3770091B2 JP 3770091 B2 JP3770091 B2 JP 3770091B2 JP 2001033857 A JP2001033857 A JP 2001033857A JP 2001033857 A JP2001033857 A JP 2001033857A JP 3770091 B2 JP3770091 B2 JP 3770091B2
- Authority
- JP
- Japan
- Prior art keywords
- cache
- register
- value
- counter
- line
- 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.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims description 17
- 230000010365 information processing Effects 0.000 claims description 8
- 238000010586 diagram Methods 0.000 description 15
- 238000005516 engineering process Methods 0.000 description 7
- 101710164820 Flotillin-2 Proteins 0.000 description 6
- 230000000694 effects Effects 0.000 description 6
- 230000002123 temporal effect Effects 0.000 description 5
- 230000006872 improvement Effects 0.000 description 4
- 230000006399 behavior Effects 0.000 description 3
- 230000008901 benefit Effects 0.000 description 3
- 230000002093 peripheral effect Effects 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 2
- 238000005457 optimization Methods 0.000 description 2
- 101100156648 Caenorhabditis elegans wdr-20 gene Proteins 0.000 description 1
- 101100317049 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) VLD1 gene Proteins 0.000 description 1
- 230000002411 adverse Effects 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 230000015556 catabolic process Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000006731 degradation reaction Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
Images
Landscapes
- Complex Calculations (AREA)
- Memory System Of A Hierarchy Structure (AREA)
Description
【0001】
【発明の属する技術分野】
本発明は、各種情報処理システムにおいて使用されるキャッシュメモリを制御するためのキャッシュ制御方法及びキャッシュ制御回路に関する。
【0002】
【従来の技術】
各種情報処理システムにおけるメモリアクセスのボトルネック解消のために、キャッシュと呼ばれる小容量で高速のバッファメモリを利用する技術は、古くからほとんどのシステムで使用されている。キャッシュメモリを使用する効果は、以下の2つである。その第1は、主メモリ等に比べて小容積に構成し得ることから、プロセッサの近く、例えば、同一LSI内部に配置できることになり、オペランドデータのレイテンシー(Latency)の大幅短縮が実現できることである。
【0003】
第2の効果は、特に、ストアイン型キャッシュのようにメモリへの書き込みを常時には行わない場合、メモリアクセスに必要なスループットを抑えることができる。したがって、メモリ構造を簡素化でき、コスト面で有利であることと、逆にいえば、メモリアクセス頻度を抑えることで、メモリインターフェースのリクエスト競合を回避できるため、性能向上が実現できることである。
【0004】
このキャッシュメモリ方式が有効であるためには、以下に示す実際のプログラムにおけるメモリアクセスの振る舞いが、通常は一定の性質を持つものであるとの前提が必要である。それは、参照の局所性(以下、ローカリティともいう)というメモリアクセスの性質によるものである。すなわち、空間的ローカリティ(参照されるアドレスはある部分に固まっていること)と、時間的ローカリティ(参照されるアドレスは、ある時間内に集中していること)である。
【0005】
ここでキャッシュミス時の動作について簡単に説明する。ただし、キャッシュメモリの動作については、多くの文献があり、例えば“並列コンピュータ” 天野英晴著(昭晃堂)に詳しく説明されているので、本発明に直接関係しない動きに関しては説明を割愛する。
【0006】
まず、既にキャッシュに登録されている同一キャッシュラインアドレスのラインは追い出される。ストアスルー型キャッシュの場合は、メモリとの一貫性が常時保たれているため、新しいラインをキャッシュに上書きするだけで済む。しかし、ストアイン型キャッシュの場合には、メモリとの一貫性が保たれていないので、追い出されるキャッシュラインをメモリに書き込む必要がある。
【0007】
また、新しいラインのリフィルにラインデータ分のブロックロードリクエストが発生する。メモリに対して、無駄なデータを持ってくる処理が入るが、その一方で暗示的なプリフェッチとなるという長所もあるため、その得失は一概には断じられない。
【0008】
この動作に関しては図5において説明しており、“A”、“B”、“W”は、ロード(以下、LDともいう)命令が、各々メモリアクセスリクエストを発行するステージ、キャッシュアクセスを終わるステージ、レジスタへの書き込みステージに存在することを意味する。
【0009】
まず、LD−1はキャッシュヒット(hit)時のタイミングであり、この場合、わずか3サイクルで終了する。LD−2は、キャッシュミス(miss)した場合の動作であり、メモリに対してリフィルデータを要求し、ターゲットとなるデータが最初に帰ってくる場合が、一般的であり、その時点で、LD−2はWステージに移行することができる。しかし、リフィルのために、1ライン分のデータをキャッシュに書き込むための時間が必要であり、その間は、後続のキャッシュアクセス命令の発行が不可となる。LD−3は、キャッシュにデータを登録しないキャッシュバイパスロードのタイミングであり、LD−2との違いは、ミスした場合に、ミスリプライデータをキャッシュに登録しない点にある。
【0010】
参照の局所性がないメモリアクセスの場合、リフィルデータのキャッシュ書き込み時における後続キャッシュアクセス命令の発行が抑止されることがない点から、このケースだけを見ればLD−3が性能上優れていると言える。
【0011】
以上のようなキャッシュ制御は、前提としている参照の局所性が崩れると、以下のような問題点が発生する。問題点1)1回しかLDしないラインをキャッシュに入れることは、キャッシュにデータを登録しない場合に比べて、キャッシュラインデータのストアとロードが余計に必要となる。問題点2)まだ有用なキャッシュラインにもかかわらずリプレースしてしまう。
【0012】
このような参照の局所性がないといわれているものには、科学技術計算プログラムがある。しかし、近年、マイクロプロセッサにおけるキャッシュ容量は、LSI技術の絶え間ない進歩によって、KB単位からMB単位に増強されている。また、キャッシュを考慮したプログラムの最適化技術も、このようなキャッシュ容量のトレンドに追従し、ストアイン型キャッシュのマイクロプロセッサにおいても、科学技術計算プログラムの性能が向上してきた。しかし、コンパイラの最適化技術はいくら進んでも、実行前のプログラムからメモリアクセスの振る舞いを認識して、高いキャッシュヒット率を実現するには限界がある。
【0013】
ところで、科学技術計算プログラムを効率よく実行する装置として、ベクトル型計算機がある。ベクトル型計算機では、ベクトルレジスタという複数ワードデータを格納するレジスタに対する処理を、ベクトル命令という命令1つで規定できる。例えば、ベクトルロード(以下、VLDともいう)命令は、ベクトル長レジスタ(以下、VLともいう)の値分のロードを実行し、その読み出しデータをベクトルレジスタという複数ワードを集めたレジスタに格納する。逆に、ベクトルストア(以下、VSTともいう)はベクトルレジスタにある複数のワードデータを、メモリに格納する。
【0014】
このベクトル型計算機において、例えば〔ディスタンス(distance)〕*〔VL〕の大きなVLD命令が発行され、それが悉くキャッシュミスする場合、VLD1命令で数多くのキャッシュラインがリプレースされてしまう。その中で、使ったばかりのラインが存在していた場合、時間的局所性を期待してキャッシュに登録されているデータがキャンセルされ、再々度キャッシュラインデータがリフィルされてしまうという、性能上悲劇的状況に至る。
【0015】
【発明が解決しようとする課題】
本発明は、上述のような従来技術の問題点を解消し、参照の局所性が厳密な意味で保証されないプログラムであっても、キャッシュメモリによる性能向上効果を得ることができるキャッシュ制御回路を提供することである。
【0016】
【課題を解決する為の手段】
本発明の課題は、キャッシュメモリを有する情報処理装置のキャッシュ制御方法において、ベクトルロード命令アクセス範囲を規定する値と、ベクトル長の値とディスタンス値との積とを比較し、この比較結果を基礎として、ベクトルロード命令のデータをキャッシュへ登録するかまたは非登録とするかの第1の判定を行い、この第1の判定結果に従ってキャッシュへの登録または非登録の制御を選択的に実行するキャッシュ制御方法によって解決される。
さらに、本発明の課題は、上記キャッシュ制御方法において、前記ベクトルロード命令アクセス範囲を規定する値は、ソフトウェアによって規定されるキャッシュ制御方法によって解決される。
さらに、本発明の課題は、上記キャッシュ制御方法において、キャッシュの各エントリに対応してキャッシュアクセス回数を計測し、このキャッシュアクセス回数とキャッシュアクセスの制限使用回数とを比較し、この比較結果から、キャッシュへ登録するかまたは非登録とするかの第2の判定を行い、この第2の判定結果と前記第1の判定結果に従ってキャッシュへの登録または非登録の制御を選択的に実行するキャッシュ制御方法によって解決される。
【0017】
さらに、本発明の課題は、キャッシュメモリを有する情報処理装置のキャッシュ制御回路において、ベクトルロード命令アクセス範囲を規定する値を保持する第1のレジスタと、ベクトル長を保持する第2のレジスタと、ディスタンスを保持する第3のレジスタと、前記第1のレジスタの値と、第2レジスタのベクトル長と第3のレジスタのディスタンスとの積の値とを比較し、この比較結果に基づいてベクトルロード命令のデータをキャッシュへの登録または非登録の判定を行う第1の判定回路と、前記第1の判定回路の判定結果を保持する第4のレジスタと、該第4のレジスタの判定結果に従ってキャッシュへの登録または非登録の制御を選択的に行うミスリプライ制御回路とを具備するキャッシュ制御回路によって解決される。
また、本発明の課題は、上記キャッシュメモリを有する情報処理装置のキャッシュ制御回路において、前記第1のレジスタの値は、ソフトウェアによってセットされるキャッシュ制御回路。
【0018】
また、本発明の課題は、キャッシュメモリを有する情報処理装置のキャッシュ制御回路において、キャッシュアクセスの制限使用回数を格納する第5のレジスタと、キャッシュの各エントリに対応してキャッシュアクセス回数の計測結果を保持する第6のレジスタ群と、キャッシュアクセス回数の計測結果の値を更新する制御回路と、アクセスしたキャッシュエントリに対応する第6のレジスタ値と第5のレジスタ値とを比較した結果から、キャッシュへの登録または非登録の判定を行う第2の判定回路とを有し、前記第4のレジスタは前記第1の判定回路及び前記第2の判定回路の結果を保持し、前記ミスリプライ制御回路は前記第4のレジスタの判定結果にしたがって、キャッシュへの登録または非登録の制御を選択的に実行するキャッシュ制御回路によって有利に解決される。
【0019】
本発明にかかるキャッシュ制御方法及び制御回路によれば、ロードリクエストの性質、あるいは、ヒットしたラインの履歴によって、キャッシュメモリに登録させるロードにするか否かをハードウェア(以下、HWともいう)が動的に判断する。
【0020】
また、VLD範囲レジスタとRUカウンタ制限値レジスタの更新によって、判断方法をソフトウェア(以下、SWともいう)が明示的に指定することができる。それによって、発明の背景で説明したような問題点を解決し、参照のローカリティが厳密な意味で保証されないプログラムであっても、キャッシュメモリによる性能向上効果を得ることができる。
【0021】
【発明の実施の形態】
以下、添付図を参照しつつ本発明にかかるキャッシュ制御装置の実施の形態を説明する。このキャッシュ制御装置は、図1に示されているような基本構成に適用される。スカラプロセッサユニット(以下、SPUともいう)−1は、全命令の解読/実行指示、及びスカラ命令の実行を行う。1次キャッシュユニット−2は、スカラメモリアクセス系命令で使用するデータのみを格納するものである。ベクトルプロセッサユニット(以下、VPUともいう)−3は、SPU−1の指示にしたがってベクトル命令の実行を行う。
【0022】
2次キャッシュユニット−4は、スカラ系/ベクトル系の両方で使われるデータを格納するものである。アドレス変換バッファ(以下、ATBという)−5は、論理アドレスを物理アドレスに変換するバッファである。また、メモリユニット−6は、メモリとメモリアクセス制御部とを含んでいる。IOP−7は入出力処理を行う。
【0023】
スカラLDの場合、SPU−1から信号線102でLDリクエストを発行し、1次キャッシュユニット−2内でミスすると、ラインデータのブロックリクエストとして信号線204を介して2次キャッシュユニット−4にデータを探しにゆく。そこでもミスした場合は、信号線405を介してATB5にメモリリクエストを送り、物理アドレスに変換して信号線506を介してメモリユニット−6に送出される。メモリユニット−6から読み出されたデータは、信号線604を介して2次キャッシュユニット−4に戻ってきてラインデータが格納され、信号線402を介して1次キャッシュユニット−2に戻って、そのラインデータが登録される。その時、最初のLD命令のターゲットデータは、信号線201を介してSPU−1に送られる。
【0024】
次に、VLD命令の動きについて説明する前に、VLD命令の仕様について、図6に基づいて説明する。VPU−3内にはベクトルレジスタとも呼ばれる複数の要素データを格納できるレジスタファイルが存在する。VLD命令は、Vxで指定されたベクトルレジスタに、SPU−1から送られてくるRy(ディスタンス)とRz(開始アドレス)で規定されたVLというレジスタで指定される個数のメモリロードを一括して行う命令である。
【0025】
ここで本発明許の実施例を説明するため、図1のような基本構成を用いる。VLというレジスタは、LVLという命令によって、ソフトウェアで書き換えられるレジスタで、VPU−3内に存在する。VLD命令の動きを図1のブロック図にしたがって説明する。VLD命令はSPU−1で命令デコードされ、その結果、信号線103を介して実行指示がVPU−3に送られる。VPU−3では、VLD命令が処理されるが、その際、開始アドレス、ディスタンス、VL(ベクトル長)が信号線304を介して2次キャッシュユニット−4に送られる。
【0026】
2次キャッシュユニット−4では、ミスした場合、該当するラインに対するブロックリクエストになり、スカラLDと同様にATB−5を通過し、メモリユニット−6から信号線604を介してリプライデータを2次キャッシュユニット−4に送る。2次キャッシュユニット−4が受け取ったリプライデータは、対応するキャッシュラインに格納されると同時に信号線403を介してターゲットデータのみがVPU−3に送られ、ベクトルレジスタに格納される。このような処理がVLで指定された数だけ実行される。しかし、2次キャッシュがヒットした場合は、2次キャッシュの読み出しデータだけが信号線403を介してVPU−3に送られる。
【0027】
ここで、このVLD命令を、本発明によるVLD範囲レジスタ、または、RUカウンタ制限値レジスタを用いたキャッシャブル判定回路によって、キャッシュミスした場合に必ずしもキャッシュに取り込まないようにする。この場合、2次キャッシュのラインサイズのブロックロードリクエストが発行されることはなく、信号線405にVLDの要素毎のリクエストが発行され、信号線604を介して送られてくるリプライデ−タを素通りさせて、信号線403を介して、VPU−3へ送る。
【0028】
まず、VLD範囲レジスタによる、本発明における動作について説明する。従来のベクトルメモリアクセスは、全てキャッシュされないものであったが、前述のようにLSI技術の進歩によるキャッシュ容量の大幅増加と、コンパイラによる最適化技術の進歩によって、科学技術計算でもある程度のキャッシュを使って意味のあるような参照局所性が実現できる。しかし、その中でもどうしても局所性を維持するような最適化ができない部分も時には存在する。その様子を図7に示す。
【0029】
その局所性のない部分では、広範囲にわたるVLD命令でベクトルオペランドデータをフェッチして、それを演算し、VST命令でメモリに書き戻すといった処理が行われ、1回VLD命令で読んだオペランドは2回以上読み出されることはほとんどない。このような場合、VLDのメモリデータをキャッシュに取り込むことは、無意味である。
【0030】
また、図8では、VLD命令のディスタンスが128BでVLが256のケースで、キャッシュ(ラインサイズ128B)に登録したケースについて説明している。VLD命令の要素データは、ラインデータのある1部にのみ存在するため、VLD命令1つのために、メモリLDデータは8B×256(=2KB)しか必要でないにもかかわらず、128B×256(=32KB)ものブロックLDが発生し、無駄なLDリクエストが30KB分も行われることになる。さらに、32KB分のキャッシュは、このVLD命令によって、図7で示しているような参照局所性が維持されている部分で必要とされているキャッシュデータが書きつぶされてしまうという悲劇的状況が生まれる。
【0031】
このような状況を回避するための別の手段として、キャッシュメモリにデータを登録しないことを最初から命令で明示的に指定するという方法もある。この方法の利点は、アドレス・ディスタンスといった値の着目だけでは不十分な参照の局所性についても考慮できることで、より効果的なキャッシュ制御が可能となる点である。このキャッシュに登録しないVLD命令が実行された場合には、無条件でキャッシュ登録を行わない。ただし、ロードすべきデータがキャッシュメモリに存在していた場合は、当然、キャッシュメモリを読み出す。
【0032】
しかし、キャッシュメモリにデータを登録するか否かをSW(ソフトウェア:コンパイラ)で判断することは極めて困難であり、ある程度のHWによるサポートが必要である。そのため、本発明では、VLD範囲レジスタで、VLDのアクセスする領域の広さを局所性の有無と判断する回路の実装によって、図8に示したような非効率的なキャッシュ動作を回避することができる。
【0033】
次に、RUカウンタ制限値レジスタによる時間的局所性に着目したキャッシュ登録制御について説明する。時間的局所性とは、1度アクセスされたデータは、再びアクセスされやすい傾向があるということである。このようなラインは、他のメモリアクセス時のキャッシュミスによって、キャッシュから追い出されないようにしなければならない。このキャッシュにおける追い出しアルゴリズムに関しては、従来技術にあるように、LRUアルゴリズムがある。
【0034】
ところが、それは複数のWayで構成されるキャッシュにおいて有用なものであり、ダイレクトマップ構成であると、同一ラインのアクセスに関しては、無条件に追い出されてしまう。さらに、キャッシュ容量の巨大化の方向では、HWコストの面からダイレクトマップ方式のキャッシュが一般的である。
【0035】
また、キャッシュ登録データは少なくとも、キャッシュに存在している限り2回以上そのラインにアクセスしないと、そのまま1ライン分のブロックLDのコストだけ、逆効果となる。そこで、最近特にアクセスが頻発に行われているラインであることを判断するために、RUカウンタという情報を各ラインに設ける。RUカウンタの動作論理は下記のようである。
このようにして、使用されないキャッシュラインに関しては、RUカウンタの値が上がってゆき、使用される可能性が低いラインであると認識される。このRUカウンタ値がRUカウンタ制限値レジスタを超えない場合は、リプレース対象から外すことによって、使用される可能性の高いラインがキャッシュに残ることになる。
【0036】
これらの動作を実現する本特許の特徴となる2次キャッシュの構成について、図2に基づいて説明する。VLD範囲REG−1(値と有効ビットで構成され、有効ビットが点灯していない時、比較結果はnon−activeである)は、乗算器−4によって計算された〔VLレジスタ−2の出力〕*〔ディスタンスレジスタ−3の出力〕と比較され、比較器−5の比較結果信号によって、ミス時にキャッシュに登録するか否かを決定する。命令コードレジスタ(OPC)−17の値から命令デコーダ−7によって、VLD信号(信号線706)及びキャッシュ非登録VLD信号(信号線710)を生成する。
【0037】
ANDゲート−6は、VLDが範囲を超えるものであったことを示す信号を生成する。ANDゲート−9は、RUカウンタ制限値REG−12(値と有効ビットとで構成され、有効ビットが点灯していない時は、比較結果はNon−activeである)とRUカウンタ−30の値を比較する比較器−8の比較結果信号より、時間的局所性の解析結果の信号が生成される。ORゲート−10は、Non−Cachable(キャッシュ非登録)の判断結果信号を出力し、その結果信号をキャッシュ非登録指示フラグ−11が受ける。
【0038】
有効フラグ−13は、Aステージに1次キャッシュからのブロックロード、あるいは、VPUからのベクトルメモリアクセス命令のリクエストが有効であることを示し、2Wayセレクタ−19は命令コードレジスタ(OPC)−17ヘ格納する値を選択する。
【0039】
OPC−17及びアドレスレジスタ(ADR)−14には、Aステージに存在する命令のコードとアドレスが格納される。ORゲート−15は、1次キャッシュからのブロックロード、あるいは、VPUからのベクトルメモリアクセス命令のリクエストが有効の出力を生成する。
【0040】
WEフラグ−16の点灯するケースは、ストア命令がwriteヒット時と、キャッシュミスリプライのデータを書き込む時である。その2つのタイミングをORゲート−20で生成している。前者はキャッシュヒット判定部−33から、後者はMissREQ制御部−36からそれぞれ送られる。また、その時のアドレスは、1次キャッシュ、VPU、Bステ−ジのアドレスレジスタ−26、MissREQ制御部−36から送られる、各々、1次キャッシュブロックロードアドレス、ベクトルメモリアクセス命令のアドレス、ストアwriteヒット時のアドレス、キャッシュミスリプライのアドレスを、4Wayセレクタ−18で選択するものである。
【0041】
WDR(Write Data Register)−20は、DA(Data Array)−32に対する書き込みデータレジスタである。2Wayセレクタ−21は、ストアwriteヒット時のストアデータ、キャッシュミスリプライデータを選択する。2Wayセレクタ−23は、1次キャッシュ/VPUからのストアリクエストのデータを選択し、ストアデータレジスタ−22に格納する。ストアがwriteヒットした場合、ストアデータレジスタ−24で1サイクル持ち回った後、WDR−20に格納し、そしてDA−32に書き込む。有効フラグ−25、アドレスレジスタ−26、ストアデータレジスタ−24、キャッシュミスフラグ−27は、いずれもBステージの情報である。
【0042】
キャッシュ有効ビット−29は、キャッシュのラインが有効であることを示す。アドレスアレイ(AA)−31は、対応するラインが如何なるアドレスのデータであるかを示す。データアレイ−32は、キャッシュデータを格納する。アドレス比較器−28は、AA−31の出力を読んで、アドレスレジスタ−14の値と比較し、キャッシュミスを判定し、その結果をキャッシュミスフラグ−27に格納する。
【0043】
キャッシュヒット判定部−33は、Bステージの制御情報を使用して、RUカウンタ−30を更新するための制御信号を生成する。DA−32から読んだキャッシュデータと、メモリからのキャッシュミスリプライデータとを2Wayセレクタ−34が選択し、RDR(Read Data Register)−35に格納する。
【0044】
次に、図3に基づいて、本実施例が前提としている2次キャッシュ構成について説明する。本実施例では、ラインサイズ128B×256エントリ(容量32KB)のダイレクトマップ方式を前提として説明する。このキャッシュの場合、AA(アドレスアレイ)及びDA(データアレイ)から構成され、AAに格納されるINDEXアドレスに対応するタグアドレスとリクエストのアドレスが比較され、キャッシュヒットの判定が行われる。メモリアクセスリクエストのアドレスは全体で40bitであり、そのうち上位25ビットはTAGアドレス、下位7ビットはラインアドレス、中間の8ビットはINDEXアドレスというように構成される。
【0045】
次に、図2中のRUカウンタ−30の周辺回路について、図4に基づいて説明する。RUカウンタ−30は、キャッシュのエントリに存在し、ADR−14の値に応じてデコーダ143とセレクタ301で選択され、その出力がCachable決定回路に送られる。
【0046】
キャッシュヒット判定部33は、INDEXアドレスのデコーダ331、命令デコーダ332を使って、RUカウンタ−30に対して、キャッシュヒット時の状況を報告する信号を出力する。デコーダ331は、INDEXアドレスの256ビットのデコード信号を生成する。命令デコーダ332は、信号線3321にキャッシュ入りロード命令デコード信号を、そして信号線3322にキャッシュ入りストア命令デコード信号をそれぞれ生成する。信号線3330の信号は、Bステージに存在する有効なメモリロード命令がヒットしたことを示す。信号線3331の信号は、あるキャッシュエントリで、Bステージに存在する有効なメモリロード命令がヒットしたことを示す。また、ストア命令でのwriteヒット検出信号を信号線3332に生成し、Bステージの次のタイミングでWEフラグを点灯させ、キャッシュにストアデータを書き込む。
【0047】
次に、図9に基づいてVL=2の時のVLD命令がキャッシュヒットした場合の動作について説明する。2次キャッシュをアクセスする命令は、Aステージで命令コード、アドレスが、各々、OPC−17、ADR−14に設定される。Bステージで、1st/2ndリクエストが両方ヒットした場合、次のタイミングは両方ともWステージに移行し、読み出しデータがRDR−35を介してVPUに送られる。
【0048】
次に、図10に基づいてVL=2の時のVST命令がキャッシュヒットした場合の動作について説明する。Aステージで命令コード、アドレス、ストアデータが、各々、OPC−17、ADR−14、ストアデータ−22に設定される。Bステージで、1st/2ndリクエストが両方ヒットした場合、次のタイミングは両方ともストアデータが、ストアデータ−22に格納され、WE−16が点灯して、DA−32に書き込まれる。
【0049】
次に、図11に基づいてVL=2の時のVLD命令がキャッシュミスした場合の動作について説明する。Aステージで命令コード、アドレスが、各々、OPC−17、ADR−14に格納され、Bステージでミスが判定される。それと同時にVL−2、distance−3の値とADR−26、さらに、VLD範囲REG−1との比較によって、Cachableであることを判定する。ここでのCachable判定条件は、〔VLD範囲REG−1〕>〔VL〕*〔distance〕である。キャッシュミス時のメモリリクエストは、1ライン分データのblockロ−ドとしてATBへ送られ、その後ミスリプライ有効信号としてターゲットになるワードデータから順に帰ってくる。そして、タイミング▲8▼及び▲9▼でWE−16を点灯させ、キャッシュに登録するとともにRDR−35を介してVPUにリプライデータを送出する。さらに、残りのキャッシュラインデータをキャッシュへ書き込むために、タイミング(10)以後でも、WE−16が点灯する。この場合、従来技術でも説明したように、後続命令の発行を止める必要がある。
【0050】
次に、図12に基づいてVL=2の時のVST命令がキャッシュミスした場合の動作について説明する。Aステージで、命令コード、アドレス、ストアデータが、各々OPC−17、ADR−14、ストアデータ−22に設定される。Bステージで、1st/2ndリクエストが両方ミスした場合、次のタイミングで両方ともATBへのリクエストとして送出される。
【0051】
次に、図13に基づいてVL=2の時のVLD命令がキャッシュミスし、且つNon‐cachableとなった場合の動作について説明する。Aステージで命令コード、アドレスが、各々OPC−17、ADR−14に格納され、Bステージでミスが判定される。それと同時にVL−2、distance−3の値とADR−26、さらに、VLD範囲REG−1との比較によって、Non‐cachableであることを判定する。ここでのCachable判定条件は、〔VLD範囲REG−1〕<=〔VL〕*〔distance〕である。キャッシュミス時のメモリリクエストは、要求するワードデータのみのリクエストとしてATBへ送られ、その後ミスリプライ有効信号として帰ってくる。しかし、Non‐cachableであるため、WE−16は点灯せず、リプライデータを単にVPUへ返すだけである。したがって、その後のリフィル動作が発生しないので、その分後続命令の待ちが発生しない点で図11の動作と異なる。
【0052】
次に、図14に基づいて、本特許におけるキャッシュ登録判定にかかわるVLD範囲REG−1、RUカウンタ制限値REG−13への命令による書き込み動作について説明する。上記2つのレジスタは、LCRG命令によってセットされる。その命令のYフィールドで指定されたレジスタ内容にしたがって各々のレジスタに値を格納する。本発明における機能を有効にしたい場合は、各々のVビットに“1”を立てる必要がある。一方、LCRG命令の動きとしては、Aステージに到着する1サイクル前にVPUからの指示によって、VLD範囲REG(V、data)−1、RUカウンタ制限値REG(V、data)−13に設定される。
【0053】
図15は、図9〜図13におけるVLD命令及びVST命令が発生した場合の動作についてフローチャートとしてまとめたものである。図左側に示すフローのように、VLD命令リクエストが発生すると、キャッシュヒットか否かが判定され、ヒットした場合は、キャッシュを読んでVPUに返す(図9に対応するフロー)。
【0054】
ヒットしない場合には、次いで、Cachableか否かが判定される。Cachableである場合には、ATBへ1ライン分のブロックLDリクエストを発行し、リプライターゲットデータをVPUに返して、キャッシュにブロックデータを書き込む(図11に対応するフロー)。
【0055】
他方、Cachableでない場合は、ATBへ必要なワードのみのリクエストを発行し、そしてリプライターゲットデータをVPUへ返す(図13に対応するフロー)。
【0056】
図15右側のようにVST命令リクエストが発生すると、キャッシュヒットか否かが判定される。ヒットした場合には、Cacheにデータの書き込みを行う(図10に対応するフロー)。他方、ヒットしない場合には、ATBへメモリ書き込みのリクエストを発行する(図12に対応するフロー)。
【0057】
【効果】
本発明にかかるキャッシュ制御方法並びに制御回路によれば、ロードリクエストの性質、あるいは、ヒットしたラインの履歴によって、キャッシュに登録させるロードにするか否かをHWが動的に判断することになる。
【0058】
また、VLD範囲レジスタとRUカウンタ制限値レジスタの更新によって、判断方法をSWが明示的に指定することができる。それによって、発明の背景で説明したような問題点を解決し、参照のローカリティが厳密な意味で保証されないプログラムであっても、キャッシュによる性能向上効果を得ることができる。
【図面の簡単な説明】
【図1】本発明の実施例におけるキャッシュ制御回路の全体構成図である。
【図2】本発明の実施例における2次キャッシュ周辺回路の構成図である。
【図3】本発明の実施例における2次キャッシュ構成図である。
【図4】RUカウンタ制御回路周辺構成図である。
【図5】キャッシュリフィル時の性能低下について説明した図である。
【図6】本発明の実施例におけるVLD命令仕様を示す図である。
【図7】科学技術計算におけるメモリアクセスの局所性について説明した図である。
【図8】局所性のないプログラムにおいてキャッシュが意味をなさない例を説明した図である。
【図9】VL=2の時のVLD命令がキャッシュヒットした時の動作について説明した図である。
【図10】VL=2の時のVST命令がキャッシュヒットした時の動作について説明した図である。
【図11】VL=2の時のVLD命令がキャッシュミスした時の動作について説明した図である。
【図12】VL=2の時のVST命令がキャッシュミスした時の動作について説明した図である。
【図13】VL=2の時のVLD命令がキャッシュミスし、且つ、Noncachableとなった時の動作について説明した図である。
【図14】キャッシュ登録判定にかかわるレジスタへの命令による書き込み動作について説明した図である。
【図15】図9ないし図13に対応するVLD命令及びVST命令の動作に関するフロー図である。
【符号の説明】
SPU スカラプロセッサユニット
VPU ベクトルプロセッサユニット
ATB アドレス変換バッファ
IOP 入出力処理部
VLD ベクトルロード
VL ベクトル長
AA アドレスアレイ
DA データアレイ
WDR 書き込みデータレジスタ
RDR 読み出しデータレジスタ
OPC 命令コードレジスタ[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a cache control method and a cache control circuit for controlling a cache memory used in various information processing systems.
[0002]
[Prior art]
In order to eliminate the bottleneck of memory access in various information processing systems, a technology that uses a small-capacity and high-speed buffer memory called a cache has been used in most systems for a long time. The effects of using the cache memory are the following two. The first is that it can be configured with a smaller capacity than the main memory or the like, so that it can be placed near the processor, for example, in the same LSI, and the latency of the operand data can be greatly reduced. .
[0003]
The second effect is that the throughput required for memory access can be suppressed particularly when writing to the memory is not always performed as in the case of a store-in type cache. Therefore, the memory structure can be simplified, which is advantageous in terms of cost, and conversely, by suppressing the memory access frequency, it is possible to avoid the memory interface request contention, so that the performance improvement can be realized.
[0004]
In order for this cache memory system to be effective, it is necessary to assume that the memory access behavior in the actual program shown below usually has a certain property. This is due to the nature of memory access called locality of reference (hereinafter also referred to as locality). That is, spatial locality (referenced addresses are fixed in a certain part) and temporal locality (referenced addresses are concentrated within a certain time).
[0005]
Here, the operation at the time of a cache miss will be briefly described. However, since there are many documents on the operation of the cache memory, for example, it is described in detail in “Parallel Computer” by Amano Hideharu (Shokodo), the description of the operation not directly related to the present invention is omitted.
[0006]
First, lines with the same cache line address already registered in the cache are evicted. In the case of a store-through cache, since it is always consistent with the memory, it is only necessary to overwrite the cache with a new line. However, in the case of a store-in type cache, since consistency with the memory is not maintained, it is necessary to write the cache line to be evicted into the memory.
[0007]
In addition, a block load request for line data is generated for refilling a new line. There is a process of bringing unnecessary data to the memory, but on the other hand, there is an advantage that implicit prefetching is performed, so the advantages and disadvantages are not completely decided.
[0008]
This operation is described in FIG. 5. “A”, “B”, and “W” are stages in which a load (hereinafter also referred to as LD) instruction issues a memory access request and a stage in which a cache access ends. , Means that it exists in the register write stage.
[0009]
First, LD-1 is a timing at the time of a cache hit (hit), and in this case, it ends in only three cycles. LD-2 is an operation in the case of a cache miss (miss), and it is common that the refill data is requested from the memory, and the target data is returned first. -2 can move to the W stage. However, it takes time to write data for one line to the cache for refilling, and during that time, subsequent cache access instructions cannot be issued. LD-3 is a cache bypass load timing in which data is not registered in the cache, and a difference from LD-2 is that, when a miss occurs, miss reply data is not registered in the cache.
[0010]
In the case of memory access without locality of reference, since the issue of subsequent cache access instructions during rewrite data cache writing is not suppressed, LD-3 is superior in performance from this case alone. I can say that.
[0011]
The cache control as described above causes the following problems when the locality of the assumed reference is lost. Problem 1) Putting a line that is LD only once into the cache requires extra storage and loading of the cache line data, compared to when no data is registered in the cache. Problem 2) Despite being a useful cache line, it is replaced.
[0012]
There is a science and technology calculation program that is said to have no locality of reference. However, in recent years, the cache capacity in microprocessors has been increased from KB units to MB units due to the continuous advancement of LSI technology. In addition, the program optimization technique considering the cache follows the trend of the cache capacity, and the performance of the science and technology calculation program has been improved even in the microprocessor of the store-in type cache. However, no matter how advanced the optimization technology of the compiler, there is a limit to realizing a high cache hit rate by recognizing the memory access behavior from the program before execution.
[0013]
By the way, there is a vector computer as an apparatus for efficiently executing a scientific and technological calculation program. In a vector type computer, processing for a register storing a plurality of word data called a vector register can be defined by one instruction called a vector instruction. For example, a vector load (hereinafter also referred to as VLD) instruction loads a value of a vector length register (hereinafter also referred to as VL), and stores the read data in a register called a vector register in which a plurality of words are collected. Conversely, a vector store (hereinafter also referred to as VST) stores a plurality of word data in a vector register in a memory.
[0014]
In this vector type computer, for example, when a VLD instruction having a large [distance] * [VL] is issued and it causes a cache miss, many cache lines are replaced by the VLD1 instruction. Among them, if there is a line that has just been used, the data registered in the cache is canceled in anticipation of temporal locality, and the cache line data is refilled again and again. To the situation.
[0015]
[Problems to be solved by the invention]
The present invention provides a cache control circuit that solves the problems of the prior art as described above and can obtain a performance improvement effect by a cache memory even for a program whose locality of reference is not guaranteed in a strict sense. It is to be.
[0016]
[Means for solving the problems]
An object of the present invention is to provide a value for defining a vector load instruction access range, a vector length value, and a distance value in a cache control method for an information processing apparatus having a cache memory.And the product of,This comparison resultWhether the vector load instruction data is registered in the cache or unregistered based onFirstMake a decisionFirstThis is solved by a cache control method that selectively executes control of registration or non-registration in the cache according to the determination result.
Furthermore, the problem of the present invention is solved by the cache control method, wherein the value defining the vector load instruction access range is defined by software.
Furthermore, an object of the present invention is to measure the number of cache accesses corresponding to each entry of the cache in the above cache control method, compare the number of cache accesses and the limited number of cache access use, and from the comparison result, Cache control for performing second determination as to whether to register in cache or not, and to selectively execute control of registration or non-registration in cache according to the second determination result and the first determination result Solved by the method.
[0017]
Furthermore, an object of the present invention is to provide a cache control circuit of an information processing apparatus having a cache memory, a first register that holds a value that defines a vector load instruction access range, a second register that holds a vector length, A third register for holding a distance; and the first registerRegister value andThe secondRegister vector length andThird registerProduct with distanceThe value of theCompare with,Based on this comparison resultDetermines whether vector load instruction data is registered or unregistered in the cacheFirst judgmentCircuit,Determination of the first determination circuitThis is solved by a cache control circuit including a fourth register for holding the result and a miss reply control circuit for selectively controlling registration or non-registration in the cache according to the determination result of the fourth register.
Another object of the present invention is to provide a cache control circuit for an information processing apparatus having the cache memory, wherein the value of the first register is set by software.
[0018]
Another object of the present invention is to provide a fifth register for storing the limited number of times of cache access in a cache control circuit of an information processing apparatus having a cache memory, and a result of measuring the number of cache accesses corresponding to each entry in the cache. A sixth register group for holdingCache access count measurement resultWhether to register or not register in the cache is determined based on the result of comparing the control circuit that updates the value of the cache and the sixth register value and the fifth register value corresponding to the accessed cache entry.Second decisionCircuit andHave,SaidFourth registerHolds the results of the first determination circuit and the second determination circuit.,The miss reply control circuit selectively executes control of registration or non-registration in the cache according to the determination result of the fourth register.This is advantageously solved by a cache control circuit.
[0019]
According to the cache control method and the control circuit of the present invention, hardware (hereinafter also referred to as HW) determines whether or not to make a load to be registered in the cache memory according to the nature of the load request or the history of the hit line. Judge dynamically.
[0020]
Also, software (hereinafter, also referred to as SW) can explicitly specify the determination method by updating the VLD range register and the RU counter limit value register. As a result, the problems described in the background of the invention can be solved, and the performance improvement effect by the cache memory can be obtained even for a program whose reference locality is not guaranteed in a strict sense.
[0021]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, an embodiment of a cache control device according to the present invention will be described with reference to the accompanying drawings. This cache control apparatus is applied to a basic configuration as shown in FIG. The scalar processor unit (hereinafter also referred to as SPU) -1 performs the decoding / execution instruction of all instructions and the execution of scalar instructions. The primary cache unit-2 stores only data used in scalar memory access system instructions. A vector processor unit (hereinafter also referred to as VPU) -3 executes a vector instruction in accordance with an instruction from SPU-1.
[0022]
The secondary cache unit-4 stores data used in both the scalar system / vector system. An address conversion buffer (hereinafter referred to as ATB) -5 is a buffer for converting a logical address into a physical address. The memory unit-6 includes a memory and a memory access control unit. IOP-7 performs input / output processing.
[0023]
In the case of a scalar LD, when an LD request is issued from the SPU-1 through the
[0024]
Next, before describing the behavior of the VLD instruction, the specification of the VLD instruction will be described with reference to FIG. In VPU-3, there is a register file that can store a plurality of element data, also called a vector register. The VLD instruction collectively loads the number of memory loads specified by the register VL specified by Ry (distance) and Rz (start address) sent from the SPU-1 to the vector register specified by Vx. The instruction to perform.
[0025]
Here, in order to describe an embodiment of the present invention, a basic configuration as shown in FIG. 1 is used. A register VL is a register that can be rewritten by software in response to an instruction LVL, and exists in VPU-3. The operation of the VLD instruction will be described with reference to the block diagram of FIG. The VLD instruction is decoded by the SPU-1, and as a result, an execution instruction is sent to the VPU-3 via the
[0026]
In the secondary cache unit-4, if a miss occurs, it becomes a block request for the corresponding line, passes through the ATB-5 like the scalar LD, and sends the reply data from the memory unit-6 via the
[0027]
Here, the cacheable determination circuit using the VLD range register or the RU counter limit value register according to the present invention does not necessarily take this VLD instruction into the cache when a cache miss occurs. In this case, a block load request of the secondary cache line size is not issued, a request for each element of the VLD is issued to the
[0028]
First, the operation of the present invention by the VLD range register will be described. All conventional vector memory accesses were not cached. However, as described above, due to the significant increase in cache capacity due to advances in LSI technology and advances in optimization technology using compilers, a certain amount of cache is used in scientific and technical calculations. This makes it possible to realize reference locality that is meaningful. However, there are some parts that cannot be optimized to maintain locality. This is shown in FIG.
[0029]
In the non-local part, processing such as fetching vector operand data with a wide range of VLD instructions, calculating it, and writing it back to the memory with the VST instruction is performed. There is almost no reading. In such a case, it is meaningless to take the memory data of the VLD into the cache.
[0030]
FIG. 8 illustrates a case where the distance of the VLD instruction is 128B and the VL is 256, and the case is registered in the cache (
[0031]
As another means for avoiding such a situation, there is a method of explicitly designating from the beginning that data is not registered in the cache memory. The advantage of this method is that more effective cache control is possible because it is possible to consider the locality of the reference, which is insufficient only by focusing on the value such as address distance. If a VLD instruction not registered in the cache is executed, the cache registration is not unconditionally performed. However, if the data to be loaded exists in the cache memory, the cache memory is naturally read out.
[0032]
However, it is extremely difficult to determine by SW (software: compiler) whether or not data is registered in the cache memory, and a certain amount of support by HW is required. Therefore, in the present invention, an inefficient cache operation as shown in FIG. 8 can be avoided by implementing a circuit that determines whether the area of the VLD access area is local or not with the VLD range register. it can.
[0033]
Next, cache registration control focusing on temporal locality by the RU counter limit value register will be described. Temporal locality means that once accessed data tends to be accessed again. Such a line must be prevented from being evicted from the cache due to a cache miss during other memory accesses. Regarding the eviction algorithm in this cache, there is an LRU algorithm as in the prior art.
[0034]
However, this is useful in a cache constituted by a plurality of ways, and in the case of a direct map configuration, access on the same line is unconditionally expelled. Further, in the direction of enlarging the cache capacity, a direct map type cache is generally used from the viewpoint of HW cost.
[0035]
Further, if the cache registration data is not accessed at least twice as long as it exists in the cache, the cost of the block LD for one line is directly adversely affected. Therefore, in order to determine that the line has recently been accessed frequently, information called an RU counter is provided in each line. The operation logic of the RU counter is as follows.
In this way, regarding a cache line that is not used, the value of the RU counter increases, and it is recognized that the line is unlikely to be used. If this RU counter value does not exceed the RU counter limit value register, a line that is likely to be used remains in the cache by removing it from the replacement target.
[0036]
The configuration of the secondary cache, which is a feature of this patent that realizes these operations, will be described with reference to FIG. The VLD range REG-1 (consisting of a value and a valid bit and the comparison result is non-active when the valid bit is not lit) was calculated by the multiplier-4 [output of the VL register-2] * [Output of distance register-3] is compared, and the comparison result signal of the comparator-5 determines whether or not to register in the cache at the time of a miss. A VLD signal (signal line 706) and a cache non-registration VLD signal (signal line 710) are generated from the value of the instruction code register (OPC) -17 by the instruction decoder-7.
[0037]
AND gate-6 generates a signal indicating that VLD was out of range. The AND gate-9 sets the RU counter limit value REG-12 (consisting of a value and a valid bit, and when the valid bit is not lit, the comparison result is Non-active) and the value of the RU counter-30. An analysis result signal of temporal locality is generated from the comparison result signal of the comparator-8 to be compared. The OR gate -10 outputs a non-cacheable (cache non-registration) determination result signal, and the cache non-registration instruction flag-11 receives the result signal.
[0038]
The valid flag-13 indicates that the block load from the primary cache in the A stage or the request for the vector memory access instruction from the VPU is valid, and the 2-way selector-19 is set to the instruction code register (OPC) -17. Select the value to store.
[0039]
The OPC-17 and the address register (ADR) -14 store the code and address of an instruction existing in the A stage. The OR gate -15 generates an output in which a block load from the primary cache or a request for a vector memory access instruction from the VPU is valid.
[0040]
The case where the WE flag-16 is lit is when the store instruction hits write and when the cache miss reply data is written. The two timings are generated by the OR gate-20. The former is sent from the cache hit determination unit -33, and the latter is sent from the MissREQ control unit -36. Also, the addresses at that time are sent from the primary cache, VPU, B
[0041]
WDR (Write Data Register) -20 is a write data register for DA (Data Array) -32. The 2Way selector-21 selects store data and cache miss reply data at the time of store write hit. The 2-way selector -23 selects store request data from the primary cache / VPU and stores it in the store data register -22. When a write hit occurs in the store, the store data register -24 goes around for one cycle, and is then stored in the WDR-20 and written in the DA-32. The valid flag-25, address register-26, store data register-24, and cache miss flag-27 are all B stage information.
[0042]
Cache valid bit -29 indicates that the cache line is valid. The address array (AA) -31 indicates what address data the corresponding line is. The data array-32 stores cache data. The address comparator -28 reads the output of AA-31, compares it with the value of the address register-14, determines a cache miss, and stores the result in the cache miss flag -27.
[0043]
The cache hit determination unit -33 uses the B stage control information to generate a control signal for updating the RU counter-30. The 2-way selector 34 selects the cache data read from the DA-32 and the cache miss reply data from the memory, and stores the selected data in an RDR (Read Data Register) -35.
[0044]
Next, based on FIG. 3, the secondary cache configuration assumed in this embodiment will be described. In the present embodiment, description will be made on the premise of a direct map system having a line size of 128 B × 256 entries (capacity: 32 KB). In the case of this cache, it is composed of AA (address array) and DA (data array), the tag address corresponding to the INDEX address stored in AA is compared with the address of the request, and a cache hit is determined. The address of the memory access request is 40 bits as a whole, of which the upper 25 bits are TAG address, the lower 7 bits are line address, and the middle 8 bits are INDEX address.
[0045]
Next, peripheral circuits of the RU counter-30 in FIG. 2 will be described with reference to FIG. The RU counter-30 exists in the cache entry, is selected by the
[0046]
The cache hit determination unit 33 uses the
[0047]
Next, the operation when the VLD instruction when VL = 2 has a cache hit will be described with reference to FIG. For the instruction to access the secondary cache, the instruction code and address are set to OPC-17 and ADR-14, respectively, at the A stage. When both the 1st / 2nd requests are hit in the B stage, both the next timing shifts to the W stage, and the read data is sent to the VPU via the RDR-35.
[0048]
Next, the operation when the VST instruction when VL = 2 causes a cache hit will be described with reference to FIG. In the A stage, the instruction code, address, and store data are set to OPC-17, ADR-14, and store data-22, respectively. When both the 1st / 2nd requests are hit in the B stage, the store data is stored in the store data-22 at the next timing, and WE-16 is lit and written to DA-32.
[0049]
Next, the operation when the VLD instruction when VL = 2 causes a cache miss will be described with reference to FIG. The instruction code and address are stored in OPC-17 and ADR-14, respectively, at the A stage, and a miss is determined at the B stage. At the same time, the values of VL-2 and distance-3 are compared with ADR-26, and further, the VLD range REG-1 is determined to be cacheable. The cache determination condition here is [VLD range REG-1]> [VL] * [distance]. A memory request at the time of a cache miss is sent to the ATB as a block load of data for one line, and then returns in order from the word data as a target as a miss reply valid signal. Then, the WE-16 is turned on at timings (8) and (9), registered in the cache and sent reply data to the VPU via the RDR-35. Furthermore, in order to write the remaining cache line data into the cache, WE-16 is lit even after timing (10). In this case, as described in the prior art, it is necessary to stop issuing subsequent instructions.
[0050]
Next, the operation when the VST instruction when VL = 2 makes a cache miss will be described with reference to FIG. In the A stage, the instruction code, address, and store data are set to OPC-17, ADR-14, and store data-22, respectively. If both the 1st / 2nd requests miss in the B stage, both are sent as requests to the ATB at the next timing.
[0051]
Next, an operation when the VLD instruction when VL = 2 is a cache miss and becomes non-cacheable will be described with reference to FIG. The instruction code and address are stored in the OPC-17 and ADR-14, respectively, at the A stage, and a miss is determined at the B stage. At the same time, it is determined to be non-cacheable by comparing the values of VL-2 and distance-3 with ADR-26 and the VLD range REG-1. The cache determination condition here is [VLD range REG-1] <= [VL] * [distance]. The memory request at the time of a cache miss is sent to the ATB as a request for only the requested word data, and then returns as a miss reply valid signal. However, since it is non-cacheable, WE-16 is not lit, and reply data is simply returned to the VPU. Therefore, since the subsequent refill operation does not occur, the operation is different from the operation of FIG.
[0052]
Next, based on FIG. 14, a write operation by an instruction to the VLD range REG-1 and the RU counter limit value REG-13 related to the cache registration determination in this patent will be described. The two registers are set by the LCRG instruction. A value is stored in each register according to the contents of the register designated in the Y field of the instruction. To make the function of the present invention effective, it is necessary to set "1" to each V bit. On the other hand, the movement of the LCRG instruction is set to the VLD range REG (V, data) -1 and the RU counter limit value REG (V, data) -13 by an instruction from the VPU one cycle before the arrival at the A stage. The
[0053]
FIG. 15 summarizes the operation when the VLD instruction and the VST instruction in FIGS. 9 to 13 are generated as a flowchart. As shown in the flow on the left side of the figure, when a VLD instruction request occurs, it is determined whether or not there is a cache hit. If a hit is found, the cache is read and returned to the VPU (flow corresponding to FIG. 9).
[0054]
If there is no hit, it is next determined whether or not it is cacheable. If it is cacheable, it issues a block LD request for one line to the ATB, returns the reply target data to the VPU, and writes the block data to the cache (flow corresponding to FIG. 11).
[0055]
On the other hand, if it is not Cacheable, a request for only the necessary word is issued to the ATB, and reply target data is returned to the VPU (flow corresponding to FIG. 13).
[0056]
When a VST instruction request is generated as shown on the right side of FIG. 15, it is determined whether or not there is a cache hit. If there is a hit, data is written to Cache (flow corresponding to FIG. 10). On the other hand, if there is no hit, a memory write request is issued to the ATB (flow corresponding to FIG. 12).
[0057]
【effect】
According to the cache control method and the control circuit according to the present invention, the HW dynamically determines whether or not to make a load to be registered in the cache based on the nature of the load request or the history of the hit line.
[0058]
Further, the SW can explicitly specify the determination method by updating the VLD range register and the RU counter limit value register. As a result, the problems described in the background of the invention can be solved, and the performance improvement effect by the cache can be obtained even for a program whose reference locality is not guaranteed in a strict sense.
[Brief description of the drawings]
FIG. 1 is an overall configuration diagram of a cache control circuit according to an embodiment of the present invention.
FIG. 2 is a configuration diagram of a secondary cache peripheral circuit in the embodiment of the present invention.
FIG. 3 is a secondary cache configuration diagram according to the embodiment of the present invention.
FIG. 4 is a peripheral configuration diagram of an RU counter control circuit.
FIG. 5 is a diagram for explaining performance degradation during cache refill.
FIG. 6 is a diagram showing VLD instruction specifications in the embodiment of the present invention.
FIG. 7 is a diagram illustrating the locality of memory access in scientific and technical calculations.
FIG. 8 is a diagram illustrating an example in which a cache does not make sense in a program without locality.
FIG. 9 is a diagram illustrating an operation when a VLD instruction when VL = 2 has a cache hit.
FIG. 10 is a diagram illustrating an operation when a VST instruction when VL = 2 has a cache hit.
FIG. 11 is a diagram illustrating an operation when a VLD instruction when VL = 2 has a cache miss;
FIG. 12 is a diagram illustrating an operation when a VST instruction when VL = 2 has a cache miss.
FIG. 13 is a diagram illustrating an operation when a VLD instruction when VL = 2 has a cache miss and becomes noncacheable.
FIG. 14 is a diagram illustrating a write operation by an instruction to a register related to cache registration determination.
FIG. 15 is a flowchart relating to the operation of the VLD instruction and the VST instruction corresponding to FIGS. 9 to 13;
[Explanation of symbols]
SPU scalar processor unit
VPU vector processor unit
ATB address translation buffer
IOP I / O processor
VLD vector load
VL vector length
AA address array
DA data array
WDR write data register
RDR read data register
OPC instruction code register
Claims (2)
ソフトウェアによって規定され、ベクトルロード命令アクセス範囲を規定する値と、ベクトル長の値とディスタンス値との積とを比較し、
この比較結果を基礎として、ベクトルロード命令のデータをキャッシュへ登録するかまたは非登録とするかの第1の判定を行い、
キャッシュの各ラインに対応してRUカウンタを設けてRUカウンタの値を計測し、
このRUカウンタの値とRUカウンタ制限値レジスタの値とを比較し、
この比較結果から、キャッシュへ登録するかまたは非登録とするかの第2の判定を行い、
この第2の判定の判定結果と前記第1の判定の判定結果とに従ってキャッシュへの登録または非登録の制御を選択的に実行するキャッシュ制御方法において、
前記RUカウンタに対応するキャッシュラインでヒットしたら当該RUカウンタを0クリアし、
前記RUカウンタに対応するキャッシュライン以外の別のラインでヒットしたら当該RUカウンタの値を1増加し、
キャッシュのどのラインでもヒットしなかったらRUカウンタの値を変えないようにし、
キャッシュミスヒットに伴いあるキャッシュラインのリプレースを行うか否かを判断する際に、当該キャッシュラインに対応するRUカウンタの値が前記RUカウンタ制限値レジスタの値を超えない場合は、当該キャッシュラインをリプレース対象から外す
ことを特徴とするキャッシュ制御方法。A cache control method for an information processing apparatus having a direct mapped cache memory,
Compare the value specified by the software and specifying the vector load instruction access range with the product of the vector length value and the distance value,
Based on the result of this comparison, a first determination is made as to whether the data of the vector load instruction is registered in the cache or unregistered,
An RU counter is provided for each line of the cache, and the value of the RU counter is measured.
Compare the value of this RU counter with the value of the RU counter limit value register,
From this comparison result, it performs a second determination of whether the or unregistered to register to the cache,
In the cache control method for selectively executing control of registration or non-registration in the cache according to the determination result of the second determination and the determination result of the first determination,
If there is a hit in the cache line corresponding to the RU counter, the RU counter is cleared to 0,
If a hit occurs in another line other than the cache line corresponding to the RU counter, the value of the RU counter is incremented by 1,
Do not change the value of the RU counter if no line in the cache is hit,
When determining whether or not to replace a cache line due to a cache miss hit, if the value of the RU counter corresponding to the cache line does not exceed the value of the RU counter limit value register, the cache line is A cache control method characterized by excluding from replacement.
ソフトウェアによってセットされ、ベクトルロード命令アクセス範囲を規定する値を保持する第1のレジスタと、
ベクトル長を保持する第2のレジスタと、
ディスタンスを保持する第3のレジスタと、
前記第1のレジスタの値と、第2のレジスタのベクトル長と第3のレジスタのディスタンスとの積の値とを比較し、この比較結果に基づいてベクトルロード命令のデータをキャッシュに対して登録するかまたは非登録とするかの判定を行う第1の判定回路と、
RUカウンタ制限値を格納する第5のレジスタと、
キャッシュの各ラインに対応してRUカウンタの値を保持する第6のレジスタ群と、
そのRUカウンタの値を更新する制御回路と、
アクセスしたキャッシュラインに対応する第6のレジスタの値と第5のレジスタの値とを比較した結果から、キャッシュへの登録または非登録の判定を行う第2の判定回路と、
前記第1の判定回路の判定結果及び第2の判定回路の判定結果を保持する第4のレジスタと、
該第4のレジスタの判定結果に従って、キャッシュへの登録または非登録の制御を選択的に実行するミスリプライ制御回路とを有するキャッシュ制御回路において、
前記RUカウンタの値を更新する制御回路は、前記RUカウンタに対応するキャッシュラインでヒットしたら当該RUカウンタを0クリアするものであり、前記RUカウンタに対応するキャッシュライン以外の別のラインでヒットしたら当該RUカウンタの値を1増加するものであり、キャッシュのどのラインでもヒットしなかったらRUカウンタの値を変えないものであり、
前記第2の判定回路は、キャッシュミスヒットに伴いあるキャッシュラインのリプレースを行うか否かを判断する際に、当該キャッシュラインに対応するRUカウンタの値が前 記第5のレジスタに格納されているRUカウンタ制限値を超えない場合は、当該キャッシュラインをリプレース対象から外す判定を行うものである、
ことを特徴とするキャッシュ制御回路。A cache control circuit of an information processing apparatus having a direct mapped cache memory,
A first register that is set by software and holds a value defining a vector load instruction access range;
A second register holding the vector length;
A third register holding the distance;
Compare the value of the first register with the product of the vector length of the second register and the distance of the third register, and register the data of the vector load instruction in the cache based on the comparison result a first decision circuit which performs one of determination to whether or not registered,
A fifth register for storing the RU counter limit value ;
A sixth register group for holding the value of the RU counter corresponding to each line of the cache;
A control circuit for updating the value of the RU counter ;
A second determination circuit for determining whether to register or not register in the cache from a result of comparing the value of the sixth register and the value of the fifth register corresponding to the accessed cache line ;
A fourth register for holding a determination result of the first determination circuit and a determination result of the second determination circuit ;
According to the judgment result of the fourth register, the cache control circuit and a miss reply control circuit for executing controls of the registration or non-registration to the cache selectively,
The control circuit that updates the value of the RU counter clears the RU counter when it hits the cache line corresponding to the RU counter, and when it hits another line other than the cache line corresponding to the RU counter. the RU counter are those that value incremented by one of, are those not be change the value of the RU counter if you did not hit in any line of the cache,
The second decision circuit, in determining whether to replace the cache line is due to a cache miss, the value of RU counter corresponding to the cache line is stored before Symbol fifth register If it does not exceed the RU counter limit value, it is determined to remove the cache line from the replacement target .
A cache control circuit.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2001033857A JP3770091B2 (en) | 2001-02-09 | 2001-02-09 | Cache control method and cache control circuit |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2001033857A JP3770091B2 (en) | 2001-02-09 | 2001-02-09 | Cache control method and cache control circuit |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2002236614A JP2002236614A (en) | 2002-08-23 |
| JP3770091B2 true JP3770091B2 (en) | 2006-04-26 |
Family
ID=18897548
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2001033857A Expired - Fee Related JP3770091B2 (en) | 2001-02-09 | 2001-02-09 | Cache control method and cache control circuit |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP3770091B2 (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2010086496A (en) * | 2008-10-03 | 2010-04-15 | Nec Corp | Vector computer system with cache memory, and operation method therefor |
Families Citing this family (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP5040121B2 (en) * | 2006-02-24 | 2012-10-03 | 日本電気株式会社 | Information processing apparatus, cache control method, and program |
| JP5223220B2 (en) * | 2007-03-30 | 2013-06-26 | 日本電気株式会社 | Vector processing apparatus and vector processing system |
| JP2011150684A (en) * | 2009-12-21 | 2011-08-04 | Sony Corp | Cache memory and cache memory control device |
| CN116257493A (en) * | 2022-12-29 | 2023-06-13 | 北京京桥热电有限责任公司 | OPC (optical clear control) network gate penetrating interface based on caching mechanism |
-
2001
- 2001-02-09 JP JP2001033857A patent/JP3770091B2/en not_active Expired - Fee Related
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2010086496A (en) * | 2008-10-03 | 2010-04-15 | Nec Corp | Vector computer system with cache memory, and operation method therefor |
| US8151058B2 (en) | 2008-10-03 | 2012-04-03 | Nec Corporation | Vector computer system with cache memory and operation method thereof |
Also Published As
| Publication number | Publication date |
|---|---|
| JP2002236614A (en) | 2002-08-23 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US12292839B2 (en) | Write merging on stores with different privilege levels | |
| US10365930B2 (en) | Instructions for managing a parallel cache hierarchy | |
| US9513904B2 (en) | Computer processor employing cache memory with per-byte valid bits | |
| US9952977B2 (en) | Cache operations and policies for a multi-threaded client | |
| US5809530A (en) | Method and apparatus for processing multiple cache misses using reload folding and store merging | |
| US8180981B2 (en) | Cache coherent support for flash in a memory hierarchy | |
| KR102244191B1 (en) | Data processing apparatus having cache and translation lookaside buffer | |
| US20100064107A1 (en) | Microprocessor cache line evict array | |
| US20090106499A1 (en) | Processor with prefetch function | |
| JP4803983B2 (en) | Arithmetic processing unit | |
| JP2006517040A (en) | Microprocessor with first and second level caches with different cache line sizes | |
| JPH07253926A (en) | Method for reduction of time penalty due to cache mistake | |
| US20170168957A1 (en) | Aware Cache Replacement Policy | |
| JP2001195304A (en) | Cache storage | |
| JP3770091B2 (en) | Cache control method and cache control circuit | |
| KR20160080385A (en) | Miss handling module for cache of multi bank memory and miss handling method | |
| US9348598B2 (en) | Data processing apparatus and method for pre-decoding instructions to be executed by processing circuitry | |
| JPH0743671B2 (en) | Cache memory control method | |
| US7251710B1 (en) | Cache memory subsystem including a fixed latency R/W pipeline | |
| US7761665B2 (en) | Handling of cache accesses in a data processing apparatus | |
| JP2001249846A (en) | Cache memory device and data processing system | |
| JP2007156821A (en) | Cache system and shared secondary cache | |
| JP3735373B2 (en) | Microcomputer |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20040903 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20040915 |
|
| A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20041115 |
|
| A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20050608 |
|
| RD01 | Notification of change of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7421 Effective date: 20050708 |
|
| A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A821 Effective date: 20050708 |
|
| A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20050808 |
|
| A911 | Transfer of reconsideration by examiner before appeal (zenchi) |
Free format text: JAPANESE INTERMEDIATE CODE: A911 Effective date: 20051013 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20051101 |
|
| A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20051221 |
|
| 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: 20060117 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20060130 |
|
| R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20100217 Year of fee payment: 4 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20100217 Year of fee payment: 4 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110217 Year of fee payment: 5 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110217 Year of fee payment: 5 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120217 Year of fee payment: 6 |
|
| LAPS | Cancellation because of no payment of annual fees |